# SDL: audio: Patched to compile (mixed declarations and code).

**URL:** <https://discourse.libsdl.org/t/sdl-audio-patched-to-compile-mixed-declarations-and-code/48416>\
**Category:** SDL Commits\
**Created:** [January 16, 2024, 3:08pm UTC](https://discourse.libsdl.org/t/sdl-audio-patched-to-compile-mixed-declarations-and-code/48416 "2024-01-16T15:08:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [January 16, 2024, 3:08pm UTC](https://discourse.libsdl.org/t/sdl-audio-patched-to-compile-mixed-declarations-and-code/48416/1 "2024-01-16T15:08:08Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/c69e858e7a7af815e9eab4a2e011c27bfacc3fc1>

```diff
From c69e858e7a7af815e9eab4a2e011c27bfacc3fc1 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 16 Jan 2024 10:07:14 -0500
Subject: [PATCH] audio: Patched to compile (mixed declarations and code).

---
 src/audio/SDL_audiotypecvt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c
index d99d2def5f09..c4f30e687e84 100644
--- a/src/audio/SDL_audiotypecvt.c
+++ b/src/audio/SDL_audiotypecvt.c
@@ -256,10 +256,11 @@ static void SDLCALL SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
          * 2) Shift the integer range from [0x43BF8000, 0x43C08000] to [-32768, 32768]
          * 3) Clamp values outside the [-32768, 32767] range */
         union float_bits x;
+ Uint32 y, z;
         x.f32 = src[i] + 384.0f;
 
- Uint32 y = x.u32 - 0x43C00000u;
- Uint32 z = 0x7FFFu - (y ^ SIGNMASK(y));
+ y = x.u32 - 0x43C00000u;
+ z = 0x7FFFu - (y ^ SIGNMASK(y));
         y = y ^ (z & SIGNMASK(z));
 
         dst[i] = (Sint16)(y & 0xFFFF);
@@ -310,10 +311,11 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
          * 2) Set values outside the [-2147483648.0, 2147483647.0] range to -2147483648.0
          * 3) Convert the float to an integer, and fixup values outside the valid range */
         union float_bits x;
+ Uint32 y, z;
         x.f32 = src[i];
 
- Uint32 y = x.u32 + 0x0F800000u;
- Uint32 z = y - 0xCF000000u;
+ y = x.u32 + 0x0F800000u;
+ z = y - 0xCF000000u;
         z &= SIGNMASK(y ^ z);
         x.u32 = y - z;
 

```
