Skip to content

Commit

Permalink
fix: added few not-null assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
deniszykov committed Oct 2, 2023
1 parent cf39d28 commit b63a37c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/deniszykov.BaseN/BaseNDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,15 @@ private unsafe void EncodeAny<InputT, OutputT>(InputT input, int inputOffset, in
for (i = 0; i < inputBlockSize; i++)
{
inputBlock <<= 8;
inputBlock |= inputBytePtr[inputOffset++];
inputBlock |= inputBytePtr![inputOffset++];
}
}
if (typeof(InputT) == typeof(CharSafePtr))
{
for (i = 0; i < inputBlockSize; i++)
{
inputBlock <<= 8;
inputBlock |= inputCharPtr[inputOffset++];
inputBlock |= inputCharPtr![inputOffset++];
}
}
#endif
Expand Down Expand Up @@ -566,7 +566,7 @@ private unsafe void EncodeAny<InputT, OutputT>(InputT input, int inputOffset, in

for (i = 0; i < outputBlockSize; i++)
{
outputBytePtr[outputOffset++] = (byte)(outputBlock & 0xFF);
outputBytePtr![outputOffset++] = (byte)(outputBlock & 0xFF);
outputBlock >>= 8;
}
}
Expand All @@ -576,7 +576,7 @@ private unsafe void EncodeAny<InputT, OutputT>(InputT input, int inputOffset, in

for (i = 0; i < outputBlockSize; i++)
{
outputCharPtr[outputOffset++] = (char)(outputBlock & 0xFF);
outputCharPtr![outputOffset++] = (char)(outputBlock & 0xFF);
outputBlock >>= 8;
}
}
Expand Down Expand Up @@ -722,7 +722,7 @@ private unsafe void EncodeAny<InputT, OutputT>(InputT input, int inputOffset, in

for (i = 0; i < finalOutputBlockSize; i++)
{
outputBytePtr[outputOffset++] = (byte)(outputBlock & 0xFF);
outputBytePtr![outputOffset++] = (byte)(outputBlock & 0xFF);
outputBlock >>= 8;
}
}
Expand All @@ -732,7 +732,7 @@ private unsafe void EncodeAny<InputT, OutputT>(InputT input, int inputOffset, in

for (i = 0; i < finalOutputBlockSize; i++)
{
outputCharPtr[outputOffset++] = (char)(outputBlock & 0xFF);
outputCharPtr![outputOffset++] = (char)(outputBlock & 0xFF);
outputBlock >>= 8;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/deniszykov.BaseN/BaseNEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,11 @@ private unsafe void DecodeInternal<InputT, OutputT>(InputT input, int inputOffse
}
if (typeof(InputT) == typeof(ByteSafePtr))
{
baseNCode = inputBytePtr[inputOffset + inputUsed++];
baseNCode = inputBytePtr![inputOffset + inputUsed++];
}
if (typeof(InputT) == typeof(CharSafePtr))
{
baseNCode = inputCharPtr[inputOffset + inputUsed++];
baseNCode = inputCharPtr![inputOffset + inputUsed++];
}
#endif
inputCount--;
Expand Down Expand Up @@ -543,15 +543,15 @@ private unsafe void DecodeInternal<InputT, OutputT>(InputT input, int inputOffse
{
for (i = 0; i < outputSize; i++)
{
outputBytePtr[outputOffset + outputUsed + (outputSize - 1 - i)] = (byte)(outputBlock & 0xFF);
outputBytePtr![outputOffset + outputUsed + (outputSize - 1 - i)] = (byte)(outputBlock & 0xFF);
outputBlock >>= 8;
}
}
if (typeof(OutputT) == typeof(CharSafePtr))
{
for (i = 0; i < outputSize; i++)
{
outputCharPtr[outputOffset + outputUsed + (outputSize - 1 - i)] = (char)(outputBlock & 0xFF);
outputCharPtr![outputOffset + outputUsed + (outputSize - 1 - i)] = (char)(outputBlock & 0xFF);
outputBlock >>= 8;
}
}
Expand Down

0 comments on commit b63a37c

Please sign in to comment.