<commit_before>//          Copyright <NAME> 2016.
// Modified in 2017-2018 by Morwenn for inclusion into cpp-sort.
// Distributed under the Boost Software License, Version 1.0.
//    (See http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef CPPSORT_DETAIL_SKA_SORT_H_
#define CPPSORT_DETAIL_SKA_SORT_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <limits>
#include <tuple>
#include <type_traits>
#include <utility>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
#include "attributes.h"
#include "memcpy_cast.h"
#include "pdqsort.h"
#include "type_traits.h"

namespace cppsort
{
namespace detail
{
    ////////////////////////////////////////////////////////////
    // ska_sort algorithm

    inline auto to_unsigned_or_bool(bool b)
        -> bool
    {
        return b;
    }

    inline auto to_unsigned_or_bool(unsigned char c)
        -> unsigned char
    {
        return c;
    }

    inline auto to_unsigned_or_bool(signed char c)
        -> unsigned char
    {
        return static_cast<unsigned char>(c) + 128;
    }

    inline auto to_unsigned_or_bool(char c)
        -> unsigned char
    {
        return static_cast<unsigned char>(c);
    }

    inline auto to_unsigned_or_bool(char16_t c)
        -> std::uint16_t
    {
        return static_cast<std::uint16_t>(c);
    }

    inline auto to_unsigned_or_bool(char32_t c)
        -> std::uint32_t
    {
        return static_cast<std::uint32_t>(c);
    }

    inline auto to_unsigned_or_bool(wchar_t c)
        -> std::uint32_t
    {
        return static_cast<std::uint32_t>(c);
    }

    inline auto to_unsigned_or_bool(short i)
        -> unsigned short
    {
        return static_cast<unsigned short>(i)
             + static_cast<unsigned short>(1 << std::numeric_limits<short>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned short i)
        -> unsigned short
    {
        return i;
    }

    inline auto to_unsigned_or_bool(int i)
        -> unsigned int
    {
        return static_cast<unsigned int>(i)
             + static_cast<unsigned int>(1 << std::numeric_limits<int>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned int i)
        -> unsigned int
    {
        return i;
    }

    inline auto to_unsigned_or_bool(long l)
        -> unsigned long
    {
        return static_cast<unsigned long>(l)
             + static_cast<unsigned long>(1l << std::numeric_limits<long>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned long l)
        -> unsigned long
    {
        return l;
    }

    inline auto to_unsigned_or_bool(long long l)
        -> unsigned long long
    {
        return static_cast<unsigned long long>(l)
             + static_cast<unsigned long long>(1ll << std::numeric_limits<long long>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned long long l)
        -> unsigned long long
    {
        return l;
    }

#ifdef __SIZEOF_INT128__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    inline auto to_unsigned_or_bool(unsigned __int128 l)<commit_msg>signed __int128 support for ska_sort<commit_after>//          Copyright <NAME> 2016.
// Modified in 2017-2018 by Morwenn for inclusion into cpp-sort.
// Distributed under the Boost Software License, Version 1.0.
//    (See http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef CPPSORT_DETAIL_SKA_SORT_H_
#define CPPSORT_DETAIL_SKA_SORT_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <limits>
#include <tuple>
#include <type_traits>
#include <utility>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
#include "attributes.h"
#include "memcpy_cast.h"
#include "pdqsort.h"
#include "type_traits.h"

namespace cppsort
{
namespace detail
{
    ////////////////////////////////////////////////////////////
    // ska_sort algorithm

    inline auto to_unsigned_or_bool(bool b)
        -> bool
    {
        return b;
    }

    inline auto to_unsigned_or_bool(unsigned char c)
        -> unsigned char
    {
        return c;
    }

    inline auto to_unsigned_or_bool(signed char c)
        -> unsigned char
    {
        return static_cast<unsigned char>(c) + 128;
    }

    inline auto to_unsigned_or_bool(char c)
        -> unsigned char
    {
        return static_cast<unsigned char>(c);
    }

    inline auto to_unsigned_or_bool(char16_t c)
        -> std::uint16_t
    {
        return static_cast<std::uint16_t>(c);
    }

    inline auto to_unsigned_or_bool(char32_t c)
        -> std::uint32_t
    {
        return static_cast<std::uint32_t>(c);
    }

    inline auto to_unsigned_or_bool(wchar_t c)
        -> std::uint32_t
    {
        return static_cast<std::uint32_t>(c);
    }

    inline auto to_unsigned_or_bool(short i)
        -> unsigned short
    {
        return static_cast<unsigned short>(i)
             + static_cast<unsigned short>(1 << std::numeric_limits<short>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned short i)
        -> unsigned short
    {
        return i;
    }

    inline auto to_unsigned_or_bool(int i)
        -> unsigned int
    {
        return static_cast<unsigned int>(i)
             + static_cast<unsigned int>(1 << std::numeric_limits<int>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned int i)
        -> unsigned int
    {
        return i;
    }

    inline auto to_unsigned_or_bool(long l)
        -> unsigned long
    {
        return static_cast<unsigned long>(l)
             + static_cast<unsigned long>(1l << std::numeric_limits<long>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned long l)
        -> unsigned long
    {
        return l;
    }

    inline auto to_unsigned_or_bool(long long l)
        -> unsigned long long
    {
        return static_cast<unsigned long long>(l)
             + static_cast<unsigned long long>(1ll << std::numeric_limits<long long>::digits);
    }

    inline auto to_unsigned_or_bool(unsigned long long l)
        -> unsigned long long
    {
        return l;
    }

#ifdef __SIZEOF_INT128__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    inline auto to_unsigned_or_bool(__int128 l)
        -> unsigned long long
    {
        return static_cast<unsigned __int128>(l)
             + static_cast<unsigned __int128>(__int128(1) << (CHAR_BIT * sizeof(__int128) - 1));
    }

    inline auto to_unsigned_or_bool(unsigned __int128 l)
{'fraction_non_alphanumeric': 0.14844784463734, 'fraction_numerical': 0.01618361041636016, 'mean_word_length': 2.157454714352067, 'pattern_counts': {'":': 0, '<': 82, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5609532', 'n_tokens_mistral': 2186, 'n_tokens_neox': 2062, 'n_words': 476}