mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-07 09:06:55 +00:00
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and .yaml files. Will avoid failures with the new CI test in https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only checks changed files. Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst to get rid of the trailing blank line there. It was probably misplaced. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
34 lines
514 B
C
34 lines
514 B
C
/*
|
|
* Copyright (c) 2019 Oticon A/S
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <sys/util.h>
|
|
|
|
u8_t u8_to_dec(char *buf, u8_t buflen, u8_t value)
|
|
{
|
|
u8_t divisor = 100;
|
|
u8_t num_digits = 0;
|
|
u8_t digit;
|
|
|
|
while (buflen > 0 && divisor > 0) {
|
|
digit = value / divisor;
|
|
if (digit != 0 || divisor == 1 || num_digits != 0) {
|
|
*buf = (char)digit + '0';
|
|
buf++;
|
|
buflen--;
|
|
num_digits++;
|
|
}
|
|
|
|
value -= digit * divisor;
|
|
divisor /= 10;
|
|
}
|
|
|
|
if (buflen) {
|
|
*buf = '\0';
|
|
}
|
|
|
|
return num_digits;
|
|
}
|