File half_float-Wstrict-aliasing.patch of Package nodejs-electron.v3
--- src/ui/gfx/half_float.cc.orig 2022-10-12 18:06:39.635381500 +0200
+++ src/ui/gfx/half_float.cc 2022-10-19 21:43:26.484063300 +0200
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <cstring>
+
#include "ui/gfx/half_float.h"
namespace gfx {
@@ -9,7 +11,9 @@
void FloatToHalfFloat(const float* input, HalfFloat* output, size_t num) {
for (size_t i = 0; i < num; i++) {
float tmp = input[i] * 1.9259299444e-34f;
- uint32_t tmp2 = *reinterpret_cast<uint32_t*>(&tmp) + (1 << 12);
+ uint32_t tmp2;
+ std::memcpy(&tmp2, &tmp, 4);
+ tmp2 += (1 << 12);
output[i] = (tmp2 & 0x80000000UL) >> 16 | (tmp2 >> 13);
}
}