Example #1
0
        private byte[] ReadValueIfIncluded(Bitstream stream, bool userDataFixedSize,
                                           uint userDataSizeBits)
        {
            var has_value = stream.ReadBool();

            if (!has_value)
            {
                return(null);
            }

            uint length;
            uint bitLength;

            if (userDataFixedSize)
            {
                length    = (userDataSizeBits + 7) / 8;
                bitLength = userDataSizeBits;
            }
            else
            {
                length    = stream.ReadBits(14);
                bitLength = 8 * length;
            }

            return(stream.ReadManyBits(bitLength));
        }
Example #2
0
        private byte[] ReadValueIfIncluded(Bitstream stream, bool userDataFixedSize,
                                           uint userDataSizeBits)
        {
            bool has_value = stream.ReadBool();

            if (!has_value)
            {
                return(null);
            }

            uint length;
            uint bitLength;

            if (userDataFixedSize)
            {
                length    = (userDataSizeBits + 7) / 8;
                bitLength = userDataSizeBits;
            }
            else
            {
                length    = stream.ReadBits(14);
                bitLength = 8 * length;
            }

            Preconditions.CheckArgument(length <= MAX_VALUE_SIZE);

            return(stream.ReadManyBits(bitLength));
        }
Example #3
0
 private float UnpackFloatNoScale(Bitstream stream)
 {
     byte[] data = stream.ReadManyBits(32);
     return(BitConverter.ToSingle(data, 0));
 }
Example #4
0
 private float UnpackFloatNoScale(Bitstream stream) {
     byte[] data = stream.ReadManyBits(32);
     return BitConverter.ToSingle(data, 0);
 }
Example #5
0
        private byte[] ReadValueIfIncluded(Bitstream stream, bool userDataFixedSize,
                uint userDataSizeBits) {
            bool has_value = stream.ReadBool();

            if (!has_value) {
                return null;
            }

            uint length;
            uint bitLength;

            if (userDataFixedSize) {
                length = (userDataSizeBits + 7) / 8;
                bitLength = userDataSizeBits;
            } else {
                length = stream.ReadBits(14);
                bitLength = 8 * length;
            }

            Preconditions.CheckArgument(length <= MAX_VALUE_SIZE);

            return stream.ReadManyBits(bitLength);
        }