msvcr90: Added _byteswap_{ushort,ulong,uint64} implementation.

This commit is contained in:
Piotr Caban 2012-04-16 18:11:37 +02:00 committed by Alexandre Julliard
parent 4b9fabefd4
commit e24e6eb278
5 changed files with 48 additions and 9 deletions

View File

@ -517,9 +517,9 @@
@ cdecl _beep(long long) msvcrt._beep
@ cdecl _beginthread(ptr long ptr) msvcrt._beginthread
@ cdecl _beginthreadex(ptr long ptr ptr long ptr) msvcrt._beginthreadex
@ stub _byteswap_uint64
@ stub _byteswap_ulong
@ stub _byteswap_ushort
@ cdecl _byteswap_uint64(int64) msvcr90._byteswap_uint64
@ cdecl _byteswap_ulong(long) msvcr90._byteswap_ulong
@ cdecl _byteswap_ushort(long) msvcr90._byteswap_ushort
@ cdecl _c_exit() msvcrt._c_exit
@ cdecl _cabs(long) msvcrt._cabs
@ cdecl _callnewh(long) msvcrt._callnewh

View File

@ -356,9 +356,9 @@
@ cdecl _beep(long long) msvcrt._beep
@ cdecl _beginthread(ptr long ptr) msvcrt._beginthread
@ cdecl _beginthreadex(ptr long ptr ptr long ptr) msvcrt._beginthreadex
@ stub _byteswap_uint64
@ stub _byteswap_ulong
@ stub _byteswap_ushort
@ cdecl _byteswap_uint64(int64) msvcr90._byteswap_uint64
@ cdecl _byteswap_ulong(long) msvcr90._byteswap_ulong
@ cdecl _byteswap_ushort(long) msvcr90._byteswap_ushort
@ cdecl _c_exit() msvcrt._c_exit
@ cdecl _cabs(long) msvcrt._cabs
@ cdecl _callnewh(long) msvcrt._callnewh

View File

@ -366,3 +366,28 @@ int CDECL MSVCR90__vswprintf_p(wchar_t *buffer, size_t length, const wchar_t *fo
{
return _vswprintf_p_l(buffer, length, format, NULL, args);
}
/*********************************************************************
* _byteswap_ushort (MSVCR90.@)
*/
unsigned short CDECL _byteswap_ushort(unsigned short s)
{
return (s<<8) + (s>>8);
}
/*********************************************************************
* _byteswap_ulong (MSVCR90.@)
*/
unsigned long CDECL _byteswap_ulong(unsigned long l)
{
return (l<<24) + ((l<<8)&0xFF0000) + ((l>>8)&0xFF00) + (l>>24);
}
/*********************************************************************
* _byteswap_uint64 (MSVCR90.@)
*/
unsigned __int64 CDECL _byteswap_uint64(unsigned __int64 i)
{
return (i<<56) + ((i&0xFF00)<<40) + ((i&0xFF0000)<<24) + ((i&0xFF000000)<<8) +
((i>>8)&0xFF000000) + ((i>>24)&0xFF0000) + ((i>>40)&0xFF00) + (i>>56);
}

View File

@ -348,9 +348,9 @@
@ cdecl _beep(long long) msvcrt._beep
@ cdecl _beginthread(ptr long ptr) msvcrt._beginthread
@ cdecl _beginthreadex(ptr long ptr ptr long ptr) msvcrt._beginthreadex
@ stub _byteswap_uint64
@ stub _byteswap_ulong
@ stub _byteswap_ushort
@ cdecl _byteswap_uint64(int64)
@ cdecl _byteswap_ulong(long)
@ cdecl _byteswap_ushort(long)
@ cdecl _c_exit() msvcrt._c_exit
@ cdecl _cabs(long) msvcrt._cabs
@ cdecl _callnewh(long) msvcrt._callnewh

View File

@ -109,6 +109,7 @@ static int (__cdecl *p_fileno)(FILE*);
static int (__cdecl *p_feof)(FILE*);
static int (__cdecl *p_ferror)(FILE*);
static int (__cdecl *p_flsbuf)(int, FILE*);
static unsigned long (__cdecl *p_byteswap_ulong)(unsigned long);
/* type info */
@ -286,6 +287,7 @@ static BOOL init(void)
SET(p_feof, "feof");
SET(p_ferror, "ferror");
SET(p_flsbuf, "_flsbuf");
SET(p_byteswap_ulong, "_byteswap_ulong");
if (sizeof(void *) == 8)
{
SET(p_type_info_name_internal_method, "?_name_internal_method@type_info@@QEBAPEBDPEAU__type_info_node@@@Z");
@ -1137,6 +1139,17 @@ static void test_nonblocking_file_access(void)
p_unlink("test_file");
}
static void test_byteswap(void)
{
unsigned long ret;
ret = p_byteswap_ulong(0x12345678);
ok(ret == 0x78563412, "ret = %lx\n", ret);
ret = p_byteswap_ulong(0);
ok(ret == 0, "ret = %lx\n", ret);
}
START_TEST(msvcr90)
{
if(!init())
@ -1159,4 +1172,5 @@ START_TEST(msvcr90)
test_getptd();
test__vswprintf_l();
test_nonblocking_file_access();
test_byteswap();
}