< Summary

Information
Class: System.IO.Compression.Crc32Helper
Assembly: System.IO.Compression
File(s): D:\runner\runtime\src\libraries\System.IO.Compression\src\System\IO\Compression\Crc32Helper.ZLib.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 29
Line coverage: 100%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
UpdateCrc32(...)50%66100%
UpdateCrc32(...)100%11100%

File(s)

D:\runner\runtime\src\libraries\System.IO.Compression\src\System\IO\Compression\Crc32Helper.ZLib.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Diagnostics;
 5using System.Runtime.InteropServices;
 6
 7namespace System.IO.Compression
 8{
 9    internal static class Crc32Helper
 10    {
 11        // Calculate CRC based on the old CRC and the new bytes
 12        public static unsafe uint UpdateCrc32(uint crc32, byte[] buffer, int offset, int length)
 64613        {
 64614            Debug.Assert((buffer != null) && (offset >= 0) && (length >= 0) && (offset <= buffer.Length - length));
 64615            fixed (byte* bufferPtr = &buffer[offset])
 64616            {
 64617                return Interop.ZLib.crc32(crc32, bufferPtr, length);
 18            }
 64619        }
 20
 21        public static unsafe uint UpdateCrc32(uint crc32, ReadOnlySpan<byte> buffer)
 193822        {
 193823            fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer))
 193824            {
 193825                return Interop.ZLib.crc32(crc32, bufferPtr, buffer.Length);
 26            }
 193827        }
 28    }
 29}