From ace09a223f47bfdc73f699d09b5411e61a407dfb Mon Sep 17 00:00:00 2001 From: igor Date: Sat, 14 Mar 2026 21:45:18 -0700 Subject: [PATCH] General changes. --- sdl_handmade.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sdl_handmade.cpp b/sdl_handmade.cpp index 24946d1..fa32fa6 100644 --- a/sdl_handmade.cpp +++ b/sdl_handmade.cpp @@ -12,7 +12,7 @@ #include // close, read // NOTE: This is so it compiles on ARM. -#if __x86_64__ || __i386__ +#if __x86_64__ || __i386__ #include #endif @@ -342,7 +342,6 @@ S32 main(int argc, char *argv[]) SDLResizeTexture(&GlobalBackbuffer, Renderer, Dimension.Width, Dimension.Height); sdl_sound_output SoundOutput = {0}; - SoundOutput.SamplesPerSecond = 48000; SoundOutput.BytesPerSample = sizeof(S16) * 2; SoundOutput.SecondaryBufferSize = SoundOutput.SamplesPerSecond * SoundOutput.BytesPerSample; @@ -368,8 +367,7 @@ S32 main(int argc, char *argv[]) GameMemory.TransientStorageSize = GB(4); U64 TotalStorageSize = GameMemory.PermanentStorageSize + GameMemory.TransientStorageSize; - // NOTE: On MacOS and Linux, mmap seems to zero-fill anonymous - // memory as a side-effect of security. + // NOTE: On MacOS and Linux, mmap seems to zero-fill anonymous memory as a side-effect of security. GameMemory.PermanentStorage = mmap(BaseAddress, TotalStorageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); GameMemory.TransientStorage = (U8 *)(GameMemory.PermanentStorage) + GameMemory.PermanentStorageSize; @@ -382,14 +380,14 @@ S32 main(int argc, char *argv[]) GlobalPerfCountFrequency = SDL_GetPerformanceFrequency(); U64 LastCounter; -#if __x86_64__ || __i386__ +#if __x86_64__ || __i386__ U64 LastCycleCount; #endif while(GlobalRunning) { LastCounter = SDLGetWallClock(); -#if __x86_64__ || __i386__ +#if __x86_64__ || __i386__ LastCycleCount = __rdtsc(); // NOTE: rdtsc reports clock cylces, however it is not meant for really precise profiler work as the value returned is varied. #endif // Also, __rdtsc is not available on MacOS ARM; I have not checked MacOS x64. @@ -463,7 +461,7 @@ S32 main(int argc, char *argv[]) SDLProcessInputDigitalButton(ControllerHandles[ControllerIndex], &OldController->Start, SDL_CONTROLLER_BUTTON_START, &NewController->Start); SDLProcessInputDigitalButton(ControllerHandles[ControllerIndex], &OldController->Back, SDL_CONTROLLER_BUTTON_BACK, &NewController->Back); } else { - // NOTE: This controller is note plugged in. + // NOTE: This controller is not plugged in. NewController->IsConnected = false; } } @@ -506,7 +504,7 @@ S32 main(int argc, char *argv[]) LastCounter = EndCounter; -#if __x86_64__ || __i386__ +#if __x86_64__ || __i386__ U64 EndCycleCount = __rdtsc(); U64 CyclesElapsed = EndCycleCount - LastCycleCount; F64 MCPF = ((F64)CyclesElapsed / (1000.0f * 1000.0f));