Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions csharp/Platform.Numbers/Bit[T].cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public static T PartialWrite(T target, T source, int shift, int limit)
{
if (shift < 0)
{
shift = 32 + shift;
shift = BitsSize + shift;
}
if (limit < 0)
{
limit = 32 + limit;
limit = BitsSize + limit;
}
var sourceMask = ~(T.MaxValue << limit) & T.MaxValue;
var targetMask = ~(sourceMask << shift);
Expand All @@ -40,11 +40,11 @@ public static T PartialRead(T target, int shift, int limit)
{
if (shift < 0)
{
shift = 32 + shift;
shift = BitsSize + shift;
}
if (limit < 0)
{
limit = 32 + limit;
limit = BitsSize + limit;
}
var sourceMask = ~(T.MaxValue << limit) & T.MaxValue;
var targetMask = sourceMask << shift;
Expand Down
Loading