aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thornburgh <dthorn@google.com>2025-07-16 13:58:01 -0700
committerDaniel Thornburgh <dthorn@google.com>2025-07-29 15:11:07 -0700
commit7bf4543da1e54794e33d7550004ae223caeaae21 (patch)
tree30af34d04f4954127be012febcd50f59408c851d
parent2f5e2bd917fa27542994b49010e86cc09f57a9a9 (diff)
downloadllvm-users/mysterymath/modular-printf/libc.zip
llvm-users/mysterymath/modular-printf/libc.tar.gz
llvm-users/mysterymath/modular-printf/libc.tar.bz2
LIBC_INLINE for modular fn definitionsusers/mysterymath/modular-printf/libc
-rw-r--r--libc/src/stdio/printf_core/float_dec_converter.h12
-rw-r--r--libc/src/stdio/printf_core/float_dec_converter_limited.h12
-rw-r--r--libc/src/stdio/printf_core/float_hex_converter.h4
-rw-r--r--libc/src/stdio/printf_core/parser.h11
4 files changed, 20 insertions, 19 deletions
diff --git a/libc/src/stdio/printf_core/float_dec_converter.h b/libc/src/stdio/printf_core/float_dec_converter.h
index deeb566..1b0a02e 100644
--- a/libc/src/stdio/printf_core/float_dec_converter.h
+++ b/libc/src/stdio/printf_core/float_dec_converter.h
@@ -1137,8 +1137,8 @@ convert_float_dec_auto(Writer<write_mode> *writer,
// TODO: unify the float converters to remove the duplicated checks for inf/nan.
template <WriteMode write_mode>
-int convert_float_decimal(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_decimal(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
if (to_conv.length_modifier == LengthModifier::L) {
fputil::FPBits<long double>::StorageType float_raw = to_conv.conv_val_raw;
fputil::FPBits<long double> float_bits(float_raw);
@@ -1159,8 +1159,8 @@ int convert_float_decimal(Writer<write_mode> *writer,
}
template <WriteMode write_mode>
-int convert_float_dec_exp(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_dec_exp(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
if (to_conv.length_modifier == LengthModifier::L) {
fputil::FPBits<long double>::StorageType float_raw = to_conv.conv_val_raw;
fputil::FPBits<long double> float_bits(float_raw);
@@ -1181,8 +1181,8 @@ int convert_float_dec_exp(Writer<write_mode> *writer,
}
template <WriteMode write_mode>
-int convert_float_dec_auto(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_dec_auto(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
if (to_conv.length_modifier == LengthModifier::L) {
fputil::FPBits<long double>::StorageType float_raw = to_conv.conv_val_raw;
fputil::FPBits<long double> float_bits(float_raw);
diff --git a/libc/src/stdio/printf_core/float_dec_converter_limited.h b/libc/src/stdio/printf_core/float_dec_converter_limited.h
index 9804a38..d9af10d 100644
--- a/libc/src/stdio/printf_core/float_dec_converter_limited.h
+++ b/libc/src/stdio/printf_core/float_dec_converter_limited.h
@@ -687,20 +687,20 @@ LIBC_PRINTF_MODULAR_DECL int convert_float_dec_auto(Writer<write_mode> *writer,
#ifdef LIBC_PRINTF_DEFINE_MODULAR
template <WriteMode write_mode>
-int convert_float_decimal(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_decimal(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
return convert_float_outer(writer, to_conv, ConversionType::F);
}
template <WriteMode write_mode>
-int convert_float_dec_exp(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_dec_exp(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
return convert_float_outer(writer, to_conv, ConversionType::E);
}
template <WriteMode write_mode>
-int convert_float_dec_auto(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_dec_auto(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
return convert_float_outer(writer, to_conv, ConversionType::G);
}
#endif
diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h
index fa72406..f1aa556 100644
--- a/libc/src/stdio/printf_core/float_hex_converter.h
+++ b/libc/src/stdio/printf_core/float_hex_converter.h
@@ -31,8 +31,8 @@ LIBC_PRINTF_MODULAR_DECL int convert_float_hex_exp(Writer<write_mode> *writer,
#ifdef LIBC_PRINTF_DEFINE_MODULAR
template <WriteMode write_mode>
-int convert_float_hex_exp(Writer<write_mode> *writer,
- const FormatSection &to_conv) {
+LIBC_INLINE int convert_float_hex_exp(Writer<write_mode> *writer,
+ const FormatSection &to_conv) {
using LDBits = fputil::FPBits<long double>;
using StorageType = LDBits::StorageType;
diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index 5a1eea3..f25e761 100644
--- a/libc/src/stdio/printf_core/parser.h
+++ b/libc/src/stdio/printf_core/parser.h
@@ -682,9 +682,9 @@ private:
#ifdef LIBC_PRINTF_DEFINE_MODULAR
template <typename ArgParser>
-void Parser<ArgParser>::write_float_arg_val(FormatSection &section,
- LengthModifier lm,
- size_t conv_index) {
+LIBC_INLINE void Parser<ArgParser>::write_float_arg_val(FormatSection &section,
+ LengthModifier lm,
+ size_t conv_index) {
if (lm != LengthModifier::L) {
WRITE_ARG_VAL_SIMPLEST(section.conv_val_raw, double, conv_index);
} else {
@@ -693,7 +693,7 @@ void Parser<ArgParser>::write_float_arg_val(FormatSection &section,
}
template <typename ArgParser>
-TypeDesc Parser<ArgParser>::float_type_desc(LengthModifier lm) {
+LIBC_INLINE TypeDesc Parser<ArgParser>::float_type_desc(LengthModifier lm) {
if (lm != LengthModifier::L)
return type_desc_from_type<double>();
else
@@ -701,7 +701,8 @@ TypeDesc Parser<ArgParser>::float_type_desc(LengthModifier lm) {
}
template <typename ArgParser>
-bool Parser<ArgParser>::advance_arg_if_float(TypeDesc cur_type_desc) {
+LIBC_INLINE bool
+Parser<ArgParser>::advance_arg_if_float(TypeDesc cur_type_desc) {
if (cur_type_desc == type_desc_from_type<double>())
args_cur.template next_var<double>();
else if (cur_type_desc == type_desc_from_type<long double>())