From 2d2b041766178f23938d5ab8ac79c6ccb409bf5c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 2 Mar 2019 20:19:11 +0100 Subject: [PATCH] Fix emit_small_memset --- cranelift/frontend/src/frontend.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cranelift/frontend/src/frontend.rs b/cranelift/frontend/src/frontend.rs index c1b3e52114..9d1eec4b22 100644 --- a/cranelift/frontend/src/frontend.rs +++ b/cranelift/frontend/src/frontend.rs @@ -638,7 +638,7 @@ impl<'a> FunctionBuilder<'a> { /// Calls libc.memset /// - /// Writes `size` bytes of value `ch` to memory starting at `buffer`. + /// Writes `size` bytes of i8 value `ch` to memory starting at `buffer`. pub fn call_memset( &mut self, config: TargetFrontendConfig, @@ -672,7 +672,7 @@ impl<'a> FunctionBuilder<'a> { &mut self, config: TargetFrontendConfig, buffer: Value, - ch: u32, + ch: u8, size: u64, buffer_align: u8, ) { @@ -702,7 +702,7 @@ impl<'a> FunctionBuilder<'a> { let load_and_store_amount = size / access_size; if load_and_store_amount > THRESHOLD { - let ch = self.ins().iconst(types::I32, i64::from(ch)); + let ch = self.ins().iconst(types::I8, i64::from(ch)); let size = self.ins().iconst(config.pointer_type(), size as i64); self.call_memset(config, buffer, ch, size); } else {