summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tlsf/src/tlsf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tlsf/src/tlsf.c b/lib/tlsf/src/tlsf.c
index 15fa8002d2..7943770975 100644
--- a/lib/tlsf/src/tlsf.c
+++ b/lib/tlsf/src/tlsf.c
@@ -163,7 +163,7 @@ void abort(void);
163#define TLSF_SIGNATURE (0x2A59FA59) 163#define TLSF_SIGNATURE (0x2A59FA59)
164 164
165#define PTR_MASK (sizeof(void *) - 1) 165#define PTR_MASK (sizeof(void *) - 1)
166#define BLOCK_SIZE (0xFFFFFFFF - PTR_MASK) 166#define BLOCK_SIZE (~PTR_MASK) /* BUGFIX (0xFFFFFFFF - PTR_MASK) */
167 167
168 168
169/* Dereferencing type-punned pointers will break strict aliasing.*/ 169/* Dereferencing type-punned pointers will break strict aliasing.*/
@@ -342,12 +342,12 @@ static __inline__ int ms_bit(int i)
342 342
343static __inline__ void set_bit(int nr, u32_t * addr) 343static __inline__ void set_bit(int nr, u32_t * addr)
344{ 344{
345 addr[nr >> 5] |= 1 << (nr & 0x1f); 345 addr[nr >> 5] |= 1u << (nr & 0x1f);
346} 346}
347 347
348static __inline__ void clear_bit(int nr, u32_t * addr) 348static __inline__ void clear_bit(int nr, u32_t * addr)
349{ 349{
350 addr[nr >> 5] &= ~(1 << (nr & 0x1f)); 350 addr[nr >> 5] &= ~(1u << (nr & 0x1f));
351} 351}
352 352
353static __inline__ void MAPPING_SEARCH(size_t * _r, int *_fl, int *_sl) 353static __inline__ void MAPPING_SEARCH(size_t * _r, int *_fl, int *_sl)
@@ -871,7 +871,7 @@ void free_ex(void *ptr, void *mem_pool)
871 } 871 }
872 if (b->size & PREV_FREE) { 872 if (b->size & PREV_FREE) {
873 /* Coalesce previous block */ 873 /* Coalesce previous block */
874 tmp_b = (bhdr_t*) ( (intptr_t)b->prev_hdr & BLOCK_SIZE ); 874 tmp_b = (bhdr_t*) ( (intptr_t)b->prev_hdr & ~STATE_MASK );
875 MAPPING_INSERT(tmp_b->size & BLOCK_SIZE, &fl, &sl); 875 MAPPING_INSERT(tmp_b->size & BLOCK_SIZE, &fl, &sl);
876 EXTRACT_BLOCK(tmp_b, tlsf, fl, sl); 876 EXTRACT_BLOCK(tmp_b, tlsf, fl, sl);
877 tmp_b->size += (b->size & BLOCK_SIZE) + BHDR_OVERHEAD; 877 tmp_b->size += (b->size & BLOCK_SIZE) + BHDR_OVERHEAD;