mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
[BZ #6442]
* string/endian.h: Add macros for fixed-size endian conversion. * bits/byteswap.h: Allow inclusion from <endian.h>. * sysdeps/i386/bits/byteswap.h: Likewise. * sysdeps/ia64/bits/byteswap.h: Likewise. * sysdeps/s390/bits/byteswap.h: Likewise. * sysdeps/x86_64/bits/byteswap.h: Likewise. * string/Makefile (tests): Add tst-endian. * string/tst-endian.c: New file.
This commit is contained in:
parent
c8d49f05e7
commit
2f9a1be867
10
ChangeLog
10
ChangeLog
@ -1,5 +1,15 @@
|
||||
2008-05-14 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #6442]
|
||||
* string/endian.h: Add macros for fixed-size endian conversion.
|
||||
* bits/byteswap.h: Allow inclusion from <endian.h>.
|
||||
* sysdeps/i386/bits/byteswap.h: Likewise.
|
||||
* sysdeps/ia64/bits/byteswap.h: Likewise.
|
||||
* sysdeps/s390/bits/byteswap.h: Likewise.
|
||||
* sysdeps/x86_64/bits/byteswap.h: Likewise.
|
||||
* string/Makefile (tests): Add tst-endian.
|
||||
* string/tst-endian.c: New file.
|
||||
|
||||
* iconvdata/run-iconv-test.sh: Use = instead of == in test.
|
||||
Patch by Reuben Thomas.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997,1998,2000,2001,2002,2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997,1998,2000-2002,2005,2008 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -17,7 +17,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
|
||||
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
|
||||
#endif
|
||||
|
||||
|
@ -69,7 +69,7 @@ translit_end
|
||||
END LC_CTYPE
|
||||
|
||||
LC_MESSAGES
|
||||
yesexpr "<U005E><U005B><U0414><U0434><U0059><U0079><U005D><U002E><U002A>"
|
||||
yesexpr "<U005E><U005B><U0422><U0442><U0059><U0079><U005D><U002E><U002A>"
|
||||
noexpr "<U005E><U005B><U041D><U043D><U004E><U006E><U005D><U002E><U002A>"
|
||||
END LC_MESSAGES
|
||||
|
||||
|
@ -62,6 +62,7 @@ script <ARMENIAN>
|
||||
script <GEORGIAN>
|
||||
script <DEVANAGARI>
|
||||
script <GUJARATI>
|
||||
script <TELUGU>
|
||||
|
||||
# Déclaration des symboles internes / Declaration of internal symbols
|
||||
#
|
||||
@ -652,6 +653,95 @@ collating-symbol <gvd-chandrabindu>
|
||||
collating-symbol <gvd-visarg>
|
||||
collating-symbol <g-halant>
|
||||
|
||||
# <TELUGU>
|
||||
#
|
||||
# tvd - denotes Telugu vowel modifier
|
||||
# tm - denotes Telugu matras
|
||||
# tvw - denotes Telugu vowels
|
||||
|
||||
# defining symbols
|
||||
collating-symbol <tummu>
|
||||
collating-symbol <tvw-a>
|
||||
collating-symbol <tvw-aa>
|
||||
collating-symbol <tvw-i>
|
||||
collating-symbol <tvw-ii>
|
||||
collating-symbol <tvw-u>
|
||||
collating-symbol <tvw-uu>
|
||||
collating-symbol <tvw-vocalicr>
|
||||
collating-symbol <tvw-vocalicrr>
|
||||
collating-symbol <tvw-vocalicl>
|
||||
collating-symbol <tvw-vocalicll>
|
||||
collating-symbol <tvw-candrae>
|
||||
collating-symbol <tvw-shorte>
|
||||
collating-symbol <tvw-e>
|
||||
collating-symbol <tvw-ai>
|
||||
collating-symbol <tvw-shorto>
|
||||
collating-symbol <tvw-o>
|
||||
collating-symbol <tvw-au>
|
||||
collating-symbol <t-ka>
|
||||
collating-symbol <t-kha>
|
||||
collating-symbol <t-ga>
|
||||
collating-symbol <t-gga>
|
||||
collating-symbol <t-gha>
|
||||
collating-symbol <t-nga>
|
||||
collating-symbol <t-ca>
|
||||
collating-symbol <t-tsa>
|
||||
collating-symbol <t-cha>
|
||||
collating-symbol <t-ja>
|
||||
collating-symbol <t-dza>
|
||||
collating-symbol <t-jja>
|
||||
collating-symbol <t-jha>
|
||||
collating-symbol <t-nya>
|
||||
collating-symbol <t-tta>
|
||||
collating-symbol <t-ttha>
|
||||
collating-symbol <t-dda>
|
||||
collating-symbol <t-ddda>
|
||||
collating-symbol <t-ddha>
|
||||
collating-symbol <t-nna>
|
||||
collating-symbol <t-ta>
|
||||
collating-symbol <t-tha>
|
||||
collating-symbol <t-da>
|
||||
collating-symbol <t-dha>
|
||||
collating-symbol <t-na>
|
||||
collating-symbol <t-pa>
|
||||
collating-symbol <t-pha>
|
||||
collating-symbol <t-ba>
|
||||
collating-symbol <t-bba>
|
||||
collating-symbol <t-bha>
|
||||
collating-symbol <t-ma>
|
||||
collating-symbol <t-ya>
|
||||
collating-symbol <t-ra>
|
||||
collating-symbol <t-rra>
|
||||
collating-symbol <t-la>
|
||||
collating-symbol <t-lla>
|
||||
collating-symbol <t-va>
|
||||
collating-symbol <t-sha>
|
||||
collating-symbol <t-ssa>
|
||||
collating-symbol <t-sa>
|
||||
collating-symbol <t-ha>
|
||||
collating-symbol <t-avagrah>
|
||||
collating-symbol <tm-aa>
|
||||
collating-symbol <tm-i>
|
||||
collating-symbol <tm-ii>
|
||||
collating-symbol <tm-u>
|
||||
collating-symbol <tm-uu>
|
||||
collating-symbol <tm-vocalicr>
|
||||
collating-symbol <tm-vocalicrr>
|
||||
collating-symbol <tm-vocalicl>
|
||||
collating-symbol <tm-vocalicll>
|
||||
collating-symbol <tm-shorte>
|
||||
collating-symbol <tm-e>
|
||||
collating-symbol <tm-ai>
|
||||
collating-symbol <tm-shorto>
|
||||
collating-symbol <tm-o>
|
||||
collating-symbol <tm-au>
|
||||
collating-symbol <tvd-chandrabindu>
|
||||
collating-symbol <tvd-anuswara>
|
||||
collating-symbol <tvd-visarg>
|
||||
collating-symbol <t-halant>
|
||||
collating-symbol <t-lenghtmark>
|
||||
collating-symbol <t-ailenghtmark>
|
||||
|
||||
# Ordre des symboles internes / Order of internal symbols
|
||||
#
|
||||
# SYMB. N°
|
||||
@ -1236,6 +1326,92 @@ collating-symbol <g-halant>
|
||||
<gvd-chandrabindu>
|
||||
<gvd-visarg>
|
||||
<g-halant>
|
||||
#
|
||||
#<TELUGU>
|
||||
#
|
||||
# collation weights in order
|
||||
|
||||
<tummu>
|
||||
<tvw-a>
|
||||
<tvw-aa>
|
||||
<tvw-i>
|
||||
<tvw-ii>
|
||||
<tvw-u>
|
||||
<tvw-uu>
|
||||
<tvw-vocalicr>
|
||||
<tvw-vocalicrr>
|
||||
<tvw-vocalicl>
|
||||
<tvw-vocalicll>
|
||||
<tvw-candrae>
|
||||
<tvw-shorte>
|
||||
<tvw-e>
|
||||
<tvw-ai>
|
||||
<tvw-shorto>
|
||||
<tvw-o>
|
||||
<tvw-au>
|
||||
<t-ka>
|
||||
<t-kha>
|
||||
<t-ga>
|
||||
<t-gga>
|
||||
<t-gha>
|
||||
<t-nga>
|
||||
<t-ca>
|
||||
<t-tsa>
|
||||
<t-cha>
|
||||
<t-ja>
|
||||
<t-dza>
|
||||
<t-jja>
|
||||
<t-jha>
|
||||
<t-nya>
|
||||
<t-tta>
|
||||
<t-ttha>
|
||||
<t-dda>
|
||||
<t-ddda>
|
||||
<t-ddha>
|
||||
<t-nna>
|
||||
<t-ta>
|
||||
<t-tha>
|
||||
<t-da>
|
||||
<t-dha>
|
||||
<t-na>
|
||||
<t-pa>
|
||||
<t-pha>
|
||||
<t-ba>
|
||||
<t-bba>
|
||||
<t-bha>
|
||||
<t-ma>
|
||||
<t-ya>
|
||||
<t-ra>
|
||||
<t-rra>
|
||||
<t-la>
|
||||
<t-lla>
|
||||
<t-va>
|
||||
<t-sha>
|
||||
<t-ssa>
|
||||
<t-sa>
|
||||
<t-ha>
|
||||
<t-avagrah>
|
||||
<tm-aa>
|
||||
<tm-i>
|
||||
<tm-ii>
|
||||
<tm-u>
|
||||
<tm-uu>
|
||||
<tm-vocalicr>
|
||||
<tm-vocalicrr>
|
||||
<tm-vocalicl>
|
||||
<tm-vocalicll>
|
||||
<tm-shorte>
|
||||
<tm-e>
|
||||
<tm-ai>
|
||||
<tm-shorto>
|
||||
<tm-o>
|
||||
<tm-au>
|
||||
<tvd-chandrabindu>
|
||||
<tvd-anuswara>
|
||||
<tvd-visarg>
|
||||
<t-halant>
|
||||
<t-lenghtmark>
|
||||
<t-ailenghtmark>
|
||||
|
||||
order_start <SPECIAL>;forward;backward;forward;forward,position
|
||||
#
|
||||
@ -3201,6 +3377,103 @@ order_start <GUJARATI>;forward;forward;forward;forward,position
|
||||
<U0ACD> <g-halant>;<BAS>;<MIN>;IGNORE
|
||||
<U0ABC> IGNORE;<GNKT>;<MIN>;IGNORE
|
||||
|
||||
order_start <TELUGU>;forward;forward;forward;forward,position
|
||||
<U0C66> <0>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C78> <0>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C67> <1>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C79> <1>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C7C> <1>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C68> <2>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C7A> <2>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C7D> <2>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C69> <3>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C7B> <3>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C7E> <3>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C6A> <4>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C6B> <5>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C6C> <6>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C6D> <7>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C6E> <8>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C6F> <9>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
|
||||
<U0C7F> <tummu> ;<BAS>;<MIN>;IGNORE
|
||||
<U0C05> <tvw-a> ;<BAS>;<MIN>;IGNORE
|
||||
<U0C06> <tvw-aa> ;<BAS>;<MIN>;IGNORE
|
||||
<U0C07> <tvw-i> ;<BAS>;<MIN>;IGNORE
|
||||
<U0C08> <tvw-ii> ;<BAS>;<MIN>;IGNORE
|
||||
<U0C09> <tvw-u> ;<BAS>;<MIN>;IGNORE
|
||||
<U0C0A> <tvw-uu>;<BAS>;<MIN>;IGNORE
|
||||
<U0C0B> <tvw-vocalicr>;<BAS>;<MIN>;IGNORE
|
||||
<U0C60> <tvw-vocalicrr>;<BAS>;<MIN>;IGNORE
|
||||
<U0C0C> <tvw-vocalicl>;<BAS>;<MIN>;IGNORE
|
||||
<U0C61> <tvw-vocalicll>;<BAS>;<MIN>;IGNORE
|
||||
<U0C0D> <tvw-candrae>;<BAS>;<MIN>;IGNORE
|
||||
<U0C0E> <tvw-shorte>;<BAS>;<MIN>;IGNORE
|
||||
<U0C0F> <tvw-e>;<BAS>;<MIN>;IGNORE
|
||||
<U0C10> <tvw-ai>;<BAS>;<MIN>;IGNORE
|
||||
<U0C12> <tvw-shorto>;<BAS>;<MIN>;IGNORE
|
||||
<U0C13> <tvw-o>;<BAS>;<MIN>;IGNORE
|
||||
<U0C14> <tvw-au>;<BAS>;<MIN>;IGNORE
|
||||
<U0C15> <t-ka>;<BAS>;<MIN>;IGNORE
|
||||
<U0C16> <t-kha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C17> <t-ga>;<BAS>;<MIN>;IGNORE
|
||||
<U0C7B> <t-gga>;<BAS>;<MIN>;IGNORE
|
||||
<U0C18> <t-gha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C19> <t-nga>;<BAS>;<MIN>;IGNORE
|
||||
<U0C1A> <t-ca>;<BAS>;<MIN>;IGNORE
|
||||
<U0C58> <t-tsa>;<BAS>;<MIN>;IGNORE
|
||||
<U0C1B> <t-cha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C1C> <t-ja>;<BAS>;<MIN>;IGNORE
|
||||
<U0C59> <t-dza>;<BAS>;<MIN>;IGNORE
|
||||
<U0C1D> <t-jha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C1E> <t-nya>;<BAS>;<MIN>;IGNORE
|
||||
<U0C1F> <t-tta>;<BAS>;<MIN>;IGNORE
|
||||
<U0C20> <t-ttha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C21> <t-dda>;<BAS>;<MIN>;IGNORE
|
||||
<U0C22> <t-ddha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C23> <t-nna>;<BAS>;<MIN>;IGNORE
|
||||
<U0C24> <t-ta>;<BAS>;<MIN>;IGNORE
|
||||
<U0C25> <t-tha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C26> <t-da>;<BAS>;<MIN>;IGNORE
|
||||
<U0C27> <t-dha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C28> <t-na>;<BAS>;<MIN>;IGNORE
|
||||
<U0C2A> <t-pa>;<BAS>;<MIN>;IGNORE
|
||||
<U0C2B> <t-pha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C2C> <t-ba>;<BAS>;<MIN>;IGNORE
|
||||
<U0C2D> <t-bha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C2E> <t-ma>;<BAS>;<MIN>;IGNORE
|
||||
<U0C2F> <t-ya>;<BAS>;<MIN>;IGNORE
|
||||
<U0C30> <t-ra>;<BAS>;<MIN>;IGNORE
|
||||
<U0C31> <t-rra>;<BAS>;<MIN>;IGNORE
|
||||
<U0C32> <t-la>;<BAS>;<MIN>;IGNORE
|
||||
<U0C33> <t-lla>;<BAS>;<MIN>;IGNORE
|
||||
<U0C35> <t-va>;<BAS>;<MIN>;IGNORE
|
||||
<U0C36> <t-sha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C37> <t-ssa>;<BAS>;<MIN>;IGNORE
|
||||
<U0C38> <t-sa>;<BAS>;<MIN>;IGNORE
|
||||
<U0C39> <t-ha>;<BAS>;<MIN>;IGNORE
|
||||
<U0C3D> <t-avagrah>;<BAS>;<MIN>;IGNORE
|
||||
<U0C3E> <tm-aa>;<BAS>;<MIN>;IGNORE
|
||||
<U0C3F> <tm-i>;<BAS>;<MIN>;IGNORE
|
||||
<U0C40> <tm-ii>;<BAS>;<MIN>;IGNORE
|
||||
<U0C41> <tm-u>;<BAS>;<MIN>;IGNORE
|
||||
<U0C42> <tm-uu>;<BAS>;<MIN>;IGNORE
|
||||
<U0C43> <tm-vocalicr>;<BAS>;<MIN>;IGNORE
|
||||
<U0C44> <tm-vocalicrr>;<BAS>;<MIN>;IGNORE
|
||||
<U0C62> <tm-vocalicl>;<BAS>;<MIN>;IGNORE
|
||||
<U0C63> <tm-vocalicll>;<BAS>;<MIN>;IGNORE
|
||||
<U0C46> <tm-shorte>;<BAS>;<MIN>;IGNORE
|
||||
<U0C47> <tm-e>;<BAS>;<MIN>;IGNORE
|
||||
<U0C48> <tm-ai>;<BAS>;<MIN>;IGNORE
|
||||
<U0C4A> <tm-shorto>;<BAS>;<MIN>;IGNORE
|
||||
<U0C4B> <tm-o>;<BAS>;<MIN>;IGNORE
|
||||
<U0C4C> <tm-au>;<BAS>;<MIN>;IGNORE
|
||||
<U0C01> <tvd-chandrabindu>;<BAS>;<MIN>;IGNORE
|
||||
<U0C02> <tvd-anuswara>;<BAS>;<MIN>;IGNORE
|
||||
<U0C03> <tvd-visarg>;<BAS>;<MIN>;IGNORE
|
||||
<U0C4D> <t-halant>;<BAS>;<MIN>;IGNORE
|
||||
<U0C55> <t-lenghtmark>;<BAS>;<MIN>;IGNORE
|
||||
<U0C56> <t-ailenghtmark>;<BAS>;<MIN>;IGNORE
|
||||
|
||||
order_end
|
||||
|
||||
END LC_COLLATE
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991-2002, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2002, 2005-2007, 2008 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -54,7 +54,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
|
||||
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
|
||||
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
|
||||
bug-strtok1 $(addprefix test-,$(strop-tests)) \
|
||||
bug-envz1 tst-strxfrm2
|
||||
bug-envz1 tst-strxfrm2 tst-endian
|
||||
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -55,4 +55,40 @@
|
||||
# define __LONG_LONG_PAIR(HI, LO) HI, LO
|
||||
#endif
|
||||
|
||||
|
||||
/* Conversion interfaces. */
|
||||
#include <bits/byteswap.h>
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define htobe16(x) __bswap_16 (x)
|
||||
# define htole16(x) (x)
|
||||
# define be16toh(x) __bswap_16 (x)
|
||||
# define le16toh(x) (x)
|
||||
|
||||
# define htobe32(x) __bswap_32 (x)
|
||||
# define htole32(x) (x)
|
||||
# define be32toh(x) __bswap_32 (x)
|
||||
# define le32toh(x) (x)
|
||||
|
||||
# define htobe64(x) __bswap_64 (x)
|
||||
# define htole64(x) (x)
|
||||
# define be64toh(x) __bswap_64 (x)
|
||||
# define le64toh(x) (x)
|
||||
#else
|
||||
# define htobe16(x) (x)
|
||||
# define htole16(x) __bswap_16 (x)
|
||||
# define be16toh(x) (x)
|
||||
# define le16toh(x) __bswap_16 (x)
|
||||
|
||||
# define htobe32(x) (x)
|
||||
# define htole32(x) __bswap_32 (x)
|
||||
# define be32toh(x) (x)
|
||||
# define le32toh(x) __bswap_32 (x)
|
||||
|
||||
# define htobe64(x) (x)
|
||||
# define htole64(x) __bswap_64 (x)
|
||||
# define be64toh(x) (x)
|
||||
# define le64toh(x) __bswap_64 (x)
|
||||
#endif
|
||||
|
||||
#endif /* endian.h */
|
||||
|
112
string/tst-endian.c
Normal file
112
string/tst-endian.c
Normal file
@ -0,0 +1,112 @@
|
||||
#include <byteswap.h>
|
||||
#include <endian.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
for (uint64_t i = 0; i < (~UINT64_C (0)) >> 2; i = (i << 1) + 3)
|
||||
{
|
||||
if (i < UINT64_C (65536))
|
||||
{
|
||||
if (htobe16 (be16toh (i)) != i)
|
||||
{
|
||||
printf ("htobe16 (be16toh (%" PRIx64 ")) == %" PRIx16 "\n",
|
||||
i, (uint16_t) htobe16 (be16toh (i)));
|
||||
result = 1;
|
||||
}
|
||||
if (htole16 (le16toh (i)) != i)
|
||||
{
|
||||
printf ("htole16 (le16toh (%" PRIx64 ")) == %" PRIx16 "\n",
|
||||
i, (uint16_t) htole16 (le16toh (i)));
|
||||
result = 1;
|
||||
}
|
||||
|
||||
uint16_t n[2];
|
||||
n[__BYTE_ORDER == __LITTLE_ENDIAN] = bswap_16 (i);
|
||||
n[__BYTE_ORDER == __BIG_ENDIAN] = i;
|
||||
if (htole16 (i) != n[0])
|
||||
{
|
||||
printf ("htole16 (%" PRIx64 ") == %" PRIx16 " != %" PRIx16 "\n",
|
||||
i, (uint16_t) htole16 (i), n[0]);
|
||||
result = 1;
|
||||
}
|
||||
if (htobe16 (i) != n[1])
|
||||
{
|
||||
printf ("htobe16 (%" PRIx64 ") == %" PRIx16 " != %" PRIx16 "\n",
|
||||
i, (uint16_t) htobe16 (i), n[1]);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < UINT64_C (4294967296))
|
||||
{
|
||||
if (htobe32 (be32toh (i)) != i)
|
||||
{
|
||||
printf ("htobe32 (be32toh (%" PRIx64 ")) == %" PRIx32 "\n",
|
||||
i, (uint32_t) htobe32 (be32toh (i)));
|
||||
result = 1;
|
||||
}
|
||||
if (htole32 (le32toh (i)) != i)
|
||||
{
|
||||
printf ("htole32 (le32toh (%" PRIx64 ")) == %" PRIx32 "\n",
|
||||
i, (uint32_t) htole32 (le32toh (i)));
|
||||
result = 1;
|
||||
}
|
||||
|
||||
uint32_t n[2];
|
||||
n[__BYTE_ORDER == __LITTLE_ENDIAN] = bswap_32 (i);
|
||||
n[__BYTE_ORDER == __BIG_ENDIAN] = i;
|
||||
if (htole32 (i) != n[0])
|
||||
{
|
||||
printf ("htole32 (%" PRIx64 ") == %" PRIx32 " != %" PRIx32 "\n",
|
||||
i, (uint32_t) htole32 (i), n[0]);
|
||||
result = 1;
|
||||
}
|
||||
if (htobe32 (i) != n[1])
|
||||
{
|
||||
printf ("htobe32 (%" PRIx64 ") == %" PRIx32 " != %" PRIx32 "\n",
|
||||
i, (uint32_t) htobe32 (i), n[1]);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (htobe64 (be64toh (i)) != i)
|
||||
{
|
||||
printf ("htobe64 (be64toh (%" PRIx64 ")) == %" PRIx64 "\n",
|
||||
i, htobe64 (be64toh (i)));
|
||||
result = 1;
|
||||
}
|
||||
if (htole64 (le64toh (i)) != i)
|
||||
{
|
||||
printf ("htole64 (le64toh (%" PRIx64 ")) == %" PRIx64 "\n",
|
||||
i, htole64 (le64toh (i)));
|
||||
result = 1;
|
||||
}
|
||||
|
||||
uint64_t n[2];
|
||||
n[__BYTE_ORDER == __LITTLE_ENDIAN] = bswap_64 (i);
|
||||
n[__BYTE_ORDER == __BIG_ENDIAN] = i;
|
||||
if (htole64 (i) != n[0])
|
||||
{
|
||||
printf ("htole64 (%" PRIx64 ") == %" PRIx64 " != %" PRIx64 "\n",
|
||||
i, htole64 (i), n[0]);
|
||||
result = 1;
|
||||
}
|
||||
if (htobe64 (i) != n[1])
|
||||
{
|
||||
printf ("htobe64 (%" PRIx64 ") == %" PRIx64 " != %" PRIx64 "\n",
|
||||
i, htobe64 (i), n[1]);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
|
||||
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997,1998,2000,2002,2003,2008 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -17,7 +17,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
|
||||
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values. s390 version.
|
||||
Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
|
||||
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
|
||||
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
|
||||
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
|
||||
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user