use memcpy in test-double-float.c

This commit is contained in:
netrunnereve 2023-07-30 23:12:25 -04:00
parent 0b206788dc
commit eab8335e33

View file

@ -7,6 +7,7 @@
#include <immintrin.h> #include <immintrin.h>
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion" #pragma GCC diagnostic ignored "-Wdouble-promotion"
@ -32,8 +33,8 @@ inline static float silu_float(float x) {
int main(void) { int main(void) {
uint32_t x = UINT32_MAX; uint32_t x = UINT32_MAX;
do { do {
float *y = (float *)&x; float f;
float f = *y; memcpy(&f, &x, sizeof(x));
assert(!isfinite(f) || (round_orig(f) == round_float(f))); assert(!isfinite(f) || (round_orig(f) == round_float(f)));
} while (x--); } while (x--);