diff --git a/runtime/runtime.c b/runtime/runtime.c index 0cb2b90be..af1da54c8 100644 --- a/runtime/runtime.c +++ b/runtime/runtime.c @@ -618,7 +618,7 @@ aint inner_hash (aint depth, auint acc, void *p) { extern void *LstringInt (char *b) { aint n; - sscanf(b, "%lld", &n); + sscanf(b, "%" SCNdAI, &n); return (void *)BOX(n); } @@ -1274,7 +1274,7 @@ extern aint Lread () { printf("> "); fflush(stdout); - scanf("%lli", &result); + scanf("%" SCNdAI, &result); return BOX(result); } @@ -1291,7 +1291,7 @@ extern int Lbinoperror2 (void) { /* Lwrite is an implementation of the "write" construct */ extern aint Lwrite (aint n) { - printf("%lld\n", UNBOX(n)); + printf("%" PRIdAI "\n", UNBOX(n)); fflush(stdout); return 0; diff --git a/runtime/runtime_common.h b/runtime/runtime_common.h index e69b132f3..e1dadbcd1 100644 --- a/runtime/runtime_common.h +++ b/runtime/runtime_common.h @@ -10,27 +10,21 @@ #if defined(__x86_64__) || defined(__ppc64__) #define X86_64 -#else #endif typedef size_t ptrt; // pointer type, because can hold a pointer on a corresponding platform -typedef #ifdef X86_64 -int64_t +typedef int64_t aint; // adaptive int +typedef uint64_t auint; // adaptive unsigned int +#define PRIdAI PRId64 +#define SCNdAI SCNd64 #else -int32_t +typedef int32_t aint; // adaptive int +typedef uint32_t auint; // adaptive unsigned int +#define PRIdAI PRId32 +#define SCNdAI SCNd32 #endif -aint; // adaptive int - -typedef -#ifdef X86_64 -uint64_t -#else -uint32_t -#endif -auint; // adaptive unsigned int - #define STRING_TAG 0x00000001 #define ARRAY_TAG 0x00000003