Skip to content

Commit 6355594

Browse files
committed
Use log10u from math.h
1 parent 3222d70 commit 6355594

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/knightos/display.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,7 @@ void draw_float(SCREEN* screen, unsigned char x, unsigned char y, float value){
353353
integer_part = (unsigned int)value;
354354
frac_part = ((value - (float)integer_part)*10000);
355355

356-
#define __log10u(x) ((x >= 10000000u) ? 7 : (x >= 1000000u) ? 6 : \
357-
(x >= 100000u) ? 5 : (x >= 10000u) ? 4 : \
358-
(x >= 1000u) ? 3 : (x >= 100u) ? 2 : (x >= 10u) ? 1u : 0u)
359-
360-
integer_part_len = (__log10u(integer_part)) + 1;
356+
integer_part_len = (log10u(integer_part)) + 1;
361357

362358
if(sgn){
363359
draw_char(screen, x, y, '-');

0 commit comments

Comments
 (0)