diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-05-15 06:02:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-05-15 06:02:35 +0000 |
commit | faaa6f628377e7037ad451f266bbc6b16f7f4d94 (patch) | |
tree | 3cfe7ec0a4ef8677380ab4732673a026c0d63f25 /sysdeps/wordsize-32 | |
parent | 30224e2bd3bfde9e02802fb9f3e45c78237f34f0 (diff) | |
download | glibc-faaa6f628377e7037ad451f266bbc6b16f7f4d94.tar.gz glibc-faaa6f628377e7037ad451f266bbc6b16f7f4d94.tar.xz glibc-faaa6f628377e7037ad451f266bbc6b16f7f4d94.zip |
Update.
2002-05-12 Bruno Haible <bruno@clisp.org> * iconvdata/testdata/EUC-JISX0213: New file. * iconvdata/testdata/EUC-JISX0213..UTF8: New file. * iconvdata/testdata/SHIFT_JISX0213: New file. * iconvdata/testdata/SHIFT_JISX0213..UTF8: New file. * iconvdata/testdata/ISO-2022-JP-3: New file. * iconvdata/testdata/ISO-2022-JP-3..UTF8: New file. * iconvdata/TESTS: Add EUC-JISX0213, SHIFT_JISX0213, ISO-2022-JP-3. * iconvdata/run-iconv-test.sh: Skip the charmap test if the charmap contains comments indicating precomposed characters. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/iso-2022-jp-3.c: New file. * iconvdata/gconv-modules (ISO-2022-JP-3): New module. * iconvdata/Makefile (modules): Add ISO-2022-JP-3. (LDFLAGS-ISO-2022-JP-3.so): New variable. (ISO-2022-JP-3.so): Depend on libJIS.so and libJISX0213.so. (distribute): Add iso-2022-jp-3.c. 2002-05-12 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table-to.c (main): Restore handling of transliterations, broken by last patch. 2002-05-12 Bruno Haible <bruno@clisp.org> * iconvdata/TESTS: Add IBM922, IBM1124, IBM1129. 2002-05-12 Bruno Haible <bruno@clisp.org> * iconvdata/euc-jisx0213.c (BODY for FROM_LOOP): Don't advance inptr when there is not enough room in the output buffer. * iconvdata/shift_jisx0213.c (BODY for FROM_LOOP): Likewise. 2002-04-20 Bruno Haible <bruno@clisp.org> * iconv/skeleton.c ({FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO}): New macros. (RESET_INPUT_BUFFER): Use them instead of {MIN,MAX}_NEEDED_{FROM,TO}. Also make this macro work if FROM_DIRECTION evaluates to 0. (gconv_init): Use the new macros instead of {MIN,MAX}_NEEDED_{FROM,TO}. (FUNCTION_NAME): Likewise, in the handling of unaligned accesses and of consume_incomplete. * iconvdata/cp1255.c: Define {FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO} instead of {MIN,MAX}_NEEDED_{FROM,TO}. Set FROM_LOOP_MAX_NEEDED_TO to 4, not 8. * iconvdata/cp1258.c: Likewise. * iconvdata/ibm930.c: Define {FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO} instead of {MIN,MAX}_NEEDED_{FROM,TO}. Set TO_LOOP_MAX_NEEDED_TO to 3, not 2. * iconvdata/ibm933.c: Likewise. * iconvdata/ibm935.c: Likewise. * iconvdata/ibm937.c: Likewise. * iconvdata/ibm939.c: Likewise. * iconvdata/iso-2022-cn.c: Define {FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO} instead of {MIN,MAX}_NEEDED_{FROM,TO}. Set TO_LOOP_MAX_NEEDED_TO to 6, not 4. * iconvdata/iso-2022-cn-ext.c: Likewise. * iconvdata/iso-2022-jp.c: Define {FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO} instead of {MIN,MAX}_NEEDED_{FROM,TO}. * iconvdata/tcvn5712-1.c: Define {FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO} instead of {MIN,MAX}_NEEDED_{FROM,TO}. Set FROM_LOOP_MAX_NEEDED_FROM to 1, not 2. * iconvdata/euc-jisx0213.c: Define {FROM,TO}_LOOP_{MIN,MAX}_NEEDED_{FROM,TO} instead of {MIN,MAX}_NEEDED_{FROM,TO}. Set FROM_LOOP_MAX_NEEDED_TO to 8, not 4. * iconvdata/shift_jisx0213.c: Likewise. 2002-05-14 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> * sysdeps/powerpc/Makefile (sysdeps_routines): Add divdi3, cmpdi2, shdi3, fixdfdi, fixsfdi in csu dir. (shared-only-routines): Likewise. * sysdeps/wordsize-32/cmpdi2.c: New file. * sysdeps/wordsize-32/shdi3.c: New file. * sysdeps/wordsize-32/fixdfdi.c: New file. * sysdeps/wordsize-32/fixsfdi.c: New file. * sysdeps/powerpc/Versions (__divdi3, __moddi3, __udivdi3, __umoddi3, __ashldi3, __ashrdi3, __lshrdi3, __cmpdi2, __ucmpdi2, __fixdfdi, __fixsfdi, __fixunsdfdi, __fixunssfdi): Export at GLIBC_2.0. * sysdeps/unix/sysv/linux/semctl.c (__old_semctl, __new_semctl): Only use va_arg if the argument will be used [PR libc/3259]. 2002-05-06 Michael A. Schmidt <mmaass@us.ibm.com> * catgets/catgets.c (catopen): Free buffer if internal catalog open fails. 2002-05-14 Ulrich Drepper <drepper@redhat.com> * debug/xtrace.sh: Make more robust. For realtime tracking use non-buffering methods. * debug/pcprofiledump.c: Implement -u option. Patch by Roger Luethi <rl@hellgate.ch>.
Diffstat (limited to 'sysdeps/wordsize-32')
-rw-r--r-- | sysdeps/wordsize-32/cmpdi2.c | 95 | ||||
-rw-r--r-- | sysdeps/wordsize-32/fixdfdi.c | 98 | ||||
-rw-r--r-- | sysdeps/wordsize-32/fixsfdi.c | 102 | ||||
-rw-r--r-- | sysdeps/wordsize-32/shdi3.c | 150 |
4 files changed, 445 insertions, 0 deletions
diff --git a/sysdeps/wordsize-32/cmpdi2.c b/sysdeps/wordsize-32/cmpdi2.c new file mode 100644 index 0000000000..720c66c460 --- /dev/null +++ b/sysdeps/wordsize-32/cmpdi2.c @@ -0,0 +1,95 @@ +/* 64-bit integer comparison. + Copyright (C) 1989, 1992-2001, 2002 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <endian.h> +#include <stdlib.h> +#include <bits/wordsize.h> +#include <shlib-compat.h> + +#if __WORDSIZE != 32 +# error This is for 32-bit targets only +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6) + +typedef unsigned int UQItype __attribute__ ((mode (QI))); +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef unsigned int UDItype __attribute__ ((mode (DI))); +#define Wtype SItype +#define HWtype SItype +#define DWtype DItype +#define UWtype USItype +#define UHWtype USItype +#define UDWtype UDItype +#define W_TYPE_SIZE 32 + +#include <stdlib/longlong.h> + +#if __BYTE_ORDER == __BIG_ENDIAN +struct DWstruct { Wtype high, low;}; +#elif __BYTE_ORDER == __LITTLE_ENDIAN +struct DWstruct { Wtype low, high;}; +#else +#error Unhandled endianity +#endif +typedef union { struct DWstruct s; DWtype ll; } DWunion; + + +Wtype +___cmpdi2 (DWtype a, DWtype b) +{ + DWunion au, bu; + + au.ll = a, bu.ll = b; + + if (au.s.high < bu.s.high) + return 0; + else if (au.s.high > bu.s.high) + return 2; + if ((UWtype) au.s.low < (UWtype) bu.s.low) + return 0; + else if ((UWtype) au.s.low > (UWtype) bu.s.low) + return 2; + return 1; +} +symbol_version (___cmpdi2, __cmpdi2, GLIBC_2.0); + + +Wtype +___ucmpdi2 (DWtype a, DWtype b) +{ + DWunion au, bu; + + au.ll = a, bu.ll = b; + + if ((UWtype) au.s.high < (UWtype) bu.s.high) + return 0; + else if ((UWtype) au.s.high > (UWtype) bu.s.high) + return 2; + if ((UWtype) au.s.low < (UWtype) bu.s.low) + return 0; + else if ((UWtype) au.s.low > (UWtype) bu.s.low) + return 2; + return 1; +} +symbol_version (___ucmpdi2, __ucmpdi2, GLIBC_2.0); + +#endif diff --git a/sysdeps/wordsize-32/fixdfdi.c b/sysdeps/wordsize-32/fixdfdi.c new file mode 100644 index 0000000000..5cdbeb42a2 --- /dev/null +++ b/sysdeps/wordsize-32/fixdfdi.c @@ -0,0 +1,98 @@ +/* Convert double to 64-bit int. + Copyright (C) 1989, 1992-2001, 2002 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <endian.h> +#include <stdlib.h> +#include <bits/wordsize.h> +#include <shlib-compat.h> + +#if __WORDSIZE != 32 +# error This is for 32-bit targets only +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6) + +typedef unsigned int UQItype __attribute__ ((mode (QI))); +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef unsigned int UDItype __attribute__ ((mode (DI))); +typedef float SFtype __attribute__ ((mode (SF))); +typedef float DFtype __attribute__ ((mode (DF))); +#define Wtype SItype +#define HWtype SItype +#define DWtype DItype +#define UWtype USItype +#define UHWtype USItype +#define UDWtype UDItype +#define W_TYPE_SIZE 32 + +#include <stdlib/longlong.h> + +#if __BYTE_ORDER == __BIG_ENDIAN +struct DWstruct { Wtype high, low;}; +#elif __BYTE_ORDER == __LITTLE_ENDIAN +struct DWstruct { Wtype low, high;}; +#else +#error Unhandled endianity +#endif +typedef union { struct DWstruct s; DWtype ll; } DWunion; + +#define WORD_SIZE __WORDSIZE +#define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) + +DWtype +___fixunsdfdi (DFtype a) +{ + DFtype b; + UDWtype v; + + if (a < 0) + return 0; + + /* Compute high word of result, as a flonum. */ + b = (a / HIGH_WORD_COEFF); + /* Convert that to fixed (but not to DWtype!), + and shift it into the high word. */ + v = (UWtype) b; + v <<= WORD_SIZE; + /* Remove high part from the DFtype, leaving the low part as flonum. */ + a -= (DFtype)v; + /* Convert that to fixed (but not to DWtype!) and add it in. + Sometimes A comes out negative. This is significant, since + A has more bits than a long int does. */ + if (a < 0) + v -= (UWtype) (- a); + else + v += (UWtype) a; + return v; +} +symbol_version (___fixunsdfdi, __fixunsdfdi, GLIBC_2.0); + + +DWtype +___fixdfdi (DFtype a) +{ + if (a < 0) + return - __fixunsdfdi (-a); + return __fixunsdfdi (a); +} +symbol_version (___fixdfdi, __fixdfdi, GLIBC_2.0); + +#endif diff --git a/sysdeps/wordsize-32/fixsfdi.c b/sysdeps/wordsize-32/fixsfdi.c new file mode 100644 index 0000000000..c0235d42a6 --- /dev/null +++ b/sysdeps/wordsize-32/fixsfdi.c @@ -0,0 +1,102 @@ +/* Convert float to 64-bit int. + Copyright (C) 1989, 1992-2001, 2002 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <endian.h> +#include <stdlib.h> +#include <bits/wordsize.h> +#include <shlib-compat.h> + +#if __WORDSIZE != 32 +# error This is for 32-bit targets only +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6) + +typedef unsigned int UQItype __attribute__ ((mode (QI))); +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef unsigned int UDItype __attribute__ ((mode (DI))); +typedef float SFtype __attribute__ ((mode (SF))); +typedef float DFtype __attribute__ ((mode (DF))); +#define Wtype SItype +#define HWtype SItype +#define DWtype DItype +#define UWtype USItype +#define UHWtype USItype +#define UDWtype UDItype +#define W_TYPE_SIZE 32 + +#include <stdlib/longlong.h> + +#if __BYTE_ORDER == __BIG_ENDIAN +struct DWstruct { Wtype high, low;}; +#elif __BYTE_ORDER == __LITTLE_ENDIAN +struct DWstruct { Wtype low, high;}; +#else +#error Unhandled endianity +#endif +typedef union { struct DWstruct s; DWtype ll; } DWunion; + + +#define WORD_SIZE __WORDSIZE +#define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) + + +DWtype +___fixunssfDI (SFtype original_a) +{ + /* Convert the SFtype to a DFtype, because that is surely not going + to lose any bits. Some day someone else can write a faster version + that avoids converting to DFtype, and verify it really works right. */ + DFtype a = original_a; + DFtype b; + UDWtype v; + + if (a < 0) + return 0; + + /* Compute high word of result, as a flonum. */ + b = (a / HIGH_WORD_COEFF); + /* Convert that to fixed (but not to DWtype!), + and shift it into the high word. */ + v = (UWtype) b; + v <<= WORD_SIZE; + /* Remove high part from the DFtype, leaving the low part as flonum. */ + a -= (DFtype) v; + /* Convert that to fixed (but not to DWtype!) and add it in. + Sometimes A comes out negative. This is significant, since + A has more bits than a long int does. */ + if (a < 0) + v -= (UWtype) (- a); + else + v += (UWtype) a; + return v; +} +symbol_version (___fixunssfDI, __fixunssfDI, GLIBC_2.0); + + +DWtype +___fixsfdi (SFtype a) +{ + if (a < 0) + return - __fixunssfDI (-a); + return __fixunssfDI (a); +} +symbol_version (___fixsfdi, __fixsfdi, GLIBC_2.0); diff --git a/sysdeps/wordsize-32/shdi3.c b/sysdeps/wordsize-32/shdi3.c new file mode 100644 index 0000000000..52feb98bec --- /dev/null +++ b/sysdeps/wordsize-32/shdi3.c @@ -0,0 +1,150 @@ +/* 64-bit integer shifting. + Copyright (C) 1989, 1992-2001, 2002 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <endian.h> +#include <stdlib.h> +#include <bits/wordsize.h> +#include <shlib-compat.h> + +#if __WORDSIZE != 32 +# error This is for 32-bit targets only +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6) + +typedef unsigned int UQItype __attribute__ ((mode (QI))); +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef unsigned int UDItype __attribute__ ((mode (DI))); +#define Wtype SItype +#define HWtype SItype +#define DWtype DItype +#define UWtype USItype +#define UHWtype USItype +#define UDWtype UDItype +#define W_TYPE_SIZE 32 +#define BITS_PER_UNIT 8 + +#include <stdlib/longlong.h> + +#if __BYTE_ORDER == __BIG_ENDIAN +struct DWstruct { Wtype high, low;}; +#elif __BYTE_ORDER == __LITTLE_ENDIAN +struct DWstruct { Wtype low, high;}; +#else +#error Unhandled endianity +#endif +typedef union { struct DWstruct s; DWtype ll; } DWunion; + + +DWtype +___lshrdi3 (DWtype u, Wtype b) +{ + DWunion w; + Wtype bm; + DWunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + w.s.high = 0; + w.s.low = (UWtype) uu.s.high >> -bm; + } + else + { + UWtype carries = (UWtype) uu.s.high << bm; + + w.s.high = (UWtype) uu.s.high >> b; + w.s.low = ((UWtype) uu.s.low >> b) | carries; + } + + return w.ll; +} +symbol_version (___lshrdi3, __lshrdi3, GLIBC_2.0); + + +DWtype +___ashldi3 (DWtype u, Wtype b) +{ + DWunion w; + Wtype bm; + DWunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + w.s.low = 0; + w.s.high = (UWtype) uu.s.low << -bm; + } + else + { + UWtype carries = (UWtype) uu.s.low >> bm; + + w.s.low = (UWtype) uu.s.low << b; + w.s.high = ((UWtype) uu.s.high << b) | carries; + } + + return w.ll; +} +symbol_version (___ashldi3, __ashldi3, GLIBC_2.0); + + +DWtype +___ashrdi3 (DWtype u, Wtype b) +{ + DWunion w; + Wtype bm; + DWunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + /* w.s.high = 1..1 or 0..0 */ + w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1); + w.s.low = uu.s.high >> -bm; + } + else + { + UWtype carries = (UWtype) uu.s.high << bm; + + w.s.high = uu.s.high >> b; + w.s.low = ((UWtype) uu.s.low >> b) | carries; + } + + return w.ll; +} +symbol_version (___ashrdi3, __ashrdi3, GLIBC_2.0); + +#endif |