Closed kavika13 closed 1 month ago
Thanks. If you change ma_lcg_rand_s32()
to cast pLCG->state
to ma_uint32
, does it work? Like this (untested):
static MA_INLINE ma_int32 ma_lcg_rand_s32(ma_lcg* pLCG)
{
pLCG->state = (ma_int32)(MA_LCG_A * (ma_uint32)pLCG->state + MA_LCG_C) % MA_LCG_M;
return pLCG->state;
}
I am making a zig wrapper, and ported over a random unit test to see if things are working. The unit test is hitting a UBSAN trap.
The test is: https://github.com/mackron/miniaudio/tree/master/tests/test_generation/ma_test_generation_noise.c
The error is: