leftRoll function
Implementation
int leftRoll(int value, int count) {
/// The count value specifies by how many places the hexadecimal value is shifted in bits.
/// For example: Value: 1100 0011, count 5. 1.Round: 1000 0111, 2.Round: 0000 1111, 3.Round: 0001 1110, 4.Round: 0011 1100, 5.Round: 0111 1000
/// Result: 0111 1000
String valueBit = value.toRadixString(2);
if (valueBit.length < 32) {
/// as long as the size of the value does not have 32 bits, a 0 is always introduced.
while (valueBit.length < 32) {
valueBit = "0$valueBit";
}
}
String firstBit = valueBit.substring(0, count);
String lastBit = valueBit.substring(count, valueBit.length);
return int.parse(lastBit + firstBit, radix: 2);
/// The last bits are placed after the first bits and converted to int again
}