libc.src.__support.CPP.span
libc.src.__support.CPP.string_view
libc.src.__support.CPP.type_traits
+ libc.src.__support.common
)
arg_list
HDRS
arg_list.h
+ DEPENDS
+ libc.src.__support.common
)
add_header_library(
char_vector
HDRS
char_vector.h
+ DEPENDS
+ libc.src.__support.common
)
add_header_library(
.builtin_wrappers
.number_pair
libc.src.__support.CPP.type_traits
+ libc.src.__support.common
)
add_header_library(
multiply_add.h
DEPENDS
.fma
+ libc.src.__support.common
)
add_header_library(
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_SQRT_H
#include "src/__support/architectures.h"
+#include "src/__support/common.h"
#if !defined(LLVM_LIBC_ARCH_AARCH64)
#error "Invalid include"
namespace __llvm_libc {
namespace fputil {
-template <> inline float sqrt<float>(float x) {
+template <> LIBC_INLINE float sqrt<float>(float x) {
float y;
__asm__ __volatile__("fsqrt %s0, %s1\n\t" : "=w"(y) : "w"(x));
return y;
}
-template <> inline double sqrt<double>(double x) {
+template <> LIBC_INLINE double sqrt<double>(double x) {
double y;
__asm__ __volatile__("fsqrt %d0, %d1\n\t" : "=w"(y) : "w"(x));
return y;
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.platform_defs
libc.src.__support.builtin_wrappers
+ libc.src.__support.common
libc.src.__support.uint128
libc.include.fenv
)
// TODO(lntue): Implement fmaf that is correctly rounded to all rounding modes.
// The implementation below only is only correct for the default rounding mode,
// round-to-nearest tie-to-even.
-template <> inline float fma<float>(float x, float y, float z) {
+template <> LIBC_INLINE float fma<float>(float x, float y, float z) {
// Product is exact.
double prod = static_cast<double>(x) * static_cast<double>(y);
double z_d = static_cast<double>(z);
} // namespace internal
-template <> inline double fma<double>(double x, double y, double z) {
+template <> LIBC_INLINE double fma<double>(double x, double y, double z) {
using FPBits = fputil::FPBits<double>;
using FloatProp = fputil::FloatProperties<double>;
#include "src/__support/FPUtil/PlatformDefs.h"
#include "src/__support/UInt128.h"
#include "src/__support/builtin_wrappers.h"
+#include "src/__support/common.h"
namespace __llvm_libc {
namespace fputil {
#ifdef LONG_DOUBLE_IS_DOUBLE
template <>
-inline void normalize<long double>(int &exponent, uint64_t &mantissa) {
+LIBC_INLINE void normalize<long double>(int &exponent, uint64_t &mantissa) {
normalize<double>(exponent, mantissa);
}
#elif !defined(SPECIAL_X86_LONG_DOUBLE)
template <>
-inline void normalize<long double>(int &exponent, UInt128 &mantissa) {
+LIBC_INLINE void normalize<long double>(int &exponent, UInt128 &mantissa) {
const uint64_t hi_bits = static_cast<uint64_t>(mantissa >> 64);
const int shift = hi_bits
? (unsafe_clz(hi_bits) - 15)
#include "src/__support/FPUtil/PlatformDefs.h"
#include "src/__support/UInt128.h"
#include "src/__support/builtin_wrappers.h"
+#include "src/__support/common.h"
namespace __llvm_libc {
namespace fputil {
namespace x86 {
-inline void normalize(int &exponent, UInt128 &mantissa) {
+LIBC_INLINE void normalize(int &exponent, UInt128 &mantissa) {
const int shift =
unsafe_clz(static_cast<uint64_t>(mantissa)) -
(8 * sizeof(uint64_t) - 1 - MantissaWidth<long double>::VALUE);
namespace __llvm_libc {
namespace fputil {
-template <> inline float multiply_add<float>(float x, float y, float z) {
+template <> LIBC_INLINE float multiply_add<float>(float x, float y, float z) {
return fma(x, y, z);
}
-template <> inline double multiply_add<double>(double x, double y, double z) {
+template <>
+LIBC_INLINE double multiply_add<double>(double x, double y, double z) {
return fma(x, y, z);
}
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_POLYEVAL_H
#include "src/__support/architectures.h"
+#include "src/__support/common.h"
#if !defined(LLVM_LIBC_ARCH_X86_64)
#error "Invalid include"
// Cubic polynomials:
// polyeval(x, a0, a1, a2, a3) = a3*x^3 + a2*x^2 + a1*x + a0
template <>
-inline float polyeval(float x, float a0, float a1, float a2, float a3) {
+LIBC_INLINE float polyeval(float x, float a0, float a1, float a2, float a3) {
__m128 xmm = _mm_set1_ps(x); // NOLINT
__m128 a13 = _mm_set_ps(0.0f, x, a3, a1); // NOLINT
__m128 a02 = _mm_set_ps(0.0f, 0.0f, a2, a0); // NOLINT
}
template <>
-inline double polyeval(double x, double a0, double a1, double a2, double a3) {
+LIBC_INLINE double polyeval(double x, double a0, double a1, double a2,
+ double a3) {
__m256d xmm = _mm256_set1_pd(x); // NOLINT
__m256d a13 = _mm256_set_pd(0.0, x, a3, a1); // NOLINT
__m256d a02 = _mm256_set_pd(0.0, 0.0, a2, a0); // NOLINT
// polyeval(x, a0, a1, a2, a3, a4, a5) = a5*x^5 + a4*x^4 + a3*x^3 + a2*x^2 +
// + a1*x + a0
template <>
-inline float polyeval(float x, float a0, float a1, float a2, float a3, float a4,
- float a5) {
+LIBC_INLINE float polyeval(float x, float a0, float a1, float a2, float a3,
+ float a4, float a5) {
__m128 xmm = _mm_set1_ps(x); // NOLINT
__m128 a25 = _mm_set_ps(0.0f, x, a5, a2); // NOLINT
__m128 a14 = _mm_set_ps(0.0f, 0.0f, a4, a1); // NOLINT
}
template <>
-inline double polyeval(double x, double a0, double a1, double a2, double a3,
- double a4, double a5) {
+LIBC_INLINE double polyeval(double x, double a0, double a1, double a2,
+ double a3, double a4, double a5) {
__m256d xmm = _mm256_set1_pd(x); // NOLINT
__m256d a25 = _mm256_set_pd(0.0, x, a5, a2); // NOLINT
__m256d a14 = _mm256_set_pd(0.0, 0.0, a4, a1); // NOLINT
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_SQRT_H
#include "src/__support/architectures.h"
+#include "src/__support/common.h"
#if !defined(LLVM_LIBC_ARCH_X86)
#error "Invalid include"
namespace __llvm_libc {
namespace fputil {
-template <> inline float sqrt<float>(float x) {
+template <> LIBC_INLINE float sqrt<float>(float x) {
float result;
__asm__ __volatile__("sqrtss %x1, %x0" : "=x"(result) : "x"(x));
return result;
}
-template <> inline double sqrt<double>(double x) {
+template <> LIBC_INLINE double sqrt<double>(double x) {
double result;
__asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
return result;
}
#ifdef LONG_DOUBLE_IS_DOUBLE
-template <> inline long double sqrt<long double>(long double x) {
+template <> LIBC_INLINE long double sqrt<long double>(long double x) {
long double result;
__asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
return result;
}
#else
-template <> inline long double sqrt<long double>(long double x) {
+template <> LIBC_INLINE long double sqrt<long double>(long double x) {
__asm__ __volatile__("fsqrt" : "+t"(x));
return x;
}
#define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_SYSCALL_H
#include "src/__support/architectures.h"
+#include "src/__support/common.h"
#ifdef LLVM_LIBC_ARCH_X86_64
#include "x86_64/syscall.h"
namespace __llvm_libc {
template <typename... Ts>
-__attribute__((always_inline)) inline long syscall_impl(long __number,
- Ts... ts) {
+LIBC_INLINE long syscall_impl(long __number, Ts... ts) {
static_assert(sizeof...(Ts) <= 6, "Too many arguments for syscall");
return syscall_impl(__number, (long)ts...);
}
#ifndef LLVM_LIBC_SRC_SUPPORT_ARG_LIST_H
#define LLVM_LIBC_SRC_SUPPORT_ARG_LIST_H
+#include "src/__support/common.h"
+
#include <stdarg.h>
namespace __llvm_libc {
va_list vlist;
public:
- ArgList(va_list vlist) { va_copy(this->vlist, vlist); }
- ArgList(ArgList &other) { va_copy(this->vlist, other.vlist); }
- ~ArgList() { va_end(this->vlist); }
+ LIBC_INLINE ArgList(va_list vlist) { va_copy(this->vlist, vlist); }
+ LIBC_INLINE ArgList(ArgList &other) { va_copy(this->vlist, other.vlist); }
+ LIBC_INLINE ~ArgList() { va_end(this->vlist); }
- ArgList &operator=(ArgList &rhs) {
+ LIBC_INLINE ArgList &operator=(ArgList &rhs) {
va_copy(vlist, rhs.vlist);
return *this;
}
- template <class T> T inline next_var() { return va_arg(vlist, T); }
+ template <class T> LIBC_INLINE T next_var() { return va_arg(vlist, T); }
};
} // namespace internal
#ifndef LLVM_LIBC_SRC_SUPPORT_CHARVECTOR_H
#define LLVM_LIBC_SRC_SUPPORT_CHARVECTOR_H
+#include "src/__support/common.h"
+
#include <stddef.h>
#include <stdlib.h> // For allocation.
public:
CharVector() = default;
- ~CharVector() {
+ LIBC_INLINE ~CharVector() {
if (cur_str != local_buffer)
free(cur_str);
}
// append returns true on success and false on allocation failure.
- bool append(char new_char) {
+ LIBC_INLINE bool append(char new_char) {
// Subtract 1 for index starting at 0 and another for the null terminator.
if (index >= cur_buff_size - 2) {
// If the new character would cause the string to be longer than the
return true;
}
- char *c_str() {
+ LIBC_INLINE char *c_str() {
cur_str[index] = '\0';
return cur_str;
}
- size_t length() { return index; }
+ LIBC_INLINE size_t length() { return index; }
};
} // namespace __llvm_libc
namespace internal {
// Returns floor(log_10(2^e)); requires 0 <= e <= 1650.
-constexpr inline uint32_t log10_pow2(const uint32_t e) {
+LIBC_INLINE constexpr uint32_t log10_pow2(const uint32_t e) {
// The first value this approximation fails for is 2^1651 which is just
// greater than 10^297. assert(e >= 0); assert(e <= 1650);
return (e * 78913) >> 18;
// power of 2 was also a power of 10, but since that doesn't exist this is
// always accurate. This is used to calculate the maximum number of base-10
// digits a given e-bit number could have.
-constexpr inline uint32_t ceil_log10_pow2(const uint32_t e) {
+LIBC_INLINE constexpr uint32_t ceil_log10_pow2(const uint32_t e) {
return log10_pow2(e) + 1;
}
// Returns the maximum number of 9 digit blocks a number described by the given
// index (which is ceil(exponent/16)) and mantissa width could need.
-constexpr inline uint32_t length_for_num(const uint32_t idx,
- const uint32_t mantissa_width) {
+LIBC_INLINE constexpr uint32_t length_for_num(const uint32_t idx,
+ const uint32_t mantissa_width) {
//+8 to round up when dividing by 9
return (ceil_log10_pow2(16 * idx) + ceil_log10_pow2(mantissa_width) +
(BLOCK_SIZE - 1)) /
// floor(5^(-9i) * 2^(e + c_1 - 9i) + 1) % (10^9 * 2^c_1)
template <size_t INT_SIZE>
-constexpr inline cpp::UInt<MID_INT_SIZE>
+LIBC_INLINE constexpr cpp::UInt<MID_INT_SIZE>
get_table_positive(int exponent, size_t i, const size_t constant) {
// INT_SIZE is the size of int that is used for the internal calculations of
// this function. It should be large enough to hold 2^(exponent+constant), so
// calculations.
// The formula being used looks more like this:
// floor(10^(9*(-i)) * 2^(c_0 + (-e))) % (10^9 * 2^c_0)
-inline cpp::UInt<MID_INT_SIZE> get_table_negative(int exponent, size_t i,
- const size_t constant) {
+LIBC_INLINE cpp::UInt<MID_INT_SIZE> get_table_negative(int exponent, size_t i,
+ const size_t constant) {
constexpr size_t INT_SIZE = 1024;
int shift_amount = constant - exponent;
cpp::UInt<INT_SIZE> num(1);
// constexpr void init_convert();
public:
- constexpr FloatToString(T init_float) : float_bits(init_float) {
+ LIBC_INLINE constexpr FloatToString(T init_float) : float_bits(init_float) {
is_negative = float_bits.get_sign();
exponent = float_bits.get_exponent();
mantissa = float_bits.get_explicit_mantissa();
// init_convert();
}
- constexpr bool is_nan() { return float_bits.is_nan(); }
- constexpr bool is_inf() { return float_bits.is_inf(); }
- constexpr bool is_inf_or_nan() { return float_bits.is_inf_or_nan(); }
+ LIBC_INLINE constexpr bool is_nan() { return float_bits.is_nan(); }
+ LIBC_INLINE constexpr bool is_inf() { return float_bits.is_inf(); }
+ LIBC_INLINE constexpr bool is_inf_or_nan() {
+ return float_bits.is_inf_or_nan();
+ }
// get_block returns an integer that represents the digits in the requested
// block.
- constexpr BlockInt get_positive_block(int block_index) {
+ LIBC_INLINE constexpr BlockInt get_positive_block(int block_index) {
if (exponent >= -MANT_WIDTH) {
// idx is ceil(exponent/16) or 0 if exponent is negative. This is used to
// find the coarse section of the POW10_SPLIT table that will be used to
return 0;
}
}
- constexpr BlockInt get_negative_block(int block_index) {
+
+ LIBC_INLINE constexpr BlockInt get_negative_block(int block_index) {
if (exponent < 0) {
const int32_t idx = -exponent / 16;
uint32_t i = block_index;
}
}
- constexpr BlockInt get_block(int block_index) {
+ LIBC_INLINE constexpr BlockInt get_block(int block_index) {
if (block_index >= 0) {
return get_positive_block(block_index);
} else {
}
}
- constexpr size_t get_positive_blocks() {
+ LIBC_INLINE constexpr size_t get_positive_blocks() {
if (exponent >= -MANT_WIDTH) {
const uint32_t idx =
exponent < 0 ? 0 : static_cast<uint32_t>(exponent + 15) / 16;
// This takes the index of a block after the decimal point (a negative block)
// and return if it's sure that all of the digits after it are zero.
- constexpr bool is_lowest_block(size_t block_index) {
+ LIBC_INLINE constexpr bool is_lowest_block(size_t block_index) {
const int32_t idx = -exponent / 16;
const uint32_t p = POW10_OFFSET_2[idx] + block_index - MIN_BLOCK_2[idx];
// If the remaining digits are all 0, then this is the lowest block.
return p >= POW10_OFFSET_2[idx + 1];
}
- constexpr size_t zero_blocks_after_point() {
+ LIBC_INLINE constexpr size_t zero_blocks_after_point() {
return MIN_BLOCK_2[-exponent / 16];
}
};
// }
template <>
-constexpr size_t FloatToString<long double>::zero_blocks_after_point() {
+LIBC_INLINE constexpr size_t
+FloatToString<long double>::zero_blocks_after_point() {
return 0;
}
template <>
-constexpr bool FloatToString<long double>::is_lowest_block(size_t) {
+LIBC_INLINE constexpr bool FloatToString<long double>::is_lowest_block(size_t) {
return false;
}
template <>
-constexpr BlockInt
+LIBC_INLINE constexpr BlockInt
FloatToString<long double>::get_positive_block(int block_index) {
if (exponent >= -MANT_WIDTH) {
const uint32_t pos_exp = (exponent < 0 ? 0 : exponent);
}
template <>
-constexpr BlockInt
+LIBC_INLINE constexpr BlockInt
FloatToString<long double>::get_negative_block(int block_index) {
if (exponent < 0) {
const int32_t idx = -exponent / 16;
#include "src/__support/CPP/span.h"
#include "src/__support/CPP/string_view.h"
#include "src/__support/CPP/type_traits.h"
+#include "src/__support/common.h"
namespace __llvm_libc {
// char b30buf[IntegerToString::bufsize<30, int>(a)];
// auto str = IntegerToString::convert<30>(a, b30buf);
class IntegerToString {
- static cpp::string_view convert_uintmax(uintmax_t uval,
- cpp::span<char> &buffer,
- bool lowercase,
- const uint8_t conv_base) {
+ LIBC_INLINE static cpp::string_view convert_uintmax(uintmax_t uval,
+ cpp::span<char> &buffer,
+ bool lowercase,
+ const uint8_t conv_base) {
const char a = lowercase ? 'a' : 'A';
size_t len = 0;
return cpp::string_view(buffer.data() + buffer.size() - len, len);
}
- static cpp::string_view convert_intmax(intmax_t val, cpp::span<char> &buffer,
- bool lowercase,
- const uint8_t conv_base) {
+ LIBC_INLINE static cpp::string_view convert_intmax(intmax_t val,
+ cpp::span<char> &buffer,
+ bool lowercase,
+ const uint8_t conv_base) {
if (val >= 0)
return convert_uintmax(uintmax_t(val), buffer, lowercase, conv_base);
uintmax_t uval = uintmax_t(-val);
return cpp::string_view(buffer.data() + buffer.size() - len, len);
}
- static constexpr inline size_t floor_log_2(size_t num) {
+ LIBC_INLINE static constexpr size_t floor_log_2(size_t num) {
size_t i = 0;
for (; num > 1; num /= 2) {
++i;
// For other bases, we approximate by rounding down to the nearest power of
// two base, since the space needed is easy to calculate and it won't
// overestimate by too much.
- template <uint8_t BASE, typename T> static constexpr size_t bufsize() {
+ template <uint8_t BASE, typename T>
+ LIBC_INLINE static constexpr size_t bufsize() {
constexpr size_t BITS_PER_DIGIT = floor_log_2(BASE);
constexpr size_t BUFSIZE_COMMON =
((sizeof(T) * 8 + (BITS_PER_DIGIT - 1)) / BITS_PER_DIGIT);
(BASE == 10 ? BUFSIZE_BASE10 : BUFSIZE_COMMON);
}
- template <typename T> static constexpr size_t dec_bufsize() {
+ template <typename T> LIBC_INLINE static constexpr size_t dec_bufsize() {
return bufsize<10, T>();
}
- template <typename T> static constexpr size_t hex_bufsize() {
+ template <typename T> LIBC_INLINE static constexpr size_t hex_bufsize() {
return bufsize<16, T>();
}
- template <typename T> static constexpr size_t oct_bufsize() {
+ template <typename T> LIBC_INLINE static constexpr size_t oct_bufsize() {
return bufsize<8, T>();
}
- template <typename T> static constexpr size_t bin_bufsize() {
+ template <typename T> LIBC_INLINE static constexpr size_t bin_bufsize() {
return bufsize<2, T>();
}
template <uint8_t BASE, typename T,
cpp::enable_if_t<2 <= BASE && BASE <= 36 && cpp::is_integral_v<T>,
int> = 0>
- static cpp::optional<cpp::string_view> convert(T val, cpp::span<char> buffer,
- bool lowercase = true) {
+ LIBC_INLINE static cpp::optional<cpp::string_view>
+ convert(T val, cpp::span<char> buffer, bool lowercase = true) {
if (buffer.size() < bufsize<BASE, T>())
return cpp::optional<cpp::string_view>();
if (cpp::is_signed_v<T>)
}
template <typename T, cpp::enable_if_t<cpp::is_integral_v<T>, int> = 0>
- static cpp::optional<cpp::string_view> dec(T val, cpp::span<char> buffer) {
+ LIBC_INLINE static cpp::optional<cpp::string_view>
+ dec(T val, cpp::span<char> buffer) {
return convert<10>(val, buffer);
}
template <typename T, cpp::enable_if_t<cpp::is_integral_v<T>, int> = 0>
- static cpp::optional<cpp::string_view> hex(T val, cpp::span<char> buffer,
- bool lowercase = true) {
+ LIBC_INLINE static cpp::optional<cpp::string_view>
+ hex(T val, cpp::span<char> buffer, bool lowercase = true) {
return convert<16>(val, buffer, lowercase);
}
template <typename T, cpp::enable_if_t<cpp::is_integral_v<T>, int> = 0>
- static cpp::optional<cpp::string_view> oct(T val, cpp::span<char> buffer) {
+ LIBC_INLINE static cpp::optional<cpp::string_view>
+ oct(T val, cpp::span<char> buffer) {
return convert<8>(val, buffer);
}
template <typename T, cpp::enable_if_t<cpp::is_integral_v<T>, int> = 0>
- static cpp::optional<cpp::string_view> bin(T val, cpp::span<char> buffer) {
+ LIBC_INLINE static cpp::optional<cpp::string_view>
+ bin(T val, cpp::span<char> buffer) {
return convert<2>(val, buffer);
}
};
#ifndef LLVM_LIBC_SRC_SUPPORT_INTEGER_UTILS_H
#define LLVM_LIBC_SRC_SUPPORT_INTEGER_UTILS_H
-#include "CPP/type_traits.h"
+#include "src/__support/CPP/type_traits.h"
+#include "src/__support/common.h"
+
#include "builtin_wrappers.h"
#include "number_pair.h"
template <typename T> NumberPair<T> full_mul(T a, T b);
template <>
-inline NumberPair<uint32_t> full_mul<uint32_t>(uint32_t a, uint32_t b) {
+LIBC_INLINE NumberPair<uint32_t> full_mul<uint32_t>(uint32_t a, uint32_t b) {
uint64_t prod = uint64_t(a) * uint64_t(b);
NumberPair<uint32_t> result;
result.lo = uint32_t(prod);
}
template <>
-inline NumberPair<uint64_t> full_mul<uint64_t>(uint64_t a, uint64_t b) {
+LIBC_INLINE NumberPair<uint64_t> full_mul<uint64_t>(uint64_t a, uint64_t b) {
#ifdef __SIZEOF_INT128__
__uint128_t prod = __uint128_t(a) * __uint128_t(b);
NumberPair<uint64_t> result;
#if defined(SPECIAL_X86_LONG_DOUBLE)
template <>
-inline void set_implicit_bit<long double>(fputil::FPBits<long double> &result) {
+LIBC_INLINE void
+set_implicit_bit<long double>(fputil::FPBits<long double> &result) {
result.set_implicit_bit(result.get_unbiased_exponent() != 0);
}
#endif
#if !defined(LONG_DOUBLE_IS_DOUBLE)
template <>
-inline bool eisel_lemire<long double>(
+LIBC_INLINE bool eisel_lemire<long double>(
typename fputil::FPBits<long double>::UIntType mantissa, int32_t exp10,
typename fputil::FPBits<long double>::UIntType *outputMantissa,
uint32_t *outputExp2) {
libc.src.__support.CPP.bit
libc.src.__support.CPP.string_view
libc.src.__support.CPP.type_traits
+ libc.src.__support.common
)
add_object_library(
#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CHAR_CONVERTER_H
#include "src/__support/CPP/string_view.h"
+#include "src/__support/common.h"
#include "src/stdio/printf_core/converter_utils.h"
#include "src/stdio/printf_core/core_structs.h"
#include "src/stdio/printf_core/writer.h"
namespace __llvm_libc {
namespace printf_core {
-int inline convert_char(Writer *writer, const FormatSection &to_conv) {
+LIBC_INLINE int convert_char(Writer *writer, const FormatSection &to_conv) {
char c = to_conv.conv_val_raw;
constexpr int string_len = 1;
#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H
#include "src/__support/CPP/limits.h"
+#include "src/__support/common.h"
#include "src/stdio/printf_core/core_structs.h"
#include <inttypes.h>
namespace __llvm_libc {
namespace printf_core {
-inline uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) {
+LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) {
switch (lm) {
case LengthModifier::none:
return num & cpp::numeric_limits<unsigned int>::max();
#include "src/__support/CPP/type_traits.h"
#include "src/__support/arg_list.h"
+#include "src/__support/common.h"
#include "src/stdio/printf_core/core_structs.h"
#include "src/stdio/printf_core/printf_config.h"
struct TypeDesc {
uint8_t size;
PrimaryType primary_type;
- constexpr bool operator==(const TypeDesc &other) const {
+ LIBC_INLINE constexpr bool operator==(const TypeDesc &other) const {
return (size == other.size) && (primary_type == other.primary_type);
}
};
public:
#ifndef LLVM_LIBC_PRINTF_DISABLE_INDEX_MODE
- Parser(const char *__restrict new_str, internal::ArgList &args)
+ LIBC_INLINE Parser(const char *__restrict new_str, internal::ArgList &args)
: str(new_str), args_cur(args), args_start(args) {}
#else
- Parser(const char *__restrict new_str, internal::ArgList &args)
+ LIBC_INLINE Parser(const char *__restrict new_str, internal::ArgList &args)
: str(new_str), args_cur(args) {}
#endif // LLVM_LIBC_PRINTF_DISABLE_INDEX_MODE
LengthModifier parse_length_modifier(size_t *local_pos);
// get_next_arg_value gets the next value from the arg list as type T.
- template <class T> T inline get_next_arg_value() {
+ template <class T> LIBC_INLINE T get_next_arg_value() {
return args_cur.next_var<T>();
}
// local_pos.
size_t parse_index(size_t *local_pos);
- template <typename T> static constexpr TypeDesc get_type_desc() {
+ template <typename T> LIBC_INLINE static constexpr TypeDesc get_type_desc() {
if constexpr (cpp::is_same_v<T, void>) {
return TypeDesc{0, PrimaryType::Integer};
} else {
}
}
- void inline set_type_desc(size_t index, TypeDesc value) {
+ LIBC_INLINE void set_type_desc(size_t index, TypeDesc value) {
if (index != 0 && index <= DESC_ARR_LEN)
desc_arr[index - 1] = value;
}
// get_arg_value gets the value from the arg list at index (starting at 1).
// This may require parsing the format string. An index of 0 is interpreted as
// the next value.
- template <class T> T inline get_arg_value(size_t index) {
+ template <class T> LIBC_INLINE T get_arg_value(size_t index) {
if (!(index == 0 || index == args_index))
args_to_index(index);
#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H
#include "src/__support/CPP/string_view.h"
+#include "src/__support/common.h"
#include "src/stdio/printf_core/converter_utils.h"
#include "src/stdio/printf_core/core_structs.h"
#include "src/stdio/printf_core/writer.h"
namespace __llvm_libc {
namespace printf_core {
-int inline convert_string(Writer *writer, const FormatSection &to_conv) {
+LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) {
size_t string_len = 0;
for (char *cur_str = reinterpret_cast<char *>(to_conv.conv_val_ptr);
#define LLVM_LIBC_SRC_STDIO_SCANF_CORE_PARSER_H
#include "src/__support/arg_list.h"
+#include "src/__support/common.h"
#include "src/stdio/scanf_core/core_structs.h"
#include "src/stdio/scanf_core/scanf_config.h"
public:
#ifndef LLVM_LIBC_SCANF_DISABLE_INDEX_MODE
- Parser(const char *__restrict new_str, internal::ArgList &args)
+ LIBC_INLINE Parser(const char *__restrict new_str, internal::ArgList &args)
: str(new_str), args_cur(args), args_start(args) {}
#else
- Parser(const char *__restrict new_str, internal::ArgList &args)
+ LIBC_INLINE Parser(const char *__restrict new_str, internal::ArgList &args)
: str(new_str), args_cur(args) {}
#endif // LLVM_LIBC_SCANF_DISABLE_INDEX_MODE
LengthModifier parse_length_modifier(size_t *local_pos);
// get_next_arg_value gets the next value from the arg list as type T.
- template <class T> T inline get_next_arg_value() {
+ template <class T> LIBC_INLINE T get_next_arg_value() {
return args_cur.next_var<T>();
}
// get_arg_value gets the value from the arg list at index (starting at 1).
// This may require parsing the format string. An index of 0 is interpreted as
// the next value.
- template <class T> T inline get_arg_value(size_t index) {
+ template <class T> LIBC_INLINE T get_arg_value(size_t index) {
if (!(index == 0 || index == args_index))
args_to_index(index);