Share via


_byteswap_uint64、_byteswap_ulong、_byteswap_ushort

更新 : 2007 年 11 月

整数内のバイト順を反転します。

unsigned short _byteswap_ushort (
   unsigned short val
);
unsigned long _byteswap_ulong (
   unsigned long val
);
unsigned __int64 _byteswap_uint64 (
   unsigned __int64 val
);

パラメータ

  • val
    バイト順を反転させる整数。

必要条件

ルーチン

必須ヘッダー

_byteswap_ushort

<stdlib.h>

_byteswap_ulong

<stdlib.h>

_byteswap_uint64

<stdlib.h>

互換性の詳細については、「C ランタイム ライブラリ」の「互換性」を参照してください。

使用例

// crt_byteswap.c
#include <stdlib.h>

int main()
{
   unsigned __int64 u64 = 0x0102030405060708;
   unsigned long ul = 0x01020304;
   
   printf("byteswap of %I64x = %I64x\n", u64, _byteswap_uint64(u64));
   printf("byteswap of %Ix = %Ix", ul, _byteswap_ulong(ul));
}

byteswap of 102030405060708 = 807060504030201
byteswap of 1020304 = 4030201

参照

参照

カテゴリ別ランタイム ルーチン