< 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
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 29
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
UpdateCrc32(...)0%660%
UpdateCrc32(...)100%110%

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)
 013        {
 014            Debug.Assert((buffer != null) && (offset >= 0) && (length >= 0) && (offset <= buffer.Length - length));
 015            fixed (byte* bufferPtr = &buffer[offset])
 016            {
 017                return Interop.ZLib.crc32(crc32, bufferPtr, length);
 18            }
 019        }
 20
 21        public static unsafe uint UpdateCrc32(uint crc32, ReadOnlySpan<byte> buffer)
 022        {
 023            fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer))
 024            {
 025                return Interop.ZLib.crc32(crc32, bufferPtr, buffer.Length);
 26            }
 027        }
 28    }
 29}