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] (google#7697)

Co-authored-by: Derek Bailey <derekbailey@google.com>
  • Loading branch information
2 people authored and candhyan committed Jan 2, 2023
1 parent a19aec8 commit bfaf316
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 bfaf316

Please sign in to comment.