src/NeinMath/Integer.cs
/// <summary>
/// Shifts an Integer a specified number of bits to the right.
/// </summary>
/// <param name="shift">
/// The number of bits to shift to the right.
/// </param>
/// <returns>
/// An Integer that has been shifted to the right by the specified
/// number of bits.
/// </returns>
Shifts an Integer a specified number of bits to the right.
Shifts an Integer a specified number of bits to the right .
public Integer RightShift(int shift)
        {
            var selfBits = sign
                ? Bits.TwosComplement(bits, length) : bits;
            var shiftPad = sign
                ? 0xFFFFFFFF : 0x00000000;
            var result = Calc.Shift(selfBits, length, -shift, shiftPad);
            if (sign)
                result = Bits.TwosComplement(result, result.Length);
            return new Integer(result, result.Length, sign);
        }
public Integer RightShift ( int shift ) { var selfBits = sign ? Bits . TwosComplement ( bits , length ) : bits ; var shiftPad = sign ? 0xFFFFFFFF : 0x00000000 ; var result = Calc . Shift ( selfBits , length , - shift , shiftPad ) ; if ( sign ) result = Bits . TwosComplement ( result , result . Length ) ; return new Integer ( result , result . Length , sign ) ; }
Shifts an Integer a specified number of bits to the right.
Shifts an Integer a specified number of bits to the right .
An Integer that has been shifted to the right by the specified
number of bits.
An Integer that has been shifted to the right by the specified number of bits .
shift
int
The number of bits to shift to the right.
The number of bits to shift to the right .