fix msvc warnings

PiperOrigin-RevId: 358388709
diff --git a/hwy/ops/scalar-inl.h b/hwy/ops/scalar-inl.h
index 1daa509..7666025 100644
--- a/hwy/ops/scalar-inl.h
+++ b/hwy/ops/scalar-inl.h
@@ -345,12 +345,12 @@
 // Single-lane => same as ShiftLeftSame except for the argument type.
 template <typename T>
 HWY_INLINE Vec1<T> operator<<(const Vec1<T> v, const Vec1<T> bits) {
-  return ShiftLeftSame(v, bits.raw);
+  return ShiftLeftSame(v, static_cast<int>(bits.raw));
 }
 
 template <typename T>
 HWY_INLINE Vec1<T> operator>>(const Vec1<T> v, const Vec1<T> bits) {
-  return ShiftRightSame(v, bits.raw);
+  return ShiftRightSame(v, static_cast<int>(bits.raw));
 }
 
 // ================================================== ARITHMETIC
diff --git a/hwy/tests/arithmetic_test.cc b/hwy/tests/arithmetic_test.cc
index e48a6dc..9f38eba 100644
--- a/hwy/tests/arithmetic_test.cc
+++ b/hwy/tests/arithmetic_test.cc
@@ -940,7 +940,7 @@
     // Lane i = N - i to include upper lanes
     min = HighestValue<T>();
     for (size_t i = 0; i < N; ++i) {
-      in_lanes[i] = N - i;  // no 8-bit so no wraparound
+      in_lanes[i] = static_cast<T>(N - i);  // no 8-bit T so no wraparound
       min = std::min(min, in_lanes[i]);
     }
     HWY_ASSERT_VEC_EQ(d, Set(d, min), MinOfLanes(Load(d, in_lanes.get())));
@@ -965,7 +965,7 @@
     // Lane i = i to include upper lanes
     max = LowestValue<T>();
     for (size_t i = 0; i < N; ++i) {
-      in_lanes[i] = i;  // no 8-bit so no wraparound
+      in_lanes[i] = static_cast<T>(i);  // no 8-bit T so no wraparound
       max = std::max(max, in_lanes[i]);
     }
     HWY_ASSERT_VEC_EQ(d, Set(d, max), MaxOfLanes(Load(d, in_lanes.get())));
diff --git a/hwy/tests/logical_test.cc b/hwy/tests/logical_test.cc
index a4b7408..52be3e4 100644
--- a/hwy/tests/logical_test.cc
+++ b/hwy/tests/logical_test.cc
@@ -225,7 +225,7 @@
       size_t expected_pos = 0;
       for (size_t i = 0; i < N; ++i) {
         in_lanes[i] = static_cast<T>(Random32(&rng));
-        mask_lanes[i] = Random32(&rng) & 1;
+        mask_lanes[i] = static_cast<T>(Random32(&rng) & 1);
         if (mask_lanes[i] == 0) {  // Zero means true (easier to compare)
           expected[expected_pos++] = in_lanes[i];
         }
@@ -492,7 +492,7 @@
     for (size_t rep = 0; rep < 100; ++rep) {
       // Generate random mask pattern.
       for (size_t i = 0; i < N; ++i) {
-        lanes[i] = (rng() & 1024) ? 1 : 0;
+        lanes[i] = static_cast<T>((rng() & 1024) ? 1 : 0);
       }
       const auto mask = Load(d, lanes.get()) == Zero(d);
 
diff --git a/hwy/tests/swizzle_test.cc b/hwy/tests/swizzle_test.cc
index 146d4eb..90ffce6 100644
--- a/hwy/tests/swizzle_test.cc
+++ b/hwy/tests/swizzle_test.cc
@@ -19,7 +19,6 @@
 #undef HWY_TARGET_INCLUDE
 #define HWY_TARGET_INCLUDE "tests/swizzle_test.cc"
 #include "hwy/foreach_target.h"
-
 #include "hwy/highway.h"
 #include "hwy/tests/test_util-inl.h"
 
@@ -273,7 +272,7 @@
         if (idx[i] >= static_cast<Index>(N)) {
           idx[i] = static_cast<Index>(N - 1);
         }
-        expected[i] = idx[i] + 1;  // == v[idx[i]]
+        expected[i] = static_cast<T>(idx[i] + 1);  // == v[idx[i]]
       }
 
       const auto opaque = SetTableIndices(d, idx.get());
@@ -296,6 +295,7 @@
 struct TestInterleave {
   template <class T, class D>
   HWY_NOINLINE void operator()(T /*unused*/, D d) {
+    using TU = MakeUnsigned<T>;
     const size_t N = Lanes(d);
     auto even_lanes = AllocateAligned<T>(N);
     auto odd_lanes = AllocateAligned<T>(N);
@@ -307,11 +307,11 @@
     const auto even = Load(d, even_lanes.get());
     const auto odd = Load(d, odd_lanes.get());
 
-
     const size_t blockN = 16 / sizeof(T);
     for (size_t i = 0; i < Lanes(d); ++i) {
       const size_t block = i / blockN;
-      expected[i] = (i % blockN) + block * 2 * blockN;
+      const size_t index = (i % blockN) + block * 2 * blockN;
+      expected[i] = static_cast<T>(index & LimitsMax<TU>());
     }
     HWY_ASSERT_VEC_EQ(d, expected.get(), InterleaveLower(even, odd));
 
diff --git a/hwy/tests/test_util-inl.h b/hwy/tests/test_util-inl.h
index 3807617..ff43faa 100644
--- a/hwy/tests/test_util-inl.h
+++ b/hwy/tests/test_util-inl.h
@@ -175,7 +175,7 @@
   HWY_TARGET_INSTANTIATE_TEST_SUITE_P(suite);       \
   static_assert(true, "For requiring trailing semicolon")
 
-#define HWY_AFTER_TEST(suite) \
+#define HWY_AFTER_TEST() \
   } /* namespace hwy */       \
   static_assert(true, "For requiring trailing semicolon")
 
@@ -201,7 +201,7 @@
   void RunAll() {              \
     static_assert(true, "For requiring trailing semicolon")
 
-#define HWY_AFTER_TEST(suite)               \
+#define HWY_AFTER_TEST()               \
   } /* RunAll*/                             \
   } /* namespace hwy */                     \
   int main(int /*argc*/, char** /*argv*/) { \