Skip to content

Commit 6fbab11

Browse files
committed
Fix cppcheck and compiler warnings
1 parent a60db2f commit 6fbab11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

buddy_alloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ size_t buddy_arena_free_size(struct buddy *buddy) {
759759
}
760760

761761
static unsigned int is_valid_alignment(size_t alignment) {
762-
return ceiling_power_of_two(alignment) == alignment;
762+
return (alignment > 0) && (ceiling_power_of_two(alignment) == alignment);
763763
}
764764

765765
static size_t buddy_tree_order_for_memory(size_t memory_size, size_t alignment) {
@@ -2152,7 +2152,7 @@ static inline unsigned int popcount_byte(unsigned char b) {
21522152

21532153
static unsigned char count_trailing_zeroes(size_t val) {
21542154
/* Implementation from https://www.chessprogramming.org/BitScan */
2155-
static const unsigned char lookup67[67+1] = {
2155+
static const signed char lookup67[67+1] = {
21562156
64, 0, 1, 39, 2, 15, 40, 23,
21572157
3, 12, 16, 59, 41, 19, 24, 54,
21582158
4, -1, 13, 10, 17, 62, 60, 28,

0 commit comments

Comments
 (0)