diff --git a/6.0s1.h b/6.0s1.h index 67986e9..6d637c7 100644 --- a/6.0s1.h +++ b/6.0s1.h @@ -1,13 +1,15 @@ #ifndef S1_6_0_H #define S1_6_0_H +#include + struct s1_location { const char *file; int line; }; -typedef int s1_int; -typedef long long s1_long; +typedef int32_t s1_int; +typedef int64_t s1_long; typedef double s1_double; typedef char s1_char; @@ -37,12 +39,12 @@ void s1_trace(const char *text, struct s1_location loc) { // 2. simple IO void write_int(s1_int value, struct s1_location loc) { - int rc = printf("%d", value); + int rc = printf(PRId32, value); s1_assert(rc != EOF, "Error: write_int", loc); } void write_long(s1_long value, struct s1_location loc) { - int rc = printf("%lld", value); + int rc = printf(PRId64, value); s1_assert(rc != EOF, "Error: write_long", loc); } @@ -63,14 +65,14 @@ void write_char(s1_char value, struct s1_location loc) { s1_int read_int(struct s1_location loc) { s1_int value = 0; - int rc = scanf("%d", &value); + int rc = scanf(SCNd32, &value); s1_assert(rc == 1, "Error: read_int", loc); return value; } s1_long read_long(struct s1_location loc) { s1_long value = 0; - int rc = scanf("%lld", &value); + int rc = scanf(SCNd64, &value); s1_assert(rc == 1, "Error: read_long", loc); return value; }