Make back use of define

Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-08-04 02:08:58 +03:00 committed by Antz
parent 6b5887cc8c
commit 53b2e576d1

View file

@ -85,6 +85,8 @@ struct PackedGuidReader
ObjectGuid* m_guidPtr;
};
#define NUM_GUID_BYTES sizeof(uint64)
class MANGOS_DLL_SPEC ObjectGuid
{
public: // constructors
@ -174,23 +176,23 @@ class MANGOS_DLL_SPEC ObjectGuid
uint8& operator[] (uint8 index)
{
MANGOS_ASSERT(index < 8);
MANGOS_ASSERT(index < NUM_GUID_BYTES);
#if MANGOS_ENDIAN == MANGOS_LITTLEENDIAN
return m_guidBytes[index];
#else
return m_guidBytes[7 - index];
return m_guidBytes[NUM_GUID_BYTES - 1 - index];
#endif
}
uint8 const& operator[] (uint8 index) const
{
MANGOS_ASSERT(index < 8);
MANGOS_ASSERT(index < NUM_GUID_BYTES);
#if MANGOS_ENDIAN == MANGOS_LITTLEENDIAN
return m_guidBytes[index];
#else
return m_guidBytes[7 - index];
return m_guidBytes[NUM_GUID_BYTES - 1 - index];
#endif
}
@ -228,7 +230,7 @@ class MANGOS_DLL_SPEC ObjectGuid
union
{
uint64 m_guid;
uint8 m_guidBytes[8];
uint8 m_guidBytes[NUM_GUID_BYTES];
};
};