<commit_before>// This file is distributed under the MIT license.
// See the LICENSE file for details.

namespace MATH_NAMESPACE
{


//--------------------------------------------------------------------------------------------------
// rectangle : xywh_layout
//

template <typename T>
inline rectangle<xywh_layout, T>::rectangle()
{
}

template <typename T>
inline rectangle<xywh_layout, T>::rectangle(T x, T y, T w, T h)
    : xywh_layout<T>(x, y, w, h)
{
}

template <typename T>
inline rectangle<xywh_layout, T>::rectangle(T const data[4])
    : xywh_layout<T>(data)
{
}

template <typename T>
inline T* rectangle<xywh_layout, T>::data()
{
    return reinterpret_cast<T*>(this);
}

template <typename T>
inline T const* rectangle<xywh_layout, T>::data() const
{
    return reinterpret_cast<T const*>(this);
}

template <typename T>
inline T& rectangle<xywh_layout, T>::operator[](size_t i)
{
    return data()[i];
}

template <typename T>
inline T const& rectangle<xywh_layout, T>::operator[](size_t i) const
{
    return data()[i];
}


//--------------------------------------------------------------------------------------------------
// Geometric functions
//

template <typename T>
bool overlapping(rectangle<xywh_layout, T> const& a, rectangle<xywh_layout, T> const& b)
{

    vector<2, T> a1(a.x, a.y);
    vector<2, T> a2(a.x + a.w, a.y + a.h);

    vector<2, T> b1(b.x, b.y);
    vector<2, T> b2(b.x + b.w, b.y + b.h);

    return !(a1[0] > b2[0] || a2[0] < b1[0] || a1[1] > b2[1] || a2[1] < b1[1]);

}


template <typename T>
inline rectangle<xywh_layout, T> combine(rectangle<xywh_layout, T> const& a,<commit_msg>Comparison operators (eq, neq) for rectangles<commit_after>// This file is distributed under the MIT license.
// See the LICENSE file for details.

namespace MATH_NAMESPACE
{


//--------------------------------------------------------------------------------------------------
// rectangle : xywh_layout
//

template <typename T>
inline rectangle<xywh_layout, T>::rectangle()
{
}

template <typename T>
inline rectangle<xywh_layout, T>::rectangle(T x, T y, T w, T h)
    : xywh_layout<T>(x, y, w, h)
{
}

template <typename T>
inline rectangle<xywh_layout, T>::rectangle(T const data[4])
    : xywh_layout<T>(data)
{
}

template <typename T>
inline T* rectangle<xywh_layout, T>::data()
{
    return reinterpret_cast<T*>(this);
}

template <typename T>
inline T const* rectangle<xywh_layout, T>::data() const
{
    return reinterpret_cast<T const*>(this);
}

template <typename T>
inline T& rectangle<xywh_layout, T>::operator[](size_t i)
{
    return data()[i];
}

template <typename T>
inline T const& rectangle<xywh_layout, T>::operator[](size_t i) const
{
    return data()[i];
}


//-------------------------------------------------------------------------------------------------
// Comparisons
//

template <typename T>
bool operator==(rectangle<xywh_layout, T> const& a, rectangle<xywh_layout, T> const& b)
{
    return a.x == b.x && a.y == b.y && a.w == b.w && a.h == b.h;
}

template <typename T>
bool operator!=(rectangle<xywh_layout, T> const& a, rectangle<xywh_layout, T> const& b)
{
    return !(a == b);
}


//--------------------------------------------------------------------------------------------------
// Geometric functions
//

template <typename T>
bool overlapping(rectangle<xywh_layout, T> const& a, rectangle<xywh_layout, T> const& b)
{

    vector<2, T> a1(a.x, a.y);
    vector<2, T> a2(a.x + a.w, a.y + a.h);

    vector<2, T> b1(b.x, b.y);
    vector<2, T> b2(b.x + b.w, b.y + b.h);

    return !(a1[0] > b2[0] || a2[0] < b1[0] || a1[1] > b2[1] || a2[1] < b1[1]);

}


template <typename T>
inline rectangle<xywh_layout, T> combine(rectangle<xywh_layout, T> const& a,
{'fraction_non_alphanumeric': 0.28360611752079423, 'fraction_numerical': 0.013415615776764154, 'mean_word_length': 2.3078970718722274, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, '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': '3510632', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1288, 'n_words': 335}