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

Function fold_vector

cranelift/interpreter/src/step.rs:1544–1549  ·  view source on GitHub ↗

Performs a lanewise fold on a vector type

(v: DataValue, ty: types::Type, init: DataValue, op: F)

Source from the content-addressed store, hash-verified

1542
1543/// Performs a lanewise fold on a vector type
1544fn fold_vector<F>(v: DataValue, ty: types::Type, init: DataValue, op: F) -> ValueResult<DataValue>
1545where
1546 F: FnMut(DataValue, DataValue) -> ValueResult<DataValue>,
1547{
1548 extractlanes(&v, ty)?.into_iter().try_fold(init, op)
1549}
1550
1551/// Performs the supplied unary arithmetic `op` on a Value, either Vector or Scalar.
1552fn unary_arith<F>(x: DataValue, vector_type: types::Type, op: F) -> ValueResult<DataValue>

Callers 1

stepFunction · 0.85

Calls 2

extractlanesFunction · 0.85
into_iterMethod · 0.45

Tested by

no test coverage detected