From 626fe5e043de25e970ebdf061b88c646fa689113 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 19 Sep 2017 10:09:31 -0700
Subject: [PATCH 2/2] use __builtin_bswap16 when building with clang

clang pretends to be gcc 4.2.0 and therefore the code does
not use __builtin_bswap16 but tries to synthesize it

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted
 include/flatbuffers/base.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h
index c73fb2d..13e8fac 100644
--- a/include/flatbuffers/base.h
+++ b/include/flatbuffers/base.h
@@ -156,7 +156,7 @@ template<typename T> T EndianSwap(T t) {
     #define FLATBUFFERS_BYTESWAP32 _byteswap_ulong
     #define FLATBUFFERS_BYTESWAP64 _byteswap_uint64
   #else
-    #if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408
+    #if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408 && !defined(__clang__)
       // __builtin_bswap16 was missing prior to GCC 4.8.
       #define FLATBUFFERS_BYTESWAP16(x) \
         static_cast<uint16_t>(__builtin_bswap32(static_cast<uint32_t>(x) << 16))
-- 
2.14.1

