aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libc/inc')
-rw-r--r--libs/libc/inc/conv.h4
-rw-r--r--libs/libc/inc/def.h28
-rw-r--r--libs/libc/inc/list.h2
-rw-r--r--libs/libc/inc/math.h2
-rw-r--r--libs/libc/inc/mem.h2
-rw-r--r--libs/libc/inc/str.h4
6 files changed, 24 insertions, 18 deletions
diff --git a/libs/libc/inc/conv.h b/libs/libc/inc/conv.h
index 8b88526..58937c2 100644
--- a/libs/libc/inc/conv.h
+++ b/libs/libc/inc/conv.h
@@ -5,7 +5,7 @@
#include <def.h>
-int itoa(int value, char *buffer, int base);
-char *ftoa(f64 value, char *buffer);
+int itoa(s32 value, char *buffer, u32 base);
+char *ftoa(f64 value, char *buffer, u32 width);
#endif
diff --git a/libs/libc/inc/def.h b/libs/libc/inc/def.h
index 3b173dd..84656b4 100644
--- a/libs/libc/inc/def.h
+++ b/libs/libc/inc/def.h
@@ -33,6 +33,7 @@ typedef long double f80;
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define ABS(a) ((u32)(((s32)(a) < 0) ? -(a) : (a)))
+#define FABS(a) ((f64)(((f64)(a) < 0.0) ? -(a) : (a)))
#define COUNT(a) (sizeof(a) / sizeof 0 [a])
@@ -42,8 +43,8 @@ typedef long double f80;
#define NUMERIC(a) ((a) >= '0' && ((a) <= '9'))
#define ALPHANUMERIC(a) (ALPHA(a) || NUMERIC(a))
-#define __STRINGIFY(a) #a
-#define STRINGIFY(a) __STRINGIFY(a)
+#define STRINGIFY_PARAM(a) #a
+#define STRINGIFY(a) STRINGIFY_PARAM(a)
#define ALIGN_UP(addr, align) (((addr) + (align)-1) & ~((align)-1))
#define ALIGN_DOWN(addr, align) ((addr) & ~((align)-1))
@@ -86,18 +87,17 @@ typedef long double f80;
#define EOF (-1)
#define NULL ((void *)0)
-#define U8_MAX 255
-#define S8_MAX 127
-#define S8_MIN -128
-#define U16_MAX 65535
-#define S16_MAX 32767
-#define S16_MIN -32768
-#define U32_MAX 4294967295
-#define S32_MAX 2147483647
-#define S32_MIN -2147483648
-
-#define LONG_MAX S32_MAX
-#define LONG_MIN S32_MIN
+#define U8_MAX ((u8)255)
+#define S8_MAX ((s8)127)
+#define S8_MIN ((s8)-128)
+#define U16_MAX ((u16)65535)
+#define S16_MAX ((s16)32767)
+#define S16_MIN ((s16)-32768)
+#define U32_MAX ((u32)4294967295)
+#define S32_MAX ((s32)2147483647)
+#define S32_MIN ((s32)-2147483648)
+#define F64_MAX ((f64)0x7fefffffffffffff)
+#define F64_MIN ((f64)0x10000000000000)
#define MILLION 1000000
#define BILLION 1000000000
diff --git a/libs/libc/inc/list.h b/libs/libc/inc/list.h
index fea98dc..4e5fe65 100644
--- a/libs/libc/inc/list.h
+++ b/libs/libc/inc/list.h
@@ -18,8 +18,6 @@ struct node {
struct list *list_new(void);
void list_destroy(struct list *list) NONNULL;
-/* struct node *list_new_node(); */ // TODO: Make node-specific things static/private?
-/* void list_add_node(struct list *list, struct node *node); */
struct node *list_add(struct list *list, void *data) NONNULL;
struct list *list_remove(struct list *list, struct node *node) NONNULL;
struct node *list_last(struct list *list) NONNULL;
diff --git a/libs/libc/inc/math.h b/libs/libc/inc/math.h
index 8affb72..4a38c5f 100644
--- a/libs/libc/inc/math.h
+++ b/libs/libc/inc/math.h
@@ -17,7 +17,9 @@
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
+f32 powf(f32 base, f32 exp);
f64 pow(f64 base, f64 exp);
+f32 sqrtf(f64 num);
f64 sqrt(f64 num);
f32 sinf(f32 angle);
diff --git a/libs/libc/inc/mem.h b/libs/libc/inc/mem.h
index 64f74f5..ef53cad 100644
--- a/libs/libc/inc/mem.h
+++ b/libs/libc/inc/mem.h
@@ -68,6 +68,7 @@ void free_debug(void *ptr, const char *file, int line, const char *func, const c
void *memcpy(void *dest, const void *src, u32 n) NONNULL;
void *memset(void *dest, u32 val, u32 n) NONNULL;
+const void *memcchr(const void *src, char c, u32 n) NONNULL;
void *memchr(void *src, char c, u32 n) NONNULL;
s32 memcmp(const void *s1, const void *s2, u32 n) NONNULL;
u8 mememp(const u8 *buf, u32 n) NONNULL;
@@ -75,6 +76,7 @@ u8 mememp(const u8 *buf, u32 n) NONNULL;
#ifdef KERNEL
void *memcpy_user(void *dest, const void *src, u32 n) NONNULL;
void *memset_user(void *dest, u32 val, u32 n) NONNULL;
+const void *memcchr_user(const void *src, char c, u32 n) NONNULL;
void *memchr_user(void *src, char c, u32 n) NONNULL;
s32 memcmp_user(const void *s1, const void *s2, u32 n) NONNULL;
u8 mememp_user(const u8 *buf, u32 n) NONNULL;
diff --git a/libs/libc/inc/str.h b/libs/libc/inc/str.h
index f024aaa..6b5d16f 100644
--- a/libs/libc/inc/str.h
+++ b/libs/libc/inc/str.h
@@ -8,6 +8,8 @@
PURE u32 strlen(const char *s) NONNULL;
PURE u32 strnlen(const char *s, u32 max) NONNULL;
u32 strlcpy(char *dst, const char *src, u32 size) NONNULL;
+PURE const char *strcchr(const char *s, char c) NONNULL;
+PURE const char *strrcchr(const char *s, char c) NONNULL;
PURE char *strchr(char *s, char c) NONNULL;
PURE char *strrchr(char *s, char c) NONNULL;
u32 strlcat(char *dst, const char *src, u32 size) NONNULL;
@@ -21,6 +23,8 @@ ATTR((malloc)) char *strdup(const char *s) NONNULL;
PURE u32 strlen_user(const char *s) NONNULL;
PURE u32 strnlen_user(const char *s, u32 max) NONNULL;
u32 strlcpy_user(char *dst, const char *src, u32 size) NONNULL;
+PURE const char *strcchr_user(const char *s, char c) NONNULL;
+PURE const char *strrcchr_user(const char *s, char c) NONNULL;
PURE char *strchr_user(char *s, char c) NONNULL;
PURE char *strrchr_user(char *s, char c) NONNULL;
u32 strlcat_user(char *dst, const char *src, u32 size) NONNULL;