3.5.2.6.3 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

int BitLShift(int num, int 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

BitLShift(100, 2) = ;  // returns 400
BitLShift(10, 4) = ;  // returns 160

See Also

BitRShift