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 | |
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')
-rw-r--r-- | src/misc/array.hpp | 20 | ||||
-rw-r--r-- | src/misc/binaryheap.hpp | 26 | ||||
-rw-r--r-- | src/misc/blob.hpp | 78 | ||||
-rw-r--r-- | src/misc/countedptr.hpp | 38 | ||||
-rw-r--r-- | src/misc/fixedsizearray.hpp | 24 | ||||
-rw-r--r-- | src/misc/hashtable.hpp | 24 | ||||
-rw-r--r-- | src/misc/str.hpp | 18 |
7 files changed, 114 insertions, 114 deletions
diff --git a/src/misc/array.hpp b/src/misc/array.hpp index 5eae3e488..a3f243e10 100644 --- a/src/misc/array.hpp +++ b/src/misc/array.hpp @@ -30,7 +30,7 @@ protected: SuperArray data; ///< array of arrays of items /** return first sub-array with free space for new item */ - FORCEINLINE SubArray& FirstFreeSubArray() + inline SubArray& FirstFreeSubArray() { uint super_size = data.Length(); if (super_size > 0) { @@ -42,11 +42,11 @@ protected: public: /** implicit constructor */ - FORCEINLINE SmallArray() { } + inline SmallArray() { } /** Clear (destroy) all items */ - FORCEINLINE void Clear() {data.Clear();} + inline void Clear() {data.Clear();} /** Return actual number of items */ - FORCEINLINE uint Length() const + inline uint Length() const { uint super_size = data.Length(); if (super_size == 0) return 0; @@ -54,22 +54,22 @@ public: return (super_size - 1) * B + sub_size; } /** return true if array is empty */ - FORCEINLINE bool IsEmpty() { return data.IsEmpty(); } + inline bool IsEmpty() { return data.IsEmpty(); } /** return true if array is full */ - FORCEINLINE bool IsFull() { return data.IsFull() && data[N - 1].IsFull(); } + inline bool IsFull() { return data.IsFull() && data[N - 1].IsFull(); } /** allocate but not construct new item */ - FORCEINLINE T *Append() { return FirstFreeSubArray().Append(); } + inline T *Append() { return FirstFreeSubArray().Append(); } /** allocate and construct new item */ - FORCEINLINE T *AppendC() { return FirstFreeSubArray().AppendC(); } + inline T *AppendC() { return FirstFreeSubArray().AppendC(); } /** indexed access (non-const) */ - FORCEINLINE T& operator [] (uint index) + inline T& operator [] (uint index) { const SubArray& s = data[index / B]; T& item = s[index % B]; return item; } /** indexed access (const) */ - FORCEINLINE const T& operator [] (uint index) const + inline const T& operator [] (uint index) const { const SubArray& s = data[index / B]; const T& item = s[index % B]; diff --git a/src/misc/binaryheap.hpp b/src/misc/binaryheap.hpp index 55730a2ce..0a2e02ed0 100644 --- a/src/misc/binaryheap.hpp +++ b/src/misc/binaryheap.hpp @@ -85,7 +85,7 @@ protected: * @param item The proposed item for filling the gap * @return The (gap)position where the item fits */ - FORCEINLINE uint HeapifyDown(uint gap, T *item) + inline uint HeapifyDown(uint gap, T *item) { assert(gap != 0); @@ -121,7 +121,7 @@ protected: * @param item The proposed item for filling the gap * @return The (gap)position where the item fits */ - FORCEINLINE uint HeapifyUp(uint gap, T *item) + inline uint HeapifyUp(uint gap, T *item) { assert(gap != 0); @@ -142,7 +142,7 @@ protected: #if BINARYHEAP_CHECK /** Verify the heap consistency */ - FORCEINLINE void CheckConsistency() + inline void CheckConsistency() { for (uint child = 2; child <= this->items; child++) { uint parent = child / 2; @@ -157,28 +157,28 @@ public: * * @return The number of items in the queue */ - FORCEINLINE uint Length() const { return this->items; } + inline uint Length() const { return this->items; } /** * Test if the priority queue is empty. * * @return True if empty */ - FORCEINLINE bool IsEmpty() const { return this->items == 0; } + inline bool IsEmpty() const { return this->items == 0; } /** * Test if the priority queue is full. * * @return True if full. */ - FORCEINLINE bool IsFull() const { return this->items >= this->capacity; } + inline bool IsFull() const { return this->items >= this->capacity; } /** * Get the smallest item in the binary tree. * * @return The smallest item, or throw assert if empty. */ - FORCEINLINE T *Begin() + inline T *Begin() { assert(!this->IsEmpty()); return this->data[1]; @@ -191,7 +191,7 @@ public: * * @return The last item */ - FORCEINLINE T *End() + inline T *End() { return this->data[1 + this->items]; } @@ -201,7 +201,7 @@ public: * * @param new_item The pointer to the new item */ - FORCEINLINE void Include(T *new_item) + inline void Include(T *new_item) { if (this->IsFull()) { assert(this->capacity < UINT_MAX / 2); @@ -222,7 +222,7 @@ public: * * @return The pointer to the removed item */ - FORCEINLINE T *Shift() + inline T *Shift() { assert(!this->IsEmpty()); @@ -244,7 +244,7 @@ public: * * @param index The position of the item in the heap */ - FORCEINLINE void Remove(uint index) + inline void Remove(uint index) { if (index < this->items) { assert(index != 0); @@ -272,7 +272,7 @@ public: * @param item The reference to the item * @return The index of the item or zero if not found */ - FORCEINLINE uint FindIndex(const T &item) const + inline uint FindIndex(const T &item) const { if (this->IsEmpty()) return 0; for (T **ppI = this->data + 1, **ppLast = ppI + this->items; ppI <= ppLast; ppI++) { @@ -287,7 +287,7 @@ public: * Make the priority queue empty. * All remaining items will remain untouched. */ - FORCEINLINE void Clear() { this->items = 0; } + inline void Clear() { this->items = 0; } }; #endif /* BINARYHEAP_HPP */ diff --git a/src/misc/blob.hpp b/src/misc/blob.hpp index 94459a365..0b14a7eae 100644 --- a/src/misc/blob.hpp +++ b/src/misc/blob.hpp @@ -71,17 +71,17 @@ public: static const size_t header_size = sizeof(BlobHeader); /** default constructor - initializes empty blob */ - FORCEINLINE ByteBlob() { InitEmpty(); } + inline ByteBlob() { InitEmpty(); } /** copy constructor */ - FORCEINLINE ByteBlob(const ByteBlob &src) + inline ByteBlob(const ByteBlob &src) { InitEmpty(); AppendRaw(src); } /** move constructor - take ownership of blob data */ - FORCEINLINE ByteBlob(BlobHeader * const & src) + inline ByteBlob(BlobHeader * const & src) { assert(src != NULL); header = src; @@ -89,14 +89,14 @@ public: } /** destructor */ - FORCEINLINE ~ByteBlob() + inline ~ByteBlob() { Free(); } protected: /** all allocation should happen here */ - static FORCEINLINE BlobHeader *RawAlloc(size_t num_bytes) + static inline BlobHeader *RawAlloc(size_t num_bytes) { return (BlobHeader*)MallocT<byte>(num_bytes); } @@ -105,13 +105,13 @@ protected: * Return header pointer to the static BlobHeader with * both items and capacity containing zero */ - static FORCEINLINE BlobHeader *Zero() + static inline BlobHeader *Zero() { return const_cast<BlobHeader *>(&ByteBlob::hdrEmpty[1]); } /** simple allocation policy - can be optimized later */ - static FORCEINLINE size_t AllocPolicy(size_t min_alloc) + static inline size_t AllocPolicy(size_t min_alloc) { if (min_alloc < (1 << 9)) { if (min_alloc < (1 << 5)) return (1 << 5); @@ -130,7 +130,7 @@ protected: } /** all deallocations should happen here */ - static FORCEINLINE void RawFree(BlobHeader *p) + static inline void RawFree(BlobHeader *p) { /* Just to silence an unsilencable GCC 4.4+ warning. */ assert(p != ByteBlob::hdrEmpty); @@ -140,74 +140,74 @@ protected: } /** initialize the empty blob */ - FORCEINLINE void InitEmpty() + inline void InitEmpty() { header = Zero(); } /** initialize blob by attaching it to the given header followed by data */ - FORCEINLINE void Init(BlobHeader *src) + inline void Init(BlobHeader *src) { header = &src[1]; } /** blob header accessor - use it rather than using the pointer arithmetics directly - non-const version */ - FORCEINLINE BlobHeader& Hdr() + inline BlobHeader& Hdr() { return *(header - 1); } /** blob header accessor - use it rather than using the pointer arithmetics directly - const version */ - FORCEINLINE const BlobHeader& Hdr() const + inline const BlobHeader& Hdr() const { return *(header - 1); } /** return reference to the actual blob size - used when the size needs to be modified */ - FORCEINLINE size_t& LengthRef() + inline size_t& LengthRef() { return Hdr().items; } public: /** return true if blob doesn't contain valid data */ - FORCEINLINE bool IsEmpty() const + inline bool IsEmpty() const { return Length() == 0; } /** return the number of valid data bytes in the blob */ - FORCEINLINE size_t Length() const + inline size_t Length() const { return Hdr().items; } /** return the current blob capacity in bytes */ - FORCEINLINE size_t Capacity() const + inline size_t Capacity() const { return Hdr().capacity; } /** return pointer to the first byte of data - non-const version */ - FORCEINLINE byte *Begin() + inline byte *Begin() { return data; } /** return pointer to the first byte of data - const version */ - FORCEINLINE const byte *Begin() const + inline const byte *Begin() const { return data; } /** invalidate blob's data - doesn't free buffer */ - FORCEINLINE void Clear() + inline void Clear() { LengthRef() = 0; } /** free the blob's memory */ - FORCEINLINE void Free() + inline void Free() { if (Capacity() > 0) { RawFree(&Hdr()); @@ -216,7 +216,7 @@ public: } /** append new bytes at the end of existing data bytes - reallocates if necessary */ - FORCEINLINE void AppendRaw(const void *p, size_t num_bytes) + inline void AppendRaw(const void *p, size_t num_bytes) { assert(p != NULL); if (num_bytes > 0) { @@ -225,7 +225,7 @@ public: } /** append bytes from given source blob to the end of existing data bytes - reallocates if necessary */ - FORCEINLINE void AppendRaw(const ByteBlob& src) + inline void AppendRaw(const ByteBlob& src) { if (!src.IsEmpty()) { memcpy(Append(src.Length()), src.Begin(), src.Length()); @@ -236,7 +236,7 @@ public: * Reallocate if there is no free space for num_bytes bytes. * @return pointer to the new data to be added */ - FORCEINLINE byte *Prepare(size_t num_bytes) + inline byte *Prepare(size_t num_bytes) { size_t new_size = Length() + num_bytes; if (new_size > Capacity()) SmartAlloc(new_size); @@ -247,7 +247,7 @@ public: * Increase Length() by num_bytes. * @return pointer to the new data added */ - FORCEINLINE byte *Append(size_t num_bytes) + inline byte *Append(size_t num_bytes) { byte *pNewData = Prepare(num_bytes); LengthRef() += num_bytes; @@ -281,7 +281,7 @@ public: } /** fixing the four bytes at the end of blob data - useful when blob is used to hold string */ - FORCEINLINE void FixTail() const + inline void FixTail() const { if (Capacity() > 0) { byte *p = &data[Length()]; @@ -317,73 +317,73 @@ public: }; /** Default constructor - makes new Blob ready to accept any data */ - FORCEINLINE CBlobT() + inline CBlobT() : base() {} /** Take ownership constructor */ - FORCEINLINE CBlobT(const OnTransfer& ot) + inline CBlobT(const OnTransfer& ot) : base(ot.header) {} /** Destructor - ensures that allocated memory (if any) is freed */ - FORCEINLINE ~CBlobT() + inline ~CBlobT() { Free(); } /** Check the validity of item index (only in debug mode) */ - FORCEINLINE void CheckIdx(size_t index) const + inline void CheckIdx(size_t index) const { assert(index < Size()); } /** Return pointer to the first data item - non-const version */ - FORCEINLINE T *Data() + inline T *Data() { return (T*)base::Begin(); } /** Return pointer to the first data item - const version */ - FORCEINLINE const T *Data() const + inline const T *Data() const { return (const T*)base::Begin(); } /** Return pointer to the index-th data item - non-const version */ - FORCEINLINE T *Data(size_t index) + inline T *Data(size_t index) { CheckIdx(index); return (Data() + index); } /** Return pointer to the index-th data item - const version */ - FORCEINLINE const T *Data(size_t index) const + inline const T *Data(size_t index) const { CheckIdx(index); return (Data() + index); } /** Return number of items in the Blob */ - FORCEINLINE size_t Size() const + inline size_t Size() const { return (base::Length() / type_size); } /** Return total number of items that can fit in the Blob without buffer reallocation */ - FORCEINLINE size_t MaxSize() const + inline size_t MaxSize() const { return (base::Capacity() / type_size); } /** Return number of additional items that can fit in the Blob without buffer reallocation */ - FORCEINLINE size_t GetReserve() const + inline size_t GetReserve() const { return ((base::Capacity() - base::Length()) / type_size); } /** Grow number of data items in Blob by given number - doesn't construct items */ - FORCEINLINE T *GrowSizeNC(size_t num_items) + inline T *GrowSizeNC(size_t num_items) { return (T*)base::Append(num_items * type_size); } @@ -392,12 +392,12 @@ public: * Ensures that given number of items can be added to the end of Blob. Returns pointer to the * first free (unused) item */ - FORCEINLINE T *MakeFreeSpace(size_t num_items) + inline T *MakeFreeSpace(size_t num_items) { return (T*)base::Prepare(num_items * type_size); } - FORCEINLINE OnTransfer Transfer() + inline OnTransfer Transfer() { return OnTransfer(*this); } diff --git a/src/misc/countedptr.hpp b/src/misc/countedptr.hpp index fbf2a40df..0187422df 100644 --- a/src/misc/countedptr.hpp +++ b/src/misc/countedptr.hpp @@ -35,64 +35,64 @@ protected: public: /** default (NULL) construct or construct from a raw pointer */ - FORCEINLINE CCountedPtr(Tcls *pObj = NULL) : m_pT(pObj) {AddRef();} + inline CCountedPtr(Tcls *pObj = NULL) : m_pT(pObj) {AddRef();} /** copy constructor (invoked also when initializing from another smart ptr) */ - FORCEINLINE CCountedPtr(const CCountedPtr& src) : m_pT(src.m_pT) {AddRef();} + inline CCountedPtr(const CCountedPtr& src) : m_pT(src.m_pT) {AddRef();} /** destructor releasing the reference */ - FORCEINLINE ~CCountedPtr() {Release();} + inline ~CCountedPtr() {Release();} protected: /** add one ref to the underlaying object */ - FORCEINLINE void AddRef() {if (m_pT != NULL) m_pT->AddRef();} + inline void AddRef() {if (m_pT != NULL) m_pT->AddRef();} public: /** release smart pointer (and decrement ref count) if not null */ - FORCEINLINE void Release() {if (m_pT != NULL) {Tcls *pT = m_pT; m_pT = NULL; pT->Release();}} + inline void Release() {if (m_pT != NULL) {Tcls *pT = m_pT; m_pT = NULL; pT->Release();}} /** dereference of smart pointer - const way */ - FORCEINLINE const Tcls *operator -> () const {assert(m_pT != NULL); return m_pT;} + inline const Tcls *operator -> () const {assert(m_pT != NULL); return m_pT;} /** dereference of smart pointer - non const way */ - FORCEINLINE Tcls *operator -> () {assert(m_pT != NULL); return m_pT;} + inline Tcls *operator -> () {assert(m_pT != NULL); return m_pT;} /** raw pointer casting operator - const way */ - FORCEINLINE operator const Tcls*() const {assert(m_pT == NULL); return m_pT;} + inline operator const Tcls*() const {assert(m_pT == NULL); return m_pT;} /** raw pointer casting operator - non-const way */ - FORCEINLINE operator Tcls*() {return m_pT;} + inline operator Tcls*() {return m_pT;} /** operator & to support output arguments */ - FORCEINLINE Tcls** operator &() {assert(m_pT == NULL); return &m_pT;} + inline Tcls** operator &() {assert(m_pT == NULL); return &m_pT;} /** assignment operator from raw ptr */ - FORCEINLINE CCountedPtr& operator = (Tcls *pT) {Assign(pT); return *this;} + inline CCountedPtr& operator = (Tcls *pT) {Assign(pT); return *this;} /** assignment operator from another smart ptr */ - FORCEINLINE CCountedPtr& operator = (const CCountedPtr& src) {Assign(src.m_pT); return *this;} + inline CCountedPtr& operator = (const CCountedPtr& src) {Assign(src.m_pT); return *this;} /** assignment operator helper */ - FORCEINLINE void Assign(Tcls *pT); + inline void Assign(Tcls *pT); /** one way how to test for NULL value */ - FORCEINLINE bool IsNull() const {return m_pT == NULL;} + inline bool IsNull() const {return m_pT == NULL;} /** another way how to test for NULL value */ - //FORCEINLINE bool operator == (const CCountedPtr& sp) const {return m_pT == sp.m_pT;} + //inline bool operator == (const CCountedPtr& sp) const {return m_pT == sp.m_pT;} /** yet another way how to test for NULL value */ - //FORCEINLINE bool operator != (const CCountedPtr& sp) const {return m_pT != sp.m_pT;} + //inline bool operator != (const CCountedPtr& sp) const {return m_pT != sp.m_pT;} /** assign pointer w/o incrementing ref count */ - FORCEINLINE void Attach(Tcls *pT) {Release(); m_pT = pT;} + inline void Attach(Tcls *pT) {Release(); m_pT = pT;} /** detach pointer w/o decrementing ref count */ - FORCEINLINE Tcls *Detach() {Tcls *pT = m_pT; m_pT = NULL; return pT;} + inline Tcls *Detach() {Tcls *pT = m_pT; m_pT = NULL; return pT;} }; template <class Tcls_> -FORCEINLINE void CCountedPtr<Tcls_>::Assign(Tcls *pT) +inline void CCountedPtr<Tcls_>::Assign(Tcls *pT) { /* if they are the same, we do nothing */ if (pT != m_pT) { 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 */ diff --git a/src/misc/hashtable.hpp b/src/misc/hashtable.hpp index c59187f4e..60bdcec25 100644 --- a/src/misc/hashtable.hpp +++ b/src/misc/hashtable.hpp @@ -21,13 +21,13 @@ struct CHashTableSlotT Titem_ *m_pFirst; - FORCEINLINE CHashTableSlotT() : m_pFirst(NULL) {} + inline CHashTableSlotT() : m_pFirst(NULL) {} /** hash table slot helper - clears the slot by simple forgetting its items */ - FORCEINLINE void Clear() {m_pFirst = NULL;} + inline void Clear() {m_pFirst = NULL;} /** hash table slot helper - linear search for item with given key through the given blob - const version */ - FORCEINLINE const Titem_ *Find(const Key& key) const + inline const Titem_ *Find(const Key& key) const { for (const Titem_ *pItem = m_pFirst; pItem != NULL; pItem = pItem->GetHashNext()) { if (pItem->GetKey() == key) { @@ -39,7 +39,7 @@ struct CHashTableSlotT } /** hash table slot helper - linear search for item with given key through the given blob - non-const version */ - FORCEINLINE Titem_ *Find(const Key& key) + inline Titem_ *Find(const Key& key) { for (Titem_ *pItem = m_pFirst; pItem != NULL; pItem = pItem->GetHashNext()) { if (pItem->GetKey() == key) { @@ -51,7 +51,7 @@ struct CHashTableSlotT } /** hash table slot helper - add new item to the slot */ - FORCEINLINE void Attach(Titem_& new_item) + inline void Attach(Titem_& new_item) { assert(new_item.GetHashNext() == NULL); new_item.SetHashNext(m_pFirst); @@ -59,7 +59,7 @@ struct CHashTableSlotT } /** hash table slot helper - remove item from a slot */ - FORCEINLINE bool Detach(Titem_& item_to_remove) + inline bool Detach(Titem_& item_to_remove) { if (m_pFirst == &item_to_remove) { m_pFirst = item_to_remove.GetHashNext(); @@ -81,7 +81,7 @@ struct CHashTableSlotT } /** hash table slot helper - remove and return item from a slot */ - FORCEINLINE Titem_ *Detach(const Key& key) + inline Titem_ *Detach(const Key& key) { /* do we have any items? */ if (m_pFirst == NULL) { @@ -150,13 +150,13 @@ protected: public: /* default constructor */ - FORCEINLINE CHashTableT() : m_num_items(0) + inline CHashTableT() : m_num_items(0) { } protected: /** static helper - return hash for the given key modulo number of slots */ - FORCEINLINE static int CalcHash(const Tkey& key) + inline static int CalcHash(const Tkey& key) { int32 hash = key.CalcHash(); if ((8 * Thash_bits) < 32) hash ^= hash >> (min(8 * Thash_bits, 31)); @@ -168,14 +168,14 @@ protected: } /** static helper - return hash for the given item modulo number of slots */ - FORCEINLINE static int CalcHash(const Titem_& item) {return CalcHash(item.GetKey());} + inline static int CalcHash(const Titem_& item) {return CalcHash(item.GetKey());} public: /** item count */ - FORCEINLINE int Count() const {return m_num_items;} + inline int Count() const {return m_num_items;} /** simple clear - forget all items - used by CSegmentCostCacheT.Flush() */ - FORCEINLINE void Clear() {for (int i = 0; i < Tcapacity; i++) m_slots[i].Clear();} + inline void Clear() {for (int i = 0; i < Tcapacity; i++) m_slots[i].Clear();} /** const item search */ const Titem_ *Find(const Tkey& key) const diff --git a/src/misc/str.hpp b/src/misc/str.hpp index 1d58b63ae..b109b4e82 100644 --- a/src/misc/str.hpp +++ b/src/misc/str.hpp @@ -24,24 +24,24 @@ struct CStrA : public CBlobT<char> typedef CBlobT<char> base; ///< base class /** Create an empty CStrT */ - FORCEINLINE CStrA() + inline CStrA() { } /** Copy constructor */ - FORCEINLINE CStrA(const CStrA &src) : base(src) + inline CStrA(const CStrA &src) : base(src) { base::FixTail(); } /** Take over ownership constructor */ - FORCEINLINE CStrA(const OnTransfer& ot) + inline CStrA(const OnTransfer& ot) : base(ot) { } /** Grow the actual buffer and fix the trailing zero at the end. */ - FORCEINLINE char *GrowSizeNC(uint count) + inline char *GrowSizeNC(uint count) { char *ret = base::GrowSizeNC(count); base::FixTail(); @@ -49,7 +49,7 @@ struct CStrA : public CBlobT<char> } /** Append zero-ended C string. */ - FORCEINLINE void AppendStr(const char *str) + inline void AppendStr(const char *str) { if (!StrEmpty(str)) { base::AppendRaw(str, strlen(str)); @@ -58,7 +58,7 @@ struct CStrA : public CBlobT<char> } /** Append another CStrA. */ - FORCEINLINE void Append(const CStrA &src) + inline void Append(const CStrA &src) { if (src.Length() > 0) { base::AppendRaw(src); @@ -67,7 +67,7 @@ struct CStrA : public CBlobT<char> } /** Assignment from C string. */ - FORCEINLINE CStrA &operator = (const char *src) + inline CStrA &operator = (const char *src) { base::Clear(); AppendStr(src); @@ -75,7 +75,7 @@ struct CStrA : public CBlobT<char> } /** Assignment from another CStrA. */ - FORCEINLINE CStrA &operator = (const CStrA &src) + inline CStrA &operator = (const CStrA &src) { if (&src != this) { base::Clear(); @@ -86,7 +86,7 @@ struct CStrA : public CBlobT<char> } /** Lower-than operator (to support stl collections) */ - FORCEINLINE bool operator < (const CStrA &other) const + inline bool operator < (const CStrA &other) const { return strcmp(base::Data(), other.Data()) < 0; } |