From: David Neto Date: Mon, 23 Nov 2015 19:17:35 +0000 (-0500) Subject: Fix compilation of an assert. X-Git-Tag: upstream/2018.6~1420 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15afbf93728dddffd332a27352e86fbc7b487db0;p=platform%2Fupstream%2FSPIRV-Tools.git Fix compilation of an assert. The asserts check the length of the endian-converted words vector with the reported number of words in the instruction. --- diff --git a/source/binary.cpp b/source/binary.cpp index c589b6b..49daf42 100755 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -377,7 +377,15 @@ spv_result_t Parser::parseInstruction() { << " words, but found " << _.word_index - inst_offset << " words instead."; } - assert(inst_word_count == words.size()); + + // Check the computed length of the endian-converted words vector against + // the declared number of words in the instruction. If endian conversion + // is required, then they should match. If no endian conversion was + // performed, then the vector only contains the initial opcode/word-count + // word. + assert(!_.requires_endian_conversion || + (inst_word_count == endian_converted_words.size())); + assert(_.requires_endian_conversion || (endian_converted_words.size() == 1)); recordNumberType(inst_offset, &inst);