Return TypeFunction nameArguments
voidWriteSerialUINT64(hzChain&,unsigned int&,unsigned long,)

Declared in file: hzCodec.h
Defined in file : hzCodec.cpp

Function Logic:

0:START 1:nValue<0x80 2:nLen hzChain::AddByte 3:nValue<0x1000 4:nLen hzChain::AddByte hzChain::AddByte 5:nValue<0x100000 6:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte 7:nValue<0x10000000 8:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte 9:nValue<0x1000000000 10:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte 11:nValue<0x100000000000 12:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte 13:nValue<0x10000000000000 14:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte 15:nValue<0x1000000000000000 16:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte 17:nLen hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte hzChain::AddByte 18: No text

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);
   }
}