示例#1
0
            public long UnpackLong()
            {
                byte markerByte = _in.ReadByte();

                if ((sbyte)markerByte >= MINUS_2_TO_THE_4)
                {
                    return((sbyte)markerByte);
                }
                switch (markerByte)
                {
                case INT_8:
                    return(_in.ReadSByte());

                case INT_16:
                    return(_in.ReadShort());

                case INT_32:
                    return(_in.ReadInt());

                case INT_64:
                    return(_in.ReadLong());

                default:
                    throw new ArgumentOutOfRangeException(nameof(markerByte), markerByte,
                                                          $"Expected an integer, but got: 0x{markerByte.ToString("X2")}");
                }
            }