2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)bswap.h 1.2 03/03/25 Copyright 2002 J. Schilling */
18 * Allow to use B2N_* macros found in libdvdread in a portable way.
19 * These macros should better be avoided as in place conversion in
20 * general only works on processors like Motorola 68000 and Intel x86.
21 * Modern processors usually have alignement restrictions that may
22 * cause problems. The stripped down libdvdread for genisoimage is known
23 * not to have these alignement problems, so we may use the macros
24 * as they have been introduced by the authors of libdvdread.
26 * Copyright (c) 2002 J. Schilling
29 * This program is free software; you can redistribute it and/or modify
30 * it under the terms of the GNU General Public License version 2
31 * as published by the Free Software Foundation.
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License along with
39 * this program; see the file COPYING. If not, write to the Free Software
40 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
47 #if defined(WORDS_BIGENDIAN)
49 /* All bigendian systems are fine, just ignore the swaps. */
50 #define B2N_16(x) (void)(x)
51 #define B2N_32(x) (void)(x)
52 #define B2N_64(x) (void)(x)
57 * It is a bad idea to convert numbers in place.
58 * In protocols, there is usually the additional problem that the
59 * data is not properly aligned.
61 #define B2N_16(x) (x) = a_to_u_2_byte(&(x))
62 #define B2N_32(x) (x) = a_to_u_4_byte(&(x))
63 #define B2N_64(x) (x) = a_to_u_8_byte(&(x))