mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-09-23 08:13:30 -04:00
Initial commit of the sharedFoundation library
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// ByteOrder.cpp
|
||||
// copyright (c) 2001 Sony Online Entertainment
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#include "sharedFoundation/FirstSharedFoundation.h"
|
||||
#include "sharedFoundation/ByteOrder.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
// I'm using the arguments, but the compiler can't tell that
|
||||
#pragma warning(disable: 4100)
|
||||
|
||||
__declspec(naked) ulong ntohl(ulong netLong)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
mov eax, [esp+4]
|
||||
bswap eax
|
||||
ret
|
||||
}
|
||||
} //lint !e533 !e715 // function should return a value, argument not referenced
|
||||
|
||||
__declspec(naked) ulong htonl(ulong hostLong)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
mov eax, [esp+4]
|
||||
bswap eax
|
||||
ret
|
||||
}
|
||||
} //lint !e533 !e715 // function should return a value, argument not referenced
|
||||
|
||||
__declspec(naked) ushort ntohs(ushort netShort)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
mov eax, [esp+4]
|
||||
bswap eax
|
||||
shr eax, 16
|
||||
ret
|
||||
}
|
||||
} //lint !e533 !e715 // function should return a value, argument not referenced
|
||||
|
||||
__declspec(naked) ushort htons(ushort hostShort)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
mov eax, [esp+4]
|
||||
bswap eax
|
||||
shr eax, 16
|
||||
ret
|
||||
}
|
||||
} //lint !e533 !e715 // function should return a value, argument not referenced
|
||||
|
||||
// ======================================================================
|
||||
Reference in New Issue
Block a user