mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-31 19:20:26 +00:00
mesh_node: use btstack_clz
This commit is contained in:
parent
ec08441f2c
commit
b8fd168e43
@ -42,6 +42,8 @@
|
||||
|
||||
#include "mesh/mesh_node.h"
|
||||
|
||||
#include "btstack_util.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -275,12 +277,12 @@ uint8_t mesh_heartbeat_count_log(uint16_t value){
|
||||
if (value == 0xffff) return 0xff;
|
||||
// count leading zeros, supported by clang and gcc
|
||||
// note: CountLog(8) == CountLog(7) = 3
|
||||
return 33 - __builtin_clz(value - 1);
|
||||
return 33 - btstack_clz(value - 1);
|
||||
}
|
||||
|
||||
uint8_t mesh_heartbeat_period_log(uint16_t value){
|
||||
if (value == 0) return 0x00;
|
||||
// count leading zeros, supported by clang and gcc
|
||||
// note: PeriodLog(8) == PeriodLog(7) = 3
|
||||
return 33 - __builtin_clz(value - 1);
|
||||
return 33 - btstack_clz(value - 1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user