Ejemplo n.º 1
0
        // Section 2.4.1.3.14
        private static void PackCompressedChunkSignature(byte[] Data, DecompressionState state, CompressedChunkHeader header)
        {
            UInt16 temp   = (UInt16)(header.AsUInt16() & (ushort)0x8FFF);
            UInt16 result = (UInt16)(temp | (ushort)0x3000);

            header.SetFrom(result);
        }
Ejemplo n.º 2
0
        // Section 2.4.1.3.16
        private static void PackCompressedChunkFlag(byte[] Data, DecompressionState state, UInt16 CompressedFlag, CompressedChunkHeader header)
        {
            if (CompressedFlag != 0 && CompressedFlag != 1)
            {
                throw new ArgumentOutOfRangeException("CompressedFlag", "CompressedFlag must be 0 or 1");
            }

            UInt16 temp1  = (UInt16)(header.AsUInt16() & (ushort)0x7FFF);
            UInt16 temp2  = (UInt16)(CompressedFlag << 15);
            UInt16 result = (UInt16)(temp1 | temp2);

            header.SetFrom(result);
        }
Ejemplo n.º 3
0
        // Section 2.4.1.3.13
        // page 66
        private static void PackCompressedChunkSize(byte[] Data, DecompressionState state, UInt16 size, CompressedChunkHeader header)
        {
            if (size > 4098 || size < 3)
            {
                throw new ArgumentOutOfRangeException("size", "Size must be between 3 - 4098");
            }

            UInt16 temp1  = (UInt16)(header.AsUInt16() & (ushort)(0xF000));
            UInt16 temp2  = (UInt16)(size - 3);
            UInt16 result = (UInt16)(temp1 | temp2);

            header.SetFrom(result);
        }