Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SubMod()

static unsafe int System.Numerics.BigIntegerCalculator.FastReducer.SubMod ( uint[] left,
int leftLength,
uint[] right,
int rightLength,
uint[] modulus,
int k )
inlinestaticprivate

Definition at line 215 of file BigIntegerCalculator.cs.

216 {
217 if (leftLength > k)
218 {
219 leftLength = k;
220 }
221 if (rightLength > k)
222 {
223 rightLength = k;
224 }
225 fixed (uint* left2 = left)
226 {
227 fixed (uint* right2 = right)
228 {
229 fixed (uint* right3 = modulus)
230 {
231 SubtractSelf(left2, leftLength, right2, rightLength);
232 leftLength = ActualLength(left, leftLength);
233 while (Compare(left2, leftLength, right3, modulus.Length) >= 0)
234 {
235 SubtractSelf(left2, leftLength, right3, modulus.Length);
236 leftLength = ActualLength(left, leftLength);
237 }
238 }
239 }
240 }
241 Array.Clear(left, leftLength, left.Length - leftLength);
242 return leftLength;
243 }
static int Compare(uint[] left, uint[] right)
static unsafe void SubtractSelf(uint *left, int leftLength, uint *right, int rightLength)

References System.Numerics.BigIntegerCalculator.ActualLength(), System.Array.Clear(), System.Numerics.BigIntegerCalculator.Compare(), and System.Numerics.BigIntegerCalculator.SubtractSelf().

Referenced by System.Numerics.BigIntegerCalculator.FastReducer.Reduce().