diff options
Diffstat (limited to 'ewah/ewok.h')
-rw-r--r-- | ewah/ewok.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ewah/ewok.h b/ewah/ewok.h index 43adeb5c68..6e2c5e1e3d 100644 --- a/ewah/ewok.h +++ b/ewah/ewok.h @@ -30,8 +30,9 @@ # define ewah_calloc xcalloc #endif +struct strbuf; typedef uint64_t eword_t; -#define BITS_IN_WORD (sizeof(eword_t) * 8) +#define BITS_IN_EWORD (sizeof(eword_t) * 8) /** * Do not use __builtin_popcountll. The GCC implementation @@ -47,7 +48,8 @@ static inline uint32_t ewah_bit_popcount64(uint64_t x) return (x * 0x0101010101010101ULL) >> 56; } -#ifdef __GNUC__ +/* __builtin_ctzll was not available until 3.4.0 */ +#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR > 3)) #define ewah_bit_ctz64(x) __builtin_ctzll(x) #else static inline int ewah_bit_ctz64(uint64_t x) @@ -97,10 +99,10 @@ int ewah_serialize_to(struct ewah_bitmap *self, void *out); int ewah_serialize(struct ewah_bitmap *self, int fd); int ewah_serialize_native(struct ewah_bitmap *self, int fd); +int ewah_serialize_strbuf(struct ewah_bitmap *self, struct strbuf *); int ewah_deserialize(struct ewah_bitmap *self, int fd); -int ewah_read_mmap(struct ewah_bitmap *self, void *map, size_t len); -int ewah_read_mmap_native(struct ewah_bitmap *self, void *map, size_t len); +int ewah_read_mmap(struct ewah_bitmap *self, const void *map, size_t len); uint32_t ewah_checksum(struct ewah_bitmap *self); |