From be20decb5c4cd2d9f829b577d0d156e5fed4f95e Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 20 Aug 2013 18:55:00 -0700 Subject: [PATCH] fix compilation for BITS 24 in_bits is const. Trying to apply bswap on it, one gets the error message: error: read-only variable 'in_bits' used as 'asm' output Change-Id: I0bef494b822c83d8ea87b1938b0e486d94de4742 --- src/utils/bit_reader.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/bit_reader.h b/src/utils/bit_reader.h index 19ef174f..52306393 100644 --- a/src/utils/bit_reader.h +++ b/src/utils/bit_reader.h @@ -54,7 +54,7 @@ extern "C" { // And just after calling VP8LoadNewBytes(): // [........vvvvvvvvBBBBBBBBBBBBBBBB]LSB || [........vvvvvvvvBBBBBBBBBBBBBBBB] // -// -> we're back to height active 'value_' bits (marked 'v') and BITS cached +// -> we're back to eight active 'value_' bits (marked 'v') and BITS cached // bits (marked 'B') // // The right-justify strategy tends to use less shifts and is often faster. @@ -178,8 +178,11 @@ static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { bits >>= 64 - BITS; #elif (BITS >= 24) #if defined(__i386__) || defined(__x86_64__) - __asm__ volatile("bswap %k0" : "=r"(in_bits) : "0"(in_bits)); - bits = (bit_t)in_bits; // 24b/32b -> 32b/64b zero-extension + { + lbit_t swapped_in_bits; + __asm__ volatile("bswap %k0" : "=r"(swapped_in_bits) : "0"(in_bits)); + bits = (bit_t)swapped_in_bits; // 24b/32b -> 32b/64b zero-extension + } #elif defined(_MSC_VER) bits = (bit_t)_byteswap_ulong(in_bits); #else