diff --git a/lib/endian.c b/lib/endian.c index 6df3913a..1b86b16c 100644 --- a/lib/endian.c +++ b/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 +} + diff --git a/lib/mbselib.h b/lib/mbselib.h index 91c88a14..9985a093 100644 --- a/lib/mbselib.h +++ b/lib/mbselib.h @@ -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);