diff --git a/AK/FixedPoint.h b/AK/FixedPoint.h index aad0cba7e05..00ff9c34d69 100644 --- a/AK/FixedPoint.h +++ b/AK/FixedPoint.h @@ -9,10 +9,13 @@ #include #include #include -#include #include #include +#ifndef KERNEL +# include +#endif + namespace AK { // FIXME: this always uses round to nearest break-tie to even @@ -45,11 +48,14 @@ public: { } +#ifndef KERNEL template explicit ALWAYS_INLINE operator F() const { return (F)m_value * pow(0.5, precision); } +#endif + template explicit constexpr operator I() const { diff --git a/AK/IntegralMath.h b/AK/IntegralMath.h index 0a23debb51b..916d9b70cc8 100644 --- a/AK/IntegralMath.h +++ b/AK/IntegralMath.h @@ -10,8 +10,6 @@ #include #include -#include - namespace AK { template diff --git a/AK/Math.h b/AK/Math.h index f0f0d1a0d5e..09debce7cda 100644 --- a/AK/Math.h +++ b/AK/Math.h @@ -11,6 +11,10 @@ #include #include +#ifdef KERNEL +# error "Including AK/Math.h from the Kernel is never correct! Floating point is disabled." +#endif + namespace AK { template diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h index fc46f472d5d..f9a46ce10f4 100644 --- a/AK/PrintfImplementation.h +++ b/AK/PrintfImplementation.h @@ -9,10 +9,13 @@ #include #include #include -#include #include #include +#ifndef KERNEL +# include +#endif + #ifdef __serenity__ extern "C" size_t strlen(char const*); #else @@ -159,7 +162,7 @@ ALWAYS_INLINE int print_decimal(PutChFunc putch, CharType*& bufptr, u64 number, return field_width; } - +#ifndef KERNEL template ALWAYS_INLINE int print_double(PutChFunc putch, CharType*& bufptr, double number, bool always_sign, bool left_pad, bool zero_pad, u32 field_width, u32 precision) { @@ -209,7 +212,7 @@ ALWAYS_INLINE int print_double(PutChFunc putch, CharType*& bufptr, double number return length; } - +#endif template ALWAYS_INLINE int print_octal_number(PutChFunc putch, CharType*& bufptr, u64 number, bool alternate_form, bool left_pad, bool zero_pad, u32 field_width, bool has_precision, u32 precision) { @@ -387,6 +390,7 @@ struct PrintfImpl { { return print_hex(m_putch, m_bufptr, NextArgument()(ap), false, false, state.left_pad, state.zero_pad, 16, false, 1); } +#ifndef KERNEL ALWAYS_INLINE int format_g(ModifierState const& state, ArgumentListRefT ap) const { return format_f(state, ap); @@ -395,6 +399,7 @@ struct PrintfImpl { { return print_double(m_putch, m_bufptr, NextArgument()(ap), state.always_sign, state.left_pad, state.zero_pad, state.field_width, state.precision); } +#endif ALWAYS_INLINE int format_o(ModifierState const& state, ArgumentListRefT ap) const { return print_octal_number(m_putch, m_bufptr, NextArgument()(ap), state.alternate_form, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);