/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#endif
-#define FB_GEN(t, fn) \
-template<> inline t EndianIntBase<t>::swap(t x) { return fn(x); }
+#define FB_GEN(t, fn) \
+ template <> \
+ inline t EndianIntBase<t>::swap(t x) { \
+ return t(fn(std::make_unsigned<t>::type(x))); \
+ }
// fn(x) expands to (x) if the second argument is empty, which is exactly
// what we want for [u]int8_t. Also, gcc 4.7 on Intel doesn't have
other.bitOffset_ - bitOffset_;
}
- unsigned int bitOffset_;
+ size_t bitOffset_;
};
/**