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

◆ RightShiftWithRounding()

static ulong System.Number.RightShiftWithRounding ( ulong value,
int shift,
bool hasZeroTail )
inlinestaticprivate

Definition at line 3839 of file Number.cs.

3840 {
3841 if (shift >= 64)
3842 {
3843 return 0uL;
3844 }
3845 ulong num = (ulong)((1L << shift - 1) - 1);
3846 ulong num2 = (ulong)(1L << shift - 1);
3847 ulong num3 = (ulong)(1L << shift);
3848 bool lsbBit = (value & num3) != 0;
3849 bool roundBit = (value & num2) != 0;
3850 bool hasTailBits = !hasZeroTail || (value & num) != 0;
3851 return (value >> shift) + (ulong)(ShouldRoundUp(lsbBit, roundBit, hasTailBits) ? 1 : 0);
3852 }
static bool ShouldRoundUp(bool lsbBit, bool roundBit, bool hasTailBits)
Definition Number.cs:3854

References System.L, System.Number.ShouldRoundUp(), and System.value.

Referenced by System.Number.AssembleFloatingPointBits().