summaryrefslogtreecommitdiff
path: root/FL/fl_casts.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-08-30 15:42:06 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-08-30 23:43:55 +0200
commited3ec2d036675601f612bb9f45ad9e9b731699f3 (patch)
tree91082aecc48e3437643640d4743d0040e42d6085 /FL/fl_casts.H
parent753631a0b57ba417701167d1e4dd24df0b923254 (diff)
Add experimental FL/fl_casts.H (issue #109)
Diffstat (limited to 'FL/fl_casts.H')
-rw-r--r--FL/fl_casts.H23
1 files changed, 23 insertions, 0 deletions
diff --git a/FL/fl_casts.H b/FL/fl_casts.H
new file mode 100644
index 000000000..b4968c055
--- /dev/null
+++ b/FL/fl_casts.H
@@ -0,0 +1,23 @@
+// experimental inline cast functions for the Fast Light Toolkit (FLTK)
+
+#include <FL/platform_types.h>
+
+inline char fl_char(void *v) { return (char)(fl_intptr_t)v; }
+inline int fl_int(void *v) { return (int)(fl_intptr_t)v; }
+inline long fl_long(void *v) { return (long)(fl_intptr_t)v; }
+
+inline unsigned char fl_uchar(void *v) { return (unsigned char)(fl_uintptr_t)v; }
+inline unsigned int fl_uint(void *v) { return (unsigned int)(fl_uintptr_t)v; }
+inline unsigned long fl_ulong(void *v) { return (unsigned long)(fl_uintptr_t)v; }
+
+#if 0 /* not necessary */
+
+inline char fl_char(size_t v) { return (char)v; }
+inline int fl_int(size_t v) { return (int)v; }
+inline long fl_long(size_t v) { return (long)v; }
+
+inline unsigned char fl_uchar(size_t v) { return (unsigned char)v; }
+inline unsigned int fl_uint(size_t v) { return (unsigned int)v; }
+inline unsigned long fl_ulong(size_t v) { return (unsigned long)v; }
+
+#endif /* not necessary */