| 39 | } |
| 40 | |
| 41 | void WriteLongConsole(long long number, int base) |
| 42 | { |
| 43 | InitConsole(); |
| 44 | if(!(base > 1 && base <= 16)) |
| 45 | { |
| 46 | nullcThrowError("incorrect base %d", base); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | static char symb[] = "0123456789abcdef"; |
| 51 | bool sign = 0; |
| 52 | char buf[128]; |
| 53 | char *curr = buf; |
| 54 | if(number < 0) |
| 55 | sign = 1; |
| 56 | |
| 57 | *curr++ = *(abs(number % base) + symb); |
| 58 | while(number /= base) |
| 59 | *curr++ = *(abs(number % base) + symb); |
| 60 | if(sign) |
| 61 | *curr++ = '-'; |
| 62 | *curr = 0; |
| 63 | int size = int(curr - buf), halfsize = size >> 1; |
| 64 | for(int i = 0; i < halfsize; i++) |
| 65 | { |
| 66 | char tmp = buf[i]; |
| 67 | buf[i] = buf[size-i-1]; |
| 68 | buf[size-i-1] = tmp; |
| 69 | } |
| 70 | printf("%s", buf); |
| 71 | } |
| 72 | |
| 73 | void WriteIntConsole(int number, int base) |
| 74 | { |
no test coverage detected