From 5729e0e9af590807df66a3db688008f9547bce9f Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 10 Feb 2023 14:09:10 -0300 Subject: iconv: Remove _STRING_ARCH_unaligned usage for get/set macros And use a packed structure instead. The compiler generates optimized unaligned code if the architecture supports it. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Wilco Dijkstra --- iconvdata/iso-2022-jp-3.c | 2 +- iconvdata/unicode.c | 6 +++--- iconvdata/utf-16.c | 6 +++--- iconvdata/utf-32.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'iconvdata') diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c index 4a4d5a3046..d341a14f51 100644 --- a/iconvdata/iso-2022-jp-3.c +++ b/iconvdata/iso-2022-jp-3.c @@ -91,7 +91,7 @@ enum if (__glibc_likely (outbuf + 4 <= outend)) \ { \ /* Write out the last character. */ \ - put32u (outbuf, ch); \ + put32 (outbuf, ch); \ outbuf += 4; \ data->__statep->__count &= 7; \ data->__statep->__count |= ASCII_set; \ diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c index 2d131270b9..cc7999e36c 100644 --- a/iconvdata/unicode.c +++ b/iconvdata/unicode.c @@ -51,10 +51,10 @@ return (inptr == inend \ ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \ \ - if (get16u (inptr) == BOM) \ + if (get16 (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ *inptrp = inptr += 2; \ - else if (get16u (inptr) == BOM_OE) \ + else if (get16 (inptr) == BOM_OE) \ { \ data->__flags |= __GCONV_SWAP; \ *inptrp = inptr += 2; \ @@ -67,7 +67,7 @@ if (__glibc_unlikely (outbuf + 2 > outend)) \ return __GCONV_FULL_OUTPUT; \ \ - put16u (outbuf, BOM); \ + put16 (outbuf, BOM); \ outbuf += 2; \ } \ swap = data->__flags & __GCONV_SWAP; diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c index ad7dfa1a5c..edd1816c9d 100644 --- a/iconvdata/utf-16.c +++ b/iconvdata/utf-16.c @@ -55,10 +55,10 @@ return (inptr == inend \ ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \ \ - if (get16u (inptr) == BOM) \ + if (get16 (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ *inptrp = inptr += 2; \ - else if (get16u (inptr) == BOM_OE) \ + else if (get16 (inptr) == BOM_OE) \ { \ data->__flags |= __GCONV_SWAP; \ *inptrp = inptr += 2; \ @@ -70,7 +70,7 @@ if (__glibc_unlikely (outbuf + 2 > outend)) \ return __GCONV_FULL_OUTPUT; \ \ - put16u (outbuf, BOM); \ + put16 (outbuf, BOM); \ outbuf += 2; \ } \ } \ diff --git a/iconvdata/utf-32.c b/iconvdata/utf-32.c index 01b6d95018..41be52bb3a 100644 --- a/iconvdata/utf-32.c +++ b/iconvdata/utf-32.c @@ -52,10 +52,10 @@ return (inptr == inend \ ? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT); \ \ - if (get32u (inptr) == BOM) \ + if (get32 (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ *inptrp = inptr += 4; \ - else if (get32u (inptr) == BOM_OE) \ + else if (get32 (inptr) == BOM_OE) \ { \ data->__flags |= __GCONV_SWAP; \ *inptrp = inptr += 4; \ @@ -69,7 +69,7 @@ if (__glibc_unlikely (outbuf + 4 > outend)) \ return __GCONV_FULL_OUTPUT; \ \ - put32u (outbuf, BOM); \ + put32 (outbuf, BOM); \ outbuf += 4; \ } \ else if (__builtin_expect (data->__invocation_counter == 0, 0) \ -- cgit 1.4.1