mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Used platform-independent aint printf patterns
This commit is contained in:
parent
6a474f80f7
commit
468caac0f2
2 changed files with 11 additions and 17 deletions
|
|
@ -618,7 +618,7 @@ aint inner_hash (aint depth, auint acc, void *p) {
|
||||||
|
|
||||||
extern void *LstringInt (char *b) {
|
extern void *LstringInt (char *b) {
|
||||||
aint n;
|
aint n;
|
||||||
sscanf(b, "%lld", &n);
|
sscanf(b, "%" SCNdAI, &n);
|
||||||
return (void *)BOX(n);
|
return (void *)BOX(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1274,7 +1274,7 @@ extern aint Lread () {
|
||||||
|
|
||||||
printf("> ");
|
printf("> ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
scanf("%lli", &result);
|
scanf("%" SCNdAI, &result);
|
||||||
|
|
||||||
return BOX(result);
|
return BOX(result);
|
||||||
}
|
}
|
||||||
|
|
@ -1291,7 +1291,7 @@ extern int Lbinoperror2 (void) {
|
||||||
|
|
||||||
/* Lwrite is an implementation of the "write" construct */
|
/* Lwrite is an implementation of the "write" construct */
|
||||||
extern aint Lwrite (aint n) {
|
extern aint Lwrite (aint n) {
|
||||||
printf("%lld\n", UNBOX(n));
|
printf("%" PRIdAI "\n", UNBOX(n));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -10,27 +10,21 @@
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__ppc64__)
|
#if defined(__x86_64__) || defined(__ppc64__)
|
||||||
#define X86_64
|
#define X86_64
|
||||||
#else
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef size_t ptrt; // pointer type, because can hold a pointer on a corresponding platform
|
typedef size_t ptrt; // pointer type, because can hold a pointer on a corresponding platform
|
||||||
|
|
||||||
typedef
|
|
||||||
#ifdef X86_64
|
#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
|
#else
|
||||||
int32_t
|
typedef int32_t aint; // adaptive int
|
||||||
|
typedef uint32_t auint; // adaptive unsigned int
|
||||||
|
#define PRIdAI PRId32
|
||||||
|
#define SCNdAI SCNd32
|
||||||
#endif
|
#endif
|
||||||
aint; // adaptive int
|
|
||||||
|
|
||||||
typedef
|
|
||||||
#ifdef X86_64
|
|
||||||
uint64_t
|
|
||||||
#else
|
|
||||||
uint32_t
|
|
||||||
#endif
|
|
||||||
auint; // adaptive unsigned int
|
|
||||||
|
|
||||||
|
|
||||||
#define STRING_TAG 0x00000001
|
#define STRING_TAG 0x00000001
|
||||||
#define ARRAY_TAG 0x00000003
|
#define ARRAY_TAG 0x00000003
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue