(svn r793) Merge INLINE -> inline replacement (revision 376)
authortron
Wed, 24 Nov 2004 13:19:48 +0000
changeset 500 ef288590e096
parent 499 509765981930
child 501 f586b24c6cf2
(svn r793) Merge INLINE -> inline replacement (revision 376)
macros.h
misc.c
newgrf.c
pathfind.c
saveload.c
smallmap_gui.c
station_cmd.c
stdafx.h
viewport.c
--- a/macros.h	Wed Nov 24 12:47:25 2004 +0000
+++ b/macros.h	Wed Nov 24 13:19:48 2004 +0000
@@ -11,20 +11,20 @@
 #undef max
 #endif
 
-static INLINE int min(int a, int b) { if (a <= b) return a; return b; }
-static INLINE int max(int a, int b) { if (a >= b) return a; return b; }
-static INLINE int64 max64(int64 a, int64 b) { if (a >= b) return a; return b; }
+static inline int min(int a, int b) { if (a <= b) return a; return b; }
+static inline int max(int a, int b) { if (a >= b) return a; return b; }
+static inline int64 max64(int64 a, int64 b) { if (a >= b) return a; return b; }
 
-static INLINE uint minu(uint a, uint b) { if (a <= b) return a; return b; }
-static INLINE uint maxu(uint a, uint b) { if (a >= b) return a; return b; }
+static inline uint minu(uint a, uint b) { if (a <= b) return a; return b; }
+static inline uint maxu(uint a, uint b) { if (a >= b) return a; return b; }
 
 
-static INLINE int clamp(int a, int min, int max) { if (a <= min) return min; if (a >= max) return max; return a; }
-static INLINE int clamp2(int a, int min, int max) { if (a <= min) a=min; if (a >= max) a=max; return a; }
-static INLINE bool int32_add_overflow(int32 a, int32 b) { return (int32)(a^b)>=0 && (int32)(a^(a+b))<0; }
-static INLINE bool int32_sub_overflow(int32 a, int32 b) { return (int32)(a^b)<0 && (int32)(a^(a-b))<0; }
+static inline int clamp(int a, int min, int max) { if (a <= min) return min; if (a >= max) return max; return a; }
+static inline int clamp2(int a, int min, int max) { if (a <= min) a=min; if (a >= max) a=max; return a; }
+static inline bool int32_add_overflow(int32 a, int32 b) { return (int32)(a^b)>=0 && (int32)(a^(a+b))<0; }
+static inline bool int32_sub_overflow(int32 a, int32 b) { return (int32)(a^b)<0 && (int32)(a^(a-b))<0; }
 
-static INLINE bool str_eq(const byte *a, const byte *b)
+static inline bool str_eq(const byte *a, const byte *b)
 {
 	int i=0;
 	while (a[i] == b[i]) {
@@ -36,7 +36,7 @@
 }
 
 // Will crash if strings are equal
-static INLINE bool str_is_below(byte *a, byte *b) {
+static inline bool str_is_below(byte *a, byte *b) {
 	while (*a <= *b) {
 		if (*a < *b) return true;
 		a++;
@@ -46,19 +46,19 @@
 }
 
 
-static INLINE int32 BIGMULSS(int32 a, int32 b, int shift) {
+static inline int32 BIGMULSS(int32 a, int32 b, int shift) {
 	return (int32)(((int64)(a) * (int64)(b)) >> (shift));
 }
 
-static INLINE int64 BIGMULSS64(int64 a, int64 b, int shift) {
+static inline int64 BIGMULSS64(int64 a, int64 b, int shift) {
 	return ((a) * (b)) >> (shift);
 }
 
-static INLINE uint32 BIGMULUS(uint32 a, uint32 b, int shift) {
+static inline uint32 BIGMULUS(uint32 a, uint32 b, int shift) {
 	return (uint32)(((uint64)(a) * (uint64)(b)) >> (shift));
 }
 
-static INLINE int64 BIGMULS(int32 a, int32 b) {
+static inline int64 BIGMULS(int32 a, int32 b) {
 	return (int32)(((int64)(a) * (int64)(b)));
 }
 
@@ -145,7 +145,7 @@
  */
 #define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
 
-static INLINE int FindFirstBit2x64(int value)
+static inline int FindFirstBit2x64(int value)
 {
 	int i = 0;
 	if ( (byte) value == 0) {
@@ -195,17 +195,17 @@
 #define abs myabs
 
 
-static INLINE int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
+static inline int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
 #define intxchg(a,b) intxchg_(&(a), (b))
 #define intswap(a,b) ((b) = intxchg_(&(a), (b)))
 
-static INLINE int myabs(int a) { if (a<0) a = -a; return a; }
-static INLINE int64 myabs64(int64 a) { if (a<0) a = -a; return a; }
+static inline int myabs(int a) { if (a<0) a = -a; return a; }
+static inline int64 myabs64(int64 a) { if (a<0) a = -a; return a; }
 
-static INLINE void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; }
-static INLINE void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; }
-static INLINE void swap_int16(int16 *a, int16 *b) { int16 t = *a; *a = *b; *b = t; }
-static INLINE void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a = *b; *b = t; }
+static inline void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; }
+static inline void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; }
+static inline void swap_int16(int16 *a, int16 *b) { int16 t = *a; *a = *b; *b = t; }
+static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a = *b; *b = t; }
 
 
 
@@ -214,14 +214,14 @@
 #	define ADD_WORD(x) (x)&0xFF, ((x) >> 8)&0xFF
 #	define ADD_DWORD(x) (x)&0xFF, ((x) >> 8)&0xFF, ((x) >> 16)&0xFF, ((x) >> 24)&0xFF
 #elif defined(TTD_BIG_ENDIAN)
-	static INLINE uint16 READ_LE_UINT16(const void *b) {
+	static inline uint16 READ_LE_UINT16(const void *b) {
 		return ((const byte*)b)[0] + (((const byte*)b)[1] << 8);
 	}
 #	define ADD_WORD(x) ((x) >> 8)&0xFF, (x)&0xFF
 #	define ADD_DWORD(x) ((x) >> 24)&0xFF, ((x) >> 16)&0xFF, ((x) >> 8)&0xFF,  (x)&0xFF
 #endif
 
-static INLINE void WRITE_LE_UINT16(void *b, uint16 x) {
+static inline void WRITE_LE_UINT16(void *b, uint16 x) {
 	((byte*)b)[0] = (byte)x;
 	((byte*)b)[1] = (byte)(x >> 8);
 }
--- a/misc.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/misc.c	Wed Nov 24 13:19:48 2004 +0000
@@ -10,7 +10,7 @@
 
 byte _name_array[512][32];
 
-static INLINE uint32 ROR(uint32 x, int n)
+static inline uint32 ROR(uint32 x, int n)
 {
 	return (x >> n) + (x << ((sizeof(x)*8)-n));
 }
--- a/newgrf.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/newgrf.c	Wed Nov 24 13:19:48 2004 +0000
@@ -114,7 +114,7 @@
 } while (0)
 
 
-static byte INLINE grf_load_byte(byte **buf)
+static inline byte grf_load_byte(byte **buf)
 {
 	return *(*buf)++;
 }
--- a/pathfind.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/pathfind.c	Wed Nov 24 13:19:48 2004 +0000
@@ -434,7 +434,7 @@
 
 // called after a new element was added in the queue at the last index.
 // move it down to the proper position
-static void INLINE HeapifyUp(NewTrackPathFinder *tpf)
+static void inline HeapifyUp(NewTrackPathFinder *tpf)
 {
 	StackedItem si;
 	int i = ++tpf->nstack;
@@ -448,7 +448,7 @@
 }
 
 // called after the element 0 was eaten. fill it with a new element
-static void INLINE HeapifyDown(NewTrackPathFinder *tpf)
+static void inline HeapifyDown(NewTrackPathFinder *tpf)
 {
 	StackedItem si;
 	int i = 1, j;
--- a/saveload.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/saveload.c	Wed Nov 24 13:19:48 2004 +0000
@@ -173,22 +173,22 @@
 	return (i>=0x80) ? 2 : 1;
 }
 
-int INLINE SlReadSparseIndex()
+int inline SlReadSparseIndex()
 {
 	return SlReadSimpleGamma();
 }
 
-void INLINE SlWriteSparseIndex(uint index)
+void inline SlWriteSparseIndex(uint index)
 {
 	SlWriteSimpleGamma(index);
 }
 
-int INLINE SlReadArrayLength()
+int inline SlReadArrayLength()
 {
 	return SlReadSimpleGamma();
 }
 
-void INLINE SlWriteArrayLength(uint length)
+void inline SlWriteArrayLength(uint length)
 {
 	SlWriteSimpleGamma(length);
 }
--- a/smallmap_gui.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/smallmap_gui.c	Wed Nov 24 13:19:48 2004 +0000
@@ -221,7 +221,7 @@
 };
 
 #if defined(TTD_ALIGNMENT_4)
-	static INLINE void WRITE_PIXELS(void *dst, uint32 val)
+	static inline void WRITE_PIXELS(void *dst, uint32 val)
 	{
 		byte *d = (byte*)dst;
 #	if defined(TTD_BIG_ENDIAN)
@@ -238,7 +238,7 @@
 	}
 
 /* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
-	static INLINE void WRITE_PIXELS_OR(void *dst, uint32 val)
+	static inline void WRITE_PIXELS_OR(void *dst, uint32 val)
 	{
 		byte *d = (byte*)dst;
 #	if defined(TTD_BIG_ENDIAN)
@@ -328,7 +328,7 @@
 	{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)},
 };
 
-static uint32 INLINE GetSmallMapCountoursPixels(uint tile)
+static inline uint32 GetSmallMapCountoursPixels(uint tile)
 {
 	uint t;
 
@@ -358,7 +358,7 @@
 }
 
 
-static uint32 INLINE GetSmallMapVehiclesPixels(uint tile)
+static inline uint32 GetSmallMapVehiclesPixels(uint tile)
 {
 	uint t;
 
@@ -411,7 +411,7 @@
 	 15, 15, 15, 15, 15, 15, 15,
 };
 
-static uint32 INLINE GetSmallMapIndustriesPixels(uint tile)
+static inline uint32 GetSmallMapIndustriesPixels(uint tile)
 {
 	int t;
 
@@ -443,7 +443,7 @@
 	} while (xc++,yc++,dst+=pitch,--reps != 0);
 }
 
-static uint32 INLINE GetSmallMapRoutesPixels(uint tile)
+static inline uint32 GetSmallMapRoutesPixels(uint tile)
 {
 	int t;
 	uint32 bits;
@@ -499,7 +499,7 @@
 	MKCOLOR(0x54545454),
 };
 
-static uint32 INLINE GetSmallMapVegetationPixels(uint tile)
+static inline uint32 GetSmallMapVegetationPixels(uint tile)
 {
 	int i,t;
 	uint32 bits;
@@ -545,7 +545,7 @@
 
 static uint32 *_owner_colors;
 
-static uint32 INLINE GetSmallMapOwnerPixels(uint tile)
+static inline uint32 GetSmallMapOwnerPixels(uint tile)
 {
 	int t;
 
@@ -601,7 +601,7 @@
 	184, 191, 152, 15, 215, 184
 };
 
-static INLINE uint32 dup_byte32(byte b) {
+static inline uint32 dup_byte32(byte b) {
 	return b + (b << 8) + (b << 16) + (b << 24);
 }
 
--- a/station_cmd.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/station_cmd.c	Wed Nov 24 13:19:48 2004 +0000
@@ -2119,7 +2119,7 @@
 	}
 }
 
-static INLINE bool IsTrainStationTile(uint tile) {
+static inline bool IsTrainStationTile(uint tile) {
 	return IS_TILETYPE(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0, 8);
 }
 
@@ -2233,7 +2233,7 @@
 	}
 }
 
-static INLINE void byte_inc_sat(byte *p) { byte b = *p + 1; if (b != 0) *p = b; }
+static inline void byte_inc_sat(byte *p) { byte b = *p + 1; if (b != 0) *p = b; }
 
 static byte _rating_boost[3] = { 0, 31, 63};
 
--- a/stdafx.h	Wed Nov 24 12:47:25 2004 +0000
+++ b/stdafx.h	Wed Nov 24 13:19:48 2004 +0000
@@ -43,7 +43,6 @@
 #if defined(__GNUC__)
 # define NORETURN
 # define FORCEINLINE inline
-# define INLINE inline
 # define CDECL
 //#include <alloca.h>
 //#include <malloc.h>
@@ -62,7 +61,7 @@
 #	include <malloc.h> // alloca()
 # define NORETURN __declspec(noreturn)
 #	define FORCEINLINE __forceinline
-#	define INLINE _inline
+#	define inline _inline
 #	define CDECL _cdecl
 # define NOT_REACHED() _assume(0)
 # define snprintf _snprintf
@@ -116,10 +115,10 @@
 # define TTD_ALIGNMENT_2
 # define TTD_ALIGNMENT_4
 
-static uint32 INLINE TO_LE32(uint32 x) { return BSWAP32(x); }
-static uint16 INLINE TO_LE16(uint16 x) { return BSWAP16(x); }
-static uint32 INLINE FROM_LE32(uint32 x) { return BSWAP32(x); }
-static uint16 INLINE FROM_LE16(uint16 x) { return BSWAP16(x); }
+static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); }
+static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); }
+static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
+static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
 #define TO_BE32(x) x
 #define TO_BE16(x) x
 #define FROM_BE32(x) x
--- a/viewport.c	Wed Nov 24 12:47:25 2004 +0000
+++ b/viewport.c	Wed Nov 24 13:19:48 2004 +0000
@@ -1227,7 +1227,7 @@
 	}
 }
 
-static void INLINE ViewportDraw(ViewPort *vp, int left, int top, int right, int bottom)
+static inline void ViewportDraw(ViewPort *vp, int left, int top, int right, int bottom)
 {
 	int t;