From f61c8e8a5586e860e19cb59fdb141bfe00fce0bc Mon Sep 17 00:00:00 2001 From: revsic Date: Sat, 23 Feb 2019 03:37:26 +0900 Subject: [PATCH] obfs: Remerging --- obfuscator.hpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/obfuscator.hpp b/obfuscator.hpp index 0823a01..e004671 100644 --- a/obfuscator.hpp +++ b/obfuscator.hpp @@ -67,6 +67,8 @@ namespace obfs { using value = TypeVal; using next = Sequence; + constexpr static std::size_t size = 1 + sizeof...(Others); + template using index = std::conditional_t>; }; @@ -75,6 +77,8 @@ namespace obfs { struct Sequence { using value = TypeVal; + constexpr static std::size_t size = 1; + template using index = std::conditional_t; }; @@ -96,9 +100,21 @@ namespace obfs { using index = std::conditional_t; }; + template + struct MinVal { + constexpr static std::size_t value = + Val < MinVal::value ? Val : MinVal::value; + }; + + template + struct MinVal { + constexpr static std::size_t value = Val; + }; + template struct SeqPack { constexpr static std::size_t size = sizeof...(T); + constexpr static std::size_t elem_size = MinVal::value; template using getter = typename U::template index; @@ -150,7 +166,7 @@ namespace obfs { template constexpr auto make_string(char const (&str)[size]) { - using pair = typename Table::template index; + using pair = typename Table::template index; constexpr Encoder encoder = pair::template index<0>::value; constexpr Decoder decoder = pair::template index<1>::value;