1. 08 1月, 2021 1 次提交
  2. 09 9月, 2020 1 次提交
  3. 18 4月, 2019 1 次提交
    • S
      define FP_FAST_FMA* when fma* can be inlined · e980ca7a
      Szabolcs Nagy 提交于
      FP_FAST_FMA can be defined if "the fma function generally executes about
      as fast as, or faster than, a multiply and an add of double operands",
      which can only be true if the fma call is inlined as an instruction.
      
      gcc sets __FP_FAST_FMA if __builtin_fma is inlined as an instruction,
      but that does not mean an fma call will be inlined (e.g. it is defined
      with -fno-builtin-fma), other compilers (clang) don't even have such
      macro, but this is the closest we can get.
      
      (even if the libc fma implementation is a single instruction, the extern
      call overhead is already too big when the macro is used to decide between
      x*y+z and fma(x,y,z) so it cannot be based on libc only, defining the
      macro unconditionally on targets which have fma in the base isa is also
      incorrect: the compiler might not inline fma anyway.)
      
      this solution works with gcc unless fma inlining is explicitly turned off.
      e980ca7a
  4. 23 8月, 2018 1 次提交
    • R
      fix FP_ILOGB0 and FP_ILOGBNAN definitions to be valid for use in #if · 184ef36f
      Rich Felker 提交于
      commit 98c9af50 wrongly claimed they
      do not need to be valid for such usage, but the last sentence of C11
      7.1.4 ¶1 imposes a broad requirement that all macros specified as
      integer constant expressions also need to be valid for #if.
      
      simply write the value out explicitly. there is no value here in
      pretending that the width of int will vary.
      184ef36f
  5. 10 3月, 2014 1 次提交
  6. 27 11月, 2013 1 次提交
    • R
      adjust fallback INFINITY definition for FLT_EVAL_METHOD==2 case · a663c930
      Rich Felker 提交于
      on archs with excess precision, the floating point constant 1e40f may
      be evaluated such that it does not actually produce an infinity.
      1e5000f is sufficiently large to produce an infinity for all supported
      floating point formats. note that this definition of INFINITY is only
      used for old or non-GNUC compilers anyway; despite being a portable,
      conforming definition, it leads to erroneous warnings on many
      compilers and thus using the builtin is preferred.
      a663c930
  7. 21 11月, 2013 2 次提交
  8. 27 9月, 2013 1 次提交
  9. 22 7月, 2013 1 次提交
    • R
      refactor headers, especially alltypes.h, and improve C++ ABI compat · 9448b051
      Rich Felker 提交于
      the arch-specific bits/alltypes.h.sh has been replaced with a generic
      alltypes.h.in and minimal arch-specific bits/alltypes.h.in.
      
      this commit is intended to have no functional changes except:
      - exposing additional symbols that POSIX allows but does not require
      - changing the C++ name mangling for some types
      - fixing the signedness of blksize_t on powerpc (POSIX requires signed)
      - fixing the limit macros for sig_atomic_t on x86_64
      - making dev_t an unsigned type (ABI matching goal, and more logical)
      
      in addition, some types that were wrongly defined with long on 32-bit
      archs were changed to int, and vice versa; this change is
      non-functional except for the possibility of making pointer types
      mismatch, and only affects programs that were using them incorrectly,
      and only at build-time, not runtime.
      
      the following changes were made in the interest of moving
      non-arch-specific types out of the alltypes system and into the
      headers they're associated with, and also will tend to improve
      application compatibility:
      - netdb.h now includes netinet/in.h (for socklen_t and uint32_t)
      - netinet/in.h now includes sys/socket.h and inttypes.h
      - sys/resource.h now includes sys/time.h (for struct timeval)
      - sys/wait.h now includes signal.h (for siginfo_t)
      - langinfo.h now includes nl_types.h (for nl_item)
      
      for the types in stdint.h:
      - types which are of no interest to other headers were moved out of
        the alltypes system.
      - fast types for 8- and 64-bit are hard-coded (at least for now); only
        the 16- and 32-bit ones have reason to vary by arch.
      
      and the following types have been changed for C++ ABI purposes;
      - mbstate_t now has a struct tag, __mbstate_t
      - FILE's struct tag has been changed to _IO_FILE
      - DIR's struct tag has been changed to __dirstream
      - locale_t's struct tag has been changed to __locale_struct
      - pthread_t is defined as unsigned long in C++ mode only
      - fpos_t now has a struct tag, _G_fpos64_t
      - fsid_t's struct tag has been changed to __fsid_t
      - idtype_t has been made an enum type (also required by POSIX)
      - nl_catd has been changed from long to void *
      - siginfo_t's struct tag has been removed
      - sigset_t's has been given a struct tag, __sigset_t
      - stack_t has been given a struct tag, sigaltstack
      - suseconds_t has been changed to long on 32-bit archs
      - [u]intptr_t have been changed from long to int rank on 32-bit archs
      - dev_t has been made unsigned
      
      summary of tests that have been performed against these changes:
      - nsz's libc-test (diff -u before and after)
      - C++ ABI check symbol dump (diff -u before, after, glibc)
      - grepped for __NEED, made sure types needed are still in alltypes
      - built gcc 3.4.6
      9448b051
  10. 07 5月, 2013 1 次提交
    • S
      remove compound literals from math.h to please c++ · 2897bfdd
      Szabolcs Nagy 提交于
      __FLOAT_BITS and __DOUBLE_BITS macros used union compound literals,
      now they are changed into static inline functions. A good C compiler
      generates the same code for both and the later is C++ conformant.
      2897bfdd
  11. 05 1月, 2013 1 次提交
    • R
      add legacy header values.h · 2ba3f44d
      rofl0r 提交于
      some programs (procps, babl) expect it, and it doesn't seem to
      cause any harm to just add it.
      it's small and straightforward.
      
      since math.h also defines MAXFLOAT, we undef it in both places,
      before defining it.
      2ba3f44d
  12. 12 12月, 2012 1 次提交
  13. 06 12月, 2012 1 次提交
    • R
      fix inefficiency of math.h isless, etc. macros · 96b3ea53
      Rich Felker 提交于
      previously, everything was going through an intermediate conversion to
      long double, which caused the extern __fpclassifyl function to get
      invoked, preventing virtually all optimizations of these operations.
      
      with the new code, tests on constant float or double arguments compile
      to a constant 0 or 1, and tests on non-constant expressions are
      efficient. I may later add support for __builtin versions on compilers
      that support them.
      96b3ea53
  14. 08 9月, 2012 1 次提交
    • R
      default features: make musl usable without feature test macros · c1a9658b
      Rich Felker 提交于
      the old behavior of exposing nothing except plain ISO C can be
      obtained by defining __STRICT_ANSI__ or using a compiler option (such
      as -std=c99) that predefines it. the new default featureset is POSIX
      with XSI plus _BSD_SOURCE. any explicit feature test macros will
      inhibit the default.
      
      installation docs have also been updated to reflect this change.
      c1a9658b
  15. 03 9月, 2012 1 次提交
    • R
      avoid "inline" in public headers for strict c89 compatibility · fb247faf
      Rich Felker 提交于
      while musl itself requires a c99 compiler, some applications insist on
      being compiled with c89 compilers, and use of "inline" in the headers
      was breaking them. much of this had been avoided already by just
      skipping the inline keyword in pre-c99 compilers or modes, but this
      new unified solution is cleaner and may/should result in better code
      generation in the default gcc configuration.
      fb247faf
  16. 14 8月, 2012 3 次提交
  17. 23 7月, 2012 1 次提交
  18. 23 5月, 2012 1 次提交
  19. 06 5月, 2012 1 次提交
    • R
      fix definitions of FP_ILOGB constants · 98c9af50
      Rich Felker 提交于
      two issues: (1) the type was wrong (unsigned instead of signed int),
      and (2) the value of FP_ILOGBNAN should be INT_MIN rather than INT_MAX
      to match the ABI. this is also much more useful since INT_MAX
      corresponds to a valid input (infinity). the standard would allow us
      to set FP_ILOGB0 to -INT_MAX instead of INT_MIN, which would give us
      distinct values for ilogb(0) and ilogb(NAN), but the benefit seems way
      too small to justify ignoring the ABI.
      
      note that the macro is just a "portable" (to any twos complement
      system where signed and unsigned int have the same width) way to write
      INT_MIN without needing limits.h. it's valid to use this method since
      these macros are not required to work in #if directives.
      98c9af50
  20. 01 5月, 2012 1 次提交
  21. 30 4月, 2012 1 次提交
    • R
      first try at writing an efficient and "correct" exp10 · f6819755
      Rich Felker 提交于
      this is a nonstandard function so it's not clear what conditions it
      should satisfy. my intent is that it be fast and exact for positive
      integral exponents when the result fits in the destination type, and
      fast and correctly rounded for small negative integral exponents.
      otherwise we aim for at most 1ulp error; it seems to differ from pow
      by at most 1ulp and it's often 2-5 times faster than pow.
      f6819755
  22. 18 4月, 2012 1 次提交
  23. 31 3月, 2012 2 次提交
  24. 18 3月, 2012 2 次提交
  25. 17 3月, 2012 1 次提交
  26. 15 3月, 2012 3 次提交
  27. 13 3月, 2012 1 次提交
    • R
      first commit of the new libm! · b69f695a
      Rich Felker 提交于
      thanks to the hard work of Szabolcs Nagy (nsz), identifying the best
      (from correctness and license standpoint) implementations from freebsd
      and openbsd and cleaning them up! musl should now fully support c99
      float and long double math functions, and has near-complete complex
      math support. tgmath should also work (fully on gcc-compatible
      compilers, and mostly on any c99 compiler).
      
      based largely on commit 0376d44a890fea261506f1fc63833e7a686dca19 from
      nsz's libm git repo, with some additions (dummy versions of a few
      missing long double complex functions, etc.) by me.
      
      various cleanups still need to be made, including re-adding (if
      they're correct) some asm functions that were dropped.
      b69f695a
  28. 03 3月, 2012 2 次提交
    • R
      fix nan/infinity macros in math.h, etc. · 405ce58d
      Rich Felker 提交于
      the previous version not only failed to work in c++, but also failed
      to produce constant expressions, making the macros useless as
      initializers for objects of static storage duration.
      
      gcc 3.3 and later have builtins for these, which sadly seem to be the
      most "portable" solution. the alternative definitions produce
      exceptions (for NAN) and compiler warnings (for INFINITY) on newer
      versions of gcc.
      405ce58d
    • R
      typo in math.h c version check · 9fcecd7b
      Rich Felker 提交于
      9fcecd7b
  29. 02 3月, 2012 1 次提交
  30. 16 2月, 2012 1 次提交
  31. 11 11月, 2011 1 次提交
  32. 09 6月, 2011 1 次提交