summaryrefslogtreecommitdiffstats
path: root/itypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'itypes.c')
-rw-r--r--itypes.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/itypes.c b/itypes.c
index 76de9013..a72444e8 100644
--- a/itypes.c
+++ b/itypes.c
@@ -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();
+ }
+}