diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | iconv/skeleton.c | 39 |
2 files changed, 28 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog index 31e9e19720..de1cb9d685 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +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. + 2000-04-04 Andreas Schwab <schwab@suse.de> * elf/cache.c (print_entry): Only look at the type field when diff --git a/iconv/skeleton.c b/iconv/skeleton.c index a7709eaca0..4a1c7554bf 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. */ |