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

neon-sunset / U8String / 6005208900

28 Aug 2023 09:36PM UTC coverage: 18.096% (-0.2%) from 18.326%
6005208900

push

github

neon-sunset
feat: Extend NativeU8String and restructure solution to account for increased line count, add roadmap draft

134 of 1050 branches covered (0.0%)

Branch coverage included in aggregate %.

1058 of 1058 new or added lines in 25 files covered. (100.0%)

478 of 2332 relevant lines covered (20.5%)

35305.41 hits per line

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

0.0
/src/Implementations/Native/NativeU8String.Indexing.cs
1
namespace U8Primitives;
2

3
public readonly unsafe partial struct NativeU8String
4
{
5
    // TODO: Write an analyzer that warns against indexing with `int` which can overflow.
6
    public ref readonly byte this[nint index]
7
    {
8
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
9
        get
10
        {
11
            if ((nuint)index >= (nuint)_length)
×
12
            {
13
                ThrowHelpers.IndexOutOfRange();
×
14
            }
15

16
            return ref _ptr[index];
×
17
        }
18
    }
19

20
    public ref readonly byte this[Index index]
21
    {
22
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
23
        get
24
        {
25
            var idx = index.GetOffset((int)_length);
×
26
            if (idx < 0 || (nint)(uint)idx >= _length)
×
27
            {
28
                ThrowHelpers.IndexOutOfRange();
×
29
            }
30

31
            return ref _ptr[idx];
×
32
        }
33
    }
34
}
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