Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lfs_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static inline uint32_t lfs_alignup(uint32_t a, uint32_t alignment) {
// Find the smallest power of 2 greater than or equal to a
static inline uint32_t lfs_npw2(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
return 32 - __builtin_clz(a-1);
return (uint32_t) (32 - __builtin_clz(a-1));
#else
uint32_t r = 0;
uint32_t s;
Expand All @@ -160,7 +160,7 @@ static inline uint32_t lfs_npw2(uint32_t a) {
// lfs_ctz(0) may be undefined
static inline uint32_t lfs_ctz(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && defined(__GNUC__)
return __builtin_ctz(a);
return (uint32_t) __builtin_ctz(a);
#else
return lfs_npw2((a & -a) + 1) - 1;
#endif
Expand All @@ -169,7 +169,7 @@ static inline uint32_t lfs_ctz(uint32_t a) {
// Count the number of binary ones in a
static inline uint32_t lfs_popc(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
return __builtin_popcount(a);
return (uint32_t) __builtin_popcount(a);
#else
a = a - ((a >> 1) & 0x55555555);
a = (a & 0x33333333) + ((a >> 2) & 0x33333333);
Expand Down