<commit_before>#pragma once
/**
@file
ASN.1 BER tag definition

@copyright <NAME> 2018
Distributed under the MIT License
(See accompanying file LICENSE or visit https://github.com/cppden/med)
*/

#include <cstdint>
#include <type_traits>


namespace med::asn::ber {

//no support for indefinite length as seems useless so far

namespace detail {

template <typename T>
constexpr auto least_bits(T x) -> std::enable_if_t<std::is_integral_v<T>, uint8_t>
{
	if constexpr (std::is_signed<T>())
	{
		if constexpr (sizeof(T) <= sizeof(int))
		{
#ifdef __clang__
			return 8*sizeof(int) - ((x != 0 && x != -1) ? (__builtin_clz(x > 0 ? x : ~x) - 1) : 8*sizeof(int) - 1);
#else
			return 8*sizeof(int) - (__builtin_clz(x >= 0 ? x : ~x) - 1);
#endif
		}
		else if constexpr (sizeof(T) <= sizeof(long))
		{
#ifdef __clang__
			return 8*sizeof(long) - ((x != 0 && x != -1) ? (__builtin_clzl(x > 0 ? x : ~x) - 1) : 8*sizeof(long) - 1);
#else
			return 8*sizeof(long) - (__builtin_clzl(x >= 0 ? x : ~x) - 1);
#endif
		}
		else
		{
#ifdef __clang__
			return 8*sizeof(long long) - ((x != 0 && x != -1) ? (__builtin_clzll(x > 0 ? x : ~x) - 1) : 8*sizeof(long long) - 1);
#else
			return 8*sizeof(long long) - (__builtin_clzll(x >= 0 ? x : ~x) - 1);
#endif
		}
	}
	else
	{
		if constexpr (sizeof(T) <= sizeof(int))
		{
#ifdef __clang__
			return 8*sizeof(int) - (x ? __builtin_clz(x) : 8*sizeof(int) - 1);
#else
			return 8*sizeof(int) - __builtin_clz(x);
#endif
		}
		else if constexpr (sizeof(T) <= sizeof(long))
		{
#ifdef __clang__
			return 8*sizeof(long) - (x ? __builtin_clzl(x) : 8*sizeof(long) - 1);
#else
			return 8*sizeof(long) - __builtin_clzl(x));
#endif
		}
		else
		{
#ifdef __clang__
			return 8*sizeof(long long) - (x ? __builtin_clzll(x) : 8*sizeof(long long) - 1);
#else
			return 8*sizeof(long long) - __builtin_clzll(x));
#endif
		}
	}
}

} //end: namespace detail

struct length<commit_msg>fix gcc compilation<commit_after>#pragma once
/**
@file
ASN.1 BER tag definition

@copyright <NAME> 2018
Distributed under the MIT License
(See accompanying file LICENSE or visit https://github.com/cppden/med)
*/

#include <cstdint>
#include <type_traits>


namespace med::asn::ber {

//no support for indefinite length as seems useless so far

namespace detail {

template <typename T>
constexpr auto least_bits(T x) -> std::enable_if_t<std::is_integral_v<T>, uint8_t>
{
	if constexpr (std::is_signed<T>())
	{
		if constexpr (sizeof(T) <= sizeof(int))
		{
#ifdef __clang__
			return 8*sizeof(int) - ((x != 0 && x != -1) ? (__builtin_clz(x > 0 ? x : ~x) - 1) : 8*sizeof(int) - 1);
#else
			return 8*sizeof(int) - (__builtin_clz(x >= 0 ? x : ~x) - 1);
#endif
		}
		else if constexpr (sizeof(T) <= sizeof(long))
		{
#ifdef __clang__
			return 8*sizeof(long) - ((x != 0 && x != -1) ? (__builtin_clzl(x > 0 ? x : ~x) - 1) : 8*sizeof(long) - 1);
#else
			return 8*sizeof(long) - (__builtin_clzl(x >= 0 ? x : ~x) - 1);
#endif
		}
		else
		{
#ifdef __clang__
			return 8*sizeof(long long) - ((x != 0 && x != -1) ? (__builtin_clzll(x > 0 ? x : ~x) - 1) : 8*sizeof(long long) - 1);
#else
			return 8*sizeof(long long) - (__builtin_clzll(x >= 0 ? x : ~x) - 1);
#endif
		}
	}
	else
	{
		if constexpr (sizeof(T) <= sizeof(int))
		{
			return 8*sizeof(int) - (x ? __builtin_clz(x) : 8*sizeof(int) - 1);
		}
		else if constexpr (sizeof(T) <= sizeof(long))
		{
			return 8*sizeof(long) - (x ? __builtin_clzl(x) : 8*sizeof(long) - 1);
		}
		else
		{
			return 8*sizeof(long long) - (x ? __builtin_clzll(x) : 8*sizeof(long long) - 1);
		}
	}
}

} //end: namespace detail

struct length
{'fraction_non_alphanumeric': 0.18013468013468015, 'fraction_numerical': 0.026094276094276093, 'mean_word_length': 3.5126582278481013, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 31, 'https://': 2, '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': '4402865', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1453, 'n_words': 369}