Skip to content

Commit ef109b2

Browse files
committed
[UR] Fix overflow in critnib on Windows
1UL is 4 bytes on windows causing wrong results with bit mask
1 parent c739700 commit ef109b2

File tree

1 file changed

+2
-2
lines changed
  • source/common/unified_malloc_framework/src/critnib

1 file changed

+2
-2
lines changed

source/common/unified_malloc_framework/src/critnib/critnib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
#define DELETED_LIFE 16
8282

8383
#define SLICE 4
84-
#define NIB ((1UL << SLICE) - 1)
84+
#define NIB ((1ULL << SLICE) - 1)
8585
#define SLNODES (1 << SLICE)
8686

8787
typedef uintptr_t word;
@@ -156,7 +156,7 @@ static inline bool is_leaf(struct critnib_node *n) { return (word)n & 1; }
156156
* internal: to_leaf -- untag a leaf pointer
157157
*/
158158
static inline struct critnib_leaf *to_leaf(struct critnib_node *n) {
159-
return (void *)((word)n & ~1UL);
159+
return (void *)((word)n & ~1ULL);
160160
}
161161

162162
/*

0 commit comments

Comments
 (0)