From 96c86580f0795a238309b733da9367d6005c2e7d Mon Sep 17 00:00:00 2001 From: Bigpet Date: Tue, 16 Sep 2014 14:52:04 +0200 Subject: [PATCH] define templates outside of block scope --- Utilities/BEType.h | 61 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 51c5e8e082..3c6d0b74ec 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -254,6 +254,35 @@ class be_t static_assert(sizeof(T2) == 1 || sizeof(T2) == 2 || sizeof(T2) == 4 || sizeof(T2) == 8, "Bad be_t type"); T m_data; + template + struct _convert + { + static __forceinline be_t& func(Tfrom& be_value) + { + Tto res = be_value; + return (be_t&)res; + } + }; + + template + struct _convert + { + static __forceinline be_t& func(Tfrom& be_value) + { + Tto res = se_t::func(se_t::func(be_value)); + return (be_t&)res; + } + }; + + template + struct _convert + { + static __forceinline be_t& func(Tfrom& be_value) + { + Tto res = be_value >> ((sizeof(Tfrom)-sizeof(Tto)) * 8); + return (be_t&)res; + } + }; public: typedef T type; @@ -306,36 +335,6 @@ public: template operator const be_t() const { - template - struct _convert - { - static __forceinline be_t& func(Tfrom& be_value) - { - Tto res = be_value; - return (be_t&)res; - } - }; - - template - struct _convert - { - static __forceinline be_t& func(Tfrom& be_value) - { - Tto res = se_t::func(se_t::func(be_value);); - return (be_t&)res; - } - }; - - template - struct _convert - { - static __forceinline be_t& func(Tfrom& be_value) - { - Tto res = be_value >> ((sizeof(Tfrom)-sizeof(Tto)) * 8); - return (be_t&)res; - } - }; - return _convert sizeof(T)) ? 1 : (sizeof(T1) < sizeof(T) ? 2 : 0))>::func(m_data); } @@ -623,4 +622,4 @@ template __forceinline static void Write32(T& f, const u32 data) template __forceinline static void Write64(T& f, const u64 data) { Write64LE(f, re64(data)); -} \ No newline at end of file +}