Fix incorrect comment on lfs_npw2

`lfs_npw2` returns a value v such that `2^v >= a` and `2^(v-1) < a`, but
the previous comment incorrectly describes it as "less than or equal to
a".
This commit is contained in:
Joe Doyle
2020-01-02 13:46:07 -08:00
parent ce2c01f098
commit 626006af0c

View File

@@ -107,7 +107,7 @@ static inline uint32_t lfs_alignup(uint32_t a, uint32_t alignment) {
return lfs_aligndown(a + alignment-1, alignment); return lfs_aligndown(a + alignment-1, alignment);
} }
// Find the next smallest power of 2 less than or equal to a // Find the smallest power of 2 greater than or equal to a
static inline uint32_t lfs_npw2(uint32_t a) { static inline uint32_t lfs_npw2(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM)) #if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
return 32 - __builtin_clz(a-1); return 32 - __builtin_clz(a-1);