<commit_before>#ifndef PACKET_HPP
#define PACKET_HPP

#include <SFML/Network/Packet.hpp>
#include <vector>
#include <array>
#include <crc32.hpp>
#include <variadic.hpp>
#include <sorted_vector.hpp>
#include "serialized_packet.hpp"

struct color32;

namespace sf {
    // Extend sf::Packet to handle 64bit types
    #ifdef HAS_UINT64_T
    packet_t::base& operator << (packet_t::base& p, std::uint64_t data);
    packet_t::base& operator >> (packet_t::base& p, std::uint64_t& data);
    #else
    struct impl_u64 {
        std::uint32_t lo, hi;
        bool operator < (const impl_u64& i) const;
    };
    packet_t::base& operator << (packet_t::base& p, impl_u64 data);
    packet_t::base& operator >> (packet_t::base& p, impl_u64& data);
    #endif

    template<typename T, typename enable = typename std::enable_if<std::is_enum<T>::value>::type>
    packet_t::base& operator >> (packet_t::base& p, T& t) {
        return p >> reinterpret_cast<typename std::underlying_type<T>::type&>(t);
    }

    template<typename T, typename enable = typename std::enable_if<std::is_enum<T>::value>::type>
    packet_t::base& operator << (packet_t::base& p, T t) {
        return p << static_cast<typename std::underlying_type<T>::type>(t);
    }

    packet_t::base& operator << (packet_t::base& o, ctl::empty_t);
    packet_t::base& operator >> (packet_t::base& i, ctl::empty_t);

    template<typename T>
    packet_t::base& operator >> (packet_t::base& p, std::vector<T>& t) {
        std::uint32_t s;
        p >> s;
        std::uint32_t i0 = t.size();
        t.resize(i0 + s);
        for (std::uint32_t i = 0; i < s; ++i) {
            p >> t[i0+i];
        }
        return p;
    }

    template<typename T>
    packet_t::base& operator << (packet_t::base& p, const std::vector<T>& t) {
        p << (std::uint32_t)t.size();
        for (auto& i : t) {
            p << i;
        }
        return p;
    }

    template<typename T, typename C>
    packet_t::base& operator >> (packet_t::base& p, ctl::sorted_vector<T,C>& t) {
        std::uint32_t s; p >> s;
        for (std::uint32_t i = 0; i < s; ++i) {
            T tmp;
            p >> tmp;
            t.insert(std::move(tmp));
        }
        return p;
    }

    template<typename T, typename C>
    packet_t::base& operator << (packet_t::base& p, const ctl::sorted_vector<T,C>& t) {
        p << (std::uint32_t)t.size();
        for (auto& i : t) {
            p << i;
        }
        return p;
    }

    template<typename T, std::size_t N>
    packet_t::base& operator >> (packet_t::base& p, std::array<T,N>& t) {
        for (std::size_t i = 0; i < N; ++i) {
            p >> t[i];
        }
        return p;
    }

    template<typename T, std::size_t N>
    packet_t::base& operator << (packet_t::base& p, const std::array<T,N>& t) {
        for (auto& i : t) {
            p << i;
        }
        return p;
    }

    packet_t::base& operator << (packet_t::base& s, const color32& c);
    packet_t::base& operator >> (packet_t::base& s, color32& c);
}

/// Physical type of a packet identifier.
using packet_id_t = std::uint32_t;

/// Return a user readable name for a given packet.
std::string get_packet_name(packet_id_t id);

/// Check if the provided ID matches that of a real packet.
bool is_packet_id(packet_id_t id);

namespace packet_impl {
    template<typename T>
    struct packet_builder;
}
<commit_msg>Added serialization for std::atomic types.<commit_after>#ifndef PACKET_HPP
#define PACKET_HPP

#include <SFML/Network/Packet.hpp>
#include <vector>
#include <atomic>
#include <array>
#include <crc32.hpp>
#include <variadic.hpp>
#include <sorted_vector.hpp>
#include "serialized_packet.hpp"

struct color32;

namespace sf {
    // Extend sf::Packet to handle 64bit types
    #ifdef HAS_UINT64_T
    packet_t::base& operator << (packet_t::base& p, std::uint64_t data);
    packet_t::base& operator >> (packet_t::base& p, std::uint64_t& data);
    #else
    struct impl_u64 {
        std::uint32_t lo, hi;
        bool operator < (const impl_u64& i) const;
    };
    packet_t::base& operator << (packet_t::base& p, impl_u64 data);
    packet_t::base& operator >> (packet_t::base& p, impl_u64& data);
    #endif

    template<typename T, typename enable = typename std::enable_if<std::is_enum<T>::value>::type>
    packet_t::base& operator >> (packet_t::base& p, T& t) {
        return p >> reinterpret_cast<typename std::underlying_type<T>::type&>(t);
    }

    template<typename T, typename enable = typename std::enable_if<std::is_enum<T>::value>::type>
    packet_t::base& operator << (packet_t::base& p, T t) {
        return p << static_cast<typename std::underlying_type<T>::type>(t);
    }

    packet_t::base& operator << (packet_t::base& o, ctl::empty_t);
    packet_t::base& operator >> (packet_t::base& i, ctl::empty_t);

    template<typename T>
    packet_t::base& operator >> (packet_t::base& p, std::vector<T>& t) {
        std::uint32_t s;
        p >> s;
        std::uint32_t i0 = t.size();
        t.resize(i0 + s);
        for (std::uint32_t i = 0; i < s; ++i) {
            p >> t[i0+i];
        }
        return p;
    }

    template<typename T>
    packet_t::base& operator << (packet_t::base& p, const std::vector<T>& t) {
        p << (std::uint32_t)t.size();
        for (auto& i : t) {
            p << i;
        }
        return p;
    }

    template<typename T, typename C>
    packet_t::base& operator >> (packet_t::base& p, ctl::sorted_vector<T,C>& t) {
        std::uint32_t s; p >> s;
        for (std::uint32_t i = 0; i < s; ++i) {
            T tmp;
            p >> tmp;
            t.insert(std::move(tmp));
        }
        return p;
    }

    template<typename T, typename C>
    packet_t::base& operator << (packet_t::base& p, const ctl::sorted_vector<T,C>& t) {
        p << (std::uint32_t)t.size();
        for (auto& i : t) {
            p << i;
        }
        return p;
    }

    template<typename T, std::size_t N>
    packet_t::base& operator >> (packet_t::base& p, std::array<T,N>& t) {
        for (std::size_t i = 0; i < N; ++i) {
            p >> t[i];
        }
        return p;
    }

    template<typename T, std::size_t N>
    packet_t::base& operator << (packet_t::base& p, const std::array<T,N>& t) {
        for (auto& i : t) {
            p << i;
        }
        return p;
    }

    template<typename T>
    packet_t::base& operator >> (packet_t::base& p, std::atomic<T>& t) {
        T tmp; p >> tmp;
        t = tmp;
        return p;
    }

    template<typename T, typename C>
    packet_t::base& operator << (packet_t::base& p, const std::atomic<T>& t) {
        p << t.load();
        return p;
    }

    packet_t::base& operator << (packet_t::base& s, const color32& c);
    packet_t::base& operator >> (packet_t::base& s, color32& c);
}

/// Physical type of a packet identifier.
using packet_id_t = std::uint32_t;

/// Return a user readable name for a given packet.
std::string get_packet_name(packet_id_t id);

/// Check if the provided ID matches that of a real packet.
bool is_packet_id(packet_id_t id);

namespace packet_impl {
    template<typename T>
    struct packet_builder;
}

{'fraction_non_alphanumeric': 0.1610785135512713, 'fraction_numerical': 0.013411567476948869, 'mean_word_length': 2.695921528136293, 'pattern_counts': {'":': 0, '<': 134, '<?xml version=': 0, '>': 126, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6623801', 'n_tokens_mistral': 2640, 'n_tokens_neox': 2544, 'n_words': 635}