Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1577849
| From | Eric Biggers <ebiggers3@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 0/5] Update LZ4 compressor module |
| Date | 2017-02-09 19:30 +0100 |
| Message-ID | <t91DH-18P-7@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <t7AvT-2Y5-9@gated-at.bofh.it> <t8K9P-6Ok-1@gated-at.bofh.it> <t8KMy-7h9-7@gated-at.bofh.it> <t8QyC-2vb-11@gated-at.bofh.it> <t8ULU-5pa-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Feb 09, 2017 at 12:05:40PM +0100, Sven Schmidt wrote:
> > Because of how LZ4_ARCH64 is defined, it needs to be '#if LZ4_ARCH64'.
> >
> > But I also think the way upstream LZ4 does 64-bit detection could have just been
> > left as-is; it has a function which gets inlined:
> >
> > static unsigned LZ4_64bits(void) { return sizeof(void*)==8; }
> >
> > Eric
>
> does this apply for LZ4_isLittleEndian() as well? As a reminder:
>
> static unsigned LZ4_isLittleEndian(void)
> {
> /* don't use static : performance detrimental */
> const union { U32 u; BYTE c[4]; } one = { 1 };
>
> return one.c[0];
> }
>
> It is surely easier to read and understand using these functions in favor of the macros.
Yes, it makes sense to retain LZ4_isLittleEndian() too, mainly so that the call
sites don't need to be changed and we have less chance of introducing bugs.
I also believe the *implementation* of LZ4_isLittleEndian() using the union
"hack" to detecting endianness works fine and will get optimized correctly,
though we could replace it with an #ifdef __LITTLE_ENDIAN__ if we wanted to. (I
am sure that upstream LZ4 would do that if it was guaranteed to work, but
upstream LZ4 needs to detect endianness reliably across many more different
compilers, compiler versions, and platforms than the Linux kernel does, and
there is no standard preprocessor macro for doing so.)
Eric
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v7 0/5] Update LZ4 compressor module Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-05 20:20 +0100
[PATCH v7 5/5] lib/lz4: Remove back-compat wrappers Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-05 20:20 +0100
[PATCH v7 3/5] crypto: Change LZ4 modules to work with new LZ4 module version Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-05 20:20 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Minchan Kim <minchan@kernel.org> - 2017-02-09 00:50 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Eric Biggers <ebiggers3@gmail.com> - 2017-02-09 01:30 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Eric Biggers <ebiggers3@gmail.com> - 2017-02-09 07:40 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-09 12:10 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Eric Biggers <ebiggers3@gmail.com> - 2017-02-09 19:30 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Minchan Kim <minchan@kernel.org> - 2017-02-10 01:20 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-09 12:10 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Eric Biggers <ebiggers3@gmail.com> - 2017-02-09 20:50 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module David Miller <davem@davemloft.net> - 2017-02-10 05:30 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-09 12:00 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Minchan Kim <minchan@kernel.org> - 2017-02-10 02:00 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-12 12:20 +0100
[PATCH] lz4: fix performance regressions Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-12 12:20 +0100
Re: [PATCH] lz4: fix performance regressions Willy Tarreau <w@1wt.eu> - 2017-02-12 14:10 +0100
Re: [PATCH] lz4: fix performance regressions Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-12 16:30 +0100
Re: [PATCH] lz4: fix performance regressions Willy Tarreau <w@1wt.eu> - 2017-02-12 22:50 +0100
Re: [PATCH] lz4: fix performance regressions Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-13 13:00 +0100
Re: [PATCH] lz4: fix performance regressions Willy Tarreau <w@1wt.eu> - 2017-02-13 14:40 +0100
Re: [PATCH] lz4: fix performance regressions Eric Biggers <ebiggers3@gmail.com> - 2017-02-13 00:40 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Minchan Kim <minchan@kernel.org> - 2017-02-13 01:10 +0100
Re: [PATCH v7 0/5] Update LZ4 compressor module Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2017-02-13 13:10 +0100
csiph-web