diff options
| author | wdfk-prog <[email protected]> | 2026-03-16 09:54:59 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-03-16 10:27:53 +0800 |
| commit | 012e301664bc10b38097d8127b6468b4e86440f2 (patch) | |
| tree | 04c68e13cbd6536a14005dd29d9ae2d560d07c41 /src | |
| parent | 05445c04e8dc0a7968330ee981aac8de2c6315cc (diff) | |
docs(kservice): Update the documentation comments of the fls function
Diffstat (limited to 'src')
| -rw-r--r-- | src/kservice.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/kservice.c b/src/kservice.c index 60806ce82a..1c77acac8a 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1104,13 +1104,19 @@ RTM_EXPORT(rt_free_align); #endif /* RT_USING_HEAP */ /** - * fls - find last (most-significant) bit set - * @x: the word to search + * @brief Find the index of the most significant set bit in a 32-bit integer. + * @details The result is the position of the highest bit set to 1, counting + * from 1 for the least significant bit. If the input value is 0, the function + * returns 0. * - * This is defined the same way as ffs. - * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. + * Examples: + * - fls(0) = 0 + * - fls(1) = 1 + * - fls(0x80000000) = 32 + * + * @param val 32-bit integer value to examine. + * @return Position of the most significant set bit (1–32), or 0 if @p val is 0. */ - int __rt_fls(int val) { int bit = 32; |
