Fix Visual Studio size_t cast compiler warning
authorLenny Komow <lenny@lunarg.com>
Thu, 13 Jul 2017 17:13:14 +0000 (11:13 -0600)
committerLenny Komow <lenny@lunarg.com>
Thu, 13 Jul 2017 19:02:43 +0000 (13:02 -0600)
Visual Studio was complaining about possible loss of data on 64-bit
builds, due to an implicit cast from size_t to int. This changes the
data to use an int with no cast.

source/comp/markv_codec.cpp

index faf545f..2288dc3 100644 (file)
@@ -1367,7 +1367,7 @@ spv_result_t MarkvDecoder::DecodeInstruction(spv_parsed_instruction_t* inst) {
 
   assert(inst->num_words == std::accumulate(
       parsed_operands_.begin(), parsed_operands_.end(), 1,
-      [](size_t num_words, const spv_parsed_operand_t& operand) {
+      [](int num_words, const spv_parsed_operand_t& operand) {
         return num_words += operand.num_words;
   }) && "num_words in instruction doesn't correspond to the sum of num_words"
         "in the operands");