<commit_before>#ifndef RECTANGLE_H
#define RECTANGLE_H

// TODO: Make template type
struct RectangleInt2D
{
    RectangleInt2D() : min_lon(INT_MAX), max_lon(INT_MIN), min_lat(INT_MAX), max_lat(INT_MIN) {}

    int32_t min_lon, max_lon;
    int32_t min_lat, max_lat;


    inline void MergeBoundingBoxes(const RectangleInt2D &other)
    {
        min_lon = std::min(min_lon, other.min_lon);
        max_lon = std::max(max_lon, other.max_lon);
        min_lat = std::min(min_lat, other.min_lat);
        max_lat = std::max(max_lat, other.max_lat);
        BOOST_ASSERT(min_lat != std::numeric_limits<int>::min());
        BOOST_ASSERT(min_lon != std::numeric_limits<int>::min());
        BOOST_ASSERT(max_lat != std::numeric_limits<int>::min());
        BOOST_ASSERT(max_lon != std::numeric_limits<int>::min());
    }

    inline FixedPointCoordinate Centroid() const
    {
        FixedPointCoordinate centroid;
        // The coordinates of the midpoints are given by:<commit_msg>Use numeric_limits<commit_after>#ifndef RECTANGLE_H
#define RECTANGLE_H

#include <boost/assert.hpp>

#include <algorithm>
#include <cstdint>
#include <limits>

// TODO: Make template type, add tests
struct RectangleInt2D
{
    RectangleInt2D() : min_lon(std::numeric_limits<int32_t>::max()),
                       max_lon(std::numeric_limits<int32_t>::min()),
                       min_lat(std::numeric_limits<int32_t>::max()),
                       max_lat(std::numeric_limits<int32_t>::min()) {}

    int32_t min_lon, max_lon;
    int32_t min_lat, max_lat;

    inline void MergeBoundingBoxes(const RectangleInt2D &other)
    {
        min_lon = std::min(min_lon, other.min_lon);
        max_lon = std::max(max_lon, other.max_lon);
        min_lat = std::min(min_lat, other.min_lat);
        max_lat = std::max(max_lat, other.max_lat);
        BOOST_ASSERT(min_lat != std::numeric_limits<int32_t>::min());
        BOOST_ASSERT(min_lon != std::numeric_limits<int32_t>::min());
        BOOST_ASSERT(max_lat != std::numeric_limits<int32_t>::min());
        BOOST_ASSERT(max_lon != std::numeric_limits<int32_t>::min());
    }

    inline FixedPointCoordinate Centroid() const
    {
        FixedPointCoordinate centroid;
        // The coordinates of the midpoints are given by:
{'fraction_non_alphanumeric': 0.1314159292035398, 'fraction_numerical': 0.01327433628318584, 'mean_word_length': 3.6714876033057853, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2729106', 'n_tokens_mistral': 796, 'n_tokens_neox': 760, 'n_words': 130}