--- libeio/ecb.h 2012/04/24 18:47:50 1.11 +++ libeio/ecb.h 2012/05/28 17:00:19 1.12 @@ -30,6 +30,9 @@ #ifndef ECB_H #define ECB_H +/* 16 bits major, 16 bits minor */ +#define ECB_VERSION 0x00010001 + #ifdef _WIN32 typedef signed char int8_t; typedef unsigned char uint8_t; @@ -44,8 +47,23 @@ typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; #endif + #ifdef _WIN64 + #define ECB_PTRSIZE 8 + typedef uint64_t uintptr_t; + typedef int64_t intptr_t; + #else + #define ECB_PTRSIZE 4 + typedef uint32_t uintptr_t; + typedef int32_t intptr_t; + #endif + typedef intptr_t ptrdiff_t; #else #include + #if UINTMAX_MAX > 0xffffffffU + #define ECB_PTRSIZE 8 + #else + #define ECB_PTRSIZE 4 + #endif #endif /* many compilers define _GNUC_ to some versions but then only implement @@ -312,6 +330,11 @@ } #endif +ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) ecb_const; +ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); } +ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) ecb_const; +ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); } + ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) ecb_const; ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) {