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

Method swap_bytes

cranelift/codegen/src/data_value.rs:105–133  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

103 }
104
105 fn swap_bytes(self) -> Self {
106 match self {
107 DataValue::I8(i) => DataValue::I8(i.swap_bytes()),
108 DataValue::I16(i) => DataValue::I16(i.swap_bytes()),
109 DataValue::I32(i) => DataValue::I32(i.swap_bytes()),
110 DataValue::I64(i) => DataValue::I64(i.swap_bytes()),
111 DataValue::I128(i) => DataValue::I128(i.swap_bytes()),
112 DataValue::F16(f) => DataValue::F16(Ieee16::with_bits(f.bits().swap_bytes())),
113 DataValue::F32(f) => DataValue::F32(Ieee32::with_bits(f.bits().swap_bytes())),
114 DataValue::F64(f) => DataValue::F64(Ieee64::with_bits(f.bits().swap_bytes())),
115 DataValue::F128(f) => DataValue::F128(Ieee128::with_bits(f.bits().swap_bytes())),
116 DataValue::V128(mut v) => {
117 v.reverse();
118 DataValue::V128(v)
119 }
120 DataValue::V64(mut v) => {
121 v.reverse();
122 DataValue::V64(v)
123 }
124 DataValue::V32(mut v) => {
125 v.reverse();
126 DataValue::V32(v)
127 }
128 DataValue::V16(mut v) => {
129 v.reverse();
130 DataValue::V16(v)
131 }
132 }
133 }
134
135 /// Converts `self` to big endian from target's endianness.
136 pub fn to_be(self) -> Self {

Callers 8

u64_bswap16Method · 0.45
u64_bswap32Method · 0.45
u64_bswap64Method · 0.45
to_beMethod · 0.45
to_leMethod · 0.45
fromMethod · 0.45

Calls 3

reverseMethod · 0.80
V128Class · 0.50
bitsMethod · 0.45

Tested by 1

fromMethod · 0.36