Commit 1beed12e authored by Jun Hyeon, Nam's avatar Jun Hyeon, Nam Committed by Wouter van Oortmerssen

fixed duplicate symbol error in flexbuffers.h (#4233)

1. modified the function that omitted inline.
2. changed the static global functions to inline functions.
parent 4cd71d67
...@@ -161,7 +161,7 @@ inline double ReadDouble(const uint8_t *data, uint8_t byte_width) { ...@@ -161,7 +161,7 @@ inline double ReadDouble(const uint8_t *data, uint8_t byte_width) {
byte_width); byte_width);
} }
const uint8_t *Indirect(const uint8_t *offset, uint8_t byte_width) { inline const uint8_t *Indirect(const uint8_t *offset, uint8_t byte_width) {
return offset - ReadUInt64(offset, byte_width); return offset - ReadUInt64(offset, byte_width);
} }
...@@ -169,7 +169,7 @@ template<typename T> const uint8_t *Indirect(const uint8_t *offset) { ...@@ -169,7 +169,7 @@ template<typename T> const uint8_t *Indirect(const uint8_t *offset) {
return offset - flatbuffers::ReadScalar<T>(offset); return offset - flatbuffers::ReadScalar<T>(offset);
} }
static BitWidth WidthU(uint64_t u) { inline BitWidth WidthU(uint64_t u) {
#define FLATBUFFERS_GET_FIELD_BIT_WIDTH(value, width) { \ #define FLATBUFFERS_GET_FIELD_BIT_WIDTH(value, width) { \
if (!((u) & ~((1ULL << (width)) - 1ULL))) return BIT_WIDTH_##width; \ if (!((u) & ~((1ULL << (width)) - 1ULL))) return BIT_WIDTH_##width; \
} }
...@@ -180,12 +180,12 @@ static BitWidth WidthU(uint64_t u) { ...@@ -180,12 +180,12 @@ static BitWidth WidthU(uint64_t u) {
return BIT_WIDTH_64; return BIT_WIDTH_64;
} }
static BitWidth WidthI(int64_t i) { inline BitWidth WidthI(int64_t i) {
auto u = static_cast<uint64_t>(i) << 1; auto u = static_cast<uint64_t>(i) << 1;
return WidthU(i >= 0 ? u : ~u); return WidthU(i >= 0 ? u : ~u);
} }
static BitWidth WidthF(double f) { inline BitWidth WidthF(double f) {
return static_cast<double>(static_cast<float>(f)) == f ? BIT_WIDTH_32 return static_cast<double>(static_cast<float>(f)) == f ? BIT_WIDTH_32
: BIT_WIDTH_64; : BIT_WIDTH_64;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment