LCOV - code coverage report
Current view: top level - /home/runner/zephyrproject/zephyr/lib/utils - dec.c (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 16 0
Test Date: 2026-03-12 12:01:18 Functions: 0.0 % 1 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0.0 % 8 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * Copyright (c) 2019 Oticon A/S
       3                 :             :  *
       4                 :             :  * SPDX-License-Identifier: Apache-2.0
       5                 :             :  */
       6                 :             : 
       7                 :             : #include <zephyr/sys/util.h>
       8                 :             : 
       9                 :           0 : uint8_t u8_to_dec(char *buf, uint8_t buflen, uint8_t value)
      10                 :             : {
      11                 :           0 :         uint8_t divisor = 100;
      12                 :           0 :         uint8_t num_digits = 0;
      13                 :           0 :         uint8_t digit;
      14                 :             : 
      15         [ #  # ]:           0 :         while ((buflen > 0) && (divisor > 0)) {
      16                 :           0 :                 digit = value / divisor;
      17   [ #  #  #  # ]:           0 :                 if ((digit != 0) || (divisor == 1) || (num_digits != 0)) {
      18                 :           0 :                         *buf = digit + (char)'0';
      19                 :           0 :                         buf++;
      20                 :           0 :                         buflen--;
      21                 :           0 :                         num_digits++;
      22                 :             :                 }
      23                 :             : 
      24                 :           0 :                 value -= digit * divisor;
      25                 :           0 :                 divisor /= 10;
      26                 :             :         }
      27                 :             : 
      28         [ #  # ]:           0 :         if (buflen != 0) {
      29                 :           0 :                 *buf = '\0';
      30                 :             :         }
      31                 :             : 
      32                 :           0 :         return num_digits;
      33                 :             : }
        

Generated by: LCOV version 2.0-1