Breyta

Deila með


__ll_lshift

Microsoft Specific

Shifts the supplied 64-bit value to the left by the specified number of bits.

Syntax

unsigned __int64 __ll_lshift(
   unsigned __int64 Mask,
   int nBit
);

Parameters

Mask
[in] The 64-bit integer value to shift left.

nBit
[in] The number of bits to shift.

Return value

The mask shifted left by nBit bits.

Requirements

Intrinsic Architecture
__ll_lshift x86, x64

Header file <intrin.h>

Remarks

If you compile your program for the 64-bit architecture, and nBit is larger than 63, the number of bits to shift is nBit modulo 64. If you compile your program for the 32-bit architecture, and nBit is larger than 31, the number of bits to shift is nBit modulo 32.

The ll in the name indicates that it's 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. This is because __ll_lshift already uses an unsigned input parameter. 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.

END Microsoft Specific

See also

__ll_rshift
__ull_rshift
Compiler intrinsics