< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 17
Coverable lines: 17
Total lines: 39
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
Align(...)0%220%
Align(...)0%440%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BitArithmetic.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.Numerics;
 6
 7namespace System.Reflection.Internal
 8{
 9    internal static class BitArithmetic
 10    {
 11        internal static uint Align(uint position, uint alignment)
 012        {
 013            Debug.Assert(BitOperations.PopCount(alignment) == 1);
 14
 015            uint result = position & ~(alignment - 1);
 016            if (result == position)
 017            {
 018                return result;
 19            }
 20
 021            return result + alignment;
 022        }
 23
 24        internal static int Align(int position, int alignment)
 025        {
 026            Debug.Assert(position >= 0 && alignment > 0);
 027            Debug.Assert(BitOperations.PopCount((uint)alignment) == 1);
 28
 029            int result = position & ~(alignment - 1);
 030            if (result == position)
 031            {
 032                return result;
 33            }
 34
 035            return result + alignment;
 036        }
 37    }
 38}
 39