Skip to content

Commit

Permalink
Don't rely on unsequenced evaluation order in bintool/metadata.h (ras…
Browse files Browse the repository at this point in the history
…pberrypi#187) (raspberrypi#188)

metadata.h:258:44: warning: multiple unsequenced modifications to 'i' [-Wunsequenced]

Fix this warning by reading the low and high words in order, then combining them,
rather than doing so in a single expression.
  • Loading branch information
ericm1024 authored Dec 10, 2024
1 parent a258a14 commit a672c24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bintool/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ struct partition_table_item : public single_byte_size_item {
new_p.flags = permissions_flags & (~PICOBIN_PARTITION_PERMISSIONS_BITS);

if (new_p.flags & PICOBIN_PARTITION_FLAGS_HAS_ID_BITS) {
new_p.id = (uint64_t)data[i++] | ((uint64_t)data[i++] << 32);
uint32_t low = data[i++];
uint32_t high = data[i++];
new_p.id = (uint64_t)low | ((uint64_t)high << 32);
}

uint8_t num_extra_families = (new_p.flags & PICOBIN_PARTITION_FLAGS_ACCEPTS_NUM_EXTRA_FAMILIES_BITS) >> PICOBIN_PARTITION_FLAGS_ACCEPTS_NUM_EXTRA_FAMILIES_LSB;
Expand Down

0 comments on commit a672c24

Please sign in to comment.