Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 1.99 KB

byteswap-uint64-byteswap-ulong-byteswap-ushort.md

File metadata and controls

63 lines (48 loc) · 1.99 KB
description title ms.date api_name api_location api_type topic_type f1_keywords helpviewer_keywords ms.assetid
Learn more about: _byteswap_uint64, _byteswap_ulong, _byteswap_ushort
_byteswap_uint64, _byteswap_ulong, _byteswap_ushort
11/04/2016
_byteswap_uint64
_byteswap_ulong
_byteswap_ushort
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-utility-l1-1-0.dll
DLLExport
apiref
byteswap_ulong
_byteswap_ulong
byteswap_uint64
_byteswap_ushort
_byteswap_uint64
byteswap_ushort
_byteswap_uint64 function
byteswap_uint64 function
swapping bytes
byte swapping
byteswap_ushort function
_byteswap_ushort function
bytes, swapping
byteswap_ulong function
_byteswap_ulong function
83bda211-f02f-4cf0-8a78-d6de1f175970

_byteswap_uint64, _byteswap_ulong, _byteswap_ushort

Reverses the order of bytes in an integer.

Syntax

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

Parameters

val
The integer to reverse byte order.

Requirements

Routine Required header
_byteswap_ushort <stdlib.h>
_byteswap_ulong <stdlib.h>
_byteswap_uint64 <stdlib.h>

For more compatibility information, see Compatibility.

Example

// 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 0102030405060708 = 0807060504030201
byteswap of 01020304 = 04030201

See also

Universal C runtime routines by category