]> Git Repo - binutils.git/blob - sim/ppc/sim-endian-n.h
* COPYING: Update FSF address.
[binutils.git] / sim / ppc / sim-endian-n.h
1 /*  This file is part of the program psim.
2
3     Copyright (C) 1994-1995, Andrew Cagney <[email protected]>
4
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.
9
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.
14  
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.
18  
19     */
20
21
22 #ifndef N
23 #error "N must be #defined"
24 #endif
25
26 #undef unsigned_N
27 #define unsigned_N XCONCAT2(unsigned_,N)
28 #undef _SWAP_N
29 #define _SWAP_N XCONCAT2(_SWAP_,N)
30 #undef endian_t2h_N
31 #define endian_t2h_N XCONCAT2(endian_t2h_,N)
32 #undef endian_h2t_N
33 #define endian_h2t_N XCONCAT2(endian_h2t_,N)
34 #undef swap_N
35 #define swap_N XCONCAT2(swap_,N)
36
37 INLINE_SIM_ENDIAN unsigned_N
38 endian_t2h_N(unsigned_N raw_in)
39 {
40   if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) {
41     return raw_in;
42   }
43   else {
44     _SWAP_N(return,raw_in);
45   }
46 }
47
48
49 INLINE_SIM_ENDIAN unsigned_N
50 endian_h2t_N(unsigned_N raw_in)
51 {
52   if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) {
53     return raw_in;
54   }
55   else {
56     _SWAP_N(return,raw_in);
57   }
58 }
59
60
61 INLINE_SIM_ENDIAN unsigned_N
62 swap_N(unsigned_N raw_in)
63 {
64   _SWAP_N(return,raw_in);
65 }
This page took 0.026928 seconds and 4 git commands to generate.