diff --git a/evildoer/io.c b/evildoer/io.c index 7ef8228..b7d9a39 100644 --- a/evildoer/io.c +++ b/evildoer/io.c @@ -7,7 +7,7 @@ val_t read_byte(void) { char c = getc(in); - return (c == EOF) ? val_wrap_eof() : val_wrap_int(c); + return (c == EOF) ? val_wrap_eof() : val_wrap_byte(c); } val_t peek_byte(void) diff --git a/evildoer/values.c b/evildoer/values.c index 9bd2a70..bfdcf63 100644 --- a/evildoer/values.c +++ b/evildoer/values.c @@ -29,6 +29,10 @@ val_t val_wrap_int(int64_t i) { return (i << int_shift) | int_type_tag; } +val_t val_wrap_byte(unsigned char b) +{ + return (b << int_shift) | int_type_tag; +} int val_unwrap_bool(val_t x) { diff --git a/evildoer/values.h b/evildoer/values.h index 39cc43d..44f1c53 100644 --- a/evildoer/values.h +++ b/evildoer/values.h @@ -28,6 +28,7 @@ type_t val_typeof(val_t x); */ int64_t val_unwrap_int(val_t x); val_t val_wrap_int(int64_t i); +val_t val_wrap_byte(unsigned char b); int val_unwrap_bool(val_t x); val_t val_wrap_bool(int b); diff --git a/extort/io.c b/extort/io.c index 7ef8228..b7d9a39 100644 --- a/extort/io.c +++ b/extort/io.c @@ -7,7 +7,7 @@ val_t read_byte(void) { char c = getc(in); - return (c == EOF) ? val_wrap_eof() : val_wrap_int(c); + return (c == EOF) ? val_wrap_eof() : val_wrap_byte(c); } val_t peek_byte(void) diff --git a/extort/values.c b/extort/values.c index 9bd2a70..bfdcf63 100644 --- a/extort/values.c +++ b/extort/values.c @@ -29,6 +29,10 @@ val_t val_wrap_int(int64_t i) { return (i << int_shift) | int_type_tag; } +val_t val_wrap_byte(unsigned char b) +{ + return (b << int_shift) | int_type_tag; +} int val_unwrap_bool(val_t x) { diff --git a/extort/values.h b/extort/values.h index 39cc43d..44f1c53 100644 --- a/extort/values.h +++ b/extort/values.h @@ -28,6 +28,7 @@ type_t val_typeof(val_t x); */ int64_t val_unwrap_int(val_t x); val_t val_wrap_int(int64_t i); +val_t val_wrap_byte(unsigned char b); int val_unwrap_bool(val_t x); val_t val_wrap_bool(int b); diff --git a/fraud/io.c b/fraud/io.c index 7ef8228..b7d9a39 100644 --- a/fraud/io.c +++ b/fraud/io.c @@ -7,7 +7,7 @@ val_t read_byte(void) { char c = getc(in); - return (c == EOF) ? val_wrap_eof() : val_wrap_int(c); + return (c == EOF) ? val_wrap_eof() : val_wrap_byte(c); } val_t peek_byte(void) diff --git a/fraud/values.c b/fraud/values.c index 9bd2a70..bfdcf63 100644 --- a/fraud/values.c +++ b/fraud/values.c @@ -29,6 +29,10 @@ val_t val_wrap_int(int64_t i) { return (i << int_shift) | int_type_tag; } +val_t val_wrap_byte(unsigned char b) +{ + return (b << int_shift) | int_type_tag; +} int val_unwrap_bool(val_t x) { diff --git a/fraud/values.h b/fraud/values.h index 39cc43d..44f1c53 100644 --- a/fraud/values.h +++ b/fraud/values.h @@ -28,6 +28,7 @@ type_t val_typeof(val_t x); */ int64_t val_unwrap_int(val_t x); val_t val_wrap_int(int64_t i); +val_t val_wrap_byte(unsigned char b); int val_unwrap_bool(val_t x); val_t val_wrap_bool(int b); diff --git a/hoax/io.c b/hoax/io.c index 7ef8228..b7d9a39 100644 --- a/hoax/io.c +++ b/hoax/io.c @@ -7,7 +7,7 @@ val_t read_byte(void) { char c = getc(in); - return (c == EOF) ? val_wrap_eof() : val_wrap_int(c); + return (c == EOF) ? val_wrap_eof() : val_wrap_byte(c); } val_t peek_byte(void) diff --git a/hoax/values.c b/hoax/values.c index a61d65e..b7e95f4 100644 --- a/hoax/values.c +++ b/hoax/values.c @@ -42,6 +42,10 @@ val_t val_wrap_int(int64_t i) { return (i << int_shift) | int_type_tag; } +val_t val_wrap_byte(unsigned char b) +{ + return (b << int_shift) | int_type_tag; +} int val_unwrap_bool(val_t x) { diff --git a/hoax/values.h b/hoax/values.h index 4cc48bb..b6ac44f 100644 --- a/hoax/values.h +++ b/hoax/values.h @@ -49,6 +49,7 @@ type_t val_typeof(val_t x); */ int64_t val_unwrap_int(val_t x); val_t val_wrap_int(int64_t i); +val_t val_wrap_byte(unsigned char b); int val_unwrap_bool(val_t x); val_t val_wrap_bool(int b); diff --git a/hustle/io.c b/hustle/io.c index 7ef8228..b7d9a39 100644 --- a/hustle/io.c +++ b/hustle/io.c @@ -7,7 +7,7 @@ val_t read_byte(void) { char c = getc(in); - return (c == EOF) ? val_wrap_eof() : val_wrap_int(c); + return (c == EOF) ? val_wrap_eof() : val_wrap_byte(c); } val_t peek_byte(void) diff --git a/hustle/values.c b/hustle/values.c index 3330f8d..b96fffb 100644 --- a/hustle/values.c +++ b/hustle/values.c @@ -38,6 +38,10 @@ val_t val_wrap_int(int64_t i) { return (i << int_shift) | int_type_tag; } +val_t val_wrap_byte(unsigned char b) +{ + return (b << int_shift) | int_type_tag; +} int val_unwrap_bool(val_t x) { diff --git a/hustle/values.h b/hustle/values.h index 92e67e5..ceab2e0 100644 --- a/hustle/values.h +++ b/hustle/values.h @@ -39,6 +39,7 @@ type_t val_typeof(val_t x); */ int64_t val_unwrap_int(val_t x); val_t val_wrap_int(int64_t i); +val_t val_wrap_byte(unsigned char b); int val_unwrap_bool(val_t x); val_t val_wrap_bool(int b); diff --git a/iniquity/io.c b/iniquity/io.c index 7ef8228..b7d9a39 100644 --- a/iniquity/io.c +++ b/iniquity/io.c @@ -7,7 +7,7 @@ val_t read_byte(void) { char c = getc(in); - return (c == EOF) ? val_wrap_eof() : val_wrap_int(c); + return (c == EOF) ? val_wrap_eof() : val_wrap_byte(c); } val_t peek_byte(void) diff --git a/iniquity/values.c b/iniquity/values.c index a61d65e..62bca18 100644 --- a/iniquity/values.c +++ b/iniquity/values.c @@ -38,6 +38,10 @@ int64_t val_unwrap_int(val_t x) { return x >> int_shift; } +val_t val_wrap_byte(unsigned char b) +{ + return (b << int_shift) | int_type_tag; +} val_t val_wrap_int(int64_t i) { return (i << int_shift) | int_type_tag; diff --git a/iniquity/values.h b/iniquity/values.h index 4cc48bb..b6ac44f 100644 --- a/iniquity/values.h +++ b/iniquity/values.h @@ -49,6 +49,7 @@ type_t val_typeof(val_t x); */ int64_t val_unwrap_int(val_t x); val_t val_wrap_int(int64_t i); +val_t val_wrap_byte(unsigned char b); int val_unwrap_bool(val_t x); val_t val_wrap_bool(int b);