Example #1
0
            public static CCtx *Copy(CCtx *ctx, ulong pledgedSrcSize = ulong.MaxValue)
            {
                CCtx *newCtx;

                Copy(&newCtx, ctx, pledgedSrcSize).EnsureZStdSuccess();
                return(newCtx);
            }
Example #2
0
            public static UIntPtr GetParameter(CCtx *cCtx, CompressionParameter parameter, out int value)
            {
                value = default;

                fixed(int *pValue = &value)
                return(GetParameter(cCtx, parameter, pValue));
            }
Example #3
0
 public static UIntPtr GetBytesReadyToFlush(CCtx *cCtx)
 {
     IL.Push(cCtx);
     IL.Push(ZSTD_toFlushNow);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *)));
     return(IL.Return <UIntPtr>());
 }
Example #4
0
 public static UIntPtr SizeOfCCtx(CCtx *cCtx)
 {
     IL.Push(cCtx);
     IL.Push(ZSTD_sizeof_CCtx);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *)));
     return(IL.Return <UIntPtr>());
 }
Example #5
0
 private static UIntPtr GetBlockSize(CCtx *ctx)
 {
     IL.Push(ctx);
     IL.Push(ZSTD_getBlockSize);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *)));
     return(IL.Return <UIntPtr>());
 }
Example #6
0
            public static UIntPtr StreamCompress(CCtx *ctx, ref ArraySegment <byte> output, ref ArraySegment <byte> input, EndDirective endOp)
            {
                UIntPtr result = default;

                Buffer.WithArraySegmentPair(ref output, ref input, (ref Buffer outBuf, ref Buffer inBuf) => {
                    result = StreamCompress(ctx, ref outBuf, ref inBuf, endOp);
                });

                return(result);
            }
Example #7
0
 public static UIntPtr GetParameterBounds(CCtx *cCtx, ulong pledgedSrcSize)
 {
     IL.Push(cCtx);
     IL.Push(pledgedSrcSize);
     IL.Push(ZSTD_CCtx_setPledgedSrcSize);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(ulong)));
     return(IL.Return <UIntPtr>());
 }
Example #8
0
 public static UIntPtr ResetCCtx(CCtx *cCtx, ResetDirective reset)
 {
     IL.Push(cCtx);
     IL.Push(reset);
     IL.Push(ZSTD_CCtx_reset);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(ResetDirective)));
     return(IL.Return <UIntPtr>());
 }
Example #9
0
 public static UIntPtr ReferenceDictionary(CCtx *cCtx, CDict *cDict)
 {
     IL.Push(cCtx);
     IL.Push(cDict);
     IL.Push(ZSTD_CCtx_refCDict);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(CDict *)));
     return(IL.Return <UIntPtr>());
 }
Example #10
0
 private static UIntPtr Copy(CCtx **cCtx, CCtx *preparedCCtx, ulong pledgedSrcSize = ulong.MaxValue)
 {
     IL.Push(cCtx);
     IL.Push(preparedCCtx);
     IL.Push(pledgedSrcSize);
     IL.Push(ZSTD_copyCCtx);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx * *), typeof(CCtx *), typeof(ulong)));
     return(IL.Return <UIntPtr>());
 }
Example #11
0
 private static UIntPtr GetParameter(CCtx *cCtx, CompressionParameter parameter, int *value)
 {
     IL.Push(cCtx);
     IL.Push(parameter);
     IL.Push(value);
     IL.Push(ZSTD_CCtx_getParameter);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(CompressionParameter), typeof(int *)));
     return(IL.Return <UIntPtr>());
 }
Example #12
0
 private static UIntPtr ReferenceDictionary(CCtx *cCtx, byte *dict, UIntPtr dictSize)
 {
     IL.Push(cCtx);
     IL.Push(dict);
     IL.Push(dictSize);
     IL.Push(ZSTD_CCtx_loadDictionary_byReference);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(byte *), typeof(UIntPtr)));
     return(IL.Return <UIntPtr>());
 }
Example #13
0
 public static UIntPtr StreamCompress(CCtx *ctx, Buffer *output, Buffer *input, EndDirective endOp)
 {
     IL.Push(ctx);
     IL.Push(output);
     IL.Push(input);
     IL.Push(endOp);
     IL.Push(ZSTD_compressStream2);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(Buffer *), typeof(Buffer *), typeof(EndDirective)));
     return(IL.Return <UIntPtr>());
 }
Example #14
0
 public static UIntPtr StreamCompress(CCtx *ctx, ref Buffer output, ref Buffer input, EndDirective endOp)
 {
     fixed(Buffer *pOutput = &output)
     fixed(Buffer * pInput = &input)
     {
         return(StreamCompress(
                    ctx,
                    pOutput,
                    pInput,
                    endOp
                    ));
     }
 }
Example #15
0
 private static UIntPtr Compress(CCtx *ctx, byte *dst, UIntPtr dstCapacity, byte *src, UIntPtr srcSize)
 {
     IL.Push(ctx);
     IL.Push(dst);
     IL.Push(dstCapacity);
     IL.Push(src);
     IL.Push(srcSize);
     IL.Push(ZSTD_compress2);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *), typeof(byte *), typeof(UIntPtr), typeof(byte *), typeof(UIntPtr)));
     return(IL.Return <UIntPtr>());
 }
Example #16
0
 public static UIntPtr StreamCompress(CCtx *ctx, byte *dst, UIntPtr dstCapacity, UIntPtr *dstPos, byte *src, UIntPtr srcSize, UIntPtr *srcPos, EndDirective endOp)
 {
     IL.Push(ctx);
     IL.Push(dst);
     IL.Push(dstCapacity);
     IL.Push(dstPos);
     IL.Push(src);
     IL.Push(srcSize);
     IL.Push(srcPos);
     IL.Push(endOp);
     IL.Push(ZSTD_compressStream2_simpleArgs);
     IL.Emit.Tail();
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(UIntPtr),
                                           typeof(CCtx *),
                                           typeof(byte *), typeof(UIntPtr), typeof(UIntPtr *),
                                           typeof(byte *), typeof(UIntPtr), typeof(UIntPtr *),
                                           typeof(EndDirective)));
     return(IL.Return <UIntPtr>());
 }
Example #17
0
 public static UIntPtr Compress(CCtx *ctx, Span <byte> dst, ReadOnlySpan <byte> src) {
     fixed(byte *pDst = dst)
     fixed(byte *pSrc = src)
     return(Compress(ctx, pDst, (UIntPtr)dst.Length, pSrc, (UIntPtr)src.Length));
 }
Example #18
0
 public static UIntPtr ReferenceDictionary(CCtx *cCtx, ReadOnlySpan <byte> dict) {
     fixed(byte *pDict = dict)
     return(ReferenceDictionary(cCtx, pDict, (UIntPtr)dict.Length));
 }
Example #19
0
 public static UIntPtr ResetDictionary(CCtx *cCtx)
 => ReferenceDictionary(cCtx, default(CDict *));