1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef STATIC_INLINE_ENDIAN
26 #define STATIC_INLINE_ENDIAN STATIC_INLINE
31 #include "ppc-config.h"
33 #include "ppc-endian.h"
34 #include "sim_callbacks.h"
44 #define ENDIAN_N(NAME,BYTE_SIZE) \
45 unsigned_##BYTE_SIZE \
46 endian_##NAME##_##BYTE_SIZE(unsigned_##BYTE_SIZE raw_in) \
48 if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) { \
55 in.val_##BYTE_SIZE[0] = raw_in; \
56 for (byte_nr = 0; byte_nr < BYTE_SIZE; byte_nr++) { \
57 out.val_1[BYTE_SIZE-1-byte_nr] = in.val_1[byte_nr]; \
59 return out.val_##BYTE_SIZE[0]; \
71 #endif /* _ENDIAN_C_ */