-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Numbers/csharp/Platform.Numbers/Bit[T].cs
Lines 25 to 52 in f6bb486
| public static T PartialWrite(T target, T source, int shift, int limit) | |
| { | |
| if (shift < 0) | |
| { | |
| shift = 32 + shift; | |
| } | |
| if (limit < 0) | |
| { | |
| limit = 32 + limit; | |
| } | |
| var sourceMask = ~(T.MaxValue << limit) & T.MaxValue; | |
| var targetMask = ~(sourceMask << shift); | |
| return target & targetMask | (source & sourceMask) << shift; | |
| } | |
| public static T PartialRead(T target, int shift, int limit) | |
| { | |
| if (shift < 0) | |
| { | |
| shift = 32 + shift; | |
| } | |
| if (limit < 0) | |
| { | |
| limit = 32 + limit; | |
| } | |
| var sourceMask = ~(T.MaxValue << limit) & T.MaxValue; | |
| var targetMask = sourceMask << shift; | |
| return (target & targetMask) >> shift; | |
| } |
Numbers/csharp/Platform.Numbers/Bit[T].cs
Line 18 in f6bb486
| private static int BitsSize = NumericType<T>.BitsSize; |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working