mirror of
https://github.com/mangosfour/server.git
synced 2025-12-29 16:37:04 +00:00
[6953] Cleanup packed guids write/read code.
* Remove unused function writeGUID and move function readGUID (with some changes) to ByteBuffer class. * Remove now empty Tools.cpp/Tools.h from project.
This commit is contained in:
parent
cc4b43c65d
commit
9c5dab1248
10 changed files with 32 additions and 172 deletions
|
|
@ -241,6 +241,32 @@ class ByteBuffer
|
|||
_rpos += len;
|
||||
}
|
||||
|
||||
bool readPackGUID(uint64& guid)
|
||||
{
|
||||
if(rpos()+1 > size())
|
||||
return false;
|
||||
|
||||
guid = 0;
|
||||
|
||||
uint8 guidmark=0;
|
||||
(*this) >> guidmark;
|
||||
|
||||
for(int i=0;i<8;i++)
|
||||
{
|
||||
if(guidmark & (uint8(1) << i))
|
||||
{
|
||||
if(rpos()+1 > size())
|
||||
return false;
|
||||
|
||||
uint8 bit;
|
||||
(*this) >> bit;
|
||||
guid |= (uint64(bit) << (i*8));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const uint8 *contents() const { return &_storage[0]; }
|
||||
|
||||
size_t size() const { return _storage.size(); }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "6952"
|
||||
#define REVISION_NR "6953"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue