Make 'int' platform-dependent

Or rather, provide abstraction to make this feature easy to add in the
future.
This commit is contained in:
Ayke van Laethem
2018-04-13 00:14:16 +02:00
parent ea6ec58241
commit 7be746e2f3
3 changed files with 14 additions and 9 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ void __go_printstring(string_t *str) {
write(STDOUT_FILENO, str->buf, str->len);
}
void __go_printint(int32_t n) {
void __go_printint(intgo_t n) {
// Print integer in signed big-endian base-10 notation, for humans to
// read.
// TODO: don't recurse, but still be compact (and don't divide/mod
@@ -19,7 +19,7 @@ void __go_printint(int32_t n) {
print("-", 1);
n = -n;
}
int32_t prevdigits = n / 10;
intgo_t prevdigits = n / 10;
if (prevdigits != 0) {
__go_printint(prevdigits);
}
+1 -2
View File
@@ -8,5 +8,4 @@ typedef struct {
uint8_t buf[]; // variable size
} string_t;
void __go_printstring(string_t *str);
void __go_printnl();
typedef int32_t intgo_t; // may be 64-bit