Jcd.BitManipulation

A bit manipulation readability enhancement library.

Jcd.BitManipulation

Jcd.BitManipulation.Algorithms.SByteAlgorithmsExtensions

SByteAlgorithmsExtensions.RotateLeft(this sbyte, int) Method

Performs a bitwise left rotation on a number.

public static sbyte RotateLeft(this sbyte number, int count);

Parameters

number System.SByte

The number to rotate

count System.Int32

the number of bits to rotate

Returns

System.SByte The rotated value.

Example

Examples

sbyte b = 0b00001111;
var b2 = b.RotateLeft(3); // b2 = 0b01111000
var b3 = b.RotateLeft(4); // b3 = 0b11110000
var b4 = b.RotateLeft(5); // b4 = 0b11100001
var b5 = b.RotateLeft(6); // b5 = 0b11000011
var b6 = b.RotateLeft(7); // b6 = 0b10000111
var b7 = b.RotateLeft(8); // b7 = 0b00001111