mirror of
https://github.com/revsic/cpp-obfuscator
synced 2026-06-08 17:08:30 +00:00
obfs: Remerging
This commit is contained in:
+17
-1
@@ -67,6 +67,8 @@ namespace obfs {
|
||||
using value = TypeVal<T, Val>;
|
||||
using next = Sequence<T, Others...>;
|
||||
|
||||
constexpr static std::size_t size = 1 + sizeof...(Others);
|
||||
|
||||
template <std::size_t Idx>
|
||||
using index = std::conditional_t<Idx == 0, value, typename next::template index<Idx - 1>>;
|
||||
};
|
||||
@@ -75,6 +77,8 @@ namespace obfs {
|
||||
struct Sequence<T, Val> {
|
||||
using value = TypeVal<T, Val>;
|
||||
|
||||
constexpr static std::size_t size = 1;
|
||||
|
||||
template <std::size_t Idx>
|
||||
using index = std::conditional_t<Idx == 0, value, Nothing>;
|
||||
};
|
||||
@@ -96,9 +100,21 @@ namespace obfs {
|
||||
using index = std::conditional_t<Idx == 0, type, Nothing>;
|
||||
};
|
||||
|
||||
template <std::size_t Val, std::size_t... Others>
|
||||
struct MinVal {
|
||||
constexpr static std::size_t value =
|
||||
Val < MinVal<Others...>::value ? Val : MinVal<Others...>::value;
|
||||
};
|
||||
|
||||
template <std::size_t Val>
|
||||
struct MinVal<Val> {
|
||||
constexpr static std::size_t value = Val;
|
||||
};
|
||||
|
||||
template <typename... T>
|
||||
struct SeqPack {
|
||||
constexpr static std::size_t size = sizeof...(T);
|
||||
constexpr static std::size_t elem_size = MinVal<T::size...>::value;
|
||||
|
||||
template <std::size_t Idx, typename U>
|
||||
using getter = typename U::template index<Idx>;
|
||||
@@ -150,7 +166,7 @@ namespace obfs {
|
||||
|
||||
template <typename Table, std::size_t size>
|
||||
constexpr auto make_string(char const (&str)[size]) {
|
||||
using pair = typename Table::template index<MAKE_RAND_VAL(Table::size)>;
|
||||
using pair = typename Table::template index<MAKE_RAND_VAL(Table::elem_size)>;
|
||||
constexpr Encoder encoder = pair::template index<0>::value;
|
||||
constexpr Decoder decoder = pair::template index<1>::value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user