diff --git a/csharp/Platform.Numbers/Bit[T].cs b/csharp/Platform.Numbers/Bit[T].cs index 8e8b752..ec6ee07 100644 --- a/csharp/Platform.Numbers/Bit[T].cs +++ b/csharp/Platform.Numbers/Bit[T].cs @@ -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); @@ -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;