mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-28 20:43:38 +01:00
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
#ifndef __STDLIB_H__
|
|
# define __STDLIB_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/* Dynamic memory management. */
|
|
|
|
/* Allocate SIZE bytes of memory. */
|
|
extern void *malloc(size_t size);
|
|
|
|
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
|
|
extern void *calloc(size_t nmemb, size_t size);
|
|
|
|
/*
|
|
** Re-allocate the previously allocated block in PTR, making the new block
|
|
** SIZE bytes long.
|
|
*/
|
|
extern void *realloc(void *ptr, size_t size);
|
|
|
|
/*
|
|
** Re-allocate the previously allocated block in PTR, making the new block large
|
|
** enough for NMEMB elements of SIZE bytes each.
|
|
*/
|
|
extern void *reallocarray(void *ptr, size_t nmemb, size_t size);
|
|
|
|
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
|
|
extern void free(void *ptr);
|
|
|
|
/* Integer arithmetic functions. */
|
|
|
|
extern int abs(int __j);
|
|
#define abs(j) ({ \
|
|
int __j = (j); \
|
|
(__j >= 0) ? __j : -(__j); \
|
|
})
|
|
|
|
extern long int labs(long int __j);
|
|
#define labs(j) ({ \
|
|
long int __j = (j); \
|
|
(__j >= 0) ? __j : -(__j); \
|
|
})
|
|
|
|
extern long long int llabs(long long int __j);
|
|
#define llabs(j) ({ \
|
|
long long int __j = (j); \
|
|
(__j >= 0) ? __j : -(__j); \
|
|
})
|
|
|
|
typedef struct {
|
|
int quot, rem;
|
|
} div_t;
|
|
|
|
typedef struct {
|
|
long int quot, rem;
|
|
} ldiv_t;
|
|
|
|
typedef struct {
|
|
long long int quot, rem;
|
|
} lldiv_t;
|
|
|
|
div_t div(int __num, int __denom);
|
|
ldiv_t ldiv(long int __num, long int __denom);
|
|
lldiv_t lldiv(long long int __num, long long int __denom);
|
|
|
|
#endif /*__STDLIB_H__*/
|