For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

Microsoft Specific

on x64, shifts a 64-bit value specified by the first parameter to the right by a number of bits specified by the second parameter.

unsigned __int64 __ull_rshift(   
   unsigned __int64 mask,    
   int nBit   


[in] mask
The 64-bit integer value to shift right.

[in] nBit
The number of bits to shift, modulo 32 on x86, and modulo 64 on x64.

The mask shifted by nBit bits.

__ull_rshiftx86, x64

Header file <intrin.h>

If the second parameter is greater than 31 on x86 (63 on x64), that number is taken modulo 32 (64 on x64) to determine the number of bits to shift. The ull in the name indicates unsigned long long (unsigned __int64).

// ull_rshift.cpp  
// compile with: /EHsc  
// processor: x86, x64  
#include <iostream>  
#include <intrin.h>  
using namespace std;  
#pragma intrinsic(__ull_rshift)  
int main()  
   unsigned __int64 mask = 0x100;  
   int nBit = 8;  
   mask = __ull_rshift(mask, nBit);  
   cout << hex << mask << endl;  


END Microsoft Specific

Compiler Intrinsics