summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-04-21 21:20:55 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:40 +0200
commitf6a03f19cf2807170717593b4de8056a1248b99b (patch)
treebe4dd0571ceab269cde781a95d75821f4889cd89 /include
parent9f68f0cbf8c8eea6a7f9e195e4617bbaa808d7c6 (diff)
endian.h: add some handy macros to be used in syscalls
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/endian.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/endian.h b/include/endian.h
index 0ba738463..1e2fc938b 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -55,6 +55,17 @@
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
+#ifdef _LIBC
+# ifndef __ASSEMBLER__
+# include <stdint.h>
+# define OFF_HI(offset) (offset >> 31)
+# define OFF_LO(offset) (offset)
+# define OFF64_HI(offset) (uint32_t)(offset >> 32)
+# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff)
+# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset))
+# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset))
+# endif
+#endif
#ifdef __USE_BSD
/* Conversion interfaces. */