分享方式:


__ll_lshift

Microsoft 特定的

將提供的 64 位值移入指定的位數左邊。

語法

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

參數

面具
[in]要向左移的 64 位整數值。

nBit
[in]要移位的位數。

傳回值

遮罩左移位 nBit

需求

內建 架構
__ll_lshift x86、x64

標頭檔 < intrin.h>

備註

如果您針對 64 位架構編譯器,且 nBit 大於 63,則要移位的位數為 nBit 模數 64。 如果您針對 32 位架構編譯器,且 nBit 大於 31,則要移位的位數為 nBit 模數 32。

ll名稱中的 ,表示它是在 ( __int64 ) 上的 long long 作業。

範例

// 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;
}

輸出

10000

注意

左移作業沒有未簽署的版本。 這是因為 __ll_lshift 已經使用不帶正負號的輸入參數。 不同于右移,左移沒有正負號相依性,因為不論值移位的正負號為何,結果中的最小有效位一律會設定為零。

END Microsoft 特定的

另請參閱

__ll_rshift
__ull_rshift
編譯器內建函式