implement is_constant for c11: https://gustedt.wordpress.com/2013/08/22/testing-compile-time-constness-and-null-pointers-with-c11s-_generic/ #ifdef _MSC_VER #include #define bswap_32(x) _byteswap_ulong(x) #define bswap_64(x) _byteswap_uint64(x) #elif defined(__APPLE__) // Mac OS X / Darwin features #include #define bswap_32(x) OSSwapInt32(x) #define bswap_64(x) OSSwapInt64(x) #elif defined(__sun) || defined(sun) #include #define bswap_32(x) BSWAP_32(x) #define bswap_64(x) BSWAP_64(x) #elif defined(__FreeBSD__) #include #define bswap_32(x) bswap32(x) #define bswap_64(x) bswap64(x) #elif defined(__OpenBSD__) #include #define bswap_32(x) swap32(x) #define bswap_64(x) swap64(x) #elif defined(__NetBSD__) #include #include #if defined(__BSWAP_RENAME) && !defined(__bswap_32) #define bswap_32(x) bswap32(x) #define bswap_64(x) bswap64(x) #endif #else #include #endif 0x00010001 - add ecb_is_pot32/64. - add intptr_t/uintptr_t. - add ECB_PTRSIZE. - more macros for C/C++ version checks. - support C11 atomics for memory fences. - support gcc-4.7 atomics for memory fences. - support m68k, m88k and sh (patch by Miod Vallat). - add ecb_binary16_to_float. TODO: ecb_restrict_array etc. http://ue.tst.eu/5093eafd713ec5fda776d8065070aa4c.txt TODO: ffs/clz 64 bit variants of everything TODO: examples from X for clz/ctz TODO: arithmetic right shift TODO: template/generic functions for x32/x64 and so on TODO: #define ecb_integer_multiples_of(n,d) ((char (*)[d])(n) - (char (*)[d])0) TODO: generalised shift TODO: #define ECB_FAST_UNALIGNED_ACCESS unsigned long gensh(unsigned long v, int x) { int a, b; a = (v << x) & -(((unsigned int)x) < 32); x = -x; b = (v >> x) & -(((unsigned int)x) < 32); return a|b; } TODO: read/write unaligned macros TODO: htonl and friends TODO: macro to convetr from unsigned to signed "the natural way" TODO: ecb_deprecated with message TODO: ecb_static_assert, with message (just like boost), or somesuch, using array-declaration TODO: alignof