mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-05 09:01:07 +00:00
Update.
* iconv/skeleton.c: Define access macros with u suffix. Adjust #if expression for use of unaligned function to the one used in the definition of these functions. * iconv/gconv_simple.c (internal_ucs4_loop_unaligned): New function. (internal_ucs4le_loop_unaligned): New function. Ralf Baechle <ralf@uni-koblenz.de>
This commit is contained in:
parent
c0c2af0799
commit
c1db8b0ddf
@ -1,5 +1,11 @@
|
|||||||
2000-03-31 Ulrich Drepper <drepper@redhat.com>
|
2000-03-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* iconv/skeleton.c: Define access macros with u suffix. Adjust
|
||||||
|
#if expression for use of unaligned function to the one used in
|
||||||
|
the definition of these functions.
|
||||||
|
* iconv/gconv_simple.c (internal_ucs4_loop_unaligned): New function.
|
||||||
|
(internal_ucs4le_loop_unaligned): New function.
|
||||||
|
|
||||||
* elf/Makefile (distribute): Add dep1.c, dep2.c, dep3.c, and dep4.c.
|
* elf/Makefile (distribute): Add dep1.c, dep2.c, dep3.c, and dep4.c.
|
||||||
(tests): Add order.
|
(tests): Add order.
|
||||||
(module-names): Add dep1, dep2, dep3, and dep4.
|
(module-names): Add dep1, dep2, dep3, and dep4.
|
||||||
@ -78,7 +84,7 @@
|
|||||||
* sysdeps/unix/sysv/linux/arm/siglist.c: Likewise.
|
* sysdeps/unix/sysv/linux/arm/siglist.c: Likewise.
|
||||||
|
|
||||||
2000-03-29 Andreas Jaeger <aj@suse.de>,
|
2000-03-29 Andreas Jaeger <aj@suse.de>,
|
||||||
Ralf Baechle <ralf@uni-koblenz.de>
|
Ralf Baechle <ralf@uni-koblenz.de>
|
||||||
|
|
||||||
* Makeconfig: Introduce new variable SHARED to mark code used in
|
* Makeconfig: Introduce new variable SHARED to mark code used in
|
||||||
the shared library.
|
the shared library.
|
||||||
|
@ -99,6 +99,52 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _STRING_ARCH_unaligned
|
||||||
|
static inline int
|
||||||
|
internal_ucs4_loop_unaligned (const unsigned char **inptrp,
|
||||||
|
const unsigned char *inend,
|
||||||
|
unsigned char **outptrp, unsigned char *outend,
|
||||||
|
mbstate_t *state, void *data, size_t *converted)
|
||||||
|
{
|
||||||
|
const unsigned char *inptr = *inptrp;
|
||||||
|
unsigned char *outptr = *outptrp;
|
||||||
|
size_t n_convert = MIN (inend - inptr, outend - outptr) / 4;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
/* Sigh, we have to do some real work. */
|
||||||
|
size_t cnt;
|
||||||
|
|
||||||
|
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4, outptr += 4)
|
||||||
|
{
|
||||||
|
outptr[0] = inptr[3];
|
||||||
|
outptr[1] = inptr[2];
|
||||||
|
outptr[2] = inptr[1];
|
||||||
|
outptr[3] = inptr[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
*inptrp = inptr;
|
||||||
|
*outptrp = outptr;
|
||||||
|
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
/* Simply copy the data. */
|
||||||
|
*inptrp = inptr + n_convert * 4;
|
||||||
|
*outptrp = __mempcpy (outptr, inptr, n_convert * 4);
|
||||||
|
# else
|
||||||
|
# error "This endianess is not supported."
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Determine the status. */
|
||||||
|
if (*outptrp == outend)
|
||||||
|
result = __GCONV_FULL_OUTPUT;
|
||||||
|
else if (*inptrp == inend)
|
||||||
|
result = __GCONV_EMPTY_INPUT;
|
||||||
|
else
|
||||||
|
result = __GCONV_INCOMPLETE_INPUT;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iconv/skeleton.c>
|
#include <iconv/skeleton.c>
|
||||||
|
|
||||||
|
|
||||||
@ -151,6 +197,53 @@ internal_ucs4le_loop (const unsigned char **inptrp, const unsigned char *inend,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _STRING_ARCH_unaligned
|
||||||
|
static inline int
|
||||||
|
internal_ucs4le_loop_unaligned (const unsigned char **inptrp,
|
||||||
|
const unsigned char *inend,
|
||||||
|
unsigned char **outptrp, unsigned char *outend,
|
||||||
|
mbstate_t *state, void *data,
|
||||||
|
size_t *converted)
|
||||||
|
{
|
||||||
|
const unsigned char *inptr = *inptrp;
|
||||||
|
unsigned char *outptr = *outptrp;
|
||||||
|
size_t n_convert = MIN (inend - inptr, outend - outptr) / 4;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
/* Sigh, we have to do some real work. */
|
||||||
|
size_t cnt;
|
||||||
|
|
||||||
|
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
|
||||||
|
{
|
||||||
|
outptr[0] = inptr[3];
|
||||||
|
outptr[1] = inptr[2];
|
||||||
|
outptr[2] = inptr[1];
|
||||||
|
outptr[3] = inptr[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
*inptrp = inptr;
|
||||||
|
*outptrp = outptr;
|
||||||
|
# elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
/* Simply copy the data. */
|
||||||
|
*inptrp = inptr + n_convert * 4;
|
||||||
|
*outptrp = __mempcpy (outptr, inptr, n_convert * 4);
|
||||||
|
# else
|
||||||
|
# error "This endianess is not supported."
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Determine the status. */
|
||||||
|
if (*outptrp == outend)
|
||||||
|
result = __GCONV_FULL_OUTPUT;
|
||||||
|
else if (*inptrp == inend)
|
||||||
|
result = __GCONV_EMPTY_INPUT;
|
||||||
|
else
|
||||||
|
result = __GCONV_INCOMPLETE_INPUT;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iconv/skeleton.c>
|
#include <iconv/skeleton.c>
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,30 +122,30 @@ static int to_object;
|
|||||||
loops we have other definitions which allow optimized access. */
|
loops we have other definitions which allow optimized access. */
|
||||||
#ifdef _STRING_ARCH_unaligned
|
#ifdef _STRING_ARCH_unaligned
|
||||||
/* We can handle unaligned memory access. */
|
/* We can handle unaligned memory access. */
|
||||||
# define get16(addr) *((uint16_t *) (addr))
|
# define get16u(addr) *((uint16_t *) (addr))
|
||||||
# define get32(addr) *((uint32_t *) (addr))
|
# define get32u(addr) *((uint32_t *) (addr))
|
||||||
|
|
||||||
/* We need no special support for writing values either. */
|
/* We need no special support for writing values either. */
|
||||||
# define put16(addr, val) *((uint16_t *) (addr)) = (val)
|
# define put16u(addr, val) *((uint16_t *) (addr)) = (val)
|
||||||
# define put32(addr, val) *((uint32_t *) (addr)) = (val)
|
# define put32u(addr, val) *((uint32_t *) (addr)) = (val)
|
||||||
#else
|
#else
|
||||||
/* Distinguish between big endian and little endian. */
|
/* Distinguish between big endian and little endian. */
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
# define get16(addr) \
|
# define get16u(addr) \
|
||||||
(((__const unsigned char *) (addr))[1] << 8 \
|
(((__const unsigned char *) (addr))[1] << 8 \
|
||||||
| ((__const unsigned char *) (addr))[0])
|
| ((__const unsigned char *) (addr))[0])
|
||||||
# define get32(addr) \
|
# define get32u(addr) \
|
||||||
(((((__const unsigned char *) (addr))[3] << 8 \
|
(((((__const unsigned char *) (addr))[3] << 8 \
|
||||||
| ((__const unsigned char *) (addr))[2]) << 8 \
|
| ((__const unsigned char *) (addr))[2]) << 8 \
|
||||||
| ((__const unsigned char *) (addr))[1]) << 8 \
|
| ((__const unsigned char *) (addr))[1]) << 8 \
|
||||||
| ((__const unsigned char *) (addr))[0])
|
| ((__const unsigned char *) (addr))[0])
|
||||||
|
|
||||||
# define put16(addr, val) \
|
# define put16u(addr, val) \
|
||||||
({ uint16_t __val = (val); \
|
({ uint16_t __val = (val); \
|
||||||
((unsigned char *) (addr))[0] = __val; \
|
((unsigned char *) (addr))[0] = __val; \
|
||||||
((unsigned char *) (addr))[1] = __val >> 8; \
|
((unsigned char *) (addr))[1] = __val >> 8; \
|
||||||
(void) 0; })
|
(void) 0; })
|
||||||
# define put32(addr, val) \
|
# define put32u(addr, val) \
|
||||||
({ uint32_t __val = (val); \
|
({ uint32_t __val = (val); \
|
||||||
((unsigned char *) (addr))[0] = __val; \
|
((unsigned char *) (addr))[0] = __val; \
|
||||||
__val >>= 8; \
|
__val >>= 8; \
|
||||||
@ -156,21 +156,21 @@ static int to_object;
|
|||||||
((unsigned char *) (addr))[3] = __val; \
|
((unsigned char *) (addr))[3] = __val; \
|
||||||
(void) 0; })
|
(void) 0; })
|
||||||
# else
|
# else
|
||||||
# define get16(addr) \
|
# define get16u(addr) \
|
||||||
(((__const unsigned char *) (addr))[0] << 8 \
|
(((__const unsigned char *) (addr))[0] << 8 \
|
||||||
| ((__const unsigned char *) (addr))[1])
|
| ((__const unsigned char *) (addr))[1])
|
||||||
# define get32(addr) \
|
# define get32u(addr) \
|
||||||
(((((__const unsigned char *) (addr))[0] << 8 \
|
(((((__const unsigned char *) (addr))[0] << 8 \
|
||||||
| ((__const unsigned char *) (addr))[1]) << 8 \
|
| ((__const unsigned char *) (addr))[1]) << 8 \
|
||||||
| ((__const unsigned char *) (addr))[2]) << 8 \
|
| ((__const unsigned char *) (addr))[2]) << 8 \
|
||||||
| ((__const unsigned char *) (addr))[3])
|
| ((__const unsigned char *) (addr))[3])
|
||||||
|
|
||||||
# define put16(addr, val) \
|
# define put16u(addr, val) \
|
||||||
({ uint16_t __val = (val); \
|
({ uint16_t __val = (val); \
|
||||||
((unsigned char *) (addr))[1] = __val; \
|
((unsigned char *) (addr))[1] = __val; \
|
||||||
((unsigned char *) (addr))[2] = __val >> 8; \
|
((unsigned char *) (addr))[2] = __val >> 8; \
|
||||||
(void) 0; })
|
(void) 0; })
|
||||||
# define put32(addr, val) \
|
# define put32u(addr, val) \
|
||||||
({ uint32_t __val = (val); \
|
({ uint32_t __val = (val); \
|
||||||
((unsigned char *) (addr))[3] = __val; \
|
((unsigned char *) (addr))[3] = __val; \
|
||||||
__val >>= 8; \
|
__val >>= 8; \
|
||||||
@ -351,7 +351,9 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
|
|||||||
data->__statep, step->__data, &converted
|
data->__statep, step->__data, &converted
|
||||||
EXTRA_LOOP_ARGS);
|
EXTRA_LOOP_ARGS);
|
||||||
}
|
}
|
||||||
#ifndef _STRING_ARCH_unaligned
|
#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
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FROM_DIRECTION)
|
if (FROM_DIRECTION)
|
||||||
|
Loading…
Reference in New Issue
Block a user