From 4073b1589d4e7df844192546c6e7f98c22e06ed2 Mon Sep 17 00:00:00 2001 From: belliash Date: Tue, 4 Apr 2023 21:02:14 +0200 Subject: [PATCH] Rename endian conversion routines to match naming convention --- sdk/xtdk/rtlfuncs.h | 24 +++++++++++----------- xtoskrnl/rtl/byteswap.c | 44 ++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/sdk/xtdk/rtlfuncs.h b/sdk/xtdk/rtlfuncs.h index 7b957dd..92d9889 100644 --- a/sdk/xtdk/rtlfuncs.h +++ b/sdk/xtdk/rtlfuncs.h @@ -194,6 +194,18 @@ LONGLONG RtlAtomicXor64(IN VOLATILE PLONGLONG Address, IN LONGLONG Mask); +XTFASTCALL +USHORT +RtlByteSwap16(IN USHORT Source); + +XTFASTCALL +ULONG +RtlByteSwap32(IN ULONG Source); + +XTFASTCALL +ULONGLONG +RtlByteSwap64(IN ULONGLONG Source); + XTAPI SIZE_T RtlCompareMemory(IN PCVOID LeftBuffer, @@ -281,18 +293,6 @@ RtlStringToWideString(OUT PWCHAR Destination, IN CONST PUCHAR *Source, IN SIZE_T Length); -XTFASTCALL -ULONG -RtlUlongByteSwap(IN ULONG Source); - -XTFASTCALL -ULONGLONG -RtlUlonglongByteSwap(IN ULONGLONG Source); - -XTFASTCALL -USHORT -RtlUshortByteSwap(IN USHORT Source); - XTCDECL INT RtlWideStringCompare(IN CONST PWCHAR String1, diff --git a/xtoskrnl/rtl/byteswap.c b/xtoskrnl/rtl/byteswap.c index 954c89b..6984565 100644 --- a/xtoskrnl/rtl/byteswap.c +++ b/xtoskrnl/rtl/byteswap.c @@ -9,6 +9,24 @@ #include +/** + * This routine converts endianness on 16bit value. + * + * @param Source + * Supplies a value to swap bytes. + * + * @return Swapped 16bit value. + * + * @since XT 1.0 + */ +XTFASTCALL +USHORT +RtlByteSwap16(IN USHORT Source) +{ + return (USHORT)(((Source >> 8) & 0x00FF) | + ((Source << 8) & 0xFF00)); +} + /** * This routine converts endianness on 32bit value. * @@ -17,11 +35,11 @@ * * @return Swapped 32bit value. * - * @since NT 4.0 + * @since XT 1.0 */ XTFASTCALL ULONG -RtlUlongByteSwap(IN ULONG Source) +RtlByteSwap32(IN ULONG Source) { return (ULONG)(((Source >> 24) & 0x000000FF) | ((Source >> 8) & 0x0000FF00) | @@ -37,11 +55,11 @@ RtlUlongByteSwap(IN ULONG Source) * * @return Swapped 64bit value. * - * @since NT 4.0 + * @since XT 1.0 */ XTFASTCALL ULONGLONG -RtlUlonglongByteSwap(IN ULONGLONG Source) +RtlByteSwap64(IN ULONGLONG Source) { return (ULONGLONG)(((Source >> 56) & 0x00000000000000FF) | ((Source >> 40) & 0x000000000000FF00) | @@ -52,21 +70,3 @@ RtlUlonglongByteSwap(IN ULONGLONG Source) ((Source << 40) & 0x00FF000000000000) | ((Source << 56) & 0xFF00000000000000)); } - -/** - * This routine converts endianness on 16bit value. - * - * @param Source - * Supplies a value to swap bytes. - * - * @return Swapped 16bit value. - * - * @since NT 4.0 - */ -XTFASTCALL -USHORT -RtlUshortByteSwap(IN USHORT Source) -{ - return (USHORT)(((Source >> 8) & 0x00FF) | - ((Source << 8) & 0xFF00)); -}