diff --git a/mini_al.h b/mini_al.h index 164709d9..9b5527d3 100644 --- a/mini_al.h +++ b/mini_al.h @@ -11197,7 +11197,8 @@ void mal_pcm_s32_to_f32(float* pOut, const int* pIn, unsigned int count) for (unsigned int i = 0; i < count; ++i) { int x = pIn[i]; double t; - t = (double)(x + 2147483648LL); + t = (double)(x + 2147483647); + t = t + 1; t = t * 0.0000000004656612873077392578125; r = (float)(t - 1); pOut[i] = (float)r; @@ -11255,7 +11256,8 @@ void mal_pcm_f32_to_s32(int* pOut, const float* pIn, unsigned int count) c = ((x < -1) ? -1 : ((x > 1) ? 1 : x)); c = c + 1; t = (mal_int64)(c * 2147483647.5); - r = (int)(t - 2147483648LL); + t = t - 2147483647; + r = (int)(t - 1); pOut[i] = (int)r; } } diff --git a/resources/format_conversions.txt b/resources/format_conversions.txt index b6c1018e..37da1d12 100644 --- a/resources/format_conversions.txt +++ b/resources/format_conversions.txt @@ -119,7 +119,8 @@ s32->s24 { # r = ((x + 2147483648) * 0.0000000004656612873077392578125) - 1 s32->f32 { dbl t; - add (dbl)t x 2147483648LL; + add (dbl)t x 2147483647; + add t t 1; mul t t 0.0000000004656612873077392578125; sub (flt)r t 1; } @@ -159,5 +160,6 @@ f32->s32 { clip c x; add c c 1; mul (lng)t c 2147483647.5; - sub (int)r t 2147483648LL; + sub t t 2147483647; + sub (int)r t 1; }