diff options
Diffstat (limited to 'sim/common/sim-endian.c')
-rw-r--r-- | sim/common/sim-endian.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sim/common/sim-endian.c b/sim/common/sim-endian.c index 3a32986..24dc7c5 100644 --- a/sim/common/sim-endian.c +++ b/sim/common/sim-endian.c @@ -23,6 +23,8 @@ #define _SIM_ENDIAN_C_ #include "sim-basics.h" +#include "sim-assert.h" +#include "sim-io.h" #if !defined(_SWAP_1) @@ -54,6 +56,17 @@ SET out.dword; #endif +#ifndef _SWAP_16 +#define _SWAP_16(SET,RAW) \ + union { unsigned_16 word; unsigned_4 words[4]; } in, out; \ + in.word = (RAW); \ + _SWAP_4 (out.words[0] =, in.words[3]); \ + _SWAP_4 (out.words[1] =, in.words[2]); \ + _SWAP_4 (out.words[2] =, in.words[1]); \ + _SWAP_4 (out.words[3] =, in.words[0]); \ + SET out.word; +#endif + #define N 1 #include "sim-n-endian.h" @@ -71,4 +84,8 @@ #include "sim-n-endian.h" #undef N +#define N 16 +#include "sim-n-endian.h" +#undef N + #endif /* _SIM_ENDIAN_C_ */ |