Newer
Older
rtlibc / inc / stdlib.h
@Razvan Turiac Razvan Turiac on 19 Dec 2019 622 bytes Improved code.
#ifndef _RTLIBC_STDLIB_H
#define _RTLIBC_STDLIB_H


#include <stdint.h>
#include <stddef.h>


#define alloca(...) __builtin_alloca(__VA_ARGS__)



#ifdef __cplusplus
extern "C"
{
#endif


void malloc_init(void *heap, size_t size, size_t alignment);
size_t msize(void *p);

void* malloc(size_t size);
void free(void *p);


uint64_t strtoul(const char *str, char **endptr, int32_t base);
int64_t strtol(const char *str, char **endptr, int32_t base);

float strtof(const char *str, char **endptr);

void abort(void);


static inline int32_t abs(int32_t a)
{
	return (a < 0) ? -a : a;
}


#ifdef __cplusplus
}
#endif

#endif