| 55 | } |
| 56 | |
| 57 | uint32_t util_write_uint32(char *str, uint32_t value) |
| 58 | { |
| 59 | uint32_t temp_val; |
| 60 | uint64_t digits; |
| 61 | uint32_t i; |
| 62 | // Count the number of digits |
| 63 | digits = 0; |
| 64 | temp_val = value; |
| 65 | |
| 66 | while (temp_val > 0) { |
| 67 | temp_val /= 10; |
| 68 | digits += 1; |
| 69 | } |
| 70 | |
| 71 | if (digits <= 0) { |
| 72 | digits = 1; |
| 73 | } |
| 74 | |
| 75 | // Write the number |
| 76 | for (i = 0; i < digits; i++) { |
| 77 | str[digits - i - 1] = '0' + (value % 10); |
| 78 | value /= 10; |
| 79 | } |
| 80 | |
| 81 | return digits; |
| 82 | } |
| 83 | |
| 84 | uint32_t util_write_uint32_zp(char *str, uint32_t value, uint16_t total_size) |
| 85 | { |
no outgoing calls
no test coverage detected