WriteInt(long int i) 64bit
Posted: 23 May 2016, 04:02
Xcode 64bit
why long int
when 64bit sizeof(long int)=8
Code: Select all
// -------------------------------------------------------------------
// WriteInt
// -------------------------------------------------------------------
void ByteArray::WriteInt(long int i)
{
CheckCompressedWrite();
unsigned char bytes[4];
bytes[0] = (i >> 24) & 0xFF;
bytes[1] = (i >> 16) & 0xFF;
bytes[2] = (i >> 8) & 0xFF;
bytes[3] = i & 0xFF;
boost::shared_ptr<vector<unsigned char> > buf (new vector<unsigned char>());
buf->push_back(bytes[0]);
buf->push_back(bytes[1]);
buf->push_back(bytes[2]);
buf->push_back(bytes[3]);
WriteBytes(buf);
}
why long int
when 64bit sizeof(long int)=8