Skip to content

Commit

Permalink
fix: byte_width_ = 1U << static_cast<BitWidth>(packed_type & 3) impli…
Browse files Browse the repository at this point in the history
…cit conversion loses integer precision: 'unsigned int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion]
  • Loading branch information
runhwguo authored and runhwguo committed Dec 6, 2022
1 parent 5b7b36e commit 8ef3996
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/flatbuffers/flexbuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class Reference {

Reference(const uint8_t *data, uint8_t parent_width, uint8_t packed_type)
: data_(data), parent_width_(parent_width) {
byte_width_ = 1U << static_cast<BitWidth>(packed_type & 3);
byte_width_ = static_cast<BitWidth>(1U << (packed_type & 3));
type_ = static_cast<Type>(packed_type >> 2);
}

Expand Down

0 comments on commit 8ef3996

Please sign in to comment.