private static int Get8BitStartShift(long value, bool isSigned)
{
if ((value >= sbyte.MinValue) && (value <= sbyte.MaxValue))
{
return 0;
}
var leading = value < 0 ? 0xFFL : 0x00L;
int shift;
long currentByte;
for (shift = StartShift8Bit;
((currentByte = (value >> shift) & 0xFF) == leading) && (shift > 0); shift -= Constants.BitsPerByte)
{
}
if (isSigned && ((value > 0) == ((currentByte & 0x80) != 0)))
{
shift += Constants.BitsPerByte;
}
return shift;
}