cmsc430 / langs

0 stars 0 forks source link

`read_byte` should wrap an unsigned char #7

Open dvanhorn opened 1 year ago

dvanhorn commented 1 year ago

Currently read_byte returns val_wrap_int(c) where c is the char that was read, but this will encode the byte as a signed integer, whereas a byte should be in (0,256]. The fix is to add a new function to the run-time:

val_t val_wrap_byte(unsigned char b)

and have read_byte return val_wrap_byte(c). The definition is the same as val_wrap_int.