mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-06 11:41:56 +00:00
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99 integer types. Jira: ZEP-2051 Change-Id: I8f57a17f78e674aca5400f005db8975c9f9e150e Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
28 lines
425 B
C
28 lines
425 B
C
/*
|
|
* Copyright (c) 2016 Nordic Semiconductor ASA
|
|
* Copyright (c) 2016 Vinayak Kariappa Chettimada
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/types.h>
|
|
#include "util.h"
|
|
|
|
u8_t util_ones_count_get(u8_t *octets, u8_t octets_len)
|
|
{
|
|
u8_t one_count = 0;
|
|
|
|
while (octets_len--) {
|
|
u8_t bite;
|
|
|
|
bite = *octets;
|
|
while (bite) {
|
|
bite &= (bite - 1);
|
|
one_count++;
|
|
}
|
|
octets++;
|
|
}
|
|
|
|
return one_count;
|
|
}
|