Thread (29 messages) 29 messages, 5 authors, 2017-02-15

Re: [PATCH v7 0/5] Update LZ4 compressor module

From: Sven Schmidt <hidden>
Date: 2017-02-09 11:08:06
Also in: lkml

Hey Eric,

On Wed, Feb 08, 2017 at 09:24:25PM -0800, Eric Biggers wrote:
Also I noticed another bug, this time in LZ4_count():
quoted
#if defined(CONFIG_64BIT)
#define LZ4_ARCH64 1
#else
#define LZ4_ARCH64 0
#endif
...
quoted
#ifdef LZ4_ARCH64
       if ((pIn < (pInLimit-3))
               && (LZ4_read32(pMatch) == LZ4_read32(pIn))) {
               pIn += 4; pMatch += 4;
       }
#endif
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.

Thanks,

Sven
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help