Skip to content

Commit

Permalink
pre-release fixes: casts
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 406100475
  • Loading branch information
jan-wassenberg authored and copybara-github committed Oct 28, 2021
1 parent 180fd92 commit 660d3db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions hwy/ops/wasm_128-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2716,14 +2716,16 @@ template <typename T>
HWY_INLINE uint64_t BitsFromMask(hwy::SizeTag<1> /*tag*/,
const Mask128<T, 8> mask) {
constexpr uint64_t kMagic = 0x103070F1F3F80ULL;
return (wasm_i64x2_extract_lane(mask.raw, 0) * kMagic) >> 56;
return (static_cast<uint64_t>(wasm_i64x2_extract_lane(mask.raw, 0)) *
kMagic) >>
56;
}

// 32-bit or less: need masking
template <typename T, size_t N, HWY_IF_LE32(T, N)>
HWY_INLINE uint64_t BitsFromMask(hwy::SizeTag<1> /*tag*/,
const Mask128<T, N> mask) {
uint64_t bytes = wasm_i64x2_extract_lane(mask.raw, 0);
uint64_t bytes = static_cast<uint64_t>(wasm_i64x2_extract_lane(mask.raw, 0));
// Clear potentially undefined bytes.
bytes &= (1ULL << (N * 8)) - 1;
constexpr uint64_t kMagic = 0x103070F1F3F80ULL;
Expand Down
2 changes: 1 addition & 1 deletion hwy/tests/mask_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct TestFirstN {
const RebindToSigned<D> di;
using TI = TFromD<decltype(di)>;
const size_t max_len =
static_cast<size_t>(HWY_MIN(LimitsMax<TI>(), LimitsMax<size_t>()));
HWY_MIN(static_cast<size_t>(LimitsMax<TI>()), LimitsMax<size_t>());

for (size_t len = 0; len <= HWY_MIN(2 * N, max_len); ++len) {
const auto expected =
Expand Down

0 comments on commit 660d3db

Please sign in to comment.