mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 23:01:37 +00:00
Add static cast to avoid implicit double promotion. (#6132)
Add static cast from float to double in flexbuffers.h to avoid implicit double promotion error. This error is surfacing during the tensorflow lite for microcontrollers build since we enabled -Werror and -Wdouble-promotion.
This commit is contained in:
@@ -1417,7 +1417,10 @@ class Builder FLATBUFFERS_FINAL_CLASS {
|
|||||||
Value(uint64_t u, Type t, BitWidth bw)
|
Value(uint64_t u, Type t, BitWidth bw)
|
||||||
: u_(u), type_(t), min_bit_width_(bw) {}
|
: u_(u), type_(t), min_bit_width_(bw) {}
|
||||||
|
|
||||||
Value(float f) : f_(f), type_(FBT_FLOAT), min_bit_width_(BIT_WIDTH_32) {}
|
Value(float f)
|
||||||
|
: f_(static_cast<double>(f)),
|
||||||
|
type_(FBT_FLOAT),
|
||||||
|
min_bit_width_(BIT_WIDTH_32) {}
|
||||||
Value(double f) : f_(f), type_(FBT_FLOAT), min_bit_width_(WidthF(f)) {}
|
Value(double f) : f_(f), type_(FBT_FLOAT), min_bit_width_(WidthF(f)) {}
|
||||||
|
|
||||||
uint8_t StoredPackedType(BitWidth parent_bit_width_ = BIT_WIDTH_8) const {
|
uint8_t StoredPackedType(BitWidth parent_bit_width_ = BIT_WIDTH_8) const {
|
||||||
|
|||||||
Reference in New Issue
Block a user