diff options
author | truebrain <truebrain@openttd.org> | 2011-12-20 17:57:56 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-20 17:57:56 +0000 |
commit | 1c9bec19993417b1f3b240f2bdb0745aa26c0cb3 (patch) | |
tree | d09407cc962ee87ac1bbbbc60951cad74c6b1db7 /src/misc/fixedsizearray.hpp | |
parent | 7a38642a1c83531a65907ae784bc03a82d35132a (diff) | |
download | openttd-1c9bec19993417b1f3b240f2bdb0745aa26c0cb3.tar.xz |
(svn r23640) -Fix: stop using FORCEINLINE (1/3rd of the instances were, the others were still regular inline), but make sure inline is always a 'forced' inline (I am looking at you MSVC)
Diffstat (limited to 'src/misc/fixedsizearray.hpp')
-rw-r--r-- | src/misc/fixedsizearray.hpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/misc/fixedsizearray.hpp b/src/misc/fixedsizearray.hpp index a6f4d0c42..4216570b8 100644 --- a/src/misc/fixedsizearray.hpp +++ b/src/misc/fixedsizearray.hpp @@ -41,13 +41,13 @@ protected: T *data; /** return reference to the array header (non-const) */ - FORCEINLINE ArrayHeader& Hdr() { return *(ArrayHeader*)(((byte*)data) - HeaderSize); } + inline ArrayHeader& Hdr() { return *(ArrayHeader*)(((byte*)data) - HeaderSize); } /** return reference to the array header (const) */ - FORCEINLINE const ArrayHeader& Hdr() const { return *(ArrayHeader*)(((byte*)data) - HeaderSize); } + inline const ArrayHeader& Hdr() const { return *(ArrayHeader*)(((byte*)data) - HeaderSize); } /** return reference to the block reference counter */ - FORCEINLINE uint& RefCnt() { return Hdr().reference_count; } + inline uint& RefCnt() { return Hdr().reference_count; } /** return reference to number of used items */ - FORCEINLINE uint& SizeRef() { return Hdr().items; } + inline uint& SizeRef() { return Hdr().items; } public: /** Default constructor. Preallocate space for items and header, then initialize header. */ @@ -83,7 +83,7 @@ public: } /** Clear (destroy) all items */ - FORCEINLINE void Clear() + inline void Clear() { /* Walk through all allocated items backward and destroy them * Note: this->Length() can be zero. In that case data[this->Length() - 1] is evaluated unsigned @@ -96,19 +96,19 @@ public: } /** return number of used items */ - FORCEINLINE uint Length() const { return Hdr().items; } + inline uint Length() const { return Hdr().items; } /** return true if array is full */ - FORCEINLINE bool IsFull() const { return Length() >= C; } + inline bool IsFull() const { return Length() >= C; } /** return true if array is empty */ - FORCEINLINE bool IsEmpty() const { return Length() <= 0; } + inline bool IsEmpty() const { return Length() <= 0; } /** add (allocate), but don't construct item */ - FORCEINLINE T *Append() { assert(!IsFull()); return &data[SizeRef()++]; } + inline T *Append() { assert(!IsFull()); return &data[SizeRef()++]; } /** add and construct item using default constructor */ - FORCEINLINE T *AppendC() { T *item = Append(); new(item)T; return item; } + inline T *AppendC() { T *item = Append(); new(item)T; return item; } /** return item by index (non-const version) */ - FORCEINLINE T& operator [] (uint index) { assert(index < Length()); return data[index]; } + inline T& operator [] (uint index) { assert(index < Length()); return data[index]; } /** return item by index (const version) */ - FORCEINLINE const T& operator [] (uint index) const { assert(index < Length()); return data[index]; } + inline const T& operator [] (uint index) const { assert(index < Length()); return data[index]; } }; #endif /* FIXEDSIZEARRAY_HPP */ |