AcManager.PackedHelper.Decompress C# (CSharp) Method

Decompress() private static method

private static Decompress ( byte input, uint offset, int end, byte output ) : int
input byte
offset uint
end int
output byte
return int
        private static int Decompress(byte[] input, uint offset, int end, byte[] output) {
            uint oidx = 0;
            do {
                uint ctrl = input[offset++];
                if (ctrl < 1 << 5) {
                    ctrl++;
                    do {
                        output[oidx++] = input[offset++];
                    } while (--ctrl != 0);
                } else {
                    var len = ctrl >> 5;
                    var reference = (int)(oidx - ((ctrl & 0x1f) << 8) - 1);
                    if (len == 7) len += input[offset++];
                    reference -= input[offset++];
                    output[oidx++] = output[reference++];
                    output[oidx++] = output[reference++];
                    do {
                        output[oidx++] = output[reference++];
                    } while (--len != 0);
                }
            } while (offset < end);
            return (int)oidx;
        }