mirror of
https://github.com/halleysfifthinc/Toyota-AVC-LAN
synced 2025-06-07 16:06:12 +00:00
Remove copy of libc function
This commit is contained in:
parent
67608e789f
commit
6d62fc4095
20
src/com232.c
20
src/com232.c
@ -125,23 +125,3 @@ void RS232_PrintDec2(uint8_t Data) {
|
|||||||
RS232_SendByte('0');
|
RS232_SendByte('0');
|
||||||
RS232_PrintDec(Data);
|
RS232_PrintDec(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *itoa(int i, char b[]) {
|
|
||||||
char const digit[] = "0123456789";
|
|
||||||
char *p = b;
|
|
||||||
if (i < 0) {
|
|
||||||
*p++ = '-';
|
|
||||||
i *= -1;
|
|
||||||
}
|
|
||||||
int shifter = i;
|
|
||||||
do { // Move to where representation ends
|
|
||||||
++p;
|
|
||||||
shifter = shifter / 10;
|
|
||||||
} while (shifter);
|
|
||||||
*p = '\0';
|
|
||||||
do { // Move back, inserting digits as u go
|
|
||||||
*--p = digit[i % 10];
|
|
||||||
i = i / 10;
|
|
||||||
} while (i);
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user