Skip to content

Commit deca45a

Browse files
committed
fix warn in __stdc_trailing_zeros
Signed-off-by: june-fish <git@june.fish>
1 parent 0a2eff0 commit deca45a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/kernel/include/compiler.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,27 +189,27 @@ static inline __UINT64_TYPE__ __stdc_bit_width_u64(__UINT64_TYPE__ value) {
189189
#else
190190
[[gnu::const]]
191191
static inline __UINT8_TYPE__ __stdc_trailing_zeros_u8(__UINT8_TYPE__ value) {
192-
return __builtin_ctzg((__UINT8_TYPE__)~value, -1) + 1U;
192+
return (__UINT8_TYPE__)(__builtin_ctzg((__UINT8_TYPE__)~value, -1) + 1);
193193
}
194194

195195
[[gnu::const]]
196196
static inline __UINT16_TYPE__ __stdc_trailing_zeros_u16(__UINT16_TYPE__ value) {
197-
return __builtin_ctzg((__UINT16_TYPE__)~value, -1) + 1U;
197+
return (__UINT16_TYPE__)(__builtin_ctzg((__UINT16_TYPE__)~value, -1) + 1);
198198
}
199199

200200
[[gnu::const]]
201201
static inline __UINT32_TYPE__ __stdc_trailing_zeros_u32(__UINT32_TYPE__ value) {
202-
return __builtin_ctzg((__UINT32_TYPE__)~value, -1) + 1U;
202+
return (__UINT32_TYPE__)(__builtin_ctzg((__UINT32_TYPE__)~value, -1) + 1);
203203
}
204204

205205
[[gnu::const]]
206206
static inline __UINT64_TYPE__ __stdc_trailing_zeros_u64(__UINT64_TYPE__ value) {
207-
return __builtin_ctzg((__UINT64_TYPE__)~value, -1) + 1U;
207+
return (__UINT64_TYPE__)(__builtin_ctzg((__UINT64_TYPE__)~value, -1) + 1);
208208
}
209209

210210
[[gnu::const]]
211211
static inline __SIZE_TYPE__ __stdc_trailing_zeros_usize(__SIZE_TYPE__ value) {
212-
return __builtin_ctzg((__SIZE_TYPE__)~value, -1) + 1U;
212+
return (__SIZE_TYPE__)(__builtin_ctzg((__SIZE_TYPE__)~value, -1) + 1);
213213
}
214214

215215
#define stdc_trailing_zeros(VALUE) \

0 commit comments

Comments
 (0)