zephyr/include/misc
Nicolas Pitre c2d38ec2b9 ARRAY_SIZE(): make it usable on 64-bit systems
With code that looks like this:

	for (int i = ARRAY_SIZfoo) - 1; i >= 0; i--) ...

If foo is empty, ARRAY_SIZfoo) will return 0. But since it is
implemented using an unsigned long, the answer to 0UL - 1 is
18446744073709551615 on a 64-bit system, and that doesn't fit into
an int. The compiler complains with:

warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘18446744073709551615’ to ‘-1’ [-Woverflow]

Let's fix that and get the expected behavior simply by turning the
unsigned long into a signed long.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-03 21:14:02 -04:00
..
__assert.h all: Update reserved function names 2019-03-11 13:48:42 -04:00
byteorder.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
dlist.h include: Make statements evaluate boolean expressions 2019-03-26 22:06:45 -04:00
errno_private.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
fdtable.h net: sockets: implement getsockname function 2019-05-17 22:49:32 +03:00
gcov.h tests: coverage: Add Gcov support. 2019-01-16 06:12:33 -05:00
libc-hooks.h libc: rename _zephyr_fputc to zephyr_fputc 2019-03-12 13:59:06 -05:00
list_gen.h include: Make statements evaluate boolean expressions 2019-03-26 22:06:45 -04:00
math_extras_impl.h misc: Implement math_extras.h function with GCC builtins. 2019-05-14 19:53:30 -05:00
math_extras.h misc: Portable math_extras.h implementations. 2019-05-14 19:53:30 -05:00
mempool_base.h all: Update reserved function names 2019-03-11 13:48:42 -04:00
mempool.h sys_mem_pool: use sys_mutex 2019-04-03 13:47:45 -04:00
mutex.h lib: os: add sys_mutex data type 2019-04-03 13:47:45 -04:00
printk.h subsystems: Rename reserved function names 2019-04-03 17:31:00 -04:00
rb.h C++: Fix compilation error "invalid conversion" 2019-05-03 14:27:07 -04:00
reboot.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
ring_buffer.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
sflist.h all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
slist.h include: misc: list_gen: Fix possible undefined behavior 2018-12-07 09:06:34 -05:00
speculation.h doc: fix misspelling in docs and API comments 2019-03-27 15:59:09 -04:00
stack.h kernel: demote K_THREAD_STACK_BUFFER() to private 2019-04-05 16:10:02 -04:00
util.h ARRAY_SIZE(): make it usable on 64-bit systems 2019-06-03 21:14:02 -04:00