From 1beed12e59d18667a35eb8a0fc494e4726c39ea4 Mon Sep 17 00:00:00 2001 From: "Jun Hyeon, Nam" Date: Sun, 19 Mar 2017 02:08:39 +0900 Subject: [PATCH] fixed duplicate symbol error in flexbuffers.h (#4233) 1. modified the function that omitted inline. 2. changed the static global functions to inline functions. --- include/flatbuffers/flexbuffers.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 3bd86f72b..c1eaf44bf 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -161,7 +161,7 @@ inline double ReadDouble(const uint8_t *data, uint8_t 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); } @@ -169,7 +169,7 @@ template const uint8_t *Indirect(const uint8_t *offset) { return offset - flatbuffers::ReadScalar(offset); } -static BitWidth WidthU(uint64_t u) { +inline BitWidth WidthU(uint64_t u) { #define FLATBUFFERS_GET_FIELD_BIT_WIDTH(value, width) { \ if (!((u) & ~((1ULL << (width)) - 1ULL))) return BIT_WIDTH_##width; \ } @@ -180,12 +180,12 @@ static BitWidth WidthU(uint64_t u) { return BIT_WIDTH_64; } -static BitWidth WidthI(int64_t i) { +inline BitWidth WidthI(int64_t i) { auto u = static_cast(i) << 1; return WidthU(i >= 0 ? u : ~u); } -static BitWidth WidthF(double f) { +inline BitWidth WidthF(double f) { return static_cast(static_cast(f)) == f ? BIT_WIDTH_32 : BIT_WIDTH_64; }