From 0f2c6474146b7cd0b1e2a97d57b4751e90074602 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Sat, 3 Aug 2024 15:00:50 +0200 Subject: [PATCH] fix storing of u8 and u16 types --- crates/cpp/src/lib.rs | 4 ++-- crates/cpp/tests/smoke_details/result8.wit | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 crates/cpp/tests/smoke_details/result8.wit diff --git a/crates/cpp/src/lib.rs b/crates/cpp/src/lib.rs index 8b0039710..c1679694a 100644 --- a/crates/cpp/src/lib.rs +++ b/crates/cpp/src/lib.rs @@ -2644,8 +2644,8 @@ impl<'a, 'b> Bindgen for FunctionBindgen<'a, 'b> { abi::Instruction::F32Load { offset } => self.load("float", *offset, operands, results), abi::Instruction::F64Load { offset } => self.load("double", *offset, operands, results), abi::Instruction::I32Store { offset } => self.store("int32_t", *offset, operands), - abi::Instruction::I32Store8 { offset } => self.store("int32_t", *offset, operands), - abi::Instruction::I32Store16 { offset } => self.store("int32_t", *offset, operands), + abi::Instruction::I32Store8 { offset } => self.store("int8_t", *offset, operands), + abi::Instruction::I32Store16 { offset } => self.store("int16_t", *offset, operands), abi::Instruction::I64Store { offset } => self.store("int64_t", *offset, operands), abi::Instruction::F32Store { offset } => self.store("float", *offset, operands), abi::Instruction::F64Store { offset } => self.store("double", *offset, operands), diff --git a/crates/cpp/tests/smoke_details/result8.wit b/crates/cpp/tests/smoke_details/result8.wit new file mode 100644 index 000000000..3ece74f19 --- /dev/null +++ b/crates/cpp/tests/smoke_details/result8.wit @@ -0,0 +1,9 @@ +package test:test; + +interface a { + f: func() -> result<_, u8>; +} + +world result8 { + export a; +}