• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

neon-sunset / U8String / 5953309698

23 Aug 2023 03:23PM UTC coverage: 21.364% (-1.9%) from 23.214%
5953309698

push

github

neon-sunset
perf: implement SIMD rune counting, add 3rd party notice for simdutf

133 of 874 branches covered (15.22%)

Branch coverage included in aggregate %.

53 of 53 new or added lines in 6 files covered. (100.0%)

481 of 2000 relevant lines covered (24.05%)

41214.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

42.86
/src/Extensions/VectorExtensions.cs
1
using System.Numerics;
2
using System.Runtime.Intrinsics;
3
using System.Runtime.Intrinsics.Arm;
4

5
namespace U8Primitives;
6

7
internal static class VectorExtensions
8
{
9
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
10
    internal static int CountMatches<T>(this Vector256<T> mask)
11
    {
12
        if (Vector256.IsHardwareAccelerated)
141!
13
        {
14
            return BitOperations.PopCount(mask.ExtractMostSignificantBits());
141✔
15
        }
16
        else
17
        {
18
            return CountMatches(mask.GetLower()) + CountMatches(mask.GetUpper());
×
19
        }
20
    }
21

22
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
23
    internal static int CountMatches<T>(this Vector128<T> mask)
24
    {
25
        if (AdvSimd.Arm64.IsSupported)
6!
26
        {
27
            var matches = AdvSimd
×
28
                .ShiftRightLogicalNarrowingLower(mask.AsUInt16(), 4)
×
29
                .AsUInt64()
×
30
                .ToScalar();
×
31
            return BitOperations.PopCount(matches) >> (int)((uint)BitOperations.PopCount(matches) / (4 * Unsafe.SizeOf<T>()));
×
32
        }
33
        else
34
        {
35
            return BitOperations.PopCount(mask.ExtractMostSignificantBits());
6✔
36
        }
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc