sys: util: use BITS_PER_BYTE macro instead of the magic number 8
Obviously, everyone knows that there are 8 bits per byte, so there isn't a lot of magic happening, per se, but it's also helpful to clearly denote where the magic number 8 is referring to the number of bits in a byte. Occasionally, 8 will refer to a field size or offset in a structure, MMR, or word. Occasionally, the number 8 will refer to the number of bytes in a 64-bit value (which should probably be replaced with `sizeof(uint64_t)`). For converting bits to bytes, or vice-versa, let's use `BITS_PER_BYTE` for clarity (or other appropriate `BITS_PER_*` macros). Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
5032d8ede8
commit
9504034733
14 changed files with 25 additions and 22 deletions
|
@ -1183,7 +1183,7 @@ ZTEST(mem_protect_kobj, test_kobj_create_out_of_memory)
|
|||
#ifdef CONFIG_DYNAMIC_OBJECTS
|
||||
extern uint8_t _thread_idx_map[CONFIG_MAX_THREAD_BYTES];
|
||||
|
||||
#define MAX_THREAD_BITS (CONFIG_MAX_THREAD_BYTES * 8)
|
||||
#define MAX_THREAD_BITS (CONFIG_MAX_THREAD_BYTES * BITS_PER_BYTE)
|
||||
#endif
|
||||
|
||||
/* @brief Test alloc thread object until out of idex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue