diff options
-rw-r--r-- | itypes.c | 15 | ||||
-rw-r--r-- | itypes.h | 2 |
2 files changed, 17 insertions, 0 deletions
@@ -29,6 +29,7 @@ #include <stddef.h> #include <wchar.h> #include <signal.h> +#include <stdlib.h> #include "config.h" #include "lib.h" #include "signal.h" @@ -262,3 +263,17 @@ unsigned long c_ulong(val n, val self) #error portme #endif } + +size_t c_size(val n, val self) +{ + switch (sizeof (size_t)) { + case sizeof (unsigned): + return c_uint(n, self); +#if SIZEOF_LONG != SIZEOF_INT + case sizeof (unsigned long): + return c_ulong(n, self); +#endif + default: + abort(); + } +} @@ -117,3 +117,5 @@ unsigned int c_uint(val, val self); long c_long(val, val self); unsigned long c_ulong(val, val self); + +size_t c_size(val, val self); |