Skip to content

Commit 4a00eee

Browse files
authored
Merge pull request #27 from rameel/avx2-guard
Add AVX2.IsSupported guard in path scanning
2 parents 30d5a05 + 890238a commit 4a00eee

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ jobs:
1717
- name: Setup .NET
1818
uses: actions/setup-dotnet@v4
1919
with:
20-
dotnet-version: 9.0.x
20+
dotnet-version: |
21+
6.x
22+
7.x
23+
8.x
24+
9.x
2125
2226
- name: Checkout
2327
uses: actions/checkout@v4

Ramstack.Globbing/Internal/PathHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public PathSegmentIterator(int length) =>
309309

310310
while (_position < _length)
311311
{
312-
if (_mask != 0)
312+
if (Avx2.IsSupported && _mask != 0)
313313
{
314314
var offset = BitOperations.TrailingZeroCount(_mask);
315315
_last = _position + (nint)((uint)offset >> 1);
@@ -321,7 +321,7 @@ public PathSegmentIterator(int length) =>
321321
return ((int)start, (int)_last);
322322
}
323323

324-
if (_position + Vector256<ushort>.Count <= _length)
324+
if (Avx2.IsSupported && _position + Vector256<ushort>.Count <= _length)
325325
{
326326
var chunk = LoadVector256(ref source, _position);
327327
var allowEscapingMask = CreateAllowEscaping256Bitmask(flags);

0 commit comments

Comments
 (0)