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

◆ Div128By96()

static uint System.Decimal.DecCalc.Div128By96 ( ref Buf16 bufNum,
ref Buf12 bufDen )
inlinestaticprivate

Definition at line 444 of file Decimal.cs.

445 {
446 ulong high = bufNum.High64;
447 uint u = bufDen.U2;
448 if (high < u)
449 {
450 return 0u;
451 }
452 uint num = (uint)(high / u);
453 uint num2 = (uint)(int)high - num * u;
454 ulong num3 = UInt32x32To64(num, bufDen.U0);
455 ulong num4 = UInt32x32To64(num, bufDen.U1);
456 num4 += num3 >> 32;
457 num3 = (uint)num3 | (num4 << 32);
458 num4 >>= 32;
459 ulong low = bufNum.Low64;
460 low -= num3;
461 num2 -= (uint)(int)num4;
462 if (low > ~num3)
463 {
464 num2--;
465 if (num2 >= (uint)(~num4))
466 {
467 goto IL_008b;
468 }
469 }
470 else if (num2 > (uint)(~num4))
471 {
472 goto IL_008b;
473 }
474 goto IL_00b4;
475 IL_008b:
476 num3 = bufDen.Low64;
477 do
478 {
479 num--;
480 low += num3;
481 num2 += u;
482 }
483 while ((low >= num3 || num2++ >= u) && num2 >= u);
484 goto IL_00b4;
485 IL_00b4:
487 bufNum.U2 = num2;
488 return num;
489 }
static ulong UInt32x32To64(uint a, uint b)
Definition Decimal.cs:300

References System.Runtime.Serialization.Dictionary, and System.Decimal.DecCalc.UInt32x32To64().

Referenced by System.Decimal.DecCalc.VarDecDiv(), and System.Decimal.DecCalc.VarDecModFull().