summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2008-06-22 15:21:51 +0000
committerskidd13 <skidd13@openttd.org>2008-06-22 15:21:51 +0000
commit8b7d893d85d2493548c023000fca99b1ce16b5f2 (patch)
tree8904cbdb49b1373360cba22af59cfdea4811c6de /src
parentccd27d1e5ba03bb8b9d6e487e158358d22d26b3b (diff)
downloadopenttd-8b7d893d85d2493548c023000fca99b1ce16b5f2.tar.xz
(svn r13606) -Codechange: use "static FORCEINLINE" where possible as default for core functions (big functions use just inline instead)
Diffstat (limited to 'src')
-rw-r--r--src/core/alloc_func.hpp9
-rw-r--r--src/core/alloc_type.hpp14
-rw-r--r--src/core/bitmath_func.hpp39
-rw-r--r--src/core/endian_func.hpp4
-rw-r--r--src/core/enum_type.hpp3
-rw-r--r--src/core/math_func.hpp36
-rw-r--r--src/core/mem_func.hpp16
-rw-r--r--src/core/random_func.hpp14
-rw-r--r--src/core/smallvec_type.hpp24
-rw-r--r--src/core/sort_func.hpp8
10 files changed, 95 insertions, 72 deletions
diff --git a/src/core/alloc_func.hpp b/src/core/alloc_func.hpp
index ec30ffb6e..45c0036d9 100644
--- a/src/core/alloc_func.hpp
+++ b/src/core/alloc_func.hpp
@@ -24,7 +24,8 @@ void NORETURN ReallocError(size_t size);
* @param num_elements the number of elements to allocate of the given type.
* @return NULL when num_elements == 0, non-NULL otherwise.
*/
-template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
+template <typename T>
+static FORCEINLINE T *MallocT(size_t num_elements)
{
/*
* MorphOS cannot handle 0 elements allocations, or rather that always
@@ -48,7 +49,8 @@ template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
* @param num_elements the number of elements to allocate of the given type.
* @return NULL when num_elements == 0, non-NULL otherwise.
*/
-template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
+template <typename T>
+static FORCEINLINE T *CallocT(size_t num_elements)
{
/*
* MorphOS cannot handle 0 elements allocations, or rather that always
@@ -73,7 +75,8 @@ template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
* @param num_elements the number of elements to allocate of the given type.
* @return NULL when num_elements == 0, non-NULL otherwise.
*/
-template <typename T> FORCEINLINE T* ReallocT(T *t_ptr, size_t num_elements)
+template <typename T>
+FORCEINLINE T *ReallocT(T *t_ptr, size_t num_elements)
{
/*
* MorphOS cannot handle 0 elements allocations, or rather that always
diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp
index 1710e9a4d..fe9c3b81d 100644
--- a/src/core/alloc_type.hpp
+++ b/src/core/alloc_type.hpp
@@ -37,20 +37,20 @@ struct SmallStackSafeStackAlloc {
* Gets a pointer to the data stored in this wrapper.
* @return the pointer.
*/
- inline operator T* () { return data; }
+ FORCEINLINE operator T* () { return data; }
/**
* Gets a pointer to the data stored in this wrapper.
* @return the pointer.
*/
- inline T* operator -> () { return data; }
+ FORCEINLINE T* operator -> () { return data; }
/**
* Gets a pointer to the last data element stored in this wrapper.
* @note needed because endof does not work properly for pointers.
* @return the 'endof' pointer.
*/
- inline T* EndOf() {
+ FORCEINLINE T* EndOf() {
#if !defined(__NDS__)
return endof(data);
#else
@@ -74,14 +74,14 @@ public:
* @param size the amount of bytes to allocate.
* @return the given amounts of bytes zeroed.
*/
- void *operator new(size_t size) { return CallocT<byte>(size); }
+ FORCEINLINE void *operator new(size_t size) { return CallocT<byte>(size); }
/**
* Memory allocator for an array of class instances.
* @param size the amount of bytes to allocate.
* @return the given amounts of bytes zeroed.
*/
- void *operator new[](size_t size) { return CallocT<byte>(size); }
+ FORCEINLINE void *operator new[](size_t size) { return CallocT<byte>(size); }
/**
* Memory release for a single class instance.
@@ -91,7 +91,7 @@ public:
* @warning The value of the \a size parameter can only be trusted for
* classes that have their own (virtual) destructor method.
*/
- void operator delete(void *ptr, size_t size) { free(ptr); }
+ FORCEINLINE void operator delete(void *ptr, size_t size) { free(ptr); }
/**
* Memory release for an array of class instances.
@@ -101,7 +101,7 @@ public:
* @warning The value of the \a size parameter can only be trusted for
* classes that have their own (virtual) destructor method.
*/
- void operator delete[](void *ptr, size_t size) { free(ptr); }
+ FORCEINLINE void operator delete[](void *ptr, size_t size) { free(ptr); }
};
#endif /* ALLOC_TYPE_HPP */
diff --git a/src/core/bitmath_func.hpp b/src/core/bitmath_func.hpp
index dd93b11d9..167a863c8 100644
--- a/src/core/bitmath_func.hpp
+++ b/src/core/bitmath_func.hpp
@@ -21,7 +21,8 @@
* @param n The number of bits to read.
* @return The selected bits, aligned to a LSB.
*/
-template<typename T> static inline uint GB(const T x, const uint8 s, const uint8 n)
+template <typename T>
+static FORCEINLINE uint GB(const T x, const uint8 s, const uint8 n)
{
return (x >> s) & ((1U << n) - 1);
}
@@ -43,7 +44,8 @@ template<typename T> static inline uint GB(const T x, const uint8 s, const uint8
* @param d The actually new bits to save in the defined position.
* @return The new value of x
*/
-template<typename T, typename U> static inline T SB(T& x, const uint8 s, const uint8 n, const U d)
+template <typename T, typename U>
+static FORCEINLINE T SB(T &x, const uint8 s, const uint8 n, const U d)
{
x &= (T)(~(((1U << n) - 1) << s));
x |= (T)(d << s);
@@ -64,7 +66,8 @@ template<typename T, typename U> static inline T SB(T& x, const uint8 s, const u
* @param i The value to add at the given startposition in the given window.
* @return The new value of x
*/
-template<typename T, typename U> static inline T AB(T& x, const uint8 s, const uint8 n, const U i)
+template <typename T, typename U>
+static FORCEINLINE T AB(T &x, const uint8 s, const uint8 n, const U i)
{
const T mask = (T)(((1U << n) - 1) << s);
x = (T)((x & ~mask) | ((x + (i << s)) & mask));
@@ -82,7 +85,8 @@ template<typename T, typename U> static inline T AB(T& x, const uint8 s, const u
* @param y The position of the bit to check, started from the LSB
* @return True if the bit is set, false else.
*/
-template<typename T> static inline bool HasBit(const T x, const uint8 y)
+template <typename T>
+static FORCEINLINE bool HasBit(const T x, const uint8 y)
{
return (x & ((T)1U << y)) != 0;
}
@@ -110,7 +114,8 @@ template<typename T> static inline bool HasBit(const T x, const uint8 y)
* @param y The bit position to set
* @return The new value of the old value with the bit set
*/
-template<typename T> static inline T SetBit(T& x, const uint8 y)
+template <typename T>
+static FORCEINLINE T SetBit(T &x, const uint8 y)
{
return x = (T)(x | (T)(1U << y));
}
@@ -138,7 +143,8 @@ template<typename T> static inline T SetBit(T& x, const uint8 y)
* @param y The bit position to clear
* @return The new value of the old value with the bit cleared
*/
-template<typename T> static inline T ClrBit(T& x, const uint8 y)
+template <typename T>
+static FORCEINLINE T ClrBit(T &x, const uint8 y)
{
return x = (T)(x & ~((T)1U << y));
}
@@ -166,7 +172,8 @@ template<typename T> static inline T ClrBit(T& x, const uint8 y)
* @param y The bit position to toggle
* @return The new value of the old value with the bit toggled
*/
-template<typename T> static inline T ToggleBit(T& x, const uint8 y)
+template <typename T>
+static FORCEINLINE T ToggleBit(T &x, const uint8 y)
{
return x = (T)(x ^ (T)(1U << y));
}
@@ -201,7 +208,7 @@ extern const uint8 _ffb_64[64];
* @return The position of the first bit which is set
* @see FIND_FIRST_BIT
*/
-static inline uint8 FindFirstBit2x64(const int value)
+static FORCEINLINE uint8 FindFirstBit2x64(const int value)
{
if ((value & 0xFF) == 0) {
return FIND_FIRST_BIT((value >> 8) & 0x3F) + 8;
@@ -223,7 +230,8 @@ uint8 FindLastBit(uint64 x);
* @param value The value to clear the first bit
* @return The new value with the first bit cleared
*/
-template<typename T> static inline T KillFirstBit(T value)
+template <typename T>
+static FORCEINLINE T KillFirstBit(T value)
{
return value &= (T)(value - 1);
}
@@ -234,7 +242,8 @@ template<typename T> static inline T KillFirstBit(T value)
* @param value the value to count the number of bits in.
* @return the number of bits.
*/
-template<typename T> static inline uint CountBits(T value)
+template <typename T>
+static inline uint CountBits(T value)
{
uint num;
@@ -258,7 +267,8 @@ template<typename T> static inline uint CountBits(T value)
* @param n The number how many we waht to rotate
* @return A bit rotated number
*/
-template<typename T> static inline T ROL(const T x, const uint8 n)
+template <typename T>
+static FORCEINLINE T ROL(const T x, const uint8 n)
{
return (T)(x << n | x >> (sizeof(x) * 8 - n));
}
@@ -271,7 +281,8 @@ template<typename T> static inline T ROL(const T x, const uint8 n)
* @param n The number how many we waht to rotate
* @return A bit rotated number
*/
-template<typename T> static inline T ROR(const T x, const uint8 n)
+template <typename T>
+static FORCEINLINE T ROR(const T x, const uint8 n)
{
return (T)(x >> n | x << (sizeof(x) * 8 - n));
}
@@ -305,7 +316,7 @@ template<typename T> static inline T ROR(const T x, const uint8 n)
* @param x the variable to bitswap
* @return the bitswapped value.
*/
- static inline uint32 BSWAP32(uint32 x)
+ static FORCEINLINE uint32 BSWAP32(uint32 x)
{
return ((x >> 24) & 0xFF) | ((x >> 8) & 0xFF00) | ((x << 8) & 0xFF0000) | ((x << 24) & 0xFF000000);
}
@@ -315,7 +326,7 @@ template<typename T> static inline T ROR(const T x, const uint8 n)
* @param x the variable to bitswap
* @return the bitswapped value.
*/
- static inline uint16 BSWAP16(uint16 x)
+ static FORCEINLINE uint16 BSWAP16(uint16 x)
{
return (x >> 8) | (x << 8);
}
diff --git a/src/core/endian_func.hpp b/src/core/endian_func.hpp
index 9032b4cef..2b80ccc68 100644
--- a/src/core/endian_func.hpp
+++ b/src/core/endian_func.hpp
@@ -33,12 +33,12 @@
#define TO_LE32X(x) (x)
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
-static inline uint16 ReadLE16Aligned(const void *x)
+static FORCEINLINE uint16 ReadLE16Aligned(const void *x)
{
return FROM_LE16(*(const uint16*)x);
}
-static inline uint16 ReadLE16Unaligned(const void *x)
+static FORCEINLINE uint16 ReadLE16Unaligned(const void *x)
{
#if OTTD_ALIGNMENT == 1
return ((const byte*)x)[0] | ((const byte*)x)[1] << 8;
diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp
index de83b6d55..717f2c5eb 100644
--- a/src/core/enum_type.hpp
+++ b/src/core/enum_type.hpp
@@ -73,7 +73,8 @@ struct MakeEnumPropsT {
template <typename Tenum_t> struct TinyEnumT;
/** The general declaration of TinyEnumT<> (above) */
-template <typename Tenum_t> struct TinyEnumT
+template <typename Tenum_t>
+struct TinyEnumT
{
typedef Tenum_t enum_type; ///< expose our enumeration type (i.e. Trackdir) to outside
typedef EnumPropsT<Tenum_t> Props; ///< make easier access to our enumeration propeties
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp
index 35aeeee1e..6b91b3ddb 100644
--- a/src/core/math_func.hpp
+++ b/src/core/math_func.hpp
@@ -27,7 +27,8 @@
* @param b The second value
* @return The greater value or a if equals
*/
-template<typename T> static inline T max(const T a, const T b)
+template <typename T>
+static FORCEINLINE T max(const T a, const T b)
{
return (a >= b) ? a : b;
}
@@ -42,7 +43,8 @@ template<typename T> static inline T max(const T a, const T b)
* @param b The second value
* @return The smaller value or b if equals
*/
-template<typename T> static inline T min(const T a, const T b)
+template <typename T>
+static FORCEINLINE T min(const T a, const T b)
{
return (a < b) ? a : b;
}
@@ -56,7 +58,7 @@ template<typename T> static inline T min(const T a, const T b)
* @param b The second integer
* @return The smaller value
*/
-static inline int min(const int a, const int b)
+static FORCEINLINE int min(const int a, const int b)
{
return (a < b) ? a : b;
}
@@ -70,7 +72,7 @@ static inline int min(const int a, const int b)
* @param b The second unsigned integer
* @return The smaller value
*/
-static inline uint minu(const uint a, const uint b)
+static FORCEINLINE uint minu(const uint a, const uint b)
{
return (a < b) ? a : b;
}
@@ -82,7 +84,8 @@ static inline uint minu(const uint a, const uint b)
* @param a The value we want to unsign
* @return The unsigned value
*/
-template <typename T> static inline T abs(const T a)
+template <typename T>
+static FORCEINLINE T abs(const T a)
{
return (a < (T)0) ? -a : a;
}
@@ -95,7 +98,8 @@ template <typename T> static inline T abs(const T a)
* @param n The base of the number we are searching
* @return The smallest multiple of n equal or greater than x
*/
-template<typename T> static inline T Align(const T x, uint n)
+template <typename T>
+static FORCEINLINE T Align(const T x, uint n)
{
n--;
return (T)((x + n) & ~(n));
@@ -117,7 +121,7 @@ template<typename T> static inline T Align(const T x, uint n)
* @returns A value between min and max which is closest to a.
* @see ClampU(uint, uint, uint)
*/
-static inline int Clamp(const int a, const int min, const int max)
+static FORCEINLINE int Clamp(const int a, const int min, const int max)
{
if (a <= min) return min;
if (a >= max) return max;
@@ -140,7 +144,7 @@ static inline int Clamp(const int a, const int min, const int max)
* @returns A value between min and max which is closest to a.
* @see Clamp(int, int, int)
*/
-static inline uint ClampU(const uint a, const uint min, const uint max)
+static FORCEINLINE uint ClampU(const uint a, const uint min, const uint max)
{
if (a <= min) return min;
if (a >= max) return max;
@@ -161,7 +165,7 @@ static inline uint ClampU(const uint a, const uint min, const uint max)
* @return The 64-bit value reduced to a 32-bit value
* @see Clamp(int, int, int)
*/
-static inline int32 ClampToI32(const int64 a)
+static FORCEINLINE int32 ClampToI32(const int64 a)
{
if (a <= INT32_MIN) return INT32_MIN;
if (a >= INT32_MAX) return INT32_MAX;
@@ -175,7 +179,7 @@ static inline int32 ClampToI32(const int64 a)
* @return The 64-bit value reduced to a 16-bit value
* @see ClampU(uint, uint, uint)
*/
-static inline uint16 ClampToU16(const uint64 a)
+static FORCEINLINE uint16 ClampToU16(const uint64 a)
{
return (uint16)(a <= UINT16_MAX ? a : UINT16_MAX);
}
@@ -187,7 +191,8 @@ static inline uint16 ClampToU16(const uint64 a)
* @param b The second scalar
* @return The absolute difference between the given scalars
*/
-template <typename T> static inline T Delta(const T a, const T b) {
+template <typename T>
+static FORCEINLINE T Delta(const T a, const T b) {
return (a < b) ? b - a : a - b;
}
@@ -203,7 +208,8 @@ template <typename T> static inline T Delta(const T a, const T b) {
* @param size The size of the interval
* @return True if the value is in the interval, false else.
*/
-template<typename T> static inline bool IsInsideBS(const T x, const uint base, const uint size)
+template <typename T>
+static FORCEINLINE bool IsInsideBS(const T x, const uint base, const uint size)
{
return (uint)(x - base) < size;
}
@@ -218,7 +224,8 @@ template<typename T> static inline bool IsInsideBS(const T x, const uint base, c
* @param max The maximum of the interval
* @see IsInsideBS()
*/
-template<typename T> static inline bool IsInsideMM(const T x, const uint min, const uint max)
+template <typename T>
+static FORCEINLINE bool IsInsideMM(const T x, const uint min, const uint max)
{
return (uint)(x - min) < (max - min);
}
@@ -228,7 +235,8 @@ template<typename T> static inline bool IsInsideMM(const T x, const uint min, co
* @param a variable to swap with b
* @param b variable to swap with a
*/
-template<typename T> void Swap(T& a, T& b)
+template <typename T>
+static FORCEINLINE void Swap(T &a, T &b)
{
T t = a;
a = b;
diff --git a/src/core/mem_func.hpp b/src/core/mem_func.hpp
index 3d87f4290..e56ad365d 100644
--- a/src/core/mem_func.hpp
+++ b/src/core/mem_func.hpp
@@ -16,7 +16,7 @@
* @param num number of items to be copied. (!not number of bytes!)
*/
template <typename T>
-FORCEINLINE void MemCpyT(T *destination, const T *source, uint num = 1)
+static FORCEINLINE void MemCpyT(T *destination, const T *source, uint num = 1)
{
memcpy(destination, source, num * sizeof(T));
}
@@ -29,7 +29,7 @@ FORCEINLINE void MemCpyT(T *destination, const T *source, uint num = 1)
* @param num number of items to be copied. (!not number of bytes!)
*/
template <typename T>
-FORCEINLINE void MemMoveT(T *destination, const T *source, uint num = 1)
+static FORCEINLINE void MemMoveT(T *destination, const T *source, uint num = 1)
{
memmove(destination, source, num * sizeof(T));
}
@@ -42,7 +42,7 @@ FORCEINLINE void MemMoveT(T *destination, const T *source, uint num = 1)
* @param num number of items to be set (!not number of bytes!)
*/
template <typename T>
-FORCEINLINE void MemSetT(T *ptr, int value, uint num = 1)
+static FORCEINLINE void MemSetT(T *ptr, int value, uint num = 1)
{
memset(ptr, value, num * sizeof(T));
}
@@ -56,7 +56,7 @@ FORCEINLINE void MemSetT(T *ptr, int value, uint num = 1)
* @return an int value indicating the relationship between the content of the two buffers
*/
template <typename T>
-FORCEINLINE int MemCmpT(const T *ptr1, const T *ptr2, uint num = 1)
+static FORCEINLINE int MemCmpT(const T *ptr1, const T *ptr2, uint num = 1)
{
return memcmp(ptr1, ptr2, num * sizeof(T));
}
@@ -69,8 +69,8 @@ FORCEINLINE int MemCmpT(const T *ptr1, const T *ptr2, uint num = 1)
* @param ptr1 Start-pointer to the block of memory.
* @param ptr2 End-pointer to the block of memory.
*/
-template<typename T>
-FORCEINLINE void MemReverseT(T *ptr1, T *ptr2)
+template <typename T>
+static FORCEINLINE void MemReverseT(T *ptr1, T *ptr2)
{
assert(ptr1 != NULL && ptr2 != NULL);
assert(ptr1 < ptr2);
@@ -86,8 +86,8 @@ FORCEINLINE void MemReverseT(T *ptr1, T *ptr2)
* @param ptr Pointer to the block of memory.
* @param num The number of items we want to reverse.
*/
-template<typename T>
-FORCEINLINE void MemReverseT(T *ptr, uint num)
+template <typename T>
+static FORCEINLINE void MemReverseT(T *ptr, uint num)
{
assert(ptr != NULL);
diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp
index cd273cb08..18cde93d3 100644
--- a/src/core/random_func.hpp
+++ b/src/core/random_func.hpp
@@ -59,12 +59,12 @@ void SetRandomSeed(uint32 seed);
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
uint DoRandomRange(uint max, int line, const char *file);
#else
- static inline uint32 Random() { return _random.Next(); }
- static inline uint32 RandomRange(uint16 max) { return _random.Next(max); }
+ static FORCEINLINE uint32 Random() { return _random.Next(); }
+ static FORCEINLINE uint32 RandomRange(uint16 max) { return _random.Next(max); }
#endif
-static inline uint32 InteractiveRandom() { return _interactive_random.Next(); }
-static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_random.Next(max); }
+static FORCEINLINE uint32 InteractiveRandom() { return _interactive_random.Next(); }
+static FORCEINLINE uint32 InteractiveRandomRange(uint16 max) { return _interactive_random.Next(max); }
/**
* Checks if a given randomize-number is below a given probability.
@@ -81,7 +81,7 @@ static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_ra
* @param r The given randomize-number
* @return True if v is less or equals (a/b)
*/
-static inline bool Chance16I(const uint a, const uint b, const uint32 r)
+static FORCEINLINE bool Chance16I(const uint a, const uint b, const uint32 r)
{
assert(b != 0);
return (uint16)r < (uint16)(((a << 16) + b / 2) / b);
@@ -99,7 +99,7 @@ static inline bool Chance16I(const uint a, const uint b, const uint32 r)
* @param b The denominator of the fraction
* @return True in (a/b) percent
*/
-static inline bool Chance16(const uint a, const uint b)
+static FORCEINLINE bool Chance16(const uint a, const uint b)
{
return Chance16I(a, b, Random());
}
@@ -119,7 +119,7 @@ static inline bool Chance16(const uint a, const uint b)
* @param r The variable to save the randomize-number from Random()
* @return True in (a/b) percent
*/
-static inline bool Chance16R(const uint a, const uint b, uint32 &r)
+static FORCEINLINE bool Chance16R(const uint a, const uint b, uint32 &r)
{
r = Random();
return Chance16I(a, b, r);
diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp
index ce41af9fd..4da1a66a8 100644
--- a/src/core/smallvec_type.hpp
+++ b/src/core/smallvec_type.hpp
@@ -36,7 +36,7 @@ public:
/**
* Remove all items from the list.
*/
- void Clear()
+ FORCEINLINE void Clear()
{
/* In fact we just reset the item counter avoiding the need to
* probably reallocate the same amount of memory the list was
@@ -47,7 +47,7 @@ public:
/**
* Compact the list down to the smallest block size boundary.
*/
- void Compact()
+ FORCEINLINE void Compact()
{
uint capacity = Align(this->items, S);
if (capacity >= this->capacity) return;
@@ -59,7 +59,7 @@ public:
/**
* Append an item and return it.
*/
- T *Append()
+ FORCEINLINE T *Append()
{
if (this->items == this->capacity) {
this->capacity += S;
@@ -72,7 +72,7 @@ public:
/**
* Get the number of items in the list.
*/
- uint Length() const
+ FORCEINLINE uint Length() const
{
return this->items;
}
@@ -82,7 +82,7 @@ public:
*
* @return the pointer to the first item
*/
- const T *Begin() const
+ FORCEINLINE const T *Begin() const
{
return this->data;
}
@@ -92,7 +92,7 @@ public:
*
* @return the pointer to the first item
*/
- T *Begin()
+ FORCEINLINE T *Begin()
{
return this->data;
}
@@ -102,7 +102,7 @@ public:
*
* @return the pointer behind the last valid item
*/
- const T *End() const
+ FORCEINLINE const T *End() const
{
return &this->data[this->items];
}
@@ -112,7 +112,7 @@ public:
*
* @return the pointer behind the last valid item
*/
- T *End()
+ FORCEINLINE T *End()
{
return &this->data[this->items];
}
@@ -123,7 +123,7 @@ public:
* @param index the position of the item
* @return the pointer to the item
*/
- const T *Get(uint index) const
+ FORCEINLINE const T *Get(uint index) const
{
return &this->data[index];
}
@@ -134,7 +134,7 @@ public:
* @param index the position of the item
* @return the pointer to the item
*/
- T *Get(uint index)
+ FORCEINLINE T *Get(uint index)
{
return &this->data[index];
}
@@ -145,7 +145,7 @@ public:
* @param index the positon of the item
* @return the item
*/
- const T &operator[](uint index) const
+ FORCEINLINE const T &operator[](uint index) const
{
return this->data[index];
}
@@ -156,7 +156,7 @@ public:
* @param index the positon of the item
* @return the item
*/
- T &operator[](uint index)
+ FORCEINLINE T &operator[](uint index)
{
return this->data[index];
}
diff --git a/src/core/sort_func.hpp b/src/core/sort_func.hpp
index 826fa278d..0ccd92a73 100644
--- a/src/core/sort_func.hpp
+++ b/src/core/sort_func.hpp
@@ -20,8 +20,8 @@
* @param comparator Function that compares two elements.
* @param desc Sort descending.
*/
-template<typename T>
-FORCEINLINE void QSortT(T *base, uint num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
+template <typename T>
+static FORCEINLINE void QSortT(T *base, uint num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
{
if (num < 2) return;
@@ -44,8 +44,8 @@ FORCEINLINE void QSortT(T *base, uint num, int (CDECL *comparator)(const T*, con
* @param comparator Function that compares two elements.
* @param desc Sort descending.
*/
-template<typename T>
-FORCEINLINE void GSortT(T *base, uint num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
+template <typename T>
+static inline void GSortT(T *base, uint num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
{
if (num < 2) return;