public static decimal ReadCompressedDecimal(this IReadBytes stream) { var bits = new int[4]; bits[0] = stream.ReadCompressedInt(); bits[1] = stream.ReadCompressedInt(); bits[2] = stream.ReadCompressedInt(); bits[3] = stream.ReadCompressedInt(); return(new decimal(bits)); }
public static int?ReadCompressedNullableInt(this IReadBytes stream) { if (!stream.ReadCompressedBool()) { return(null); } return(stream.ReadCompressedInt()); }
public static double ReadDoubleOffset(this IReadBytes stream, double seed, double tickSize) { var numTicks = stream.ReadCompressedInt(); /// Since this is true 80% of the time in a trading platform, we use this optimization for significant performance gains. if (numTicks == 0) { return(seed); } return(ToValue(tickSize, ToTicks(seed, tickSize) + numTicks)); }
public static T ReadCompressedEnum <T>(this IReadBytes stream) where T : Enum { return((T)(object)stream.ReadCompressedInt()); }