mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
Make back use of define
Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
parent
6b5887cc8c
commit
53b2e576d1
1 changed files with 7 additions and 5 deletions
|
|
@ -85,6 +85,8 @@ struct PackedGuidReader
|
||||||
ObjectGuid* m_guidPtr;
|
ObjectGuid* m_guidPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUM_GUID_BYTES sizeof(uint64)
|
||||||
|
|
||||||
class MANGOS_DLL_SPEC ObjectGuid
|
class MANGOS_DLL_SPEC ObjectGuid
|
||||||
{
|
{
|
||||||
public: // constructors
|
public: // constructors
|
||||||
|
|
@ -174,23 +176,23 @@ class MANGOS_DLL_SPEC ObjectGuid
|
||||||
|
|
||||||
uint8& operator[] (uint8 index)
|
uint8& operator[] (uint8 index)
|
||||||
{
|
{
|
||||||
MANGOS_ASSERT(index < 8);
|
MANGOS_ASSERT(index < NUM_GUID_BYTES);
|
||||||
|
|
||||||
#if MANGOS_ENDIAN == MANGOS_LITTLEENDIAN
|
#if MANGOS_ENDIAN == MANGOS_LITTLEENDIAN
|
||||||
return m_guidBytes[index];
|
return m_guidBytes[index];
|
||||||
#else
|
#else
|
||||||
return m_guidBytes[7 - index];
|
return m_guidBytes[NUM_GUID_BYTES - 1 - index];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 const& operator[] (uint8 index) const
|
uint8 const& operator[] (uint8 index) const
|
||||||
{
|
{
|
||||||
MANGOS_ASSERT(index < 8);
|
MANGOS_ASSERT(index < NUM_GUID_BYTES);
|
||||||
|
|
||||||
#if MANGOS_ENDIAN == MANGOS_LITTLEENDIAN
|
#if MANGOS_ENDIAN == MANGOS_LITTLEENDIAN
|
||||||
return m_guidBytes[index];
|
return m_guidBytes[index];
|
||||||
#else
|
#else
|
||||||
return m_guidBytes[7 - index];
|
return m_guidBytes[NUM_GUID_BYTES - 1 - index];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,7 +230,7 @@ class MANGOS_DLL_SPEC ObjectGuid
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
uint64 m_guid;
|
uint64 m_guid;
|
||||||
uint8 m_guidBytes[8];
|
uint8 m_guidBytes[NUM_GUID_BYTES];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue