Skip to content

Commit 751711a

Browse files
etienne-lmsjhedberg
authored andcommitted
include: zephyr: sys: correct sys_test_bit() and friends description
Correct the documentation of sys_test_bit() and its derivative helper functions (listed below) since these return a bit mask value instead of an essentially boolean value as previosuly described. In tree implementation do conform with that: the result of these functions are always implicitly tested against being 0 or a non-zero value. Helper functions which documentation is modified are sys_test_bit(), sys_test_and_set_bit(), sys_test_and_clear_bit(), sys_bitfield_test_bit(), sys_bitfield_test_and_set_bit() and sys_bitfield_test_and_clear_bit(). Signed-off-by: Etienne Carriere <[email protected]>
1 parent b0d4580 commit 751711a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

include/zephyr/sys/sys_io.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ typedef uintptr_t mem_addr_t;
285285
* @param addr the memory address from where to look for the bit
286286
* @param bit the designated bit to test (from 0 to 31)
287287
*
288-
* @return 1 if it is set, 0 otherwise
288+
* @return the bitwise AND result of @p addr content and (1 << @p bit).
289+
* Result is 0 only if the bit is cleared otherwise result is a non-0 value.
289290
*/
290291

291292
/**
@@ -298,7 +299,8 @@ typedef uintptr_t mem_addr_t;
298299
* @param addr the memory address from where to look for the bit
299300
* @param bit the designated bit to test and set (from 0 to 31)
300301
*
301-
* @return 1 if it was set, 0 otherwise
302+
* @return the bitwise AND result of @p addr content and (1 << @p bit) before target bit
303+
* is set. Result is 0 only if the bit was cleared otherwise result is a non-0 value.
302304
*/
303305

304306
/**
@@ -311,7 +313,8 @@ typedef uintptr_t mem_addr_t;
311313
* @param addr the memory address from where to look for the bit
312314
* @param bit the designated bit to test and clear (from 0 to 31)
313315
*
314-
* @return 0 if it was clear, 1 otherwise
316+
* @return the bitwise AND result of @p addr content and (1 << @p bit) before target bit
317+
* is cleared. Result is 0 only if the bit was cleared otherwise result is a non-0 value.
315318
*/
316319

317320
/**
@@ -344,7 +347,8 @@ typedef uintptr_t mem_addr_t;
344347
* @param addr the memory address from where to look for the bit
345348
* @param bit the designated bit to test (arbitrary
346349
*
347-
* @return 1 if it is set, 0 otherwise
350+
* @return the bitwise AND result of @p addr content and (1 << @p bit). Result is 0
351+
* only if the bit is cleared otherwise result is a non-0 value.
348352
*/
349353

350354
/**
@@ -357,7 +361,8 @@ typedef uintptr_t mem_addr_t;
357361
* @param addr the memory address from where to look for the bit
358362
* @param bit the designated bit to test and set (arbitrary)
359363
*
360-
* @return 1 if it was set, 0 otherwise
364+
* @return the bitwise AND result of @p addr content and (1 << @p bit) before target bit
365+
* is set. Result is 0 only if the bit was cleared otherwise result is a non-0 value.
361366
*/
362367

363368
/**
@@ -370,7 +375,8 @@ typedef uintptr_t mem_addr_t;
370375
* @param addr the memory address from where to look for the bit
371376
* @param bit the designated bit to test and clear (arbitrary)
372377
*
373-
* @return 0 if it was clear, 1 otherwise
378+
* @return the bitwise AND result of @p addr content and (1 << @p bit) before target bit
379+
* is cleared. Result is 0 only if the bit was cleared otherwise result is a non-0 value.
374380
*/
375381

376382

0 commit comments

Comments
 (0)