Пример #1
0
        public static ulong GetFrameContentSize(byte[] inputBytes, int inputOffset, int inputCount)
        {
            if (inputBytes == null)
            {
                throw new ArgumentNullException("inputBytes");
            }

            if (inputOffset < 0 || inputOffset >= inputBytes.Length)
            {
                throw new ArgumentOutOfRangeException("inputOffset");
            }

            if (inputCount <= 0 || inputOffset + inputCount > inputBytes.Length)
            {
                throw new ArgumentOutOfRangeException("inputCount");
            }

            ulong result;
            var   inputHandle  = GCHandle.Alloc(inputBytes, GCHandleType.Pinned);
            var   inputAddress = inputHandle.AddrOfPinnedObject() + inputOffset;

            result = _Is64Bit == true
                         ? ZstdNative64.GetFrameContentSize(inputAddress, (ulong)inputCount)
                         : ZstdNative32.GetFrameContentSize(inputAddress, (uint)inputCount);

            inputHandle.Free();
            return(result);
        }
Пример #2
0
 public static bool IsError(ulong code)
 {
     return((_Is64Bit == true ? ZstdNative64.IsError(code) : ZstdNative32.IsError((uint)code)) != 0);
 }