[PATCH] Fixed HWY_SCALAR BitCast to copy only sizeof(T) bytes
authorJohn Platts <john_platts@hotmail.com>
Fri, 27 Jan 2023 17:26:16 +0000 (11:26 -0600)
committerMathieu Malaterre <malat@debian.org>
Fri, 24 Feb 2023 07:52:20 +0000 (07:52 +0000)
Gbp-Pq: Name 06ea5ed21d28e2873dc8c80db2c8d03d047bed1c.patch

hwy/ops/scalar-inl.h

index c28f7b510fd39a01c4da7acd6c1991037e2843f6..eeb1b6ae3b733b7eb854f046a319c5b9e098c52c 100644 (file)
@@ -93,7 +93,7 @@ template <typename T, typename FromT>
 HWY_API Vec1<T> BitCast(Sisd<T> /* tag */, Vec1<FromT> v) {
   static_assert(sizeof(T) <= sizeof(FromT), "Promoting is undefined");
   T to;
-  CopyBytes<sizeof(FromT)>(&v.raw, &to);  // not same size - ok to shrink
+  CopyBytes<sizeof(T)>(&v.raw, &to);  // not same size - ok to shrink
   return Vec1<T>(to);
 }