__ll_lshift
Microsoft Specific
Shifts a 64-bit value specified by the first parameter to the left by a number of bits specified by the second parameter.
unsigned __int64 __ll_lshift(
unsigned __int64 Mask,
int nBit
);
Parameters
- [in] Mask
The 64-bit integer value to shift left.
- [in] nBit
The number of bits to shift, modulo 64.
Return Value
The mask shifted left by nBit bits.
Requirements
Intrinsic | Architecture |
---|---|
__ll_lshift |
x86, x64 |
Header file <intrin.h>
Remarks
If the second parameter is greater than 64, that number is taken modulo 64 to determine the number of bits to shift. The ll in the name indicates that this is an operation on long long (__int64).
Example
// ll_lshift.cpp
// compile with: /EHsc
// processor: x86, x64
#include <iostream>
#include <intrin.h>
using namespace std;
#pragma intrinsic(__ll_lshift)
int main()
{
unsigned __int64 Mask = 0x100;
int nBit = 8;
Mask = __ll_lshift(Mask, nBit);
cout << hex << Mask << endl;
}
Output
10000
Note There is no unsigned version of the left shift operation. Unlike the right shift, there is no sign dependence for the left shift, because the least significant bit in the result is always set to zero regardless of the sign of the value shifted.