diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-04-05 22:11:14 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-04-05 22:11:14 +0100 |
| commit | 7e0306b56f3cded667b681a09de13162ab4fc17b (patch) | |
| tree | a5b40423c7ff0cfede2ce09704cb604d402a2bd0 /patio-to-cranelift | |
| parent | 9ee6cccd2aa1be75a1c6bccf2b219cd8dbd3984b (diff) | |
Handle byte data values in patio-to-cranelift
Diffstat (limited to 'patio-to-cranelift')
| -rw-r--r-- | patio-to-cranelift/src/codegen/values.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/patio-to-cranelift/src/codegen/values.rs b/patio-to-cranelift/src/codegen/values.rs index 825292e6..0d5861bf 100644 --- a/patio-to-cranelift/src/codegen/values.rs +++ b/patio-to-cranelift/src/codegen/values.rs @@ -31,7 +31,8 @@ fn write_data_value( PatioDataValue::Bool(value) => bytes.push(if *value { 1 } else { 0 }), - PatioDataValue::Byte(_) => todo!(), + PatioDataValue::Byte(value) => bytes.push(*value), + PatioDataValue::DataPtr(_) => todo!(), PatioDataValue::Int(int_value) => { // TODO: handle 32-bit int @@ -94,4 +95,13 @@ mod data_value_to_bytes_test { assert_eq!(bytes.as_ref(), &[1]); } + + #[test] + fn byte_is_written_as_single_byte() { + let data_value = PatioDataValue::Byte(42); + + let bytes = data_value_to_bytes(data_value); + + assert_eq!(bytes.as_ref(), &[42]); + } } |
