Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. diff --git a/modules/native/feathers/bufext/bytebuf.h b/modules/native/feathers/bufext/bytebuf.h
  2. index a111777..9e716af 100644
  3. --- a/modules/native/feathers/bufext/bytebuf.h
  4. +++ b/modules/native/feathers/bufext/bytebuf.h
  5. @@ -344,17 +344,9 @@ template<ByteBufEndianMode ENDIANMODE> class ByteBufTemplate
  6.  
  7.  
  8. private:
  9. +
  10. + template<typename T> inline void EndianConvertHelper(T& val) const;
  11.  
  12. - template<typename T> inline void EndianConvertHelper(T& val) const
  13. - {
  14. - switch(_endian)
  15. - {
  16. - case ENDIANMODE_LITTLE: ToLittleEndian<T>(val); break;
  17. - case ENDIANMODE_BIG: ToBigEndian<T>(val); break;
  18. - case ENDIANMODE_REVERSE: ToOtherEndian<T>(val); break;
  19. - // ENDIANMODE_NATIVE and ENDIANMODE_MANUAL do nothing
  20. - }
  21. - }
  22.  
  23. // this code compiles with MSVC, but not with GCC - it is not required to have this class working, just a small optimization
  24. #ifdef _MSC_VER
  25. @@ -365,9 +357,22 @@ template<ByteBufEndianMode ENDIANMODE> class ByteBufTemplate
  26.  
  27. // endian specializations below
  28. template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_NATIVE>::EndianConvertHelper(T& val) const {}
  29. -template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_LITTLE>::EndianConvertHelper(T& val) const { ToLittleEndian<T>(val); }
  30. -template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_BIG>::EndianConvertHelper(T& val) const { ToBigEndian<T>(val); }
  31. -template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_REVERSE>::EndianConvertHelper(T& val) const { ToOtherEndian<T>(val); }
  32. +template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_LITTLE>::EndianConvertHelper(T& val) const { ToLittleEndian(val); }
  33. +template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_BIG>::EndianConvertHelper(T& val) const { ToBigEndian(val); }
  34. +template <> template <typename T> inline void ByteBufTemplate<ENDIANMODE_REVERSE>::EndianConvertHelper(T& val) const { ToOtherEndian(val); }
  35. +
  36. +template<ByteBufEndianMode ENDIANMODE>
  37. +template<typename T> inline void ByteBufTemplate<ENDIANMODE>::EndianConvertHelper(T& val) const
  38. +{
  39. + switch(_endian)
  40. + {
  41. + case ENDIANMODE_LITTLE: ToLittleEndian(val); break;
  42. + case ENDIANMODE_BIG: ToBigEndian(val); break;
  43. + case ENDIANMODE_REVERSE: ToOtherEndian(val); break;
  44. + // ENDIANMODE_NATIVE and ENDIANMODE_MANUAL do nothing
  45. + }
  46. +}
  47. +
  48.  
  49. template <> inline void ByteBufTemplate<ENDIANMODE_NATIVE>::setEndian(ByteBufEndianMode en) {}
  50. template <> inline void ByteBufTemplate<ENDIANMODE_LITTLE>::setEndian(ByteBufEndianMode en) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement