Skip to content

Commit

Permalink
addressing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Scooletz committed Aug 7, 2024
1 parent 4359ef7 commit 67ce49c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Paprika/Store/StorageFanOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static int GetIndex(scoped in NibblePath key, out NibblePath sliced)
{
Debug.Assert(key.IsOdd == false);

var at = (key.UnsafeSpan << TwoNibbleShift) + key.GetAt(2) & NibbleHalfLower;
var at = (key.UnsafeSpan << NibbleHalfShift) + (key.GetAt(2) & NibbleHalfLower);

Debug.Assert(0 <= at && at < DbAddressList.Of1024.Count);

Expand Down Expand Up @@ -204,7 +204,7 @@ private static int GetIndex(scoped in NibblePath key, Type type, out NibblePath
}

var at = (hi << TwoNibbleShift) + Unsafe.Add(ref key.UnsafeSpan, 1);
Debug.Assert(at < DbAddressList.Of1024.Count);
Debug.Assert(0 <= at && at < DbAddressList.Of1024.Count);

sliced = key.SliceFrom(Level1ConsumedNibblesForStorage);
return at;
Expand Down

0 comments on commit 67ce49c

Please sign in to comment.