Commit 9cd70a70 authored by Mathieu Maret's avatar Mathieu Maret

fix printInt for INT_MIN

parent 3ce16712
......@@ -18,11 +18,11 @@ void printInt(int integer, uint color, uint bgColor, int startX, int startY)
int i = 0, k = 0;
if (integer < 0) {
printChar('-', color, bgColor, x++, startY);
integer = -integer;
}
while (integer != 0) {
num[i++] = integer % 10;
integer = integer / 10;
int digit = integer % 10;
num[i++] = (digit > 0) ? digit : -digit;
integer = integer / 10;
}
for (k = i - 1; k >= 0; k--) {
printChar(num[k] + '0', color, bgColor, x++, startY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment