compile with clang and gcc

This commit is contained in:
daanx 2024-11-30 12:41:11 -08:00
parent d15e83030e
commit f8d04dc2bc
15 changed files with 57 additions and 60 deletions

View file

@ -291,7 +291,7 @@ static inline size_t mi_rotr(size_t x, size_t r) {
// The term `(-rshift)&(MI_BFIELD_BITS-1)` is written instead of `MI_BFIELD_BITS - rshift` to
// avoid UB when `rshift==0`. See <https://blog.regehr.org/archives/1063>
const unsigned int rshift = (unsigned int)(r) & (MI_SIZE_BITS-1);
return (x >> rshift) | (x << ((-rshift) & (MI_SIZE_BITS-1)));
return ((x >> rshift) | (x << ((-rshift) & (MI_SIZE_BITS-1))));
#endif
}
@ -310,7 +310,7 @@ static inline size_t mi_rotl(size_t x, size_t r) {
// The term `(-rshift)&(MI_BFIELD_BITS-1)` is written instead of `MI_BFIELD_BITS - rshift` to
// avoid UB when `rshift==0`. See <https://blog.regehr.org/archives/1063>
const unsigned int rshift = (unsigned int)(r) & (MI_SIZE_BITS-1);
return (x << rshift) | (x >> ((-rshift) & (MI_SIZE_BITS-1)))
return ((x << rshift) | (x >> ((-rshift) & (MI_SIZE_BITS-1))));
#endif
}

View file

@ -471,7 +471,7 @@ static inline uint8_t* mi_page_area(const mi_page_t* page, size_t* size) {
static inline bool mi_page_contains_address(const mi_page_t* page, const void* p) {
size_t psize;
uint8_t* start = mi_page_area(page, &psize);
return (start <= p && p < start + psize);
return (start <= (uint8_t*)p && (uint8_t*)p < start + psize);
}
static inline bool mi_page_is_in_arena(const mi_page_t* page) {

View file

@ -125,7 +125,7 @@ terms of the MIT license. A copy of the license can be found in the file
#define MI_ARENA_SLICE_SIZE (MI_ZU(1) << MI_ARENA_SLICE_SHIFT)
#define MI_ARENA_SLICE_ALIGN (MI_ARENA_SLICE_SIZE)
#define MI_BITMAP_CHUNK_BITS (MI_ZU(1) << MI_BITMAP_CHUNK_BITS_SHIFT)
#define MI_BITMAP_CHUNK_BITS (1 << MI_BITMAP_CHUNK_BITS_SHIFT)
#define MI_ARENA_MIN_OBJ_BLOCKS (1)
#define MI_ARENA_MAX_OBJ_BLOCKS (MI_BITMAP_CHUNK_BITS) // for now, cannot cross chunk boundaries