MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / into_bool

Method into_bool

cranelift/interpreter/src/value.rs:348–357  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

346 }
347
348 fn into_bool(self) -> ValueResult<bool> {
349 match self {
350 DataValue::I8(b) => Ok(b != 0),
351 DataValue::I16(b) => Ok(b != 0),
352 DataValue::I32(b) => Ok(b != 0),
353 DataValue::I64(b) => Ok(b != 0),
354 DataValue::I128(b) => Ok(b != 0),
355 _ => Err(ValueError::InvalidType(ValueTypeClass::Boolean, self.ty())),
356 }
357 }
358
359 fn vector(v: [u8; 16], ty: Type) -> ValueResult<Self> {
360 assert!(ty.is_vector() && [2, 4, 8, 16].contains(&ty.bytes()));

Callers 2

convertMethod · 0.80
stepFunction · 0.80

Calls 2

OkFunction · 0.85
tyMethod · 0.45

Tested by

no test coverage detected