chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
@@@ timeout wip
[mLib]
/
utils
/
bits.h
diff --git
a/utils/bits.h
b/utils/bits.h
index 656eee5d5b20cf54e651243d499e60e568b069fe..28c7dd453916dac73e67ba3b6076407db452cb6e 100644
(file)
--- a/
utils/bits.h
+++ b/
utils/bits.h
@@
-36,7
+36,7
@@
#include <limits.h>
#include <stddef.h>
#include <limits.h>
#include <stddef.h>
-#if __STDC_VERSION__ >= 19990
0l
+#if __STDC_VERSION__ >= 19990
1
# include <stdint.h>
#endif
# include <stdint.h>
#endif
@@
-184,21
+184,21
@@
typedef unsigned char octet, uint8;
/* --- List macros --- */
#ifdef HAVE_UINT64
/* --- List macros --- */
#ifdef HAVE_UINT64
-# define DOUINTCONV(_) \
- _(8, 8, 8) \
- _(16, 16, 16) _(16, 16_L, 16l) _(16, 16_B, 16b) \
- _(24, 24, 24) _(24, 24_L, 24l) _(24, 24_B, 24b) \
- _(32, 32, 32) _(32, 32_L, 32l) _(32, 32_B, 32b) \
+# define DOUINTCONV_64(_) \
_(64, 64, 64) _(64, 64_L, 64l) _(64, 64_B, 64b)
_(64, 64, 64) _(64, 64_L, 64l) _(64, 64_B, 64b)
-# define
DOUINTSZ(_) _(8) _(16) _(24) _(32
) _(64)
+# define
DOUINTSZ_64(_
) _(64)
#else
#else
-# define DOUINTCONV(_) \
+# define DOUINTCONV_64(_)
+# define DOUINTSZ_64(_)
+#endif
+
+#define DOUINTCONV(_) \
_(8, 8, 8) \
_(16, 16, 16) _(16, 16_L, 16l) _(16, 16_B, 16b) \
_(24, 24, 24) _(24, 24_L, 24l) _(24, 24_B, 24b) \
_(8, 8, 8) \
_(16, 16, 16) _(16, 16_L, 16l) _(16, 16_B, 16b) \
_(24, 24, 24) _(24, 24_L, 24l) _(24, 24_B, 24b) \
- _(32, 32, 32) _(32, 32_L, 32l) _(32, 32_B, 32b)
-
# define DOUINTSZ(_) _(8) _(16) _(24) _(32
)
-#
endif
+ _(32, 32, 32) _(32, 32_L, 32l) _(32, 32_B, 32b)
\
+
DOUINTCONV_64(_
)
+#
define DOUINTSZ(_) _(8) _(16) _(24) _(32) _DOUINTSZ_64(_)
/* --- Type coercions --- */
/* --- Type coercions --- */
@@
-320,13
+320,13
@@
typedef unsigned char octet, uint8;
/* --- Endianness swapping --- */
/* --- Endianness swapping --- */
-#if GCC_VERSION_P(4, 8)
+#if GCC_VERSION_P(4, 8)
|| CLANG_VERSION_P(3, 2)
# define ENDSWAP16(x) ((uint16)__builtin_bswap16(x))
#endif
# define ENDSWAP16(x) ((uint16)__builtin_bswap16(x))
#endif
-#if GCC_VERSION_P(4, 3)
+#if GCC_VERSION_P(4, 3)
|| CLANG_VERSION_P(3, 2)
# define ENDSWAP32(x) ((uint32)__builtin_bswap32(x))
#endif
# define ENDSWAP32(x) ((uint32)__builtin_bswap32(x))
#endif
-#if
GCC_VERSION_P(4, 3
) && defined(HAVE_UINT64)
+#if
(GCC_VERSION_P(4, 3) || CLANG_VERSION_P(3, 2)
) && defined(HAVE_UINT64)
# define ENDSWAP64(x) ((uint64)__builtin_bswap64(x))
#endif
# define ENDSWAP64(x) ((uint64)__builtin_bswap64(x))
#endif
@@
-427,7
+427,7
@@
typedef unsigned char octet, uint8;
/* --- Unaligned access (GCC-specific) --- */
/* --- Unaligned access (GCC-specific) --- */
-#if
GCC_VERSION_P(3, 3
) && CHAR_BIT == 8
+#if
(GCC_VERSION_P(3, 3) || CLANG_VERSION_P(3, 0)
) && CHAR_BIT == 8
# define MLIB_MISALIGNED __attribute__((aligned(1), may_alias))
# if __SIZEOF_SHORT__ == 2
typedef MLIB_MISALIGNED unsigned short misaligned_uint16;
# define MLIB_MISALIGNED __attribute__((aligned(1), may_alias))
# if __SIZEOF_SHORT__ == 2
typedef MLIB_MISALIGNED unsigned short misaligned_uint16;