Added unsigned short endian swap
This commit is contained in:
parent
c360a801cf
commit
ea90ffba3a
11
lib/endian.c
11
lib/endian.c
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Change integer value CPU endian independant
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2006
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -47,4 +47,13 @@ int le_int(int val)
|
||||
}
|
||||
|
||||
|
||||
unsigned short le_us(unsigned short val)
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
return ((val & 0xff) << 8) | ((val >> 8) & 0xff);
|
||||
#else
|
||||
return val;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: MBSE BBS main library header
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2005
|
||||
* Copyright (C) 1997-2006
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -2203,6 +2203,7 @@ struct termios tbufs, tbufsavs; /* Structure for raw mode */
|
||||
* From endian.c
|
||||
*/
|
||||
int le_int(int);
|
||||
unsigned short le_us(unsigned short);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user