public static long ReadUnsignedLong(ITransport trans) { byte b = trans.GetBinaryReader().ReadByte(); long i = b & 0x7F; for (int shift = 7; (b & 0x80) != 0; shift += 7) { b = trans.GetBinaryReader().ReadByte(); i |= (b & 0x7FL) << shift; } if (logger.IsTraceEnabled) logger.Trace(String.Format("Unsigned long read : " + i)); return i; }
public static int ReadUnsignedInt(ITransport trans) { byte b = trans.GetBinaryReader().ReadByte(); int i = b & 0x7F; for (int shift = 7; (b & 0x80) != 0; shift += 7) { i |= (b & (int)0x7FL) << shift; } if (logger.IsTraceEnabled) { logger.Trace(String.Format("Unsigned Int read : " + i)); } return i; }