From 1b4e3d3f9447571da680a977c0142e475b6efbb4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 25 Jan 2018 13:35:34 +0200 Subject: [PATCH] Added overloaded Little...() functions for big endian targets https://forum.zdoom.org/viewtopic.php?t=59197 --- src/m_swap.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/m_swap.h b/src/m_swap.h index 1ab82d3b1..a68a0837b 100644 --- a/src/m_swap.h +++ b/src/m_swap.h @@ -91,6 +91,16 @@ inline unsigned short LittleShort (unsigned short x) return (unsigned short)((x>>8) | (x<<8)); } +inline short LittleShort (int x) +{ + return LittleShort((short)x); +} + +inline unsigned short LittleShort (unsigned int x) +{ + return LittleShort((unsigned short)x); +} + // Swapping 32bit. inline unsigned int LittleLong (unsigned int x) { @@ -110,6 +120,16 @@ inline int LittleLong (int x) | (((unsigned int)x)<<24)); } +inline unsigned int LittleLong(unsigned long x) +{ + return LittleLong((unsigned int)x); +} + +inline int LittleLong(long x) +{ + return LittleLong((int)x); +} + #define BigShort(x) (x) #define BigLong(x) (x)