mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
SDL_test_fuzzer.c: fix strict aliasing warnings by using a union.
This commit is contained in:
parent
cbfee82dff
commit
3ea093cc85
@ -126,29 +126,35 @@ SDLTest_RandomUint32()
|
|||||||
Uint64
|
Uint64
|
||||||
SDLTest_RandomUint64()
|
SDLTest_RandomUint64()
|
||||||
{
|
{
|
||||||
Uint64 value = 0;
|
union {
|
||||||
Uint32 *vp = (void *)&value;
|
Uint64 v64;
|
||||||
|
Uint32 v32[2];
|
||||||
|
} value;
|
||||||
|
value.v64 = 0;
|
||||||
|
|
||||||
fuzzerInvocationCounter++;
|
fuzzerInvocationCounter++;
|
||||||
|
|
||||||
vp[0] = SDLTest_RandomSint32();
|
value.v32[0] = SDLTest_RandomSint32();
|
||||||
vp[1] = SDLTest_RandomSint32();
|
value.v32[1] = SDLTest_RandomSint32();
|
||||||
|
|
||||||
return value;
|
return value.v64;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sint64
|
Sint64
|
||||||
SDLTest_RandomSint64()
|
SDLTest_RandomSint64()
|
||||||
{
|
{
|
||||||
Uint64 value = 0;
|
union {
|
||||||
Uint32 *vp = (void *)&value;
|
Uint64 v64;
|
||||||
|
Uint32 v32[2];
|
||||||
|
} value;
|
||||||
|
value.v64 = 0;
|
||||||
|
|
||||||
fuzzerInvocationCounter++;
|
fuzzerInvocationCounter++;
|
||||||
|
|
||||||
vp[0] = SDLTest_RandomSint32();
|
value.v32[0] = SDLTest_RandomSint32();
|
||||||
vp[1] = SDLTest_RandomSint32();
|
value.v32[1] = SDLTest_RandomSint32();
|
||||||
|
|
||||||
return value;
|
return (Sint64)value.v64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user