bit_util: Change ffs functions indexing.

Making these 0-based instead of 1-based makes calling code simpler and will be
more consistent with functions introduced in subsequent diffs.
This commit is contained in:
David Goldblatt
2020-07-22 08:07:12 -07:00
committed by David Goldblatt
parent 786a27b9e5
commit 1ed0288d9c
5 changed files with 86 additions and 24 deletions

View File

@@ -211,8 +211,8 @@ pages_map(void *addr, size_t size, size_t alignment, bool *commit) {
flags |= MAP_FIXED | MAP_EXCL;
} else {
unsigned alignment_bits = ffs_zu(alignment);
assert(alignment_bits > 1);
flags |= MAP_ALIGNED(alignment_bits - 1);
assert(alignment_bits > 0);
flags |= MAP_ALIGNED(alignment_bits);
}
void *ret = mmap(addr, size, prot, flags, -1, 0);
@@ -600,7 +600,7 @@ init_thp_state(void) {
#endif
if (nread < 0) {
goto label_error;
goto label_error;
}
if (strncmp(buf, sys_state_madvise, (size_t)nread) == 0) {