Skip to content

Commit

Permalink
rewrite for as do-while to remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
JRaspass committed Jan 15, 2014
1 parent 48f886a commit a6cb13d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions JavaBin.c
Expand Up @@ -22,11 +22,11 @@ static HV* bool_stash;
// Lucene variable-length +ve integer, the MSB indicates whether you need another octet.
// http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/fileformats.html#VInt
static uint32_t read_v_int() {
uint8_t shift;
uint32_t result = *in++ & 127;
uint8_t shift = 0;
uint32_t result = 0;

for (shift = 7; in[-1] & 128; shift += 7)
result |= (*in++ & 127) << shift;
do result |= (*in++ & 127) << shift;
while (in[-1] & 128 && (shift += 7));

return result;
}
Expand Down

0 comments on commit a6cb13d

Please sign in to comment.