<commit_before>/**
 * @file   Unit.hpp
 * @brief  Unit package.
 * @author zer0
 * @date   2016-04-20
 */

#ifndef __INCLUDE_LIBTBAG__LIBTBAG_UNIT_HPP__
#define __INCLUDE_LIBTBAG__LIBTBAG_UNIT_HPP__

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libtbag/config.h>
#include <libtbag/predef.hpp>
#include <libtbag/tmp/Power.hpp>

// -------------------
NAMESPACE_LIBTBAG_OPEN
// -------------------

/**
 * @defgroup __DOXYGEN_GROUP__BYTE__ Byte.
 * @brief Unit of digital information.
 * @{
 */

TBAG_CONSTEXPR uint64_t const BYTE_UNIT = 1024;

TBAG_CONSTEXPR uint64_t const  KILO_BYTE_TO_BYTE = tmp::Power<BYTE_UNIT, 1>::value;<commit_msg>Create 'limit' variables.<commit_after>/**
 * @file   Unit.hpp
 * @brief  Unit package.
 * @author zer0
 * @date   2016-04-20
 */

#ifndef __INCLUDE_LIBTBAG__LIBTBAG_UNIT_HPP__
#define __INCLUDE_LIBTBAG__LIBTBAG_UNIT_HPP__

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libtbag/config.h>
#include <libtbag/predef.hpp>
#include <libtbag/tmp/Power.hpp>

#include <cstdint>

#define TBAG_CHAR_BIT    8  // Number of bits in a char
#define TBAG_MB_LEN_MAX  6  // Allow 31 bit UTF2

#define TBAG_SCHAR_MAX   (+127)  // min value for a signed char
#define TBAG_SCHAR_MIN   (-128)  // max value for a signed char

#define TBAG_SCHAR_MAX   (+127)  // min value for a signed char
#define TBAG_SCHAR_MIN   (-128)  // max value for a signed char

#define TBAG_UCHAR_MAX   (+255)  // max value for an unsigned char
#define TBAG_CHAR_MAX    (+127)  // max value for a char
#define TBAG_CHAR_MIN    (-128)  // min value for a char

#define TBAG_USHRT_MAX   (+65535)  // max value for an unsigned short */
#define TBAG_SHRT_MAX    (+32767)  // max value for a short */
#define TBAG_SHRT_MIN    (-32768)  // min value for a short */

#define TBAG_UINT_MAX    ( 0xffffffff  )  // max value for an unsigned int
#define TBAG_INT_MAX     (+2147483647  )  // max value for an int
#define TBAG_INT_MIN     (-2147483647-1)  // min value for an int

#if defined(__LP64__)
# define TBAG_ULONG_MAX  ( 0xffffffffffffffffUL )  // max unsigned long
# define TBAG_LONG_MAX   ( 0x7fffffffffffffffL  )  // max signed long
# define TBAG_LONG_MIN   (-0x7fffffffffffffffL-1)  // min signed long
#else
# define TBAG_ULONG_MAX  ( 0xffffffffUL )  // max unsigned long
# define TBAG_LONG_MAX   (+2147483647L  )  // max signed long
# define TBAG_LONG_MIN   (-2147483647L-1)  // min signed long
#endif

#define TBAG_ULLONG_MAX  ( 0xffffffffffffffffULL )  // max unsigned long long
#define TBAG_LLONG_MAX   ( 0x7fffffffffffffffLL  )  // max signed long long
#define TBAG_LLONG_MIN   (-0x7fffffffffffffffLL-1)  // min signed long long

#if !defined(_ANSI_SOURCE)
# if defined(__LP64__)
#  define TBAG_LONG_BIT    64
# else // !defined(__LP64__)
#  define TBAG_LONG_BIT    32
# endif // defined(__LP64__)
# define  TBAG_SSIZE_MAX  LONG_MAX // max value for a ssize_t
# define  TBAG_WORD_BIT    32
# if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
#  define TBAG_SIZE_T_MAX  TBAG_ULONG_MAX   // max value for a size_t
#  define TBAG_UQUAD_MAX   TBAG_ULLONG_MAX
#  define TBAG_QUAD_MAX    TBAG_LLONG_MAX
#  define TBAG_QUAD_MIN    TBAG_LLONG_MIN
# endif // (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
#endif // !defined(_ANSI_SOURCE)

// -------------------
NAMESPACE_LIBTBAG_OPEN
// -------------------

/**
 * @defgroup __DOXYGEN_GROUP__BYTE__ Byte.
 * @brief Unit of digital information.
 * @{
 */

TBAG_CONSTEXPR uint64_t const BYTE_UNIT = 1024;

TBAG_CONSTEXPR uint64_t const  KILO_BYTE_TO_BYTE = tmp::Power<BYTE_UNIT, 1>::value;
{'fraction_non_alphanumeric': 0.12207446808510639, 'fraction_numerical': 0.041223404255319146, 'mean_word_length': 3.5698663426488455, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, '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': '3778014', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1381, 'n_words': 349}