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.
23 #error "N must be #defined"
27 #define unsigned_N XCONCAT2(unsigned_,N)
29 #define _SWAP_N XCONCAT2(_SWAP_,N)
31 #define endian_t2h_N XCONCAT2(endian_t2h_,N)
33 #define endian_h2t_N XCONCAT2(endian_h2t_,N)
35 #define swap_N XCONCAT2(swap_,N)
37 INLINE_SIM_ENDIAN unsigned_N
38 endian_t2h_N(unsigned_N raw_in
)
40 if (CURRENT_TARGET_BYTE_ORDER
== CURRENT_HOST_BYTE_ORDER
) {
44 _SWAP_N(return,raw_in
);
49 INLINE_SIM_ENDIAN unsigned_N
50 endian_h2t_N(unsigned_N raw_in
)
52 if (CURRENT_TARGET_BYTE_ORDER
== CURRENT_HOST_BYTE_ORDER
) {
56 _SWAP_N(return,raw_in
);
61 INLINE_SIM_ENDIAN unsigned_N
62 swap_N(unsigned_N raw_in
)
64 _SWAP_N(return,raw_in
);