Skip to content

Commit

Permalink
IL2CPP compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-st committed May 18, 2023
1 parent 314fbc4 commit f394937
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ZstdSharp/Unsafe/ZstdCompress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3221,7 +3221,7 @@ private static nuint ZSTD_buildSeqStore(ZSTD_CCtx_s* zc, void* src, nuint srcSiz
ZSTD_matchState_t* ms = &zc->blockState.matchState;
assert(srcSize <= 1 << 17);
ZSTD_assertEqualCParams(zc->appliedParams.cParams, ms->cParams);
if (srcSize < 1 + 1 + ZSTD_blockHeaderSize + 1 + 1)
if (srcSize < (nuint)(1 + 1) + ZSTD_blockHeaderSize + 1 + 1)
{
if (zc->appliedParams.cParams.strategy >= ZSTD_strategy.ZSTD_btopt)
{
Expand Down Expand Up @@ -4422,7 +4422,7 @@ private static nuint ZSTD_compress_frameChunk(ZSTD_CCtx_s* cctx, void* dst, nuin
{
ZSTD_matchState_t* ms = &cctx->blockState.matchState;
uint lastBlock = lastFrameChunk & (uint)(blockSize >= remaining ? 1 : 0);
if (dstCapacity < ZSTD_blockHeaderSize + (1 + 1) + 1)
if (dstCapacity < ZSTD_blockHeaderSize + (nuint)(1 + 1) + 1)
{
return unchecked((nuint)(-(int)ZSTD_ErrorCode.ZSTD_error_dstSize_tooSmall));
}
Expand Down Expand Up @@ -7103,7 +7103,7 @@ private static nuint ZSTD_compressSequences_internal(ZSTD_CCtx_s* cctx, void* ds
}

blockSize -= additionalByteAdjustment;
if (blockSize < 1 + 1 + ZSTD_blockHeaderSize + 1 + 1)
if (blockSize < (nuint)(1 + 1) + ZSTD_blockHeaderSize + 1 + 1)
{
cBlockSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock);
{
Expand Down
2 changes: 1 addition & 1 deletion src/ZstdSharp/Unsafe/ZstdDecompress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ public static nuint ZSTD_freeDStream(ZSTD_DCtx_s* zds)
/* *** Initialization *** */
public static nuint ZSTD_DStreamInSize()
{
return (1 << 17) + ZSTD_blockHeaderSize;
return (nuint)(1 << 17) + ZSTD_blockHeaderSize;
}

public static nuint ZSTD_DStreamOutSize()
Expand Down
2 changes: 1 addition & 1 deletion src/ZstdSharp/Unsafe/ZstdInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static unsafe partial class Methods
public static readonly uint* repStartValue = GetArrayPointer(new uint[3] { 1, 4, 8 });
public static readonly nuint* ZSTD_fcs_fieldSize = GetArrayPointer(new nuint[4] { 0, 2, 4, 8 });
public static readonly nuint* ZSTD_did_fieldSize = GetArrayPointer(new nuint[4] { 0, 1, 2, 4 });
public const nuint ZSTD_blockHeaderSize = 3;
public const uint ZSTD_blockHeaderSize = 3;
public static readonly byte* LL_bits = GetArrayPointer(new byte[36] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 });
public static readonly short* LL_defaultNorm = GetArrayPointer(new short[36] { 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1, -1, -1, -1, -1 });
public const uint LL_defaultNormLog = 6;
Expand Down

0 comments on commit f394937

Please sign in to comment.