8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:43:03 +01:00
This commit is contained in:
alexpeshkoff 2009-11-26 16:01:17 +00:00
parent 25bc5c51f4
commit 751c8f6c61

View File

@ -63,24 +63,9 @@ inline USHORT get_short(const UCHAR* p)
* from two chars
*
**************************************/
#ifndef WORDS_BIGENDIAN
// little-endian
USHORT temp;
memcpy(&temp, p, sizeof(USHORT));
return temp;
#else
// big-endian
union
{
USHORT n;
UCHAR c[2];
} temp;
temp.c[0] = p[0];
temp.c[1] = p[1];
return temp.n;
#endif
}
inline SLONG get_long(const UCHAR* p)
@ -96,26 +81,9 @@ inline SLONG get_long(const UCHAR* p)
* from four chars
*
**************************************/
#ifndef WORDS_BIGENDIAN
// little-endian
SLONG temp;
memcpy(&temp, p, sizeof(SLONG));
return temp;
#else
// big-endian
union
{
SLONG n;
UCHAR c[4];
} temp;
temp.c[0] = p[0];
temp.c[1] = p[1];
temp.c[2] = p[2];
temp.c[3] = p[3];
return temp.n;
#endif
}
inline void put_short(UCHAR* p, USHORT value)
@ -131,22 +99,7 @@ inline void put_short(UCHAR* p, USHORT value)
* two chars
*
**************************************/
#ifndef WORDS_BIGENDIAN
// little-endian
memcpy(p, &value, sizeof(USHORT));
#else
// big-endian
union
{
USHORT n;
UCHAR c[2];
} temp;
temp.n = value;
p[0] = temp.c[0];
p[1] = temp.c[1];
#endif
}
inline void put_long(UCHAR* p, SLONG value)
@ -162,24 +115,7 @@ inline void put_long(UCHAR* p, SLONG value)
* four chars
*
**************************************/
#ifndef WORDS_BIGENDIAN
// little-endian
memcpy(p, &value, sizeof(SLONG));
#else
// big-endian
union
{
SLONG n;
UCHAR c[4];
} temp;
temp.n = value;
p[0] = temp.c[0];
p[1] = temp.c[1];
p[2] = temp.c[2];
p[3] = temp.c[3];
#endif
}
inline void put_vax_short(UCHAR* p, SSHORT value)