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

Method bounds

cranelift/codegen/src/ir/types.rs:81–101  ·  view source on GitHub ↗

Get the (minimum, maximum) values represented by each lane in the type. Note that these are returned as unsigned 'bit patterns'.

(self, signed: bool)

Source from the content-addressed store, hash-verified

79 /// Get the (minimum, maximum) values represented by each lane in the type.
80 /// Note that these are returned as unsigned 'bit patterns'.
81 pub fn bounds(self, signed: bool) -> (u128, u128) {
82 if signed {
83 match self.lane_type() {
84 I8 => (i8::MIN as u128, i8::MAX as u128),
85 I16 => (i16::MIN as u128, i16::MAX as u128),
86 I32 => (i32::MIN as u128, i32::MAX as u128),
87 I64 => (i64::MIN as u128, i64::MAX as u128),
88 I128 => (i128::MIN as u128, i128::MAX as u128),
89 _ => unimplemented!(),
90 }
91 } else {
92 match self.lane_type() {
93 I8 => (u8::MIN as u128, u8::MAX as u128),
94 I16 => (u16::MIN as u128, u16::MAX as u128),
95 I32 => (u32::MIN as u128, u32::MAX as u128),
96 I64 => (u64::MIN as u128, u64::MAX as u128),
97 I128 => (u128::MIN, u128::MAX),
98 _ => unimplemented!(),
99 }
100 }
101 }
102
103 /// Get an integer type with the requested number of bits.
104 ///

Callers 4

emitMethod · 0.80
stepFunction · 0.80
generate_blocksMethod · 0.80
float_limitsFunction · 0.80

Calls 1

lane_typeMethod · 0.45

Tested by

no test coverage detected