mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 16:51:39 +00:00
[UCRT] Import Microsoft.Windows.SDK.CRTSource version 10.0.22621.3
Imported from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource/10.0.22621.3 License: MIT
This commit is contained in:
parent
f1b60c66f0
commit
04e0dc4a7a
568 changed files with 115483 additions and 0 deletions
62
sdk/lib/ucrt/stdlib/byteswap.cpp
Normal file
62
sdk/lib/ucrt/stdlib/byteswap.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
//
|
||||
// byteswap.cpp
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Defines functions that swap the bytes of an unsigned integer.
|
||||
//
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
#pragma function(_byteswap_ulong, _byteswap_uint64, _byteswap_ushort)
|
||||
|
||||
/***
|
||||
*unsigned long _byteswap_ulong(i) - long byteswap
|
||||
*
|
||||
*Purpose:
|
||||
* Performs a byte swap on an unsigned integer.
|
||||
*
|
||||
*Entry:
|
||||
* unsigned long i: value to swap
|
||||
*
|
||||
*Exit:
|
||||
* returns swaped
|
||||
*
|
||||
*Exceptions:
|
||||
* None.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
extern "C" unsigned long __cdecl _byteswap_ulong(unsigned long const i)
|
||||
{
|
||||
unsigned int j;
|
||||
j = (i << 24);
|
||||
j += (i << 8) & 0x00FF0000;
|
||||
j += (i >> 8) & 0x0000FF00;
|
||||
j += (i >> 24);
|
||||
return j;
|
||||
}
|
||||
|
||||
extern "C" unsigned short __cdecl _byteswap_ushort(unsigned short const i)
|
||||
{
|
||||
unsigned short j;
|
||||
j = (i << 8);
|
||||
j += (i >> 8);
|
||||
return j;
|
||||
}
|
||||
|
||||
extern "C" unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 const i)
|
||||
{
|
||||
unsigned __int64 j;
|
||||
j = (i << 56);
|
||||
j += (i << 40) & 0x00FF000000000000;
|
||||
j += (i << 24) & 0x0000FF0000000000;
|
||||
j += (i << 8) & 0x000000FF00000000;
|
||||
j += (i >> 8) & 0x00000000FF000000;
|
||||
j += (i >> 24) & 0x0000000000FF0000;
|
||||
j += (i >> 40) & 0x000000000000FF00;
|
||||
j += (i >> 56);
|
||||
return j;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue