From baf0508027872f50198e838fe1148b73a9b11b1f Mon Sep 17 00:00:00 2001 From: Erwin Jansen Date: Wed, 21 Nov 2018 16:09:40 -0800 Subject: CMake support to enable compilation under Visual Studio - Add support for cmake - Template fix to enable compilation with visual studio. - Exclusion of static type tests under visual studio - Fix unit tests due to declaration issues Note we do not build the fuzzing target. Test: All unit tests green on VS2017, MacOs, Linux Change-Id: Ie8437f61d187fff03279c99fde0ff565e8f39b50 --- src/decoder/integer_sequence_codec.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/decoder/integer_sequence_codec.cc') diff --git a/src/decoder/integer_sequence_codec.cc b/src/decoder/integer_sequence_codec.cc index 83c0359..c2cd511 100644 --- a/src/decoder/integer_sequence_codec.cc +++ b/src/decoder/integer_sequence_codec.cc @@ -193,13 +193,20 @@ inline constexpr bool IsPow2(T x) { return (x & (x - 1)) == 0; } const int kInterleavedQuintBits[3] = { 3, 2, 2 }; const int kInterleavedTritBits[5] = { 2, 2, 1, 2, 1 }; +// Some template meta programming to get around the fact that MSVC +// will not allow (ValRange == 5) ? 3 : 5 as a template parameter +template +struct DecodeBlockSize { + enum { value = (ValRange == 5 ? 3 : 5) }; +}; + // Decodes either a trit or quint block using the BISE (Bounded Integer Sequence // Encoding) defined in Section C.2.12 of the ASTC specification. ValRange is // expected to be either 3 or 5 depending on whether or not we're encoding trits // or quints respectively. In other words, it is the remaining factor in whether // the passed blocks contain encoded values of the form 3*2^k or 5*2^k. template -std::array DecodeISEBlock( +std::array::value> DecodeISEBlock( uint64_t block_bits, int num_bits) { static_assert(ValRange == 3 || ValRange == 5, "We only know about trits and quints"); -- cgit v1.2.3