Correctly handle m68k long double format.
[glibc/pb-stable.git] / string / tst-bswap.c
blob7037c1eb69373d00c6a03925054a70cbb8c519bd
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@cygnus.com>.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <byteswap.h>
21 #include <stdio.h>
23 extern unsigned long long int wash (unsigned long long int a);
25 int
26 main (void)
28 int result = 0;
30 /* Test the functions with constant arguments. */
31 if (bswap_16 (0x1234) != 0x3412)
33 puts ("bswap_16 (constant) flunked");
34 result = 1;
36 if (bswap_32 (0x12345678) != 0x78563412)
38 puts ("bswap_32 (constant) flunked");
39 result = 1;
41 if (bswap_64 (0x1234567890abcdefULL) != 0xefcdab9078563412ULL)
43 puts ("bswap_64 (constant) flunked");
44 result = 1;
47 /* Test the functions with non-constant arguments. */
48 if (bswap_16 (wash (0x1234)) != 0x3412)
50 puts ("bswap_16 (non-constant) flunked");
51 result = 1;
53 if (bswap_32 (wash (0x12345678)) != 0x78563412)
55 puts ("bswap_32 (non-constant) flunked");
56 result = 1;
58 if (bswap_64 (wash (0x1234567890abcdefULL)) != 0xefcdab9078563412ULL)
60 puts ("bswap_64 (non-constant) flunked");
61 result = 1;
64 return result;
68 unsigned long long int
69 wash (unsigned long long int a)
71 /* Do nothing. This function simply exists to avoid that the compiler
72 regards the argument to the bswap_*() functions as constant. */
73 return a + 0;