Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public static int?ReadCompressedNullableInt(this IReadBytes stream)
 {
     if (!stream.ReadCompressedBool())
     {
         return(null);
     }
     return(stream.ReadCompressedInt());
 }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 public static T ReadCompressedEnum <T>(this IReadBytes stream) where T : Enum
 {
     return((T)(object)stream.ReadCompressedInt());
 }