summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTechGeekNZ <git@tech.geek.nz>2020-07-03 09:36:10 +1200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2020-07-03 09:08:46 +0200
commit716c883737b76757e0f3bcddeacc1e276dfff13b (patch)
treeafd30f0dc704eb6264499b1999a2a0f9d48d69f8 /src/core
parent97592c409378c2d353a1cdd6b50f80b7e81b67c2 (diff)
downloadopenttd-716c883737b76757e0f3bcddeacc1e276dfff13b.tar.xz
Fix: Globally apply preprocessor directive coding style
Global; except for the 32-bit SSE blitter, which has some #DEFINEs in not-very-nice places.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/endian_func.hpp40
-rw-r--r--src/core/endian_type.hpp4
-rw-r--r--src/core/geometry_type.hpp4
-rw-r--r--src/core/random_func.hpp18
4 files changed, 33 insertions, 33 deletions
diff --git a/src/core/endian_func.hpp b/src/core/endian_func.hpp
index b1a584785..e077d977a 100644
--- a/src/core/endian_func.hpp
+++ b/src/core/endian_func.hpp
@@ -15,27 +15,27 @@
/* Setup alignment and conversion macros */
#if TTD_ENDIAN == TTD_BIG_ENDIAN
- #define FROM_BE16(x) (x)
- #define FROM_BE32(x) (x)
- #define TO_BE16(x) (x)
- #define TO_BE32(x) (x)
- #define TO_BE32X(x) (x)
- #define FROM_LE16(x) BSWAP16(x)
- #define FROM_LE32(x) BSWAP32(x)
- #define TO_LE16(x) BSWAP16(x)
- #define TO_LE32(x) BSWAP32(x)
- #define TO_LE32X(x) BSWAP32(x)
+# define FROM_BE16(x) (x)
+# define FROM_BE32(x) (x)
+# define TO_BE16(x) (x)
+# define TO_BE32(x) (x)
+# define TO_BE32X(x) (x)
+# define FROM_LE16(x) BSWAP16(x)
+# define FROM_LE32(x) BSWAP32(x)
+# define TO_LE16(x) BSWAP16(x)
+# define TO_LE32(x) BSWAP32(x)
+# define TO_LE32X(x) BSWAP32(x)
#else
- #define FROM_BE16(x) BSWAP16(x)
- #define FROM_BE32(x) BSWAP32(x)
- #define TO_BE16(x) BSWAP16(x)
- #define TO_BE32(x) BSWAP32(x)
- #define TO_BE32X(x) BSWAP32(x)
- #define FROM_LE16(x) (x)
- #define FROM_LE32(x) (x)
- #define TO_LE16(x) (x)
- #define TO_LE32(x) (x)
- #define TO_LE32X(x) (x)
+# define FROM_BE16(x) BSWAP16(x)
+# define FROM_BE32(x) BSWAP32(x)
+# define TO_BE16(x) BSWAP16(x)
+# define TO_BE32(x) BSWAP32(x)
+# define TO_BE32X(x) BSWAP32(x)
+# define FROM_LE16(x) (x)
+# define FROM_LE32(x) (x)
+# define TO_LE16(x) (x)
+# define TO_LE32(x) (x)
+# define TO_LE32X(x) (x)
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
static inline uint16 ReadLE16Aligned(const void *x)
diff --git a/src/core/endian_type.hpp b/src/core/endian_type.hpp
index e1add251e..f7cae53a8 100644
--- a/src/core/endian_type.hpp
+++ b/src/core/endian_type.hpp
@@ -12,10 +12,10 @@
#if defined(ARM) || defined(__arm__) || defined(__alpha__)
/** The architecture requires aligned access. */
- #define OTTD_ALIGNMENT 1
+# define OTTD_ALIGNMENT 1
#else
/** The architecture does not require aligned access. */
- #define OTTD_ALIGNMENT 0
+# define OTTD_ALIGNMENT 0
#endif
/** Little endian builds use this for TTD_ENDIAN. */
diff --git a/src/core/geometry_type.hpp b/src/core/geometry_type.hpp
index 0e9f86e67..92a1d97df 100644
--- a/src/core/geometry_type.hpp
+++ b/src/core/geometry_type.hpp
@@ -12,8 +12,8 @@
#if defined(__APPLE__)
/* Mac OS X already has both Rect and Point declared */
- #define Rect OTTD_Rect
- #define Point OTTD_Point
+# define Rect OTTD_Rect
+# define Point OTTD_Point
#endif /* __APPLE__ */
diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp
index 7a40c9b74..ece90ccc3 100644
--- a/src/core/random_func.hpp
+++ b/src/core/random_func.hpp
@@ -12,7 +12,7 @@
#if defined(__APPLE__)
/* Apple already has Random declared */
- #define Random OTTD_Random
+# define Random OTTD_Random
#endif /* __APPLE__ */
/**
@@ -57,13 +57,13 @@ static inline void RestoreRandomSeeds(const SavedRandomSeeds &storage)
void SetRandomSeed(uint32 seed);
#ifdef RANDOM_DEBUG
- #ifdef __APPLE__
- #define OTTD_Random() DoRandom(__LINE__, __FILE__)
- #else
- #define Random() DoRandom(__LINE__, __FILE__)
- #endif
+# ifdef __APPLE__
+# define OTTD_Random() DoRandom(__LINE__, __FILE__)
+# else
+# define Random() DoRandom(__LINE__, __FILE__)
+# endif
uint32 DoRandom(int line, const char *file);
- #define RandomRange(limit) DoRandomRange(limit, __LINE__, __FILE__)
+# define RandomRange(limit) DoRandomRange(limit, __LINE__, __FILE__)
uint32 DoRandomRange(uint32 limit, int line, const char *file);
#else
static inline uint32 Random()
@@ -126,7 +126,7 @@ static inline bool Chance16I(const uint a, const uint b, const uint32 r)
* @return True with (a/b) probability
*/
#ifdef RANDOM_DEBUG
- #define Chance16(a, b) Chance16I(a, b, DoRandom(__LINE__, __FILE__))
+# define Chance16(a, b) Chance16I(a, b, DoRandom(__LINE__, __FILE__))
#else
static inline bool Chance16(const uint a, const uint b)
{
@@ -150,7 +150,7 @@ static inline bool Chance16(const uint a, const uint b)
* @return True in (a/b) percent
*/
#ifdef RANDOM_DEBUG
- #define Chance16R(a, b, r) (r = DoRandom(__LINE__, __FILE__), Chance16I(a, b, r))
+# define Chance16R(a, b, r) (r = DoRandom(__LINE__, __FILE__), Chance16I(a, b, r))
#else
static inline bool Chance16R(const uint a, const uint b, uint32 &r)
{