Exemplo n.º 1
0
 public static sbyte ReadSByte(ByteArray array)
 {
     if (!array.HasNext())
     {
         throw new IndexOutOfRangeException();
     }
     return((sbyte)array.Read());
 }
Exemplo n.º 2
0
        public static unsafe char ReadChar(ByteArray array)
        {
            if (!array.Has(Sizes.CharLength))
            {
                throw new IndexOutOfRangeException();
            }

            char  output;
            byte *ptr = (byte *)&output;

            for (int i = 0; i < Sizes.CharLength; i++)
            {
                ptr[i] = array.Read();
            }
            return(output);
        }
Exemplo n.º 3
0
        public static unsafe ushort ReadUShort(ByteArray array)
        {
            if (!array.Has(Sizes.UShortLength))
            {
                throw new IndexOutOfRangeException();
            }

            ushort output;
            byte * ptr = (byte *)&output;

            for (int i = 0; i < Sizes.UShortLength; i++)
            {
                ptr[i] = array.Read();
            }
            return(output);
        }
Exemplo n.º 4
0
        public static unsafe double ReadDouble(ByteArray array)
        {
            if (!array.Has(Sizes.DoubleLength))
            {
                throw new IndexOutOfRangeException();
            }

            double output;
            byte * ptr = (byte *)&output;

            for (int i = 0; i < Sizes.DoubleLength; i++)
            {
                ptr[i] = array.Read();
            }
            return(output);
        }