<commit_before>/*
 * Copyright (C) 2020 Otto-von-Guericke-Universität Magdeburg
 *
 * This file is subject to the terms and conditions of the GNU Lesser General
 * Public License v2.1. See the file LICENSE in the top level directory for more
 * details.
 */

/**
 * @defgroup    sys_architecture    Platform-independent access to architecture
 *                                  details
 * @ingroup     sys
 *
 * This module provides architecture-independent access to architecture details.
 *
 * @{
 *
 * @file
 * @brief       Platform-independent access to architecture details
 *
 * @author      <NAME> <<EMAIL>>
 */

#ifndef ARCHITECTURE_H
#define ARCHITECTURE_H

#include <stdint.h>

#include "architecture_arch.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Provide doxygen doc centrally, instead of in every architecture_arch.h */
#ifdef DOXYGEN
/**
 * @brief   Size of a word in bits
 *
 * @details Depending on architecture, this can have a value of 8, 16, or 32
 */
#define ARCHITECTURE_WORD_BITS      <NUM>
/**
 * @brief   Size of a word in bytes
 *
 * @details Depending on architecture, this can have a value or 1, 2, or 4.
 */
#define ARCHITECTURE_WORD_BYTES     <NUM>
/**
 * @brief   Word sized unsigned integer
 *
 * @details Synonym to `uint8_t`, `uint16_t` or `uint32_t` depending on
 *          architecture
 */
typedef uint<num>_t uword_t;
/**
 * @brief   Word sized signed integer
 *
 * @details Synonym to `int8_t`, `int16_t` or `int32_t` depending on
 *          architecture
 */
typedef int<num>_t  sword_t;
#elif (ARCHITECTURE_WORD_BITS == 8)
#define ARCHITECTURE_WORD_BYTES     (1U)
typedef uint8_t     uword_t;
typedef int8_t      sword_t;
#elif (ARCHITECTURE_WORD_BITS == 16)
#define ARCHITECTURE_WORD_BYTES     (2U)
typedef uint16_t    uword_t;
typedef int16_t     sword_t;
#elif (ARCHITECTURE_WORD_BITS == 32)
#define ARCHITECTURE_WORD_BYTES     (4U)
typedef uint32_t    uword_t;
typedef int32_t     sword_t;
#else
#error  "Unsupported word size (check ARCHITECTURE_WORD_BITS in architecture_arch.h)"
#endif

/**
 * @brief   Type qualifier to use to align data on word boundaries
 *
 * Use like this:
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
 * char WORD_ALIGNED thread_stack[THREAD_STACKSIZE_DEFAULT];
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
#define WORD_ALIGNED __attribute__((aligned(ARCHITECTURE_WORD_BYTES)))

#ifdef __cplusplus
}
#endif

#endif /* ARCHITECTURE_H */
/** @} */<commit_msg>sys/architecture: Add UWORD_MIN, UWORD_MAX, ...<commit_after>/*
 * Copyright (C) 2020 Otto-von-Guericke-Universität Magdeburg
 *
 * This file is subject to the terms and conditions of the GNU Lesser General
 * Public License v2.1. See the file LICENSE in the top level directory for more
 * details.
 */

/**
 * @defgroup    sys_architecture    Platform-independent access to architecture
 *                                  details
 * @ingroup     sys
 *
 * This module provides architecture-independent access to architecture details.
 *
 * @{
 *
 * @file
 * @brief       Platform-independent access to architecture details
 *
 * @author      <NAME> <<EMAIL>>
 */

#ifndef ARCHITECTURE_H
#define ARCHITECTURE_H

#include <stdint.h>

#include "architecture_arch.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Provide doxygen doc centrally, instead of in every architecture_arch.h */
#ifdef DOXYGEN
/**
 * @brief   Size of a word in bits
 *
 * @details Depending on architecture, this can have a value of 8, 16, or 32
 */
#define ARCHITECTURE_WORD_BITS      <NUM>
/**
 * @brief   Size of a word in bytes
 *
 * @details Depending on architecture, this can have a value or 1, 2, or 4.
 */
#define ARCHITECTURE_WORD_BYTES     <NUM>
/**
 * @brief   Word sized unsigned integer
 *
 * @details Synonym to `uint8_t`, `uint16_t` or `uint32_t` depending on
 *          architecture
 */
typedef uint<num>_t uword_t;
/**
 * @brief   Word sized signed integer
 *
 * @details Synonym to `int8_t`, `int16_t` or `int32_t` depending on
 *          architecture
 */
typedef int<num>_t  sword_t;
#elif (ARCHITECTURE_WORD_BITS == 8)
#define ARCHITECTURE_WORD_BYTES     (1U)
typedef uint8_t     uword_t;
typedef int8_t      sword_t;
#elif (ARCHITECTURE_WORD_BITS == 16)
#define ARCHITECTURE_WORD_BYTES     (2U)
typedef uint16_t    uword_t;
typedef int16_t     sword_t;
#elif (ARCHITECTURE_WORD_BITS == 32)
#define ARCHITECTURE_WORD_BYTES     (4U)
typedef uint32_t    uword_t;
typedef int32_t     sword_t;
#else
#error  "Unsupported word size (check ARCHITECTURE_WORD_BITS in architecture_arch.h)"
#endif

/**
 * @brief   Type qualifier to use to align data on word boundaries
 *
 * Use like this:
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
 * char WORD_ALIGNED thread_stack[THREAD_STACKSIZE_DEFAULT];
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
#define WORD_ALIGNED __attribute__((aligned(ARCHITECTURE_WORD_BYTES)))

/**
 * @brief   Smallest number an uword_t can hold
 */
#define UWORD_MIN                   0

/**
 * @brief   Highest number an uword_t can hold
 */
#define UWORD_MAX                   ((1ULL << ARCHITECTURE_WORD_BITS) - 1)

/**
 * @brief   Smallest number an sword_t can hold
 */
#define SWORD_MIN                   (-(1LL << (ARCHITECTURE_WORD_BITS - 1)))

/**
 * @brief   Highest number an sword_t can hold
 */
#define SWORD_MAX                   ((1LL << (ARCHITECTURE_WORD_BITS - 1)) - 1)

#ifdef __cplusplus
}
#endif

#endif /* ARCHITECTURE_H */
/** @} */
{'fraction_non_alphanumeric': 0.1479076479076479, 'fraction_numerical': 0.016594516594516596, 'mean_word_length': 3.515472312703583, 'pattern_counts': {'":': 0, '<': 25, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2458261', 'n_tokens_mistral': 1924, 'n_tokens_neox': 1802, 'n_words': 535}