internal void WriteInt(int v, TdsParserStateObject stateObj)
{
if ((stateObj._outBytesUsed + 4) > stateObj._outBuff.Length)
{
// if all of the int doesn't fit into the buffer
for (int shiftValue = 0; shiftValue < sizeof(int) * 8; shiftValue += 8)
{
stateObj.WriteByte((byte)((v >> shiftValue) & 0xff));
}
}
else
{
// all of the int fits into the buffer
// NOTE: We don't use a loop here for performance
stateObj._outBuff[stateObj._outBytesUsed] = (byte)(v & 0xff);
stateObj._outBuff[stateObj._outBytesUsed + 1] = (byte)((v >> 8) & 0xff);
stateObj._outBuff[stateObj._outBytesUsed + 2] = (byte)((v >> 16) & 0xff);
stateObj._outBuff[stateObj._outBytesUsed + 3] = (byte)((v >> 24) & 0xff);
stateObj._outBytesUsed += 4;
}
}