diff options
Diffstat (limited to 'executor/_include/flatbuffers/flexbuffers.h')
| -rw-r--r-- | executor/_include/flatbuffers/flexbuffers.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/executor/_include/flatbuffers/flexbuffers.h b/executor/_include/flatbuffers/flexbuffers.h index 7bf84302e..8e8cac144 100644 --- a/executor/_include/flatbuffers/flexbuffers.h +++ b/executor/_include/flatbuffers/flexbuffers.h @@ -17,6 +17,7 @@ #ifndef FLATBUFFERS_FLEXBUFFERS_H_ #define FLATBUFFERS_FLEXBUFFERS_H_ +#include <algorithm> #include <map> // Used to select STL variant. #include "flatbuffers/base.h" @@ -382,10 +383,10 @@ class Reference { type_(type) {} 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); - type_ = static_cast<Type>(packed_type >> 2); - } + : data_(data), + parent_width_(parent_width), + byte_width_(static_cast<uint8_t>(1 << (packed_type & 3))), + type_(static_cast<Type>(packed_type >> 2)) {} Type GetType() const { return type_; } @@ -1423,12 +1424,10 @@ class Builder FLATBUFFERS_FINAL_CLASS { template<typename T> static Type GetScalarType() { static_assert(flatbuffers::is_scalar<T>::value, "Unrelated types"); - return flatbuffers::is_floating_point<T>::value - ? FBT_FLOAT - : flatbuffers::is_same<T, bool>::value - ? FBT_BOOL - : (flatbuffers::is_unsigned<T>::value ? FBT_UINT - : FBT_INT); + return flatbuffers::is_floating_point<T>::value ? FBT_FLOAT + : flatbuffers::is_same<T, bool>::value + ? FBT_BOOL + : (flatbuffers::is_unsigned<T>::value ? FBT_UINT : FBT_INT); } public: @@ -1844,7 +1843,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS { uint8_t len = 0; auto vtype = ToFixedTypedVectorElementType(r.type_, &len); if (!VerifyType(vtype)) return false; - return VerifyFromPointer(p, r.byte_width_ * len); + return VerifyFromPointer(p, static_cast<size_t>(r.byte_width_) * len); } default: return false; } |
