Skip to content

Commit

Permalink
implemented fast cast for a certain type
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed Oct 31, 2023
1 parent 029c2da commit 00dc67d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/xsimd/arch/xsimd_wasm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,15 @@ namespace xsimd
v128_t f = wasm_f64x2_sub(xH, wasm_f64x2_splat(442726361368656609280.)); // 3*2^67 + 2^52
return wasm_f64x2_add(f, xL);
}

template <class A>
inline batch<int32_t, A> fast_cast(batch<float, A> const& self, batch<int32_t, A> const&, requires_arch<wasm>) noexcept
{
return batch<int32_t, A>(static_cast<int32_t>(wasm_f32x4_extract_lane(self, 0)),
static_cast<int32_t>(wasm_f32x4_extract_lane(self, 1)),
static_cast<int32_t>(wasm_f32x4_extract_lane(self, 2)),
static_cast<int32_t>(wasm_f32x4_extract_lane(self, 3)));
}
}

// floor
Expand Down

0 comments on commit 00dc67d

Please sign in to comment.