Return Type | Function name | Arguments |
---|---|---|
void | WriteSerialUINT64 | (hzChain&,unsigned int&,unsigned long,) |
Declared in file: hzCodec.h
Defined in file : hzCodec.cpp
Function Logic:
Function body:
void WriteSerialUINT64 (hzChain& Z, unsigned int& nLen, unsigned long nValue) { if (nValue < 0x80) { nLen = 1; Z.AddByte(nValue & 0x7f); } else if (nValue < 0x1000) { nLen = 2; Z.AddByte(0x80+((nValue&0x0f00)>>8)); Z.AddByte(nValue & 0xff); } else if (nValue < 0x100000) { nLen = 3; Z.AddByte(0x90+((nValue&0x0f0000)>>16)); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else if (nValue < 0x10000000) { nLen = 4; Z.AddByte(0xA0+((nValue&0x0f000000)>>24)); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else if (nValue < 0x1000000000) { nLen = 5; Z.AddByte(0xB0+((nValue&0x0f00000000)>>32)); Z.AddByte((nValue & 0xff000000)>>24); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else if (nValue < 0x100000000000) { nLen = 6; Z.AddByte(0xC0+((nValue&0x0f0000000000)>>40)); Z.AddByte((nValue & 0xff00000000)>>32); Z.AddByte((nValue & 0xff000000)>>24); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else if (nValue < 0x10000000000000) { nLen = 7; Z.AddByte(0xD0+((nValue&0x0f000000000000)>>48)); Z.AddByte((nValue & 0xff0000000000)>>40); Z.AddByte((nValue & 0xff00000000)>>32); Z.AddByte((nValue & 0xff000000)>>24); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else if (nValue < 0x1000000000000000) { nLen = 8; Z.AddByte(0xE0+((nValue&0x0f00000000000000)>>56)); Z.AddByte((nValue & 0xff000000000000)>>48); Z.AddByte((nValue & 0xff0000000000)>>40); Z.AddByte((nValue & 0xff00000000)>>32); Z.AddByte((nValue & 0xff000000)>>24); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else { nLen = 5; Z.AddByte(0xf0); Z.AddByte((nValue & 0xff00000000000000)>>56); Z.AddByte((nValue & 0xff000000000000)>>48); Z.AddByte((nValue & 0xff0000000000)>>40); Z.AddByte((nValue & 0xff00000000)>>32); Z.AddByte((nValue & 0xff000000)>>24); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } }