_lrotl _lrotr

旋轉左邊的位元 (_lrotl) 或向右 (_lrotr)。

unsigned long _lrotl(
   unsigned long value,
   int shift 
);
unsigned long _lrotr(
   unsigned long value,
   int shift 
);

參數

  • value
    若要旋轉的值。

  • shift
    要移位的位元數

傳回值

這兩個函數會傳回旋轉的值。沒有任何錯誤傳回。

備註

_lrotl和**_lrotr函式旋轉的shift位元。_lrotl旋轉保留的值。_lrotr**旋轉的值的權限。這兩個函式包裝位元旋轉某端到另一端。

需求

常式

所需的標頭

_lrotl

<stdlib.h>

_lrotr

<stdlib.h>

如需相容性資訊,請參閱相容性在簡介中。

文件庫

所有版本的 C 執行階段程式庫

範例

// crt_lrot.c

#include <stdlib.h>
#include <stdio.h>

int main( void )
{
   unsigned long val = 0x0fac35791;

   printf( "0x%8.8lx rotated left eight times is 0x%8.8lx\n", 
            val, _lrotl( val, 8 ) );
   printf( "0x%8.8lx rotated right four times is 0x%8.8lx\n", 
            val, _lrotr( val, 4 ) );
}

Output

0xfac35791 rotated left eight times is 0xc35791fa
0xfac35791 rotated right four times is 0x1fac3579

.NET Framework 對等用法

不適用。 若要呼叫標準的 c 函式,使用PInvoke。 如需詳細資訊,請參閱平台叫用範例

請參閱

參考

浮點支援

_rotl、 _rotl64、 _rotr、 _rotr64