"memrchr" => {
let ptr = self.into_ptr(args[0].value)?;
- let val = self.value_to_scalar(args[1])?.to_u64()? as u8;
+ let val = self.value_to_scalar(args[1])?.to_bytes()? as u8;
let num = self.value_to_scalar(args[2])?.to_u64()?;
if let Some(idx) = self.memory.read_bytes(ptr, Size::from_bytes(num))?.iter().rev().position(
|&c| c == val,
"memchr" => {
let ptr = self.into_ptr(args[0].value)?;
- let val = self.value_to_scalar(args[1])?.to_u64()? as u8;
+ let val = self.value_to_scalar(args[1])?.to_bytes()? as u8;
let num = self.value_to_scalar(args[2])?.to_u64()?;
if let Some(idx) = self.memory.read_bytes(ptr, Size::from_bytes(num))?.iter().position(
|&c| c == val,
}
"write" => {
- let fd = self.value_to_scalar(args[0])?.to_u64()?;
+ let fd = self.value_to_scalar(args[0])?.to_bytes()?;
let buf = self.into_ptr(args[1].value)?;
- let n = self.value_to_scalar(args[2])?.to_u64()?;
+ let n = self.value_to_scalar(args[2])?.to_bytes()? as u64;
trace!("Called write({:?}, {:?}, {:?})", fd, buf, n);
let result = if fd == 1 || fd == 2 {
// stdout/stderr
fn from_f64(f: f64) -> Self;
fn to_u64(self) -> EvalResult<'static, u64>;
fn is_null(self) -> EvalResult<'static, bool>;
+ /// HACK: this function just extracts all bits if `defined != 0`
+ /// Mainly used for args of C-functions and we should totally correctly fetch the size
+ /// of their arguments
fn to_bytes(self) -> EvalResult<'static, u128>;
}