From 638e96be11c8df3cb1551553e8be843ac3a3a459 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 29 Jan 2020 22:14:35 +0000 Subject: [PATCH] Move and rename attrHot Like the MIN and MAX macros, I'd rather keep this in the source file than a common header. --- src/Backends/Audio/SDL2.cpp | 6 +++++- src/CommonDefines.h | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Backends/Audio/SDL2.cpp b/src/Backends/Audio/SDL2.cpp index ae087d3d..6b73cdae 100644 --- a/src/Backends/Audio/SDL2.cpp +++ b/src/Backends/Audio/SDL2.cpp @@ -18,6 +18,10 @@ #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define CLAMP(x, y, z) MIN(MAX((x), (y)), (z)) +#ifdef __GNUC__ +#define ATTR_HOT __attribute__((hot)) +#endif + struct AudioBackend_Sound { unsigned char *samples; @@ -72,7 +76,7 @@ static void SetSoundPan(AudioBackend_Sound *sound, long pan) } // Most CPU-intensive function in the game (2/3rd CPU time consumption in my experience), so marked with attrHot so the compiler considers it a hot spot (as it is) when optimizing -attrHot static void MixSounds(float *stream, unsigned int frames_total) +ATTR_HOT static void MixSounds(float *stream, unsigned int frames_total) { for (AudioBackend_Sound *sound = sound_list_head; sound != NULL; sound = sound->next) { diff --git a/src/CommonDefines.h b/src/CommonDefines.h index 9e458bdc..5b616ffb 100644 --- a/src/CommonDefines.h +++ b/src/CommonDefines.h @@ -10,10 +10,6 @@ #define TILES_TO_UNITS(x) ((int)((x) * (0x200 * 0x10))) #define UNITS_TO_TILES(x) ((int)((x) / (0x200 * 0x10))) -#ifdef __GNUC__ -#define attrHot __attribute__((hot)) -#endif - enum Collisions { COLL_LEFT_WALL = 1, // Touching a left wall