aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-04-01 09:53:28 +0000
committerUlrich Drepper <drepper@redhat.com>2005-04-01 09:53:28 +0000
commit91682d7038c0247ba1a52925b284fcb59756546e (patch)
tree72a7a15deaab616cd30e97712f31479ac7a65bbd
parentee6189855aab3a9be8f3c2d95ce2b2cd17db4ec2 (diff)
downloadglibc-91682d7038c0247ba1a52925b284fcb59756546e.tar
glibc-91682d7038c0247ba1a52925b284fcb59756546e.tar.gz
glibc-91682d7038c0247ba1a52925b284fcb59756546e.tar.bz2
glibc-91682d7038c0247ba1a52925b284fcb59756546e.zip
* sysdeps/ia64/fpu/libm_cpu_defs.h: Update copyright.cvs/fedora-glibc-20050401T1444
2005-04-01 Ulrich Drepper <drepper@redhat.com> * wcsmbs/btowc.c (__btowc): Optimize parameters in ASCII range. * wcsmbs/wctob.c (wctob): Likewise. * wcsmbs/wchar.h (btowc): Add optimized inline function. (wctob): Likewise.
-rw-r--r--ChangeLog11
-rw-r--r--sysdeps/ia64/fpu/libm_cpu_defs.h44
-rw-r--r--wcsmbs/btowc.c8
-rw-r--r--wcsmbs/wchar.h18
-rw-r--r--wcsmbs/wctob.c7
5 files changed, 78 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 98d63c94bc..a3fbb7e11f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-03-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/ia64/fpu/libm_cpu_defs.h: Update copyright.
+
+2005-04-01 Ulrich Drepper <drepper@redhat.com>
+
+ * wcsmbs/btowc.c (__btowc): Optimize parameters in ASCII range.
+ * wcsmbs/wctob.c (wctob): Likewise.
+ * wcsmbs/wchar.h (btowc): Add optimized inline function.
+ (wctob): Likewise.
+
2005-03-31 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/getcontext.S: Use functionally
diff --git a/sysdeps/ia64/fpu/libm_cpu_defs.h b/sysdeps/ia64/fpu/libm_cpu_defs.h
index 7b17540cef..516128c404 100644
--- a/sysdeps/ia64/fpu/libm_cpu_defs.h
+++ b/sysdeps/ia64/fpu/libm_cpu_defs.h
@@ -1,13 +1,43 @@
/* file: libm_cpu_defs.h */
-/*
-** Copyright (C) 1985-2004 Intel Corporation.
-**
-** The information and source code contained herein is the exclusive property
-** of Intel Corporation and may not be disclosed, examined, or reproduced in
-** whole or in part without explicit written authorization from the Company.
-*/
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
#ifndef __LIBM_CPU_DEFS__H_INCLUDED__
#define __LIBM_CPU_DEFS__H_INCLUDED__
diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c
index 1ba0221403..6add7ed8bb 100644
--- a/wcsmbs/btowc.c
+++ b/wcsmbs/btowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,2002,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <ctype.h>
#include <dlfcn.h>
#include <gconv.h>
#include <stdio.h>
@@ -37,6 +38,11 @@ __btowc (c)
if (c < SCHAR_MIN || c > UCHAR_MAX || c == EOF)
return WEOF;
+ /* We know that only ASCII compatible encodings are used for the
+ locale and that the wide character encoding is ISO 10646. */
+ if (isascii (c))
+ return (wint_t) c;
+
/* Get the conversion functions. */
fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 1fe7e94d92..fe4ee80bff 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2004, 2005 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
@@ -320,6 +320,22 @@ __END_NAMESPACE_C99
#ifdef __USE_EXTERN_INLINES
/* Define inline function as optimization. */
+
+/* We can use the BTOWC and WCTOB optimizations since we know that all
+ locales must use ASCII encoding for the values in the ASCII range
+ and because the wchar_t encoding is always ISO 10646. */
+extern wint_t __btowc_alias (int __c) __asm ("btowc");
+extern __inline wint_t
+__NTH (btowc (int __c))
+{ return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
+ ? (wint_t) __c : __btowc_alias (__c)); }
+
+extern int __wctob_alias (wint_t __c) __asm ("wctob");
+extern __inline int
+__NTH (wctob (wint_t __wc))
+{ return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
+ ? (int) __wc : __wctob_alias (__wc)); }
+
extern __inline size_t
__NTH (mbrlen (__const char *__restrict __s, size_t __n,
mbstate_t *__restrict __ps))
diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c
index 854a3f25db..0f241577a4 100644
--- a/wcsmbs/wctob.c
+++ b/wcsmbs/wctob.c
@@ -40,6 +40,11 @@ wctob (c)
if (c == WEOF)
return EOF;
+ /* We know that only ASCII compatible encodings are used for the
+ locale and that the wide character encoding is ISO 10646. */
+ if (c >= L'\0' && c <= L'\x7f')
+ return (int) c;
+
/* Tell where we want the result. */
data.__outbuf = buf;
data.__outbufend = buf + MB_LEN_MAX;
@@ -69,5 +74,5 @@ wctob (c)
|| data.__outbuf != (unsigned char *) (buf + 1))
return EOF;
- return (unsigned char) buf[0];
+ return buf[0];
}