mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
Make 'int' platform-dependent
Or rather, provide abstraction to make this feature easy to add in the future.
This commit is contained in:
+2
-2
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user