aboutsummaryrefslogtreecommitdiff
path: root/iconv/skeleton.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-04-04 21:16:13 +0000
committerUlrich Drepper <drepper@redhat.com>2000-04-04 21:16:13 +0000
commit3aaad0b63854cf780e2605b7c4f34170f8920957 (patch)
tree350f39e6a1bba44695bd18d93332fd575330285a /iconv/skeleton.c
parent0b7219cc9da20a5ebc65fa1212d8f2ade36a247e (diff)
downloadglibc-3aaad0b63854cf780e2605b7c4f34170f8920957.zip
glibc-3aaad0b63854cf780e2605b7c4f34170f8920957.tar.gz
glibc-3aaad0b63854cf780e2605b7c4f34170f8920957.tar.bz2
Update.
2000-04-04 Ulrich Drepper <drepper@redhat.com> * iconv/skeleton.c (FUNCTION_NAME): Reorder initialization of unaligned so that it compiles for system which need unaligned access handling.
Diffstat (limited to 'iconv/skeleton.c')
-rw-r--r--iconv/skeleton.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index a7709ea..4a1c755 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -297,36 +297,41 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
unsigned char *outbuf = data->__outbuf;
unsigned char *outend = data->__outbufend;
unsigned char *outstart;
+ /* This variable is used to count the number of characters we
+ actually converted. */
+ size_t converted = 0;
#if defined _STRING_ARCH_unaligned \
|| MIN_NEEDED_FROM == 1 || MAX_NEEDED_FROM % MIN_NEEDED_FROM != 0 \
|| MIN_NEEDED_TO == 1 || MAX_NEEDED_TO % MIN_NEEDED_TO != 0
# define unaligned 0
#else
- /* The following assumes that encodings, which have a variable length
- what might unalign a buffer even though it is a aligned in the
- beginning, either don't have the minimal number of bytes as a divisor
- of the maximum length or have a minimum length of 1. This is true
- for all known and supported encodings. */
- int unaligned = ((FROM_DIRECTION
- && ((uintptr_t) inptr % MIN_NEEDED_FROM != 0
- || (data->__is_last
- && (uintptr_t) outbuf % MIN_NEEDED_TO != 0)))
- || (!FROM_DIRECTION
- && ((data->__is_last
- && (uintptr_t) outbuf % MIN_NEEDED_FROM != 0)
- || (uintptr_t) inptr % MIN_NEEDED_TO != 0)));
+ int unaligned;
# define GEN_unaligned(name) GEN_unaligned2 (name)
# define GEN_unaligned2(name) name##_unaligned
#endif
- /* This variable is used to count the number of characters we
- actually converted. */
- size_t converted = 0;
-
#ifdef PREPARE_LOOP
PREPARE_LOOP
#endif
+#if !defined _STRING_ARCH_unaligned \
+ && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
+ && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0
+ /* The following assumes that encodings, which have a variable length
+ what might unalign a buffer even though it is a aligned in the
+ beginning, either don't have the minimal number of bytes as a divisor
+ of the maximum length or have a minimum length of 1. This is true
+ for all known and supported encodings. */
+ unaligned = ((FROM_DIRECTION
+ && ((uintptr_t) inptr % MIN_NEEDED_FROM != 0
+ || (data->__is_last
+ && (uintptr_t) outbuf % MIN_NEEDED_TO != 0)))
+ || (!FROM_DIRECTION
+ && ((data->__is_last
+ && (uintptr_t) outbuf % MIN_NEEDED_FROM != 0)
+ || (uintptr_t) inptr % MIN_NEEDED_TO != 0)));
+#endif
+
do
{
/* Remember the start value for this round. */