BitLShift
Description
Shift a given decimal number num left by the specified number of bits shift. It is proceeded as follows: firstly convert num into its binary representation, add 0 to the end of the binary, and then convert it back to the decimal number.
Syntax
__int64 BitLShift( __int64 num, __int64 shift)
Parameters
num
- The number in the decimal representation. It must be a non-negative integer.
shift
- The number of bits by which to shift num left. It should be a non-negative integer. If a negative value is given, it will return the same value as the absolute value of shift of the BitRShift function.
Return
Return a decimal number shifted left by the specified number of bits.
Example
EX1
BitLShift(100, 2) = ; // returns 400 BitLShift(10, 4) = ; // returns 160
EX21
i=hex(F1101010101); j=hex(F2010101011); Dec2hex(bitLShift(i,3),12)$=;// 788808080808