Return Type | Function name | Arguments |
---|---|---|
void | WriteSerialUINT32 | (hzChain&,unsigned int&,unsigned int,) |
Declared in file: hzCodec.h
Defined in file : hzCodec.cpp
Function Logic:
Function body:
void WriteSerialUINT32 (hzChain& Z, unsigned int& nLen, unsigned int nValue) { if (nValue < 0x80) { nLen = 1; Z.AddByte(nValue & 0x7f); } else if (nValue < 0x2000) { nLen = 2; Z.AddByte(0x80+((nValue&0x1f00)>>8)); Z.AddByte(nValue & 0xff); } else if (nValue < 0x200000) { nLen = 3; Z.AddByte(0xA0+((nValue&0x1f0000)>>16)); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else if (nValue < 0x20000000) { nLen = 4; Z.AddByte(0xC0+((nValue&0x1f000000)>>24)); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } else { nLen = 5; Z.AddByte(0xE0); Z.AddByte((nValue & 0xff000000)>>24); Z.AddByte((nValue & 0xff0000)>>16); Z.AddByte((nValue & 0xff00)>>8); Z.AddByte(nValue & 0xff); } }