C++ Decrease Build Time of Supremacy

Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2018
Сообщения
25
Реакции[?]
5
Поинты[?]
3K
One of the main reasons it takes so long for Supremacy to build is due to how the xor.h file is structured, and a lot of people pasting off of supremacy do not fix this. Included is a fix for this.
Updated xor.h:
namespace xor{
    // actual xor implementation.
    template< class t, const size_t len, const t key >
    classGen {
    private:
        std::array< t, len > m_buffer;

    private:
        // encrypt single character.
        constexpr t enc(const tc) const noexcept {
            return c^key;
        }

        // decrypt single character.
        __forceinline t dec(const tc) const noexcept {
            return c^key;
        }

    public:
        // iterate each byte and decrypt.
        __forceinline auto data() noexcept {
            for (size_t i{ 0u }; i < len; ++i)
                m_buffer[i] = dec(m_buffer[i]);

            return m_buffer.data();
        }

        // ctor.
        template<size_t...seq>
        constexpr __forceinline Gen(const t(&s)[len], std::index_sequence< seq... >) noexcept : m_buffer{ enc(s[seq])... } {}
    };
}

template< class t, const size_t len >
constexpr __forceinline auto XorStr(const t(&s)[len]) {
    return xor ::Gen< t, len, GET_XOR_KEYUI8 >(s, std::make_index_sequence< len >()).data();
}

#define XOR( s ) ( s )
 
Сверху Снизу