Be C89 compliant and fix alignment for gcc11

This commit is contained in:
Danila Kutenin
2021-06-08 20:45:57 +01:00
parent 444f4db955
commit 6534c0000f
+12 -11
View File
@@ -932,7 +932,7 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
seq.matchLength = mlDInfo->baseValue;
seq.litLength = llDInfo->baseValue;
U32 const ofBase = ofDInfo->baseValue;
{ U32 const ofBase = ofDInfo->baseValue;
BYTE const llBits = llDInfo->nbAdditionalBits;
BYTE const mlBits = mlDInfo->nbAdditionalBits;
BYTE const ofBits = ofDInfo->nbAdditionalBits;
@@ -952,11 +952,11 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
/* sequence */
{ size_t offset;
#if defined(__clang__)
#if defined(__clang__)
if (LIKELY(ofBits > 1)) {
#else
#else
if (ofBits > 1) {
#endif
#endif
ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
assert(ofBits <= MaxOff);
@@ -992,11 +992,11 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
seq.offset = offset;
}
#if defined(__clang__)
#if defined(__clang__)
if (UNLIKELY(mlBits > 0))
#else
#else
if (mlBits > 0)
#endif
#endif
seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
@@ -1006,11 +1006,11 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
/* Ensure there are enough bits to read the rest of data in 64-bit mode. */
ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
#if defined(__clang__)
#if defined(__clang__)
if (UNLIKELY(llBits > 0))
#else
#else
if (llBits > 0)
#endif
#endif
seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
if (MEM_32bits())
@@ -1023,6 +1023,7 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits); /* <= 9 bits */
if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */
ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits); /* <= 8 bits */
}
return seq;
}
@@ -1155,7 +1156,7 @@ ZSTD_decompressSequences_body( ZSTD_DCtx* dctx,
__asm__("nop");
__asm__(".p2align 5");
__asm__("nop");
# if __GNUC__ >= 9
# if __GNUC__ >= 9 && __GNUC__ < 11
/* better for gcc-9 and gcc-10, worse for clang and gcc-8 */
__asm__(".p2align 3");
# else