diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..12b670a0c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "src/hyperlight_guest_bin/third_party/picolibc"] + path = src/hyperlight_guest_bin/third_party/picolibc + url = https://github.com/picolibc/picolibc.git + shallow = true +[submodule "src/hyperlight_guest_bin/third_party/mimalloc"] + path = src/hyperlight_guest_bin/third_party/mimalloc + url = https://github.com/microsoft/mimalloc diff --git a/Cargo.lock b/Cargo.lock index 072b85b2a..473a2f30b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -275,15 +275,6 @@ dependencies = [ "serde", ] -[[package]] -name = "buddy_system_allocator" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0108968a3a2dab95b089c0fc3f1afa7759aa5ebe6f1d86d206d6f7ba726eb" -dependencies = [ - "spin 0.9.8", -] - [[package]] name = "built" version = "0.8.0" @@ -1351,7 +1342,7 @@ dependencies = [ "flatbuffers", "hyperlight-testing", "log", - "spin 0.10.0", + "spin", "tracing", ] @@ -1406,15 +1397,16 @@ dependencies = [ name = "hyperlight-guest-bin" version = "0.9.0" dependencies = [ - "buddy_system_allocator", + "anyhow", "cc", "cfg-if", "glob", "hyperlight-common", "hyperlight-guest", "hyperlight-guest-tracing", + "libc_alloc", "log", - "spin 0.10.0", + "spin", ] [[package]] @@ -1423,7 +1415,7 @@ version = "0.9.0" dependencies = [ "hyperlight-common", "hyperlight-guest-tracing-macro", - "spin 0.10.0", + "spin", ] [[package]] @@ -1823,6 +1815,12 @@ version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +[[package]] +name = "libc_alloc" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7581282928bc99698341d1de7590964c28db747c164eaac9409432a3eaed098a" + [[package]] name = "libfuzzer-sys" version = "0.4.10" @@ -3251,15 +3249,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - [[package]] name = "spin" version = "0.10.0" diff --git a/NOTICE.txt b/NOTICE.txt index 3f2d09d46..4227c8453 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -2,227 +2,6445 @@ NOTICES This repository incorporates material as listed below or described in the code. -Component. printf +Component. picolibc Open Source License/Copyright Notice. -The MIT License (MIT) +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: picolibc +Upsream-Contact: Keith Packard +Source: https://keithp.com/git/picolibc +Copyright: 2019 Keith Packard +License: BSD3-1 -Copyright (c) 2014 Marco Paland +Files: * +Copyright: 2020 The Newlib Project +License: Default-1 -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Files: debian/* +Copyright: 2019-2022 Keith Packard +License: BSD3-1 -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Files: *.md +Copyright: 2019 Keith Packard +License: BSD3-1 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Files: scripts/GeneratePicolibcCrossFile.sh +Copyright: 2022 R. Diez - Licensed under the GNU AGPLv3 +License: AGPL3-1 -Component. musl +Files: newlib/libc/include/devctl.h +Copyright: 2016,2019 Joel Sherrill . +License: BSD2-1 -Open Source License/Copyright Notice. +Files: newlib/libc/include/iconv.h +Copyright: 2003-2004, Artem B. Bityuckiy, SoftMine Corporation. Rights transferred to Franklin Electronic Publishers. +License: BSD2-1 + +Files: newlib/libc/include/langinfo.h + newlib/libc/include/wchar.h +Copyright: 2001 Alexey Zelkin +License: BSD2-1 + +Files: newlib/libc/include/machine/fenv-softfloat.h +Copyright: 2004-2011 David Schultz +License: BSD2-1 + +Files: newlib/libc/include/spawn.h +Copyright: 2008 Ed Schouten +License: BSD2-1 + +Files: newlib/libc/include/strings.h + newlib/libc/include/sys/_timeval.h +Copyright: 2002 Mike Barcroft +License: BSD2-1 + +Files: newlib/libc/include/sys/endian.h +Copyright: 2002 Thomas Moestl +License: BSD2-1 + +Files: newlib/libc/include/sys/iconvnls.h +Copyright: 2003-2004, Artem B. Bityuckiy. Rights transferred to Franklin Electronic Publishers. +License: BSD2-1 + +Files: newlib/libc/machine/aarch64/machine/_fpmath.h + newlib/libc/machine/riscv/machine/_fpmath.h +Copyright: 2002, 2003 David Schultz + 2014 The FreeBSD Foundation +License: BSD2-1 + +Files: newlib/libc/machine/aarch64/machine/fenv-fp.h + newlib/libc/machine/aarch64/machine/fenv.h + newlib/libc/machine/arm/machine/fenv.h + newlib/libc/machine/mips/machine/fenv-fp.h + newlib/libc/machine/mips/machine/fenv.h + newlib/libc/machine/powerpc/machine/fenv-fp.h + newlib/libc/machine/powerpc/machine/fenv.h + newlib/libc/machine/sh/machine/fenv.h + newlib/libc/machine/sparc/machine/fenv.h + newlib/libm/ld/common/s_frexpl.c +Copyright: 2004-2005 David Schultz +License: BSD2-1 + +Files: newlib/libc/machine/lm32/setjmp.S +Copyright: 2008 Jon Beniston +License: BSD2-1 + +Files: newlib/libc/machine/loongarch/machine/_fpmath.h +Copyright: 2002, 2003 David Schultz + 2014 The FreeBSD Foundation + 2024 Jiaxun Yang +License: BSD2-1 + +Files: newlib/libc/machine/sh/machine/fenv-fp.h +Copyright: 2004-2005 David Schultz + 2013 Andrew Turner +License: BSD2-1 + +Files: newlib/libc/machine/x86/machine/fenv.h +Copyright: 2010-2019 Red Hat, Inc. +License: BSD2-1 + +Files: newlib/libc/machine/x86_64/machine/_fpmath.h + newlib/libm/ld/ld80/i386_fpmath.h +Copyright: 2002, 2003 David Schultz +License: BSD2-1 + +Files: newlib/libc/stdio/clearerr_u.c + newlib/libc/stdio/feof_u.c + newlib/libc/stdio/ferror_u.c + newlib/libc/stdio/fflush_u.c + newlib/libc/stdio/fgetc_u.c + newlib/libc/stdio/fgets_u.c + newlib/libc/stdio/fgetwc_u.c + newlib/libc/stdio/fgetws_u.c + newlib/libc/stdio/fileno_u.c + newlib/libc/stdio/fputc_u.c + newlib/libc/stdio/fputs_u.c + newlib/libc/stdio/fputwc_u.c + newlib/libc/stdio/fputws_u.c + newlib/libc/stdio/fread_u.c + newlib/libc/stdio/fsetlocking.c + newlib/libc/stdio/fwrite_u.c + newlib/libc/stdio/getwc_u.c + newlib/libc/stdio/getwchar_u.c + newlib/libc/stdio/putwc_u.c + newlib/libc/stdio/putwchar_u.c +Copyright: 2014 Red Hat, Inc. +License: BSD2-1 + +Files: newlib/libc/stdio/fgetwc.c + newlib/libc/stdio/fgetws.c + newlib/libc/stdio/fputwc.c + newlib/libc/stdio/fputws.c + newlib/libc/stdio/fwide.c + newlib/libc/stdio/ungetwc.c +Copyright: 2002-2004 Tim J. Robbins. +License: BSD2-1 + +Files: newlib/libc/stdio/getwc.c + newlib/libc/stdio/getwchar.c + newlib/libc/stdio/putwc.c + newlib/libc/stdio/putwchar.c + newlib/libc/stdlib/wcstod.c +Copyright: 2002 Tim J. Robbins. +License: BSD2-1 + +Files: newlib/libc/stdlib/arc4random.h +Copyright: 2016 embedded brains GmbH +License: BSD2-1 + +Files: newlib/libc/stdlib/imaxabs.c + newlib/libc/stdlib/imaxdiv.c + newlib/libc/stdlib/llabs.c + newlib/libc/stdlib/lldiv.c +Copyright: 2001 Mike Barcroft +License: BSD2-1 + +Files: newlib/libc/stdlib/quick_exit.c +Copyright: 2011 David Chisnall + 2015 embedded brains GmbH +License: BSD2-1 + +Files: newlib/libc/stdlib/reallocf.c +Copyright: 1998, M. Warner Losh +License: BSD2-1 + +Files: newlib/libc/stdlib/rpmatch.c +Copyright: 2004-2005 Tim J. Robbins. +License: BSD2-1 + +Files: newlib/libc/string/ffsl.c + newlib/libc/string/ffsll.c + newlib/libc/string/fls.c + newlib/libc/string/flsl.c + newlib/libc/string/flsll.c + newlib/libm/machine/arm/s_sqrt.c + newlib/libm/machine/arm/sf_sqrt.c +Copyright: 2017 embedded brains GmbH +License: BSD2-1 + +Files: newlib/libc/string/wcscat.c + newlib/libc/string/wcschr.c + newlib/libc/string/wcscpy.c + newlib/libc/string/wcscspn.c + newlib/libc/string/wcslen.c + newlib/libc/string/wcsncat.c + newlib/libc/string/wcsncpy.c + newlib/libc/string/wcspbrk.c + newlib/libc/string/wcsrchr.c + newlib/libc/string/wcsspn.c + newlib/libc/string/wcsstr.c + newlib/libc/string/wmemchr.c + newlib/libc/string/wmemcmp.c + newlib/libc/string/wmemcpy.c + newlib/libc/string/wmemmove.c + newlib/libc/string/wmemset.c +Copyright: 1999 Citrus Project, +License: BSD2-1 + +Files: newlib/libm/common/fma_inc.h +Copyright: 2005-2011 David Schultz +License: BSD2-1 + +Files: newlib/libm/complex/csqrtl.c +Copyright: 2007-2008 David Schultz +License: BSD2-1 + +Files: newlib/libm/ld/common/e_remainderl.c + newlib/libm/ld/common/s_rintl.c + newlib/libm/ld/ld128/invtrig.c + newlib/libm/ld/ld128/invtrig.h + newlib/libm/ld/ld80/invtrig.c + newlib/libm/ld/ld80/invtrig.h +Copyright: 2008 David Schultz +License: BSD2-1 + +Files: newlib/libm/ld/common/s_fdiml.c + newlib/libm/ld/common/s_finitel.c + newlib/libm/ld/common/s_fmaxl.c + newlib/libm/ld/common/s_fminl.c + newlib/libm/ld/common/s_isinfl.c + newlib/libm/ld/common/s_isnanl.c + newlib/libm/ld/common/s_scalbl.c + newlib/libm/ld/common/s_scalbln.c + newlib/libm/ld/common/s_signbitl.c +Copyright: 2004 David Schultz +License: BSD2-1 + +Files: newlib/libm/ld/common/s_lrintl.c + newlib/libm/ld/common/s_lround.c +Copyright: 2005 David Schultz +License: BSD2-1 + +Files: newlib/libm/ld/ld128/s_exp2l.c + newlib/libm/ld/ld80/s_exp2l.c +Copyright: 2005-2008 David Schultz +License: BSD2-1 + +Files: newlib/testsuite/newlib.iconv/iconv.exp + newlib/testsuite/newlib.iconv/iconvjp.c + newlib/testsuite/newlib.iconv/iconvnm.c + newlib/testsuite/newlib.iconv/iconvru.c +Copyright: 2003, Artem B. Bityuckiy, SoftMine Corporation. Rights transferred to Franklin Electronic Publishers. +License: BSD2-1 + +Files: test/t_fmemopen.c +Copyright: 2010 Takehiko NOZAKI, +License: BSD2-1 + +Files: newlib/libc/include/machine/fenv.h +Copyright: 2019 Joel Sherrill +License: BSD2-2 + +Files: newlib/libm/fenv/fe_dfl_env.c +Copyright: 2019 Joel Sherrill +License: BSD2-4 + +Files: newlib/libc/machine/pru/setjmp.s + newlib/libm/machine/pru/fpclassify.c + newlib/libm/machine/pru/fpclassifyf.c + newlib/libm/machine/pru/isfinite.c + newlib/libm/machine/pru/isfinitef.c + newlib/libm/machine/pru/isinf.c + newlib/libm/machine/pru/isinff.c + newlib/libm/machine/pru/isnan.c + newlib/libm/machine/pru/isnanf.c + newlib/libm/machine/pru/isnormal.c + newlib/libm/machine/pru/isnormalf.c +Copyright: 2018-2019 Dimitar Dimitrov +License: BSD2-4 + +Files: newlib/libc/machine/or1k/setjmp.S +Copyright: 2014, Hesham ALMatary +License: BSD2-5 + +Files: newlib/libc/machine/sparc/machine/fenv-fp.h +Copyright: 2004-2005 David Schultz +License: BSD2-6 + +Files: newlib/libc/machine/xtensa/machine/fenv-fp.h + newlib/libc/machine/xtensa/machine/fenv.h +Copyright: 2011 Tensilica Inc. +License: BSD2-7 + +Files: newlib/libc/posix/collate.h +Copyright: 1995 Alex Tatmanjants at Electronni Visti IA, Kiev, Ukraine. +License: BSD2-8 + +Files: newlib/libc/posix/collcmp.c +Copyright: 1996 Andrey A. Chernov, Moscow, Russia. +License: BSD2-9 + +Files: newlib/libc/signal/sig2str.c +Copyright: 2021 Matthew Joyce +License: BSD2-10 + +Files: newlib/libm/ld/common/e_sqrtl.c + newlib/libm/ld/common/s_cosl.c + newlib/libm/ld/common/s_sinl.c + newlib/libm/ld/common/s_tanl.c +Copyright: 2007 Steven G. Kargl +License: BSD2-11 + +Files: newlib/libm/ld/common/s_roundl.c +Copyright: 2003, Steven G. Kargl +License: BSD2-11 + +Files: newlib/libm/ld/ld128/s_nanl.c + newlib/libm/ld/ld80/s_nanl.c +Copyright: 2007 David Schultz +License: BSD2-12 + +Files: CMakeLists.txt + cmake/picolibc.cmake + newlib/CMakeLists.txt + newlib/libc/CMakeLists.txt + newlib/libc/argz/CMakeLists.txt + newlib/libc/ctype/CMakeLists.txt + newlib/libc/errno/CMakeLists.txt + newlib/libc/include/CMakeLists.txt + newlib/libc/include/arpa/CMakeLists.txt + newlib/libc/include/byteswap.h + newlib/libc/include/machine/CMakeLists.txt + newlib/libc/include/rpc/CMakeLists.txt + newlib/libc/include/rpc/meson.build + newlib/libc/include/ssp/CMakeLists.txt + newlib/libc/include/sys/CMakeLists.txt + newlib/libc/machine/CMakeLists.txt + newlib/libc/machine/aarch64/CMakeLists.txt + newlib/libc/machine/aarch64/machine/CMakeLists.txt + newlib/libc/machine/aarch64/machine/math.h + newlib/libc/machine/aarch64/machine/meson.build + newlib/libc/machine/arc/CMakeLists.txt + newlib/libc/machine/arc/meson.build + newlib/libc/machine/arc64/CMakeLists.txt + newlib/libc/machine/arc64/meson.build + newlib/libc/machine/arm/CMakeLists.txt + newlib/libc/machine/arm/machine/CMakeLists.txt + newlib/libc/machine/avr/meson.build + newlib/libc/machine/m68k/machine/CMakeLists.txt + newlib/libc/machine/mips/CMakeLists.txt + newlib/libc/machine/mips/machine/CMakeLists.txt + newlib/libc/machine/mips/machine/meson.build + newlib/libc/machine/mips/meson.build + newlib/libc/machine/msp430/meson.build + newlib/libc/machine/nios2/CMakeLists.txt + newlib/libc/machine/nios2/meson.build + newlib/libc/machine/powerpc/CMakeLists.txt + newlib/libc/machine/powerpc/machine/CMakeLists.txt + newlib/libc/machine/powerpc/machine/meson.build + newlib/libc/machine/riscv/CMakeLists.txt + newlib/libc/machine/riscv/machine/CMakeLists.txt + newlib/libc/machine/sparc/CMakeLists.txt + newlib/libc/machine/sparc/machine/CMakeLists.txt + newlib/libc/machine/sparc/machine/meson.build + newlib/libc/machine/sparc/meson.build + newlib/libc/machine/x86/CMakeLists.txt + newlib/libc/machine/x86/machine/CMakeLists.txt + newlib/libc/machine/xtensa/CMakeLists.txt + newlib/libc/machine/xtensa/machine/CMakeLists.txt + newlib/libc/misc/CMakeLists.txt + newlib/libc/picolib/CMakeLists.txt + newlib/libc/picolib/machine/CMakeLists.txt + newlib/libc/picolib/machine/aarch64/CMakeLists.txt + newlib/libc/picolib/machine/arc/CMakeLists.txt + newlib/libc/picolib/machine/arc/tls.c + newlib/libc/picolib/machine/arc64/CMakeLists.txt + newlib/libc/picolib/machine/arm/CMakeLists.txt + newlib/libc/picolib/machine/mips/tls.c + newlib/libc/picolib/machine/msp430/CMakeLists.txt + newlib/libc/picolib/machine/or1k/CMakeLists.txt + newlib/libc/picolib/machine/riscv/CMakeLists.txt + newlib/libc/picolib/machine/rx/CMakeLists.txt + newlib/libc/picolib/machine/sh/CMakeLists.txt + newlib/libc/picolib/machine/sparc/CMakeLists.txt + newlib/libc/picolib/machine/x86/CMakeLists.txt + newlib/libc/picolib/machine/xtensa/CMakeLists.txt + newlib/libc/picolib/machine/xtensa/tls.c + newlib/libc/posix/CMakeLists.txt + newlib/libc/search/CMakeLists.txt + newlib/libc/signal/CMakeLists.txt + newlib/libc/ssp/CMakeLists.txt + newlib/libc/stdlib/CMakeLists.txt + newlib/libc/string/CMakeLists.txt + newlib/libc/time/CMakeLists.txt + newlib/libc/tinystdio/CMakeLists.txt + newlib/libc/tinystdio/ecvt_r.c + newlib/libc/tinystdio/ecvtf_r.c + newlib/libc/tinystdio/ecvtl_r.c + newlib/libc/tinystdio/fcvt_r.c + newlib/libc/tinystdio/fcvtf_r.c + newlib/libc/tinystdio/fcvtl_r.c + newlib/libc/tinystdio/fmemopen.c + newlib/libc/tinystdio/getline.c + newlib/libc/tinystdio/remove.c + newlib/libc/tinystdio/stdio-bufio.h + newlib/libc/tinystdio/strtoimax_l.c + newlib/libc/tinystdio/strtol_l.c + newlib/libc/tinystdio/strtoll_l.c + newlib/libc/tinystdio/strtoul_l.c + newlib/libc/tinystdio/strtoull_l.c + newlib/libc/tinystdio/strtoumax_l.c + newlib/libc/tinystdio/tmpfile.c + newlib/libc/tinystdio/tmpnam.c + newlib/libc/xdr/CMakeLists.txt + newlib/libm/CMakeLists.txt + newlib/libm/common/CMakeLists.txt + newlib/libm/common/s_iseqsig.c + newlib/libm/common/sf_iseqsig.c + newlib/libm/common/sl_iseqsig.c + newlib/libm/fenv/CMakeLists.txt + newlib/libm/fenv/fegetmode.c + newlib/libm/fenv/fesetmode.c + newlib/libm/ld/CMakeLists.txt + newlib/libm/ld/common/meson.build + newlib/libm/ld/common/s_issignalingl.c + newlib/libm/ld/common/s_significandl.c + newlib/libm/ld/e_acoshl.c + newlib/libm/ld/e_acosl.c + newlib/libm/ld/e_asinl.c + newlib/libm/ld/e_atan2l.c + newlib/libm/ld/e_atanhl.c + newlib/libm/ld/e_coshl.c + newlib/libm/ld/e_expl.c + newlib/libm/ld/e_fmodl.c + newlib/libm/ld/e_hypotl.c + newlib/libm/ld/e_lgammal.c + newlib/libm/ld/e_lgammal_r.c + newlib/libm/ld/e_log10l.c + newlib/libm/ld/e_log2l.c + newlib/libm/ld/e_logl.c + newlib/libm/ld/e_powl.c + newlib/libm/ld/e_remainderl.c + newlib/libm/ld/e_sinhl.c + newlib/libm/ld/e_sqrtl.c + newlib/libm/ld/e_tgammal.c + newlib/libm/ld/invtrig.c + newlib/libm/ld/k_cosl.c + newlib/libm/ld/k_rem_pio2.c + newlib/libm/ld/k_sinl.c + newlib/libm/ld/k_tanl.c + newlib/libm/ld/ldd/s_ceill.c + newlib/libm/ld/ldd/s_floorl.c + newlib/libm/ld/ldd/s_fpclassifyl.c + newlib/libm/ld/ldd/s_nanl.c + newlib/libm/ld/ldd/s_nearbyintl.c + newlib/libm/ld/ldd/s_truncl.c + newlib/libm/ld/math_ld.h + newlib/libm/ld/meson.build + newlib/libm/ld/polevll.c + newlib/libm/ld/s_asinhl.c + newlib/libm/ld/s_atanl.c + newlib/libm/ld/s_cbrtl.c + newlib/libm/ld/s_ceill.c + newlib/libm/ld/s_copysignl.c + newlib/libm/ld/s_cosl.c + newlib/libm/ld/s_erfl.c + newlib/libm/ld/s_exp2l.c + newlib/libm/ld/s_expm1l.c + newlib/libm/ld/s_fabsl.c + newlib/libm/ld/s_fdiml.c + newlib/libm/ld/s_finitel.c + newlib/libm/ld/s_floorl.c + newlib/libm/ld/s_fmal.c + newlib/libm/ld/s_fmaxl.c + newlib/libm/ld/s_fminl.c + newlib/libm/ld/s_fpclassifyl.c + newlib/libm/ld/s_frexpl.c + newlib/libm/ld/s_getpayloadl.c + newlib/libm/ld/s_ilogbl.c + newlib/libm/ld/s_isnanl.c + newlib/libm/ld/s_issignalingl.c + newlib/libm/ld/s_llrintl.c + newlib/libm/ld/s_llroundl.c + newlib/libm/ld/s_log1pl.c + newlib/libm/ld/s_logbl.c + newlib/libm/ld/s_lrintl.c + newlib/libm/ld/s_lroundl.c + newlib/libm/ld/s_modfl.c + newlib/libm/ld/s_nanl.c + newlib/libm/ld/s_nextafterl.c + newlib/libm/ld/s_nexttoward.c + newlib/libm/ld/s_nexttowardf.c + newlib/libm/ld/s_remquol.c + newlib/libm/ld/s_rintl.c + newlib/libm/ld/s_roundl.c + newlib/libm/ld/s_scalbl.c + newlib/libm/ld/s_scalbln.c + newlib/libm/ld/s_scalbnl.c + newlib/libm/ld/s_significandl.c + newlib/libm/ld/s_sincosl.c + newlib/libm/ld/s_sinl.c + newlib/libm/ld/s_tanhl.c + newlib/libm/ld/s_tanl.c + newlib/libm/ld/s_truncl.c + newlib/libm/machine/CMakeLists.txt + newlib/libm/machine/aarch64/CMakeLists.txt + newlib/libm/machine/arm/CMakeLists.txt + newlib/libm/machine/arm/s_fabs.c + newlib/libm/machine/arm/sf_fabs.c + newlib/libm/machine/powerpc/CMakeLists.txt + newlib/libm/machine/powerpc/complex128.c + newlib/libm/machine/riscv/CMakeLists.txt + newlib/libm/machine/x86/CMakeLists.txt + newlib/libm/math/CMakeLists.txt + newlib/testsuite/newlib.time/meson.build + picocrt/CMakeLists.txt + picocrt/machine/arc/CMakeLists.txt + picocrt/machine/arc64/CMakeLists.txt + picocrt/machine/arm/CMakeLists.txt + picocrt/machine/powerpc/crt0.S + picocrt/machine/powerpc/powerpc_crt.h + picocrt/machine/sh/CMakeLists.txt + semihost/CMakeLists.txt + semihost/fake/fake_exit.c + semihost/fake/fake_io.c + semihost/fake/fake_kill.c + semihost/fake/fake_stub.c + semihost/fake/meson.build + semihost/getentropy.c + semihost/machine/arc/CMakeLists.txt + semihost/machine/arc64/CMakeLists.txt + semihost/machine/arm/CMakeLists.txt + semihost/machine/powerpc/opal.h + semihost/machine/powerpc/opal_call.S + semihost/machine/powerpc/opal_cec_power_down.c + semihost/machine/powerpc/opal_console_write.c + semihost/machine/sh/sh_io.c + test/CMakeLists.txt + test/lock-valid.c + test/long_double.c + test/native-locks.c + test/test-efcvt.c + test/test-except.c + test/test-fopen.c + test/test-mktemp.c + test/test-strtod.c + zephyr/zephyr.cmake +Copyright: 2022 Keith Packard +License: BSD3-1 + +Files: cmake/TC-arm-none-eabi.ld + cmake/TC-microbit.ld + hello-world/hello-worldpp.cpp + newlib/libc/errno/errno.c + newlib/libc/include/machine/math.h + newlib/libc/include/ssp/meson.build + newlib/libc/include/sys/auxv.h + newlib/libc/machine/arm/machine/meson.build + newlib/libc/machine/csky/meson.build + newlib/libc/machine/riscv/machine/math.h + newlib/libc/machine/riscv/machine/meson.build + newlib/libc/machine/x86/machine/meson.build + newlib/libc/picolib/getauxval.c + newlib/libc/picolib/machine/aarch64/tls.c + newlib/libc/picolib/machine/arm/arm_tls.h + newlib/libc/posix/meson.build + newlib/libc/stdio/nano-svfprintf.c + newlib/libc/stdio/nano-svfscanf.c + newlib/libc/stdio64/meson.build + newlib/libc/tinystdio/asnprintf.c + newlib/libc/tinystdio/asprintf.c + newlib/libc/tinystdio/compare_exchange.c + newlib/libc/tinystdio/ecvt.c + newlib/libc/tinystdio/ecvtf.c + newlib/libc/tinystdio/ecvtl.c + newlib/libc/tinystdio/exchange.c + newlib/libc/tinystdio/fcvt.c + newlib/libc/tinystdio/fcvtf.c + newlib/libc/tinystdio/fcvtl.c + newlib/libc/tinystdio/fflush.c + newlib/libc/tinystdio/filestrget.c + newlib/libc/tinystdio/filestrput.c + newlib/libc/tinystdio/filestrputalloc.c + newlib/libc/tinystdio/filewstrget.c + newlib/libc/tinystdio/gcvt.c + newlib/libc/tinystdio/gcvtf.c + newlib/libc/tinystdio/gcvtl.c + newlib/libc/tinystdio/perror.c + newlib/libc/tinystdio/setvbuf.c + newlib/libc/tinystdio/strtod_l.c + newlib/libc/tinystdio/strtof_l.c + newlib/libc/tinystdio/strtold_l.c + newlib/libc/tinystdio/vasnprintf.c + newlib/libc/tinystdio/vasprintf.c + newlib/libm/machine/arm/s_fma_arm.c + newlib/libm/machine/arm/sf_fma_arm.c + newlib/libm/machine/riscv/s_fma.c + newlib/libm/machine/riscv/s_sqrt.c + newlib/libm/machine/riscv/sf_fma.c + newlib/libm/machine/riscv/sf_sqrt.c + newlib/libm/math/s_lgamma.c + scripts/run-aarch64 + scripts/run-arc + scripts/run-i386 + scripts/run-m68k + scripts/run-mips + scripts/run-msp430 + scripts/run-nios2 + scripts/run-or1k + scripts/run-sh + scripts/run-sparc + scripts/run-x86 + scripts/run-x86_64 + semihost/fstat.c + semihost/isatty.c + semihost/mapstdio.c + semihost/sys_iserror.c + semihost/sys_system.c + semihost/sys_tickfreq.c + test/fenv.c + test/ffs.c + test/malloc.c + test/malloc_stress.c + test/math_errhandling.c + test/math_errhandling_tests.c + test/regex.c + test/semihost/meson.build + test/semihost/semihost-argv.c + test/semihost/semihost-clock.c + test/semihost/semihost-close.c + test/semihost/semihost-elapsed.c + test/semihost/semihost-errno.c + test/semihost/semihost-exit-extended-failure.c + test/semihost/semihost-exit-extended.c + test/semihost/semihost-exit-failure.c + test/semihost/semihost-exit.c + test/semihost/semihost-flen.c + test/semihost/semihost-get-cmdline.c + test/semihost/semihost-gettimeofday.c + test/semihost/semihost-heapinfo.c + test/semihost/semihost-iserror.c + test/semihost/semihost-istty.c + test/semihost/semihost-no-argv.c + test/semihost/semihost-open.c + test/semihost/semihost-read.c + test/semihost/semihost-readc.c + test/semihost/semihost-remove.c + test/semihost/semihost-rename.c + test/semihost/semihost-seek.c + test/semihost/semihost-system-failure.c + test/semihost/semihost-system.c + test/semihost/semihost-tickfreq.c + test/semihost/semihost-time.c + test/semihost/semihost-times.c + test/semihost/semihost-tmpnam.c + test/semihost/semihost-tmpname.c + test/semihost/semihost-write.c + test/semihost/semihost-write0.c + test/semihost/semihost-writec.c + test/setjmp.c + test/stack-smash.c + test/tls.c + test/try-ilp32-sub.c + test/try-ilp32.c + test/try-ilp32.h +Copyright: 2020 Keith Packard +License: BSD3-1 + +Files: cmake/TC-rx.ld + newlib/libc/ctype/iswspace_l.c + newlib/libc/ctype/mkctype-extended.py + newlib/libc/iconv/CMakeLists.txt + newlib/libc/iconv/iconv.c + newlib/libc/iconv/iconv_close.c + newlib/libc/iconv/iconv_open.c + newlib/libc/iconv/iconv_private.h + newlib/libc/iconv/meson.build + newlib/libc/locale/CMakeLists.txt + newlib/libc/locale/duplocale.c + newlib/libc/locale/freelocale.c + newlib/libc/locale/getlocalename_l.c + newlib/libc/locale/locale_ctype_ptr.c + newlib/libc/locale/locale_ctype_ptr_l.c + newlib/libc/locale/locale_mb_cur_max.c + newlib/libc/locale/locale_names.c + newlib/libc/locale/locale_private.h + newlib/libc/locale/localeconv.c + newlib/libc/locale/localedata.c + newlib/libc/locale/meson.build + newlib/libc/locale/newlocale.c + newlib/libc/locale/nl_langinfo.c + newlib/libc/locale/posix_locale.c + newlib/libc/locale/setlocale.c + newlib/libc/locale/timedata.c + newlib/libc/locale/uselocale.c + newlib/libc/machine/powerpc/machine/_ssp_tls.h + newlib/libc/picolib/machine/aarch64/interrupt_vector.S + newlib/libc/picolib/machine/loongarch/CMakeLists.txt + newlib/libc/picolib/machine/loongarch/tls.c + newlib/libc/picolib/machine/m68k/meson.build + newlib/libc/picolib/machine/m68k/read_tp.s + newlib/libc/picolib/machine/m68k/set_tls.c + newlib/libc/picolib/machine/m68k/tls-local.h + newlib/libc/picolib/machine/m68k/tls.c + newlib/libc/picolib/machine/or1k/meson.build + newlib/libc/picolib/machine/or1k/tls.c + newlib/libc/picolib/machine/powerpc/CMakeLists.txt + newlib/libc/picolib/machine/powerpc/hwcap.c + newlib/libc/picolib/machine/powerpc/meson.build + newlib/libc/picolib/machine/powerpc/tls.c + newlib/libc/picolib/machine/sh/tls.c + newlib/libc/picolib/machine/x86/interrupt.S + newlib/libc/picolib/machine/x86/interrupt.c + newlib/libc/stdlib/mk-sb-charsets.py + newlib/libc/stdlib/sb_charsets.h + newlib/libc/tinystdio/flockfile_init.c + newlib/libc/tinystdio/wcstod.c + newlib/libc/tinystdio/wcstod_l.c + newlib/libc/tinystdio/wcstof.c + newlib/libc/tinystdio/wcstof_l.c + newlib/libc/tinystdio/wcstoimax.c + newlib/libc/tinystdio/wcstoimax_l.c + newlib/libc/tinystdio/wcstol.c + newlib/libc/tinystdio/wcstol_l.c + newlib/libc/tinystdio/wcstold.c + newlib/libc/tinystdio/wcstold_l.c + newlib/libc/tinystdio/wcstoll.c + newlib/libc/tinystdio/wcstoll_l.c + newlib/libc/tinystdio/wcstoul.c + newlib/libc/tinystdio/wcstoul_l.c + newlib/libc/tinystdio/wcstoull.c + newlib/libc/tinystdio/wcstoull_l.c + newlib/libc/tinystdio/wcstoumax.c + newlib/libc/tinystdio/wcstoumax_l.c + newlib/libc/ubsan/CMakeLists.txt + newlib/libc/ubsan/meson.build + newlib/libc/ubsan/ubsan.h + newlib/libc/ubsan/ubsan_cfi_type_check_to_string.c + newlib/libc/ubsan/ubsan_error.c + newlib/libc/ubsan/ubsan_handle_add_overflow.c + newlib/libc/ubsan/ubsan_handle_alignment_assumption.c + newlib/libc/ubsan/ubsan_handle_builtin_unreachable.c + newlib/libc/ubsan/ubsan_handle_cfi_bad_type.c + newlib/libc/ubsan/ubsan_handle_cfi_check_fail.c + newlib/libc/ubsan/ubsan_handle_divrem_overflow.c + newlib/libc/ubsan/ubsan_handle_dynamic_type_cache_miss.c + newlib/libc/ubsan/ubsan_handle_float_cast_overflow.c + newlib/libc/ubsan/ubsan_handle_function_type_mismatch.c + newlib/libc/ubsan/ubsan_handle_implicit_conversion.c + newlib/libc/ubsan/ubsan_handle_invalid_builtin.c + newlib/libc/ubsan/ubsan_handle_invalid_objc_cast.c + newlib/libc/ubsan/ubsan_handle_load_invalid_value.c + newlib/libc/ubsan/ubsan_handle_missing_return.c + newlib/libc/ubsan/ubsan_handle_mul_overflow.c + newlib/libc/ubsan/ubsan_handle_negate_overflow.c + newlib/libc/ubsan/ubsan_handle_nonnull_arg.c + newlib/libc/ubsan/ubsan_handle_nonnull_return.c + newlib/libc/ubsan/ubsan_handle_nonnull_return_v1.c + newlib/libc/ubsan/ubsan_handle_nullability_arg.c + newlib/libc/ubsan/ubsan_handle_nullability_return.c + newlib/libc/ubsan/ubsan_handle_nullability_return_v1.c + newlib/libc/ubsan/ubsan_handle_out_of_bounds.c + newlib/libc/ubsan/ubsan_handle_pointer_overflow.c + newlib/libc/ubsan/ubsan_handle_shift_out_of_bounds.c + newlib/libc/ubsan/ubsan_handle_sub_overflow.c + newlib/libc/ubsan/ubsan_handle_type_mismatch.c + newlib/libc/ubsan/ubsan_handle_type_mismatch_v1.c + newlib/libc/ubsan/ubsan_message.c + newlib/libc/ubsan/ubsan_type_check_to_string.c + newlib/libc/ubsan/ubsan_val_to_imax.c + newlib/libc/ubsan/ubsan_val_to_string.c + newlib/libc/ubsan/ubsan_val_to_umax.c + newlib/libc/ubsan/ubsan_warning.c + picocrt/machine/lm32/crt0.S + picocrt/machine/or1k/crt0.S + picocrt/machine/or1k/crt0.c + picocrt/machine/rx/crt0.c + picocrt/machine/x86/traps.S + picocrt/machine/x86/traps.c + semihost/machine/lm32/lm32_errno.c + semihost/machine/rx/rx_iob.c + semihost/machine/rx/rx_semihost.h + semihost/machine/sh/sh_syscall.c + test/test-scmpu.c + test/test-wcase.c + test/test-wctomb.c +Copyright: 2025 Keith Packard +License: BSD3-1 + +Files: doc/printf-sample/Makefile + doc/printf-sample/printf.c + newlib/libc/machine/arm/machine/fenv-fp.h + newlib/libc/machine/m68k/CMakeLists.txt + newlib/libc/machine/m68k/machine/fenv-fp.h + newlib/libc/machine/m68k/machine/fenv.h + newlib/libc/tinystdio/dtox_engine.c + newlib/libc/tinystdio/ftox_engine.c + newlib/libc/tinystdio/getdelim.c + newlib/libc/tinystdio/ldtox_engine.c + newlib/libc/tinystdio/swprintf.c + newlib/libc/tinystdio/vswprintf.c + newlib/testsuite/newlib.time/asctime.c + picocrt/machine/m68k/crt0.c + picocrt/machine/mips/crt0.c + picocrt/machine/msp430/crt0.c + picocrt/machine/nios2/crt0.c + picocrt/machine/sparc/crt0.c + semihost/machine/arc/arc_close.c + semihost/machine/arc/arc_errno.c + semihost/machine/arc/arc_exit.c + semihost/machine/arc/arc_fstat.c + semihost/machine/arc/arc_lseek.c + semihost/machine/arc/arc_open.c + semihost/machine/arc/arc_read.c + semihost/machine/arc/arc_semihost.h + semihost/machine/arc/arc_stat.c + semihost/machine/arc/arc_unlink.c + semihost/machine/arc/arc_write.c + semihost/machine/m68k/m68k_close.c + semihost/machine/m68k/m68k_exit.c + semihost/machine/m68k/m68k_fstat.c + semihost/machine/m68k/m68k_lseek.c + semihost/machine/m68k/m68k_open.c + semihost/machine/m68k/m68k_read.c + semihost/machine/m68k/m68k_semihost.S + semihost/machine/m68k/m68k_semihost.h + semihost/machine/m68k/m68k_stat.c + semihost/machine/m68k/m68k_unlink.c + semihost/machine/m68k/m68k_write.c + semihost/machine/msp430/msp430-iob.c + semihost/machine/msp430/msp430-semihost.h + semihost/machine/nios2/nios2_close.c + semihost/machine/nios2/nios2_exit.c + semihost/machine/nios2/nios2_fstat.c + semihost/machine/nios2/nios2_lseek.c + semihost/machine/nios2/nios2_open.c + semihost/machine/nios2/nios2_read.c + semihost/machine/nios2/nios2_semihost.c + semihost/machine/nios2/nios2_semihost.h + semihost/machine/nios2/nios2_stat.c + semihost/machine/nios2/nios2_unlink.c + semihost/machine/nios2/nios2_write.c + semihost/machine/or1k/or1k_iob.c + semihost/machine/or1k/or1k_semihost.h + semihost/machine/sh/sh_semihost.h + semihost/machine/sparc/sparc-semihost.h + semihost/machine/sparc/sparc_iob.c + semihost/machine/xtensa/xtensa-iob.c + semihost/machine/xtensa/xtensa-semihost.h + test/test-fma.c + test/test-fread-fwrite.c + test/test-gets.c + test/test-long-long.c + test/test-raise.c + test/test-ubsan.c +Copyright: 2023 Keith Packard +License: BSD3-1 + +Files: hello-world/Makefile + hello-world/hello-world.c + hello-world/printf.c + hello-world/run-aarch64 + hello-world/run-aarch64++ + hello-world/run-arm + hello-world/run-riscv + hello-world/run-riscv++ + hello-world/*.ld + meson_options.txt + newlib/libc/argz/meson.build + newlib/libc/ctype/meson.build + newlib/libc/errno/meson.build + newlib/libc/include/arpa/meson.build + newlib/libc/include/endian.h + newlib/libc/include/machine/meson.build + newlib/libc/include/meson.build + newlib/libc/include/newlib.h + newlib/libc/include/picotls.h + newlib/libc/include/sys/meson.build + newlib/libc/machine/arm/meson.build + newlib/libc/machine/riscv/meson.build + newlib/libc/machine/x86/meson.build + newlib/libc/meson.build + newlib/libc/misc/meson.build + newlib/libc/picolib/dso_handle.c + newlib/libc/picolib/inittls.c + newlib/libc/picolib/machine/aarch64/interrupt.c + newlib/libc/picolib/machine/arm/interrupt.c + newlib/libc/picolib/machine/riscv/tls.c + newlib/libc/picolib/machine/sparc/interrupt.S + newlib/libc/picolib/machine/sparc/tls.c + newlib/libc/picolib/meson.build + newlib/libc/picolib/picosbrk.c + newlib/libc/search/meson.build + newlib/libc/signal/meson.build + newlib/libc/ssp/meson.build + newlib/libc/stdio/meson.build + newlib/libc/stdio/svfiprintf.c + newlib/libc/stdio/svfiscanf.c + newlib/libc/stdio/svfiwprintf.c + newlib/libc/stdio/svfiwscanf.c + newlib/libc/stdio/svfprintf.c + newlib/libc/stdio/svfscanf.c + newlib/libc/stdio/svfwprintf.c + newlib/libc/stdio/svfwscanf.c + newlib/libc/stdio/sys/meson.build + newlib/libc/stdio/vfiprintf.c + newlib/libc/stdio/vfiscanf.c + newlib/libc/stdio/vfiwprintf.c + newlib/libc/stdio/vfiwscanf.c + newlib/libc/stdlib/malloc-calloc.c + newlib/libc/stdlib/malloc-cfree.c + newlib/libc/stdlib/malloc-free.c + newlib/libc/stdlib/malloc-mallinfo.c + newlib/libc/stdlib/malloc-malloc.c + newlib/libc/stdlib/malloc-malloc_stats.c + newlib/libc/stdlib/malloc-malloc_usable_size.c + newlib/libc/stdlib/malloc-mallopt.c + newlib/libc/stdlib/malloc-memalign.c + newlib/libc/stdlib/malloc-posix_memalign.c + newlib/libc/stdlib/malloc-pvalloc.c + newlib/libc/stdlib/malloc-realloc.c + newlib/libc/stdlib/malloc-valloc.c + newlib/libc/stdlib/meson.build + newlib/libc/string/meson.build + newlib/libc/time/meson.build + newlib/libc/tinystdio/bufio.c + newlib/libc/tinystdio/fdopen.c + newlib/libc/tinystdio/fileno.c + newlib/libc/tinystdio/fopen.c + newlib/libc/tinystdio/freopen.c + newlib/libc/tinystdio/fseek.c + newlib/libc/tinystdio/fseeko.c + newlib/libc/tinystdio/ftell.c + newlib/libc/tinystdio/ftello.c + newlib/libc/tinystdio/fwide.c + newlib/libc/tinystdio/meson.build + newlib/libc/tinystdio/posixiob_stderr.c + newlib/libc/tinystdio/posixiob_stdin.c + newlib/libc/tinystdio/posixiob_stdout.c + newlib/libc/tinystdio/setbuf.c + newlib/libc/tinystdio/setbuffer.c + newlib/libc/tinystdio/setlinebuf.c + newlib/libc/xdr/meson.build + newlib/libm/common/meson.build + newlib/libm/common/s_issignaling.c + newlib/libm/common/sf_issignaling.c + newlib/libm/common/signgam.c + newlib/libm/common/sl_issignaling.c + newlib/libm/complex/meson.build + newlib/libm/fenv/meson.build + newlib/libm/machine/arm/meson.build + newlib/libm/machine/riscv/meson.build + newlib/libm/machine/x86/meson.build + newlib/libm/math/meson.build + newlib/libm/meson.build + newlib/libm/test/copysign_vec.c + newlib/libm/test/copysignf_vec.c + newlib/libm/test/issignaling_vec.c + newlib/libm/test/meson.build + newlib/libm/test/modf_vec.c + newlib/libm/test/modff_vec.c + newlib/libm/test/pow_vec.c + newlib/libm/test/powf_vec.c + newlib/meson.build + newlib/testsuite/meson.build + newlib/testsuite/newlib.iconv/meson.build + newlib/testsuite/newlib.locale/meson.build + newlib/testsuite/newlib.search/meson.build + newlib/testsuite/newlib.stdio/meson.build + newlib/testsuite/newlib.stdlib/meson.build + newlib/testsuite/newlib.string/meson.build + newlib/testsuite/newlib.wctype/meson.build + newlib/testsuite/stdio-bits.c + picocrt/crt0.h + picocrt/machine/aarch64/crt0.c + picocrt/machine/arc/crt0.c + picocrt/machine/arm/crt0.c + picocrt/machine/sh/crt0.c + picocrt/meson.build + picocrt/shared/crt0.c + scripts/do-aarch64-configure + scripts/do-aarch64-zephyr-configure + scripts/do-aarch64-zephyr-elf-configure + scripts/do-arc-configure + scripts/do-arc64-configure + scripts/do-arm-configure + scripts/do-avr-configure + scripts/do-clang-aarch64-configure + scripts/do-clang-aarch64-fvp-configure + scripts/do-clang-arm-configure + scripts/do-clang-msp430-configure + scripts/do-clang-riscv-configure + scripts/do-clang-rv32imafdc-configure + scripts/do-clang-thumb-configure + scripts/do-clang-thumbv6m-configure + scripts/do-clang-thumbv7-a-configure + scripts/do-clang-thumbv7e+dp-configure + scripts/do-clang-thumbv7e+fp-configure + scripts/do-clang-thumbv7m-configure + scripts/do-configure + scripts/do-cortex-a9-configure + scripts/do-esp32-configure + scripts/do-freedom-tools-configure + scripts/do-i386-configure + scripts/do-lx106-configure + scripts/do-mips-configure + scripts/do-mips-zephyr-configure + scripts/do-mips64-configure + scripts/do-mipsel-configure + scripts/do-msp430-configure + scripts/do-msp430-unknown-elf-configure + scripts/do-native-configure + scripts/do-native-m32-configure + scripts/do-nios2-configure + scripts/do-or1k-configure + scripts/do-riscv-configure + scripts/do-rv32imac-configure + scripts/do-sh-unknown-elf-configure + scripts/do-sparc-zephyr-configure + scripts/do-sparc64-configure + scripts/do-thumbv8_1m-configure + scripts/do-thumbv8m_main_fp-configure + scripts/do-x86-configure + scripts/do-x86_64-configure + scripts/do-x86_64-zephyr-configure + scripts/do-xtensa-dc233c-configure + scripts/do-xtensa-espressif_esp32-configure + scripts/do-xtensa-espressif_esp32s2-configure + scripts/do-xtensa-intel_apl_adsp-configure + scripts/do-xtensa-intel_s1000-configure + scripts/do-xtensa-nxp_imx8m_adsp-configure + scripts/do-xtensa-nxp_imx_adsp-configure + scripts/do-xtensa-sample_controller-configure + scripts/do-zephyr-aarch64-configure + scripts/do-zephyr-arm-configure + scripts/do-zephyr-riscv-configure + scripts/run-arm + scripts/run-power9 + scripts/run-riscv + semihost/close.c + semihost/exit.c + semihost/iob.c + semihost/kill.c + semihost/lseek.c + semihost/lseek64.c + semihost/machine/aarch64/semihost-aarch64.S + semihost/machine/arm/semihost-arm.S + semihost/machine/riscv/semihost-riscv.S + semihost/meson.build + semihost/open.c + semihost/read.c + semihost/semihost-private.h + semihost/semihost.h + semihost/sys_clock.c + semihost/sys_close.c + semihost/sys_elapsed.c + semihost/sys_errno.c + semihost/sys_exit.c + semihost/sys_exit_extended.c + semihost/sys_feature.c + semihost/sys_flen.c + semihost/sys_get_cmdline.c + semihost/sys_getc.c + semihost/sys_heapinfo.c + semihost/sys_istty.c + semihost/sys_open.c + semihost/sys_putc.c + semihost/sys_read.c + semihost/sys_remove.c + semihost/sys_rename.c + semihost/sys_seek.c + semihost/sys_time.c + semihost/sys_tmpnam.c + semihost/sys_write.c + semihost/sys_write0.c + semihost/sysconf.c + semihost/times.c + semihost/unlink.c + semihost/write.c + test/libc-testsuite/meson.build + test/meson.build + test/posix-io.c + test/printf_scanf.c + test/rand.c + test/ungetc.c +Copyright: 2019 Keith Packard +License: BSD3-1 + +Files: meson.build +Copyright: 2019-2021 Keith Packard +License: BSD3-1 + +Files: newlib/empty.c + newlib/libc/machine/arm/memmove.c + newlib/libc/machine/xtensa/machine/meson.build + newlib/libc/picolib/machine/aarch64/meson.build + newlib/libc/picolib/machine/arc/meson.build + newlib/libc/picolib/machine/arc64/meson.build + newlib/libc/picolib/machine/arm/meson.build + newlib/libc/picolib/machine/loongarch/meson.build + newlib/libc/picolib/machine/mips/meson.build + newlib/libc/picolib/machine/msp430/meson.build + newlib/libc/picolib/machine/riscv/meson.build + newlib/libc/picolib/machine/sh/meson.build + newlib/libc/picolib/machine/sparc/meson.build + newlib/libc/picolib/machine/x86/meson.build + newlib/libc/picolib/machine/xtensa/meson.build + newlib/libc/stdlib/pico-atexit.c + newlib/libc/stdlib/pico-cxa-atexit.c + newlib/libc/stdlib/pico-exit.c + newlib/libc/stdlib/pico-exitprocs.c + newlib/libc/stdlib/pico-onexit.c + newlib/libc/stdlib/pico-onexit.h + newlib/libc/tinystdio/atold_engine.c + newlib/libc/tinystdio/ldtoa_engine.c + newlib/libc/tinystdio/matchcaseprefix.c + newlib/libc/tinystdio/rewind.c + newlib/libc/tinystdio/strfromd.c + newlib/libc/tinystdio/strfromf.c + newlib/libc/tinystdio/strfroml.c + newlib/libm/common/exp10l.c + newlib/libm/common/math_inexact.c + newlib/libm/common/math_inexactf.c + newlib/libm/common/math_inexactl.c + newlib/libm/common/s_getpayload.c + newlib/libm/common/sf_getpayload.c + newlib/libm/ld/ld128/s_getpayloadl.c + newlib/libm/ld/ld80/s_getpayloadl.c + newlib/libm/machine/powerpc/meson.build + newlib/libm/test/scalb_vec.c + newlib/libm/test/scalbn_vec.c + picocrt/machine/aarch64/meson.build + picocrt/machine/arc/meson.build + picocrt/machine/arc64/meson.build + picocrt/machine/arm/meson.build + picocrt/machine/lm32/meson.build + picocrt/machine/m68k/meson.build + picocrt/machine/mips/meson.build + picocrt/machine/msp430/meson.build + picocrt/machine/nios2/meson.build + picocrt/machine/or1k/meson.build + picocrt/machine/powerpc/meson.build + picocrt/machine/riscv/meson.build + picocrt/machine/sh/meson.build + picocrt/machine/sparc/meson.build + picocrt/machine/x86/CMakeLists.txt + picocrt/machine/x86/meson.build + scripts/do-power9-configure + scripts/do-power9-fp128-configure + scripts/do-powerpc64-configure + scripts/do-powerpc64le-configure + semihost/gettimeofday.c + semihost/machine/aarch64/meson.build + semihost/machine/arc/arc_stub.c + semihost/machine/arc/meson.build + semihost/machine/arc64/meson.build + semihost/machine/arm/meson.build + semihost/machine/m68k/m68k_stub.c + semihost/machine/m68k/meson.build + semihost/machine/msp430/meson.build + semihost/machine/msp430/msp430-exit.c + semihost/machine/msp430/msp430-stub.c + semihost/machine/nios2/meson.build + semihost/machine/nios2/nios2_stub.c + semihost/machine/or1k/meson.build + semihost/machine/or1k/or1k_exit.c + semihost/machine/or1k/or1k_stub.c + semihost/machine/powerpc/meson.build + semihost/machine/powerpc/powerpc_exit.c + semihost/machine/powerpc/powerpc_io.c + semihost/machine/powerpc/powerpc_kill.c + semihost/machine/powerpc/powerpc_stub.c + semihost/machine/riscv/meson.build + semihost/machine/rx/CMakeLists.txt + semihost/machine/rx/meson.build + semihost/machine/rx/rx_exit.c + semihost/machine/rx/rx_stub.c + semihost/machine/sh/meson.build + semihost/machine/sh/sh_exit.c + semihost/machine/sh/sh_stub.c + semihost/machine/sparc/meson.build + semihost/machine/sparc/sparc_exit.c + semihost/machine/sparc/sparc_stub.c + semihost/machine/x86/bios.S + semihost/machine/x86/e9_exit.c + semihost/machine/x86/e9_io.c + semihost/machine/x86/e9_kill.c + semihost/machine/x86/e9_stub.c + semihost/machine/x86/meson.build + semihost/machine/xtensa/meson.build + semihost/machine/xtensa/xtensa-exit.c + semihost/machine/xtensa/xtensa-stub.c + test/atexit.c + test/constructor-skip.c + test/constructor.c + test/hosted-exit.c + test/libc-testsuite/testcase.h + test/math-funcs.c + test/on_exit.c + test/rounding-mode-sub.c + test/rounding-mode.c + test/rounding-mode.h + test/test-memchr.c + test/test-memset.c + test/test-put.c + test/test-strchr.c + test/timegm.c + test/timegm.h +Copyright: 2021 Keith Packard +License: BSD3-1 + +Files: newlib/libc/ctype/ctype_extended.h + newlib/libc/ctype/ctype_table.c + newlib/libc/ctype/ctype_table.h + newlib/libc/ctype/mkctype.py + newlib/libc/include/stdnoreturn.h + newlib/libc/include/sys/_initfini.h + newlib/libc/include/uchar.h + newlib/libc/machine/m68k/machine/meson.build + newlib/libc/machine/rx/CMakeLists.txt + newlib/libc/machine/sh/CMakeLists.txt + newlib/libc/machine/sh/machine/CMakeLists.txt + newlib/libc/machine/sh/machine/meson.build + newlib/libc/picolib/machine/arc/vector_table.c + newlib/libc/picolib/machine/m68k/interrupt.c + newlib/libc/posix/fpathconf.c + newlib/libc/posix/pathconf.c + newlib/libc/stdio/flockfile.c + newlib/libc/stdio/funlockfile.c + newlib/libc/string/memset_explicit.c + newlib/libc/tinystdio/atomic_load.c + newlib/libc/tinystdio/flockfile.c + newlib/libc/tinystdio/ftrylockfile.c + newlib/libc/tinystdio/funlockfile.c + newlib/libc/tinystdio/funopen.c + newlib/libc/uchar/CMakeLists.txt + newlib/libc/uchar/c16rtomb.c + newlib/libc/uchar/c32rtomb.c + newlib/libc/uchar/c8rtomb.c + newlib/libc/uchar/mbrtoc16.c + newlib/libc/uchar/mbrtoc32.c + newlib/libc/uchar/mbrtoc8.c + newlib/libc/uchar/meson.build + newlib/libc/uchar/uchar-local.h + newlib/libm/fenv/fenv.c + picocrt/crt0-none.c + picocrt/machine/xtensa/crt0.S + picocrt/machine/xtensa/crt1.c + picocrt/machine/xtensa/meson.build + scripts/do-clang-x86-configure + scripts/do-clang-x86_64-configure + scripts/run-xtensa-dc233c + scripts/validate-cdefs + semihost/machine/lm32/lm32_close.c + semihost/machine/lm32/lm32_exit.c + semihost/machine/lm32/lm32_lseek.c + semihost/machine/lm32/lm32_open.c + semihost/machine/lm32/lm32_read.c + semihost/machine/lm32/lm32_scall.c + semihost/machine/lm32/lm32_semihost.h + semihost/machine/lm32/lm32_stub.c + semihost/machine/lm32/lm32_unlink.c + semihost/machine/lm32/lm32_write.c + semihost/machine/lm32/meson.build + semihost/machine/xtensa/simcall.S + semihost/machine/xtensa/simcall.c + semihost/machine/xtensa/simcall.h + semihost/machine/xtensa/xtensa-close.c + semihost/machine/xtensa/xtensa-lseek.c + semihost/machine/xtensa/xtensa-open.c + semihost/machine/xtensa/xtensa-read.c + semihost/machine/xtensa/xtensa-unlink.c + semihost/machine/xtensa/xtensa-write.c + test/test-cplusplus.cpp + test/test-ctype.c + test/test-encode.c + test/test-flockfile.c + test/test-funopen.c + test/test-uchar.c + test/test-wctype.c +Copyright: 2024 Keith Packard +License: BSD3-1 + +Files: newlib/libc/machine/aarch64/meson.build + newlib/libm/machine/aarch64/meson.build +Copyright: 2019 Keith Packard, + 2020 Anthony Anderson +License: BSD3-1 + +Files: newlib/libc/machine/arm/machine/math.h +Copyright: 2020 Keith Packard + 2017 embedded brains GmbH. + 2011, 2012 ARM Ltd. +License: BSD3-1 + +Files: newlib/libc/machine/lm32/meson.build + newlib/libc/machine/loongarch/asm.h + newlib/libc/machine/loongarch/machine/fenv.h + picocrt/machine/lm32/crt0.c + scripts/do-lm32-unknown-elf-configure +Copyright: 2024 Jiaxun Yang +License: BSD3-1 + +Files: newlib/libc/machine/loongarch/machine/math.h + semihost/machine/loongarch/semihost-loongarch.S +Copyright: 2024 Jiaxun Yang +License: BSD3-1 + +Files: newlib/libc/machine/loongarch/machine/meson.build +Copyright: 2020 Keith Packard + 2024 Jiaxun Yang +License: BSD3-1 + +Files: newlib/libc/machine/loongarch/meson.build +Copyright: 2019 Keith Packard + 2024 Jiaxun Yang +License: BSD3-1 + +Files: newlib/libc/machine/m68k/meson.build + scripts/do-m68k-configure + scripts/do-m68k-unknown-elf-configure +Copyright: 2020 Thomas Daede +License: BSD3-1 + +Files: newlib/libc/machine/microblaze/CMakeLists.txt + newlib/libc/machine/microblaze/meson.build + scripts/do-microblazeel-configure +Copyright: 2023 Advanced Micro Devices, Inc. (AMD) + 2023 Alp Sayin +License: BSD3-1 + +Files: newlib/libc/machine/or1k/CMakeLists.txt + newlib/libc/machine/or1k/meson.build +Copyright: 2025 NVIDIA Corporation +License: BSD3-1 + +Files: newlib/libc/machine/powerpc/meson.build +Copyright: 2019 Ash Logan, Keith Packard +License: BSD3-1 + +Files: newlib/libc/machine/rx/meson.build + newlib/libc/picolib/machine/rx/interrupt.c + newlib/libc/picolib/machine/rx/meson.build + picocrt/machine/rx/CMakeLists.txt + picocrt/machine/rx/meson.build + scripts/do-rx-zephyr-elf-configure + scripts/run-rx +Copyright: 2025 Renesas Electronics Corporation +License: BSD3-1 + +Files: newlib/libc/machine/sh/meson.build +Copyright: 2023 Adrian Siekierka +License: BSD3-1 + +Files: newlib/libc/machine/x86/machine/_ssp_tls.h + newlib/libc/machine/x86/machine/_tls.h + newlib/libc/picolib/machine/x86/tcb-32.S + newlib/libc/picolib/machine/x86/tcb-64.S + newlib/libc/picolib/machine/x86/tls.c +Copyright: 2025 TK Chia +License: BSD3-1 + +Files: newlib/libc/machine/xtensa/meson.build +Copyright: 2019 Jonathan McDowell +License: BSD3-1 + +Files: newlib/libc/picolib/machine/arm/read_tp.S +Copyright: 2020 Keith Packard + 2024 Stephen Street +License: BSD3-1 + +Files: newlib/libc/picolib/machine/arm/set_tls.c + newlib/libc/picolib/machine/arm/tls.c +Copyright: 2019 Keith Packard + 2024 Stephen Street +License: BSD3-1 + +Files: newlib/libc/stdlib/ignore_handler_s.c + newlib/libc/stdlib/local_s.h + newlib/libc/stdlib/set_constraint_handler_s.c + newlib/libc/string/memcpy_s.c + newlib/libc/string/memmove_s.c + newlib/libc/string/memset_s.c + newlib/libc/string/strcat_s.c + newlib/libc/string/strcpy_s.c + newlib/libc/string/strerror_s.c + newlib/libc/string/strerrorlen_s.c + newlib/libc/string/string_private.h + newlib/libc/string/strncat_s.c + newlib/libc/string/strncpy_s.c + newlib/libc/string/strnlen_s.c + newlib/libc/tinystdio/sprintf_s.c + newlib/libc/tinystdio/vfprintf_s.c + newlib/libc/tinystdio/vsnprintf_s.c + test/test-fgetc.c + test/test-fgets-eof.c + test/test-memcpy_s.c + test/test-memmove_s.c + test/test-memset_s.c + test/test-sprintf_s.c + test/test-strcat_s.c + test/test-strcpy_s.c + test/test-strerror_s.c + test/test-strerrorlen_s.c + test/test-strncat_s.c + test/test-strncpy_s.c + test/test-strnlen_s.c + test/test-vfprintf_s.c + test/test-vsnprintf_s.c +Copyright: 2024, Synopsys Inc. +License: BSD3-1 + +Files: newlib/libm/machine/riscv/s_copysign.c + newlib/libm/machine/riscv/s_fabs.c + newlib/libm/machine/riscv/s_finite.c + newlib/libm/machine/riscv/s_fmax.c + newlib/libm/machine/riscv/s_fmin.c + newlib/libm/machine/riscv/s_fpclassify.c + newlib/libm/machine/riscv/s_isinf.c + newlib/libm/machine/riscv/s_isnan.c + newlib/libm/machine/riscv/s_llrint.c + newlib/libm/machine/riscv/s_llround.c + newlib/libm/machine/riscv/s_lrint.c + newlib/libm/machine/riscv/s_lround.c + newlib/libm/machine/riscv/sf_copysign.c + newlib/libm/machine/riscv/sf_fabs.c + newlib/libm/machine/riscv/sf_finite.c + newlib/libm/machine/riscv/sf_fmax.c + newlib/libm/machine/riscv/sf_fmin.c + newlib/libm/machine/riscv/sf_fpclassify.c + newlib/libm/machine/riscv/sf_isinf.c + newlib/libm/machine/riscv/sf_isnan.c + newlib/libm/machine/riscv/sf_llrint.c + newlib/libm/machine/riscv/sf_llround.c + newlib/libm/machine/riscv/sf_lrint.c + newlib/libm/machine/riscv/sf_lround.c +Copyright: 2020 Kito Cheng +License: BSD3-1 + +Files: picocrt/machine/loongarch/crt0.c +Copyright: 2024 Jiaxun Yang < +License: BSD3-1 + +Files: picocrt/machine/loongarch/meson.build + semihost/machine/loongarch/meson.build +Copyright: 2024 Jiaxun Yang + 2021 Keith Packard +License: BSD3-1 + +Files: picocrt/machine/powerpc/cstart.c + picocrt/machine/riscv/crt0.c +Copyright: 2020 Sebastian Meyer +License: BSD3-1 + +Files: picocrt/machine/x86/crt0-32.S + picocrt/machine/x86/crt0-64.S +Copyright: 2021 Mike Haertel and Keith Packard +License: BSD3-1 + +Files: scripts/do-coreboot-arm-eabi-configure + scripts/do-coreboot-i386-elf-configure + scripts/do-coreboot-riscv-elf-configure + scripts/do-coreboot-x86_64-elf-configure +Copyright: 2024 The ChromiumOS Authors +License: BSD3-1 + +Files: scripts/do-freedom-tools-package +Copyright: 2020 SiFive Inc. +License: BSD3-1 + +Files: scripts/do-loongarch64-configure +Copyright: 2024 Jiaxun Yang + 2019 Keith Packard +License: BSD3-1 + +Files: scripts/run-aarch64-fvp +Copyright: 2024 Arm Limited and/or its affiliates +License: BSD3-1 + +Files: scripts/run-loongarch64 +Copyright: 2024 Jiaxun Yang + 2020 Keith Packard +License: BSD3-1 + +Files: semihost/machine/mips/meson.build +Copyright: 2021 Keith Packard + 2025 Jiaxun Yang +License: BSD3-1 + +Files: semihost/machine/mips/mips_close.c + semihost/machine/mips/mips_exit.c + semihost/machine/mips/mips_fstat.c + semihost/machine/mips/mips_lseek.c + semihost/machine/mips/mips_open.c + semihost/machine/mips/mips_read.c + semihost/machine/mips/mips_semihost.h + semihost/machine/mips/mips_stub.c + semihost/machine/mips/mips_unlink.c + semihost/machine/mips/mips_write.c +Copyright: 2025 Jiaxun Yang +License: BSD3-1 + +Files: test/test-sprintf-percent-n.c + test/test-vfscanf-percent-a.c + test/test-wchar.c +Copyright: 2024, Synopsys Inc. + 2024, Solid Sands B.V. +License: BSD3-1 + +Files: test/test-strncpy.c +Copyright: 2025 Fredrik Gihl +License: BSD3-1 + +Files: test/test-tmpnam.c +Copyright: 2024 Mostafa Salmaan +License: BSD3-1 + +Files: test/test-ungetc-ftell.c +Copyright: 2024 Hana Ashour +License: BSD3-1 + +Files: test/time-tests.c +Copyright: 2021 R. Diez +License: BSD3-1 + +Files: newlib/libc/ctype/ctype_.c + newlib/libc/ctype/ctype_wide.c + newlib/libc/ctype/isalnum.c + newlib/libc/ctype/isalpha.c + newlib/libc/ctype/isascii.c + newlib/libc/ctype/iscntrl.c + newlib/libc/ctype/isdigit.c + newlib/libc/ctype/isgraph.c + newlib/libc/ctype/islower.c + newlib/libc/ctype/isprint.c + newlib/libc/ctype/ispunct.c + newlib/libc/ctype/isspace.c + newlib/libc/ctype/isupper.c + newlib/libc/ctype/isxdigit.c + newlib/libc/ctype/toascii.c + newlib/libc/ctype/tolower.c + newlib/libc/ctype/toupper.c + newlib/libc/include/pwd.h +Copyright: 1989 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/include/dirent.h + newlib/libc/string/wcsncmp.c +Copyright: 1989, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/include/ndbm.h + newlib/libc/include/search.h + newlib/libc/search/hash_func.c + newlib/libc/search/ndbm.c + newlib/libc/stdlib/getsubopt.c + newlib/libc/string/wcscmp.c +Copyright: 1990, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/include/sys/_select.h + newlib/libc/include/sys/_timespec.h + newlib/libc/include/sys/_types.h + newlib/libc/include/sys/_wait.h + newlib/libc/include/sys/config.h + newlib/libc/include/sys/dirent.h + newlib/libc/include/sys/errno.h + newlib/libc/include/sys/fcntl.h + newlib/libc/include/sys/file.h + newlib/libc/include/sys/param.h + newlib/libc/include/sys/resource.h + newlib/libc/include/sys/select.h + newlib/libc/include/sys/stat.h + newlib/libc/include/sys/time.h + newlib/libc/include/sys/timeb.h + newlib/libc/include/sys/times.h + newlib/libc/include/sys/types.h + newlib/libc/include/sys/unistd.h + newlib/libc/include/sys/utime.h + newlib/libc/include/sys/wait.h +Copyright: 1982, 1986, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/include/sys/cdefs.h + newlib/libc/include/sys/queue.h +Copyright: 1991, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/include/sys/syslimits.h + newlib/libc/stdlib/atoll.c +Copyright: 1988, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/include/unctrl.h + newlib/libc/misc/ffs.c + newlib/libc/misc/misc.tex + newlib/libc/misc/unctrl.c +Copyright: 1981, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/posix/cclass.h + newlib/libc/posix/cname.h + newlib/libc/posix/regex2.h + newlib/libc/posix/utils.h +Copyright: 1992, 1993, 1994 Henry Spencer. + 1992, 1993, 1994 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/search/bsearch.c + newlib/libc/search/extern.h + newlib/libc/search/hcreate.3 + newlib/libc/search/tdelete.c + newlib/libc/search/tdestroy.c + newlib/libc/search/tfind.c + newlib/libc/search/tsearch.c + newlib/libc/search/twalk.c +Copyright: 1991, 1993, 1994 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/search/db_local.h + newlib/libc/search/hash.c + newlib/libc/search/hash.h + newlib/libc/search/hash_bigkey.c + newlib/libc/search/hash_buf.c + newlib/libc/search/hash_log2.c + newlib/libc/search/hash_page.c + newlib/libc/search/page.h +Copyright: 1990, 1993, 1994 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/search/qsort.c +Copyright: 1992, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/stdio/nano-vfprintf.c + newlib/libc/stdio/nano-vfprintf_float.c + newlib/libc/stdio/nano-vfprintf_local.h + newlib/libc/stdio/vfprintf.c + newlib/libc/stdlib/strtol.c + newlib/libc/stdlib/strtoll.c + newlib/libc/stdlib/wcstol.c + newlib/libc/stdlib/wcstoll.c +Copyright: 1990 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/stdlib/div.c + newlib/libc/stdlib/ldiv.c + newlib/libc/stdlib/strtoul.c + newlib/libc/stdlib/strtoull.c + newlib/libc/stdlib/wcstoul.c + newlib/libc/stdlib/wcstoull.c +Copyright: 1990 Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/stdlib/getsubopt.3 +Copyright: 1990, 1991, 1993 The Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/string/strtok_r.c + newlib/libc/string/strtok_r.h + newlib/libc/string/wcstok.c +Copyright: 1988 Regents of the University of California. +License: BSD3-2 + +Files: newlib/libc/ctype/iswalnum.c + newlib/libc/ctype/iswalpha.c + newlib/libc/ctype/iswblank.c + newlib/libc/ctype/iswcntrl.c + newlib/libc/ctype/iswctype.c + newlib/libc/ctype/iswdigit.c + newlib/libc/ctype/iswgraph.c + newlib/libc/ctype/iswlower.c + newlib/libc/ctype/iswprint.c + newlib/libc/ctype/iswpunct.c + newlib/libc/ctype/iswspace.c + newlib/libc/ctype/iswupper.c + newlib/libc/ctype/iswxdigit.c + newlib/libc/ctype/jp2uc.c + newlib/libc/ctype/jp2uc.h + newlib/libc/ctype/local.h + newlib/libc/ctype/towctrans.c + newlib/libc/ctype/towlower.c + newlib/libc/ctype/towupper.c + newlib/libc/ctype/wctrans.c + newlib/libc/ctype/wctype.c +Copyright: 2002 Red Hat Incorporated. +License: BSD3-3 + +Files: newlib/libc/machine/hppa/setjmp.S +Copyright: 1995, 2002 Red Hat Incorporated. +License: BSD3-3 + +Files: newlib/libc/machine/m32c/setjmp.S +Copyright: 2005 Red Hat Incorporated. +License: BSD3-3 + +Files: newlib/libc/machine/rl78/setjmp.S +Copyright: 2011 Red Hat Incorporated. +License: BSD3-3 + +Files: newlib/libc/stdlib/environ.c +Copyright: 1995, 1996, 2002 Red Hat Incorporated. +License: BSD3-3 + +Files: newlib/libc/include/ar.h + newlib/libc/include/assert.h + newlib/libc/include/ctype.h + newlib/libc/include/errno.h + newlib/libc/include/fastmath.h + newlib/libc/include/fcntl.h + newlib/libc/include/ieeefp.h + newlib/libc/include/locale.h + newlib/libc/include/malloc.h + newlib/libc/include/math.h + newlib/libc/include/paths.h + newlib/libc/include/regdef.h + newlib/libc/include/setjmp.h + newlib/libc/include/signal.h + newlib/libc/include/stdlib.h + newlib/libc/include/string.h + newlib/libc/include/termios.h + newlib/libc/include/time.h + newlib/libc/include/unistd.h + newlib/libc/include/utime.h + newlib/libc/include/utmp.h +Copyright: 1991, 1993 The Regents of the University of California. +License: BSD3-4 + +Files: newlib/libc/include/grp.h +Copyright: 1989, 1993 The Regents of the University of California. +License: BSD3-4 + +Files: newlib/libc/include/envlock.h + newlib/libc/include/fnmatch.h +Copyright: 1992, 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/include/glob.h +Copyright: 1989, 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/include/regex.h +Copyright: 1992 Henry Spencer. + 1992, 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/include/sys/timespec.h +Copyright: 1982, 1986, 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/posix/engine.c + newlib/libc/posix/regcomp.c + newlib/libc/posix/regerror.c + newlib/libc/posix/regexec.c + newlib/libc/posix/regfree.c +Copyright: 1992, 1993, 1994 Henry Spencer. + 1992, 1993, 1994 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/posix/fnmatch.c +Copyright: 1989, 1993, 1994 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/posix/rune.h + newlib/libc/posix/runetype.h +Copyright: 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/posix/sysexits.h +Copyright: 1987, 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/stdio/vfwprintf.c +Copyright: 1990 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/string/strcasestr.c +Copyright: 1990, 1993 The Regents of the University of California. +License: BSD3-5 + +Files: newlib/libc/include/rpc/types.h + newlib/libc/include/rpc/xdr.h + newlib/libc/xdr/xdr.c + newlib/libc/xdr/xdr_array.c + newlib/libc/xdr/xdr_float.c + newlib/libc/xdr/xdr_float_vax.c + newlib/libc/xdr/xdr_mem.c + newlib/libc/xdr/xdr_rec.c + newlib/libc/xdr/xdr_reference.c + newlib/libc/xdr/xdr_sizeof.c + newlib/libc/xdr/xdr_stdio.c +Copyright: 2009, Sun Microsystems, Inc. +License: BSD3-6 + +Files: newlib/libc/include/sys/_sigset.h +Copyright: 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. +License: BSD3-7 + +Files: newlib/libc/machine/aarch64/machine/_types.h +Copyright: 2012 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/aarch64/setjmp.S + newlib/libm/machine/aarch64/s_ceil.c + newlib/libm/machine/aarch64/s_floor.c + newlib/libm/machine/aarch64/s_fma.c + newlib/libm/machine/aarch64/s_fmax.c + newlib/libm/machine/aarch64/s_fmin.c + newlib/libm/machine/aarch64/s_llrint.c + newlib/libm/machine/aarch64/s_llround.c + newlib/libm/machine/aarch64/s_lrint.c + newlib/libm/machine/aarch64/s_lround.c + newlib/libm/machine/aarch64/s_nearbyint.c + newlib/libm/machine/aarch64/s_rint.c + newlib/libm/machine/aarch64/s_round.c + newlib/libm/machine/aarch64/s_trunc.c + newlib/libm/machine/aarch64/sf_ceil.c + newlib/libm/machine/aarch64/sf_floor.c + newlib/libm/machine/aarch64/sf_fma.c + newlib/libm/machine/aarch64/sf_fmax.c + newlib/libm/machine/aarch64/sf_fmin.c + newlib/libm/machine/aarch64/sf_llrint.c + newlib/libm/machine/aarch64/sf_llround.c + newlib/libm/machine/aarch64/sf_lrint.c + newlib/libm/machine/aarch64/sf_lround.c + newlib/libm/machine/aarch64/sf_nearbyint.c + newlib/libm/machine/aarch64/sf_rint.c + newlib/libm/machine/aarch64/sf_round.c + newlib/libm/machine/aarch64/sf_trunc.c + newlib/libm/machine/arm/s_ceil.c + newlib/libm/machine/arm/s_floor.c + newlib/libm/machine/arm/s_nearbyint.c + newlib/libm/machine/arm/s_rint.c + newlib/libm/machine/arm/s_round.c + newlib/libm/machine/arm/s_trunc.c + newlib/libm/machine/arm/sf_ceil.c + newlib/libm/machine/arm/sf_floor.c + newlib/libm/machine/arm/sf_nearbyint.c + newlib/libm/machine/arm/sf_rint.c + newlib/libm/machine/arm/sf_round.c + newlib/libm/machine/arm/sf_trunc.c +Copyright: 2011, 2012 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/aeabi_memset.c + newlib/libc/machine/arm/bzero.c + newlib/libc/machine/arm/machine/_endian.h + newlib/libc/machine/arm/memset-arm.S + newlib/libc/machine/arm/memset-thumb.S + newlib/libc/machine/arm/memset-thumb2.S + newlib/libc/machine/arm/memset.S + newlib/libc/machine/arm/memset.c + newlib/libm/machine/aarch64/s_fabs.c + newlib/libm/machine/aarch64/s_sqrt.c + newlib/libm/machine/aarch64/sf_fabs.c + newlib/libm/machine/aarch64/sf_sqrt.c +Copyright: 2015 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/arm_asm.h +Copyright: 2009 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/machine/acle-compat.h + newlib/libc/machine/arm/strcmp-armv6m.S +Copyright: 2014 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/memcpy-armv7m.S +Copyright: 2013 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/memcpy.S +Copyright: 2013-2015 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/strcmp-arm-tiny.S + newlib/libc/machine/arm/strcmp-armv4.S + newlib/libc/machine/arm/strcmp-armv4t.S + newlib/libc/machine/arm/strcmp-armv6.S + newlib/libc/machine/arm/strcmp-armv7.S + newlib/libc/machine/arm/strcmp-armv7m.S + newlib/libc/machine/arm/strcmp.S + newlib/libc/stdio/nano-vfprintf_i.c + newlib/libc/stdio/nano-vfscanf_i.c +Copyright: 2012-2014 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/strcpy.S +Copyright: 2008 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/arm/strlen.c +Copyright: 2008-2015 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/stdlib/nano-calloc.c + newlib/libc/stdlib/nano-free.c + newlib/libc/stdlib/nano-getpagesize.c + newlib/libc/stdlib/nano-mallinfo.c + newlib/libc/stdlib/nano-malloc-stats.c + newlib/libc/stdlib/nano-malloc-usable-size.c + newlib/libc/stdlib/nano-malloc.c + newlib/libc/stdlib/nano-malloc.h + newlib/libc/stdlib/nano-mallopt.c + newlib/libc/stdlib/nano-memalign.c + newlib/libc/stdlib/nano-posix-memalign.c + newlib/libc/stdlib/nano-pvalloc.c + newlib/libc/stdlib/nano-realloc.c + newlib/libc/stdlib/nano-valloc.c +Copyright: 2012, 2013 ARM Ltd +License: BSD3-8 + +Files: newlib/testsuite/newlib.string/memcpy-1.c + newlib/testsuite/newlib.string/strcmp-1.c +Copyright: 2011 ARM Ltd +License: BSD3-8 + +Files: newlib/libc/machine/aarch64/memchr-stub.c + newlib/libc/machine/aarch64/memcmp-stub.c + newlib/libc/machine/aarch64/memmove-stub.c + newlib/libc/machine/aarch64/strlen-stub.c + newlib/libc/machine/aarch64/strncmp-stub.c + newlib/libc/machine/aarch64/strnlen-stub.c + newlib/libc/machine/aarch64/strnlen.S +Copyright: 2013, Linaro Limited +License: BSD3-9 + +Files: newlib/libc/machine/aarch64/memcpy-stub.c + newlib/libc/machine/aarch64/memset-stub.c + newlib/libc/machine/aarch64/strcmp-stub.c +Copyright: 2012-2013, Linaro Limited +License: BSD3-9 + +Files: newlib/libc/machine/aarch64/strlen.S +Copyright: 2013-2015, Linaro Limited +License: BSD3-9 + +Files: newlib/libc/machine/aarch64/strncmp.S +Copyright: 2013, 2018, Linaro Limited +License: BSD3-9 + +Files: newlib/libc/machine/arm/memchr.c + newlib/libc/machine/arm/memcpy.c + newlib/libc/machine/arm/strlen-thumb1-Os.S + newlib/libc/machine/arm/strlen-thumb2-Os.S + newlib/libc/machine/arm/strlen.S +Copyright: 2015 ARM Ltd. +License: BSD3-9 + +Files: newlib/libc/machine/aarch64/rawmemchr-stub.c + newlib/libc/machine/aarch64/rawmemchr.S +Copyright: 2015-2016, ARM Limited +License: BSD3-10 + +Files: newlib/libc/machine/aarch64/stpcpy-stub.c +Copyright: 2015, ARM Limited +License: BSD3-10 + +Files: newlib/libc/machine/aarch64/strchr-stub.c + newlib/libc/machine/aarch64/strchrnul-stub.c + newlib/libc/machine/aarch64/strcpy-stub.c + newlib/libc/machine/aarch64/strrchr-stub.c + newlib/libc/machine/aarch64/strrchr.S +Copyright: 2014, ARM Limited +License: BSD3-10 + +Files: newlib/libc/machine/aarch64/strchr.S + newlib/libc/machine/aarch64/strchrnul.S +Copyright: 2014-2022, ARM Limited +License: BSD3-10 + +Files: newlib/libc/machine/aarch64/strcpy.S +Copyright: 2013, 2014, 2015, 2020-2023 ARM Ltd. +License: BSD3-10 + +Files: newlib/libc/machine/arc/asm.h + newlib/libc/machine/arc/strchr.S +Copyright: 2015, Synopsys, Inc. +License: BSD3-11 + +Files: newlib/libc/machine/arc/memcmp-bs-norm.S + newlib/libc/machine/arc/memcmp-stub.c + newlib/libc/machine/arc/memcmp.S + newlib/libc/machine/arc/memcpy-archs.S + newlib/libc/machine/arc/memcpy-bs.S + newlib/libc/machine/arc/memcpy-stub.c + newlib/libc/machine/arc/memcpy.S + newlib/libc/machine/arc/memset-archs.S + newlib/libc/machine/arc/memset-bs.S + newlib/libc/machine/arc/memset-stub.c + newlib/libc/machine/arc/memset.S + newlib/libc/machine/arc/setjmp.S + newlib/libc/machine/arc/strchr-bs-norm.S + newlib/libc/machine/arc/strchr-bs.S + newlib/libc/machine/arc/strchr-stub.c + newlib/libc/machine/arc/strcmp-archs.S + newlib/libc/machine/arc/strcmp-stub.c + newlib/libc/machine/arc/strcmp.S + newlib/libc/machine/arc/strcpy-bs-arc600.S + newlib/libc/machine/arc/strcpy-bs.S + newlib/libc/machine/arc/strcpy-stub.c + newlib/libc/machine/arc/strcpy.S + newlib/libc/machine/arc/strncpy-bs.S + newlib/libc/machine/arc/strncpy-stub.c + newlib/libc/machine/arc/strncpy.S +Copyright: 2015-2024, Synopsys, Inc. +License: BSD3-11 + +Files: newlib/libc/machine/arc64/memchr.S + newlib/libc/machine/arc64/memcmp-stub.c + newlib/libc/machine/arc64/memcmp.S + newlib/libc/machine/arc64/memcpy-stub.c + newlib/libc/machine/arc64/memcpy.S + newlib/libc/machine/arc64/memmove.S + newlib/libc/machine/arc64/memset-stub.c + newlib/libc/machine/arc64/memset.S + newlib/libc/machine/arc64/setjmp.S + newlib/libc/machine/arc64/strcat.S + newlib/libc/machine/arc64/strcmp.S + newlib/libc/machine/arc64/strlen.S + newlib/libc/machine/arc64/sys/asm.h +Copyright: 2024, Synopsys, Inc. +License: BSD3-11 + +Files: newlib/libc/machine/arm/memchr.S +Copyright: 2010-2011, Linaro Limited +License: BSD3-12 + +Files: newlib/libc/machine/arm/memcpy-armv7a.S +Copyright: 2013, Linaro Limited +License: BSD3-12 + +Files: newlib/libc/machine/arm/strlen-armv7.S +Copyright: 2010-2011,2013 Linaro Limited +License: BSD3-12 + +Files: newlib/libc/machine/avr/macros.inc +Copyright: 2002, 2005, 2006, 2007 Marek Michalkiewicz + 2006 Dmitry Xmelkov +License: BSD3-13 + +Files: newlib/libc/machine/avr/sectionname.h +Copyright: 2009 Atmel Corporation +License: BSD3-13 + +Files: newlib/libc/machine/avr/setjmp.S +Copyright: 2002, Marek Michalkiewicz +License: BSD3-13 + +Files: newlib/libc/tinystdio/atod_engine.c + newlib/libc/tinystdio/atof_engine.c + newlib/libc/tinystdio/conv_flt.c + newlib/libc/tinystdio/scanf_private.h + newlib/libc/tinystdio/strtoi.h + newlib/libc/tinystdio/strtoimax.c + newlib/libc/tinystdio/strtol.c + newlib/libc/tinystdio/strtoll.c + newlib/libc/tinystdio/strtoul.c + newlib/libc/tinystdio/strtoull.c + newlib/libc/tinystdio/strtoumax.c + newlib/libc/tinystdio/vfscanf.c +Copyright: 2002,2004,2005 Joerg Wunsch + 2008 Dmitry Xmelkov +License: BSD3-13 + +Files: newlib/libc/tinystdio/clearerr.c + newlib/libc/tinystdio/fclose.c + newlib/libc/tinystdio/feof.c + newlib/libc/tinystdio/ferror.c + newlib/libc/tinystdio/fgetc.c + newlib/libc/tinystdio/stdio_private.h +Copyright: 2002,2005 Joerg Wunsch +License: BSD3-13 + +Files: newlib/libc/tinystdio/dtoa.h + newlib/libc/tinystdio/dtoa_engine.c + newlib/libc/tinystdio/sprintfd.c + newlib/libc/tinystdio/sprintff.c + newlib/libc/tinystdio/vffprintf.c + newlib/libc/tinystdio/vffscanf.c + newlib/libc/tinystdio/vfiprintf.c + newlib/libc/tinystdio/vfiscanf.c + newlib/libc/tinystdio/vflprintf.c + newlib/libc/tinystdio/vflscanf.c + newlib/libc/tinystdio/vfmprintf.c + newlib/libc/tinystdio/vfmscanf.c + newlib/libc/tinystdio/vfwprintf.c + newlib/libc/tinystdio/vfwscanf.c +Copyright: 2018, Keith Packard +License: BSD3-13 + +Files: newlib/libc/tinystdio/fdevopen.c +Copyright: 2002,2005, 2007 Joerg Wunsch +License: BSD3-13 + +Files: newlib/libc/tinystdio/fgets.c + newlib/libc/tinystdio/fgetwc.c + newlib/libc/tinystdio/fgetws.c + newlib/libc/tinystdio/fprintf.c + newlib/libc/tinystdio/fputc.c + newlib/libc/tinystdio/fputs.c + newlib/libc/tinystdio/fputwc.c + newlib/libc/tinystdio/fputws.c + newlib/libc/tinystdio/fread.c + newlib/libc/tinystdio/fscanf.c + newlib/libc/tinystdio/fwprintf.c + newlib/libc/tinystdio/fwrite.c + newlib/libc/tinystdio/fwscanf.c + newlib/libc/tinystdio/getchar.c + newlib/libc/tinystdio/gets.c + newlib/libc/tinystdio/getwchar.c + newlib/libc/tinystdio/printf.c + newlib/libc/tinystdio/putchar.c + newlib/libc/tinystdio/puts.c + newlib/libc/tinystdio/putwchar.c + newlib/libc/tinystdio/scanf.c + newlib/libc/tinystdio/snprintf.c + newlib/libc/tinystdio/sprintf.c + newlib/libc/tinystdio/sscanf.c + newlib/libc/tinystdio/swscanf.c + newlib/libc/tinystdio/ungetc.c + newlib/libc/tinystdio/ungetwc.c + newlib/libc/tinystdio/wprintf.c + newlib/libc/tinystdio/wscanf.c +Copyright: 2002, Joerg Wunsch +License: BSD3-13 + +Files: newlib/libc/tinystdio/snprintfd.c + newlib/libc/tinystdio/snprintff.c +Copyright: 2021 Keith Packard +License: BSD3-13 + +Files: newlib/libc/tinystdio/stdio.h +Copyright: 2002, 2005, 2007 Joerg Wunsch + 1990, 1991, 1993 The Regents of the University of California. +License: BSD3-13 + +Files: newlib/libc/tinystdio/strtod.c + newlib/libc/tinystdio/strtof.c + newlib/libc/tinystdio/strtold.c +Copyright: 2002-2005 Michael Stumpf + 2006,2008 Dmitry Xmelkov +License: BSD3-13 + +Files: newlib/libc/tinystdio/ultoa_invert.c +Copyright: 2017 Keith Packard +License: BSD3-13 + +Files: newlib/libc/tinystdio/vfprintf.c +Copyright: 2002, Alexander Popov (sasho@vip.bg) + 2002,2004,2005 Joerg Wunsch + 2005, Helmut Wallner + 2007, Dmitry Xmelkov +License: BSD3-13 + +Files: newlib/libc/tinystdio/vprintf.c + newlib/libc/tinystdio/vscanf.c + newlib/libc/tinystdio/vsscanf.c + newlib/libc/tinystdio/vswscanf.c + newlib/libc/tinystdio/vwprintf.c + newlib/libc/tinystdio/vwscanf.c +Copyright: 2005, Joerg Wunsch +License: BSD3-13 + +Files: newlib/libc/tinystdio/vsnprintf.c + newlib/libc/tinystdio/vsprintf.c +Copyright: 2003, Joerg Wunsch +License: BSD3-13 + +Files: newlib/libc/machine/epiphany/setjmp.S +Copyright: 2011, Adapteva, Inc. +License: BSD3-14 + +Files: newlib/libc/machine/loongarch/machine/fenv-fp.h +Copyright: 2017 Michael R. Neilly + 2024 Jiaxun Yang +License: BSD3-15 + +Files: newlib/libc/machine/riscv/machine/fenv-fp.h +Copyright: 2017 Michael R. Neilly +License: BSD3-15 + +Files: newlib/libc/machine/microblaze/abort.c + newlib/libc/machine/microblaze/longjmp.S + newlib/libc/machine/microblaze/setjmp.S +Copyright: 2001, 2009 Xilinx, Inc. +License: BSD3-16 + +Files: newlib/libc/machine/microblaze/strcmp.c + newlib/libc/machine/microblaze/strcpy.c + newlib/libc/machine/microblaze/strlen.c +Copyright: 2009 Xilinx, Inc. +License: BSD3-16 + +Files: newlib/libc/machine/mips/machine/asm.h + newlib/libc/machine/mips/machine/regdef.h +Copyright: 1996-2007 MIPS Technologies, Inc. + 2009 CodeSourcery, LLC. +License: BSD3-17 + +Files: newlib/libc/machine/mips/memcpy.S +Copyright: 2012-2015 MIPS Technologies, Inc., California. +License: BSD3-18 + +Files: newlib/libc/machine/mips/memset.S +Copyright: 2013 MIPS Technologies, Inc., California. +License: BSD3-18 + +Files: newlib/libc/machine/mips/strcmp.S +Copyright: 2014 Imagination Technologies Limited. +License: BSD3-19 + +Files: newlib/libc/machine/nds32/abort.c + newlib/libc/machine/nds32/memcpy.S + newlib/libc/machine/nds32/memset.S + newlib/libc/machine/nds32/setjmp.S + newlib/libc/machine/nds32/strcmp.S + newlib/libc/machine/nds32/strcpy.S +Copyright: 2013 Andes Technology Corporation. +License: BSD3-20 + +Files: newlib/libm/machine/nds32/w_sqrt.S + newlib/libm/machine/nds32/wf_sqrt.S +Copyright: 2013-2014 Andes Technology Corporation. +License: BSD3-20 + +Files: newlib/libc/machine/nios2/setjmp.s +Copyright: 2003 Altera Corporation +License: BSD3-21 + +Files: newlib/libc/machine/sparc/setjmp.S +Copyright: 1992, 1993 The Regents of the University of California. +License: BSD3-22 + +Files: newlib/libc/machine/spu/c99ppe.h + newlib/libc/machine/spu/clearerr.c + newlib/libc/machine/spu/fclose.c + newlib/libc/machine/spu/feof.c + newlib/libc/machine/spu/ferror.c + newlib/libc/machine/spu/fflush.c + newlib/libc/machine/spu/fgetc.c + newlib/libc/machine/spu/fgetpos.c + newlib/libc/machine/spu/fgets.c + newlib/libc/machine/spu/fileno.c + newlib/libc/machine/spu/fopen.c + newlib/libc/machine/spu/fputc.c + newlib/libc/machine/spu/fputs.c + newlib/libc/machine/spu/fread.c + newlib/libc/machine/spu/freopen.c + newlib/libc/machine/spu/fseek.c + newlib/libc/machine/spu/fsetpos.c + newlib/libc/machine/spu/ftell.c + newlib/libc/machine/spu/fwrite.c + newlib/libc/machine/spu/getc.c + newlib/libc/machine/spu/getchar.c + newlib/libc/machine/spu/gets.c + newlib/libc/machine/spu/perror.c + newlib/libc/machine/spu/putc.c + newlib/libc/machine/spu/putchar.c + newlib/libc/machine/spu/puts.c + newlib/libc/machine/spu/remove.c + newlib/libc/machine/spu/rename.c + newlib/libc/machine/spu/rewind.c + newlib/libc/machine/spu/setbuf.c + newlib/libc/machine/spu/setvbuf.c + newlib/libc/machine/spu/sys/custom_file.h + newlib/libc/machine/spu/tmpfile.c + newlib/libc/machine/spu/tmpnam.c + newlib/libc/machine/spu/ungetc.c + newlib/libc/machine/spu/vfprintf.c + newlib/libc/machine/spu/vfscanf.c + newlib/libc/machine/spu/vprintf.c + newlib/libc/machine/spu/vscanf.c + newlib/libc/machine/spu/vsnprintf.c + newlib/libc/machine/spu/vsprintf.c + newlib/libc/machine/spu/vsscanf.c +Copyright: IBM Corp. 2006 +License: BSD3-23 + +Files: newlib/libc/machine/spu/calloc_ea.c + newlib/libc/machine/spu/ea_internal.h + newlib/libc/machine/spu/free_ea.c + newlib/libc/machine/spu/include/ea.h + newlib/libc/machine/spu/malloc_ea.c + newlib/libc/machine/spu/memchr_ea.c + newlib/libc/machine/spu/memcmp_ea.c + newlib/libc/machine/spu/memcpy_ea.c + newlib/libc/machine/spu/memmove_ea.c + newlib/libc/machine/spu/memset_ea.c + newlib/libc/machine/spu/mmap_ea.c + newlib/libc/machine/spu/mremap_ea.c + newlib/libc/machine/spu/msync_ea.c + newlib/libc/machine/spu/munmap_ea.c + newlib/libc/machine/spu/posix_memalign_ea.c + newlib/libc/machine/spu/realloc_ea.c + newlib/libc/machine/spu/strcat_ea.c + newlib/libc/machine/spu/strchr_ea.c + newlib/libc/machine/spu/strcmp_ea.c + newlib/libc/machine/spu/strcpy_ea.c + newlib/libc/machine/spu/strcspn_ea.c + newlib/libc/machine/spu/strlen_ea.c + newlib/libc/machine/spu/strncat_ea.c + newlib/libc/machine/spu/strncmp_ea.c + newlib/libc/machine/spu/strncpy_ea.c + newlib/libc/machine/spu/strpbrk_ea.c + newlib/libc/machine/spu/strrchr_ea.c + newlib/libc/machine/spu/strspn_ea.c + newlib/libc/machine/spu/strstr_ea.c +Copyright: IBM Corp. 2007, 2008 +License: BSD3-23 + +Files: newlib/libc/machine/spu/fdopen.c + newlib/libc/stdlib/strtold.c + newlib/libc/stdlib/wcstold.c + newlib/libm/common/copysignl.c + newlib/libm/common/fabsl.c + newlib/libm/common/frexpl.c + newlib/libm/common/nanl.c + newlib/libm/common/scalbnl.c + newlib/libm/ld/s_isinfl.c + newlib/libm/ld/s_signbitl.c +Copyright: IBM Corp. 2009 +License: BSD3-23 + +Files: newlib/libc/machine/spu/include/spu_timer.h + newlib/libc/machine/spu/pread_ea.c + newlib/libc/machine/spu/pwrite_ea.c + newlib/libc/machine/spu/read_ea.c + newlib/libc/machine/spu/readv_ea.c + newlib/libc/machine/spu/spu-gmon.c + newlib/libc/machine/spu/spu-mcount.S + newlib/libc/machine/spu/spu_clock_stop.c + newlib/libc/machine/spu/spu_clock_svcs.c + newlib/libc/machine/spu/spu_timebase.c + newlib/libc/machine/spu/spu_timer_flih.S + newlib/libc/machine/spu/spu_timer_free.c + newlib/libc/machine/spu/spu_timer_internal.h + newlib/libc/machine/spu/spu_timer_slih.c + newlib/libc/machine/spu/spu_timer_slih_reg.c + newlib/libc/machine/spu/spu_timer_stop.c + newlib/libc/machine/spu/spu_timer_svcs.c + newlib/libc/machine/spu/sys/linux_syscalls.h + newlib/libc/machine/spu/write_ea.c + newlib/libc/machine/spu/writev_ea.c +Copyright: IBM Corp. 2008 +License: BSD3-23 + +Files: newlib/libc/machine/spu/setjmp.S +Copyright: IBM Corp. 2005, 2006 +License: BSD3-23 + +Files: newlib/libc/machine/spu/sys/mman.h +Copyright: IBM Corp. 2007 +License: BSD3-23 + +Files: newlib/libc/machine/spu/fiprintf.S + newlib/libc/machine/spu/fiscanf.S + newlib/libc/machine/spu/fprintf.S + newlib/libc/machine/spu/fscanf.S + newlib/libc/machine/spu/iprintf.S + newlib/libc/machine/spu/iscanf.S + newlib/libc/machine/spu/printf.S + newlib/libc/machine/spu/scanf.S + newlib/libc/machine/spu/siprintf.S + newlib/libc/machine/spu/siscanf.S + newlib/libc/machine/spu/sniprintf.S + newlib/libc/machine/spu/snprintf.S + newlib/libc/machine/spu/sprintf.S + newlib/libc/machine/spu/sscanf.S + newlib/libc/machine/spu/stack_reg_va.S +Copyright: 2007, Toshiba Corporation +License: BSD3-24 + +Files: newlib/libc/machine/spu/mk_syscalls + newlib/libc/machine/spu/syscall.def +Copyright: 2007 TOSHIBA CORPORATION +License: BSD3-24 + +Files: newlib/libc/machine/spu/include/fenv.h + newlib/libc/machine/spu/machine/fenv.h +Copyright: 2006, 2007 International Business Machines Corporation, Sony Computer Entertainment, Incorporated, Toshiba Corporation, +License: BSD3-25 + +Files: newlib/libc/machine/spu/machine/_types.h + newlib/libc/machine/spu/sys/dirent.h + newlib/libm/machine/spu/headers/dom_chkd_less_than.h + newlib/libm/machine/spu/headers/dom_chkd_negone_one.h + newlib/libm/machine/spu/headers/dom_chkf_less_than.h + newlib/libm/machine/spu/headers/dom_chkf_negone_one.h + newlib/libm/machine/spu/sf_finite.c + newlib/libm/machine/spu/sf_isinf.c + newlib/libm/machine/spu/sf_isinff.c + newlib/libm/machine/spu/sf_isnan.c + newlib/libm/machine/spu/sf_isnanf.c + newlib/libm/machine/spu/sf_nan.c +Copyright: 2007 International Business Machines Corporation, Sony Computer Entertainment, Incorporated, Toshiba Corporation, +License: BSD3-25 + +Files: newlib/libc/machine/spu/memcmp.c + newlib/libc/machine/spu/straddr.h + newlib/libc/machine/spu/strcat.c + newlib/libc/machine/spu/strcpy.c + newlib/libc/machine/spu/strcpy.h + newlib/libc/machine/spu/strncat.c + newlib/libc/machine/spu/strncpy.c +Copyright: 2008 International Business Machines Corporation +License: BSD3-25 + +Files: newlib/libc/machine/spu/memcpy.c + newlib/libc/machine/spu/memmove.c + newlib/libc/machine/spu/memset.c + newlib/libc/machine/spu/strchr.c + newlib/libc/machine/spu/strcmp.c + newlib/libc/machine/spu/strcspn.c + newlib/libc/machine/spu/strlen.c + newlib/libc/machine/spu/strncmp.c + newlib/libc/machine/spu/strpbrk.c + newlib/libc/machine/spu/strrchr.c + newlib/libc/machine/spu/strspn.c + newlib/libc/machine/spu/strxfrm.c + newlib/libc/machine/spu/vec_literal.h + newlib/libm/machine/spu/headers/atanf.h + newlib/libm/machine/spu/headers/cbrt.h + newlib/libm/machine/spu/headers/cbrtf.h + newlib/libm/machine/spu/headers/ceil.h + newlib/libm/machine/spu/headers/ceilf.h + newlib/libm/machine/spu/headers/copysign.h + newlib/libm/machine/spu/headers/copysignf.h + newlib/libm/machine/spu/headers/exp2f.h + newlib/libm/machine/spu/headers/expf.h + newlib/libm/machine/spu/headers/fabs.h + newlib/libm/machine/spu/headers/fabsf.h + newlib/libm/machine/spu/headers/fdim.h + newlib/libm/machine/spu/headers/fdimf.h + newlib/libm/machine/spu/headers/feclearexcept.h + newlib/libm/machine/spu/headers/fefpscr.h + newlib/libm/machine/spu/headers/fegetenv.h + newlib/libm/machine/spu/headers/fegetexceptflag.h + newlib/libm/machine/spu/headers/fegetround.h + newlib/libm/machine/spu/headers/feholdexcept.h + newlib/libm/machine/spu/headers/feraiseexcept.h + newlib/libm/machine/spu/headers/fesetenv.h + newlib/libm/machine/spu/headers/fesetexceptflag.h + newlib/libm/machine/spu/headers/fesetround.h + newlib/libm/machine/spu/headers/fetestexcept.h + newlib/libm/machine/spu/headers/feupdateenv.h + newlib/libm/machine/spu/headers/floor.h + newlib/libm/machine/spu/headers/floorf.h + newlib/libm/machine/spu/headers/fma.h + newlib/libm/machine/spu/headers/fmaf.h + newlib/libm/machine/spu/headers/fmax.h + newlib/libm/machine/spu/headers/fmaxf.h + newlib/libm/machine/spu/headers/fmin.h + newlib/libm/machine/spu/headers/fminf.h + newlib/libm/machine/spu/headers/fmod.h + newlib/libm/machine/spu/headers/fmodf.h + newlib/libm/machine/spu/headers/frexp.h + newlib/libm/machine/spu/headers/frexpf.h + newlib/libm/machine/spu/headers/ilogb.h + newlib/libm/machine/spu/headers/ilogbf.h + newlib/libm/machine/spu/headers/ldexp.h + newlib/libm/machine/spu/headers/ldexpf.h + newlib/libm/machine/spu/headers/llrint.h + newlib/libm/machine/spu/headers/llrintf.h + newlib/libm/machine/spu/headers/llround.h + newlib/libm/machine/spu/headers/llroundf.h + newlib/libm/machine/spu/headers/log10f.h + newlib/libm/machine/spu/headers/log2f.h + newlib/libm/machine/spu/headers/logf.h + newlib/libm/machine/spu/headers/lrint.h + newlib/libm/machine/spu/headers/lrintf.h + newlib/libm/machine/spu/headers/lround.h + newlib/libm/machine/spu/headers/lroundf.h + newlib/libm/machine/spu/headers/nearbyint.h + newlib/libm/machine/spu/headers/remainder.h + newlib/libm/machine/spu/headers/remainderf.h + newlib/libm/machine/spu/headers/remquo.h + newlib/libm/machine/spu/headers/remquof.h + newlib/libm/machine/spu/headers/rint.h + newlib/libm/machine/spu/headers/round.h + newlib/libm/machine/spu/headers/roundf.h + newlib/libm/machine/spu/headers/scalbn.h + newlib/libm/machine/spu/headers/scalbnf.h + newlib/libm/machine/spu/headers/sqrt.h + newlib/libm/machine/spu/headers/trunc.h + newlib/libm/machine/spu/headers/truncf.h + newlib/libm/machine/spu/headers/vec_literal.h + newlib/libm/machine/spu/llrint.c + newlib/libm/machine/spu/llrintf.c + newlib/libm/machine/spu/llround.c + newlib/libm/machine/spu/llroundf.c + newlib/libm/machine/spu/log2f.c + newlib/libm/machine/spu/s_cbrt.c + newlib/libm/machine/spu/s_ceil.c + newlib/libm/machine/spu/s_copysign.c + newlib/libm/machine/spu/s_fabs.c + newlib/libm/machine/spu/s_fdim.c + newlib/libm/machine/spu/s_floor.c + newlib/libm/machine/spu/s_fma.c + newlib/libm/machine/spu/s_fmax.c + newlib/libm/machine/spu/s_fmin.c + newlib/libm/machine/spu/s_frexp.c + newlib/libm/machine/spu/s_ilogb.c + newlib/libm/machine/spu/s_ldexp.c + newlib/libm/machine/spu/s_lrint.c + newlib/libm/machine/spu/s_lround.c + newlib/libm/machine/spu/s_nearbyint.c + newlib/libm/machine/spu/s_remquo.c + newlib/libm/machine/spu/s_rint.c + newlib/libm/machine/spu/s_round.c + newlib/libm/machine/spu/s_scalbn.c + newlib/libm/machine/spu/s_trunc.c + newlib/libm/machine/spu/sf_atan.c + newlib/libm/machine/spu/sf_cbrt.c + newlib/libm/machine/spu/sf_ceil.c + newlib/libm/machine/spu/sf_copysign.c + newlib/libm/machine/spu/sf_fabs.c + newlib/libm/machine/spu/sf_fdim.c + newlib/libm/machine/spu/sf_floor.c + newlib/libm/machine/spu/sf_fma.c + newlib/libm/machine/spu/sf_fmax.c + newlib/libm/machine/spu/sf_fmin.c + newlib/libm/machine/spu/sf_frexp.c + newlib/libm/machine/spu/sf_ilogb.c + newlib/libm/machine/spu/sf_ldexp.c + newlib/libm/machine/spu/sf_lrint.c + newlib/libm/machine/spu/sf_lround.c + newlib/libm/machine/spu/sf_remquo.c + newlib/libm/machine/spu/sf_round.c + newlib/libm/machine/spu/sf_scalbn.c + newlib/libm/machine/spu/sf_trunc.c + newlib/libm/machine/spu/w_fmod.c + newlib/libm/machine/spu/w_remainder.c + newlib/libm/machine/spu/w_sqrt.c + newlib/libm/machine/spu/wf_exp.c + newlib/libm/machine/spu/wf_exp2.c + newlib/libm/machine/spu/wf_fmod.c + newlib/libm/machine/spu/wf_log.c + newlib/libm/machine/spu/wf_log10.c + newlib/libm/machine/spu/wf_remainder.c +Copyright: 2001,2006, International Business Machines Corporation, Sony Computer Entertainment, Incorporated, Toshiba Corporation, +License: BSD3-25 + +Files: newlib/libc/machine/spu/stdio.c +Copyright: 2007 Sony Computer Entertainment Inc. + 2007 Sony Corp. +License: BSD3-25 + +Files: newlib/libc/machine/spu/strncmp.h +Copyright: 2001,2006,2008 International Business Machines Corporation, Sony Computer Entertainment, Incorporated, Toshiba Corporation, +License: BSD3-25 + +Files: newlib/libc/machine/tic6x/setjmp.S +Copyright: 1996-2010 Texas Instruments Incorporated http://www.ti.com +License: BSD3-26 + +Files: newlib/libc/machine/visium/memcpy.c + newlib/libc/machine/visium/memcpy.h + newlib/libc/machine/visium/memmove.c + newlib/libc/machine/visium/memset.c + newlib/libc/machine/visium/memset.h + newlib/libc/machine/visium/setjmp.S +Copyright: 2015 Rolls-Royce Controls and Data Services Limited. +License: BSD3-27 + +Files: newlib/libc/search/hcreate.c + newlib/libc/search/hcreate_r.c + newlib/testsuite/newlib.search/hsearchtest.c +Copyright: 2001 Christopher G. Demetriou +License: BSD3-28 + +Files: newlib/libc/search/tsearch.3 +Copyright: 1997 Todd C. Miller +License: BSD3-29 + +Files: newlib/libc/stdlib/aligned_alloc.c +Copyright: 2020 Arm Ltd. +License: BSD3-30 + +Files: newlib/libc/string/memmem.c + newlib/libc/string/strstr.c + newlib/libm/common/cosf.c + newlib/libm/common/exp.c + newlib/libm/common/exp2.c + newlib/libm/common/exp_data.c + newlib/libm/common/log.c + newlib/libm/common/log2.c + newlib/libm/common/log2_data.c + newlib/libm/common/log_data.c + newlib/libm/common/math_denorm.c + newlib/libm/common/math_denormf.c + newlib/libm/common/math_denorml.c + newlib/libm/common/math_err_check_oflow.c + newlib/libm/common/math_err_check_uflow.c + newlib/libm/common/math_err_divzero.c + newlib/libm/common/math_err_invalid.c + newlib/libm/common/math_err_may_uflow.c + newlib/libm/common/math_err_oflow.c + newlib/libm/common/math_err_uflow.c + newlib/libm/common/math_err_with_errno.c + newlib/libm/common/math_errf_check_oflowf.c + newlib/libm/common/math_errf_check_uflowf.c + newlib/libm/common/pow.c + newlib/libm/common/pow_log_data.c + newlib/libm/common/sincosf.c + newlib/libm/common/sincosf.h + newlib/libm/common/sincosf_data.c + newlib/libm/common/sinf.c + newlib/libm/ld/math_errl_check_oflowl.c + newlib/libm/ld/math_errl_check_uflowl.c + newlib/libm/ld/math_errl_divzerol.c + newlib/libm/ld/math_errl_invalidl.c + newlib/libm/ld/math_errl_oflowl.c + newlib/libm/ld/math_errl_uflowl.c + newlib/libm/ld/math_errl_with_errnol.c +Copyright: 2018 Arm Ltd. +License: BSD3-30 + +Files: newlib/libm/common/math_config.h + newlib/libm/common/math_errf_divzerof.c + newlib/libm/common/math_errf_invalidf.c + newlib/libm/common/math_errf_may_uflowf.c + newlib/libm/common/math_errf_oflowf.c + newlib/libm/common/math_errf_uflowf.c + newlib/libm/common/math_errf_with_errnof.c + newlib/libm/common/sf_pow.c +Copyright: 2017-2018 Arm Ltd. +License: BSD3-30 + +Files: newlib/libm/common/sf_exp.c + newlib/libm/common/sf_exp2.c + newlib/libm/common/sf_exp2_data.c + newlib/libm/common/sf_log.c + newlib/libm/common/sf_log2.c + newlib/libm/common/sf_log2_data.c + newlib/libm/common/sf_log_data.c + newlib/libm/common/sf_pow_log2_data.c +Copyright: 2017 Arm Ltd. +License: BSD3-30 + +Files: newlib/libc/stdlib/strtoimax.c + newlib/libc/stdlib/strtoumax.c + newlib/libc/stdlib/wcstoimax.c + newlib/libc/stdlib/wcstoumax.c +Copyright: 1992, 1993 The Regents of the University of California. + 2011 The FreeBSD Foundation +License: BSD3-31 + +Files: newlib/libc/time/strptime.c +Copyright: 1999 Kungliga Tekniska Högskolan Royal Institute of Technology, Stockholm, Sweden). +License: BSD3-32 + +Files: newlib/libc/tinystdio/ftoa_engine.c +Copyright: 2005, Dmitry Xmelkov +License: BSD3-33 + +Files: newlib/libm/common/nexttoward.c + newlib/libm/common/nexttowardl.c +Copyright: 2014 Mentor Graphics, Inc. +License: BSD3-34 + +Files: newlib/libm/ld/common/s_fabsl.c +Copyright: 2003 Dag-Erling Coïdan Smørgrav +License: BSD3-35 + +Files: newlib/libm/machine/spu/headers/acos.h + newlib/libm/machine/spu/headers/acosd2.h + newlib/libm/machine/spu/headers/acosf.h + newlib/libm/machine/spu/headers/acosh.h + newlib/libm/machine/spu/headers/acoshf.h + newlib/libm/machine/spu/headers/asin.h + newlib/libm/machine/spu/headers/asind2.h + newlib/libm/machine/spu/headers/asinf.h + newlib/libm/machine/spu/headers/asinh.h + newlib/libm/machine/spu/headers/asinhf.h + newlib/libm/machine/spu/headers/atan.h + newlib/libm/machine/spu/headers/atan2.h + newlib/libm/machine/spu/headers/atan2f.h + newlib/libm/machine/spu/headers/atanh.h + newlib/libm/machine/spu/headers/atanhf.h + newlib/libm/machine/spu/headers/cos.h + newlib/libm/machine/spu/headers/cosf.h + newlib/libm/machine/spu/headers/cosh.h + newlib/libm/machine/spu/headers/coshd2.h + newlib/libm/machine/spu/headers/coshf.h + newlib/libm/machine/spu/headers/coshf4.h + newlib/libm/machine/spu/headers/erf.h + newlib/libm/machine/spu/headers/erfc.h + newlib/libm/machine/spu/headers/erfcf.h + newlib/libm/machine/spu/headers/erff.h + newlib/libm/machine/spu/headers/exp.h + newlib/libm/machine/spu/headers/exp2.h + newlib/libm/machine/spu/headers/expm1.h + newlib/libm/machine/spu/headers/expm1f.h + newlib/libm/machine/spu/headers/hypot.h + newlib/libm/machine/spu/headers/hypotd2.h + newlib/libm/machine/spu/headers/hypotf.h + newlib/libm/machine/spu/headers/isnan.h + newlib/libm/machine/spu/headers/isnand2.h + newlib/libm/machine/spu/headers/isnanf.h + newlib/libm/machine/spu/headers/isnanf4.h + newlib/libm/machine/spu/headers/lgamma.h + newlib/libm/machine/spu/headers/lgammaf.h + newlib/libm/machine/spu/headers/log.h + newlib/libm/machine/spu/headers/log10.h + newlib/libm/machine/spu/headers/log1p.h + newlib/libm/machine/spu/headers/log1pf.h + newlib/libm/machine/spu/headers/log2.h + newlib/libm/machine/spu/headers/logbf.h + newlib/libm/machine/spu/headers/logbf4.h + newlib/libm/machine/spu/headers/nearbyintf.h + newlib/libm/machine/spu/headers/nextafter.h + newlib/libm/machine/spu/headers/nextafterf.h + newlib/libm/machine/spu/headers/pow.h + newlib/libm/machine/spu/headers/powf.h + newlib/libm/machine/spu/headers/rintf.h + newlib/libm/machine/spu/headers/signbit.h + newlib/libm/machine/spu/headers/signbitd2.h + newlib/libm/machine/spu/headers/simdmath.h + newlib/libm/machine/spu/headers/sin.h + newlib/libm/machine/spu/headers/sincos.h + newlib/libm/machine/spu/headers/sincosf.h + newlib/libm/machine/spu/headers/sinf.h + newlib/libm/machine/spu/headers/sinh.h + newlib/libm/machine/spu/headers/sinhd2.h + newlib/libm/machine/spu/headers/sinhf.h + newlib/libm/machine/spu/headers/sinhf4.h + newlib/libm/machine/spu/headers/sqrtf.h + newlib/libm/machine/spu/headers/tan.h + newlib/libm/machine/spu/headers/tanf.h + newlib/libm/machine/spu/headers/tanh.h + newlib/libm/machine/spu/headers/tanhf.h + newlib/libm/machine/spu/headers/tgamma.h + newlib/libm/machine/spu/headers/tgammaf.h + newlib/libm/machine/spu/log2.c + newlib/libm/machine/spu/s_asinh.c + newlib/libm/machine/spu/s_atan.c + newlib/libm/machine/spu/s_cos.c + newlib/libm/machine/spu/s_erf.c + newlib/libm/machine/spu/s_expm1.c + newlib/libm/machine/spu/s_isnan.c + newlib/libm/machine/spu/s_log1p.c + newlib/libm/machine/spu/s_nextafter.c + newlib/libm/machine/spu/s_sin.c + newlib/libm/machine/spu/s_tan.c + newlib/libm/machine/spu/s_tanh.c + newlib/libm/machine/spu/sf_asinh.c + newlib/libm/machine/spu/sf_cos.c + newlib/libm/machine/spu/sf_erf.c + newlib/libm/machine/spu/sf_expm1.c + newlib/libm/machine/spu/sf_log1p.c + newlib/libm/machine/spu/sf_logb.c + newlib/libm/machine/spu/sf_nearbyint.c + newlib/libm/machine/spu/sf_nextafter.c + newlib/libm/machine/spu/sf_rint.c + newlib/libm/machine/spu/sf_sin.c + newlib/libm/machine/spu/sf_tan.c + newlib/libm/machine/spu/sf_tanh.c + newlib/libm/machine/spu/w_acos.c + newlib/libm/machine/spu/w_acosh.c + newlib/libm/machine/spu/w_asin.c + newlib/libm/machine/spu/w_atan2.c + newlib/libm/machine/spu/w_atanh.c + newlib/libm/machine/spu/w_cosh.c + newlib/libm/machine/spu/w_exp.c + newlib/libm/machine/spu/w_exp2.c + newlib/libm/machine/spu/w_hypot.c + newlib/libm/machine/spu/w_lgamma.c + newlib/libm/machine/spu/w_log.c + newlib/libm/machine/spu/w_log10.c + newlib/libm/machine/spu/w_pow.c + newlib/libm/machine/spu/w_sincos.c + newlib/libm/machine/spu/w_sinh.c + newlib/libm/machine/spu/w_tgamma.c + newlib/libm/machine/spu/wf_acos.c + newlib/libm/machine/spu/wf_acosh.c + newlib/libm/machine/spu/wf_asin.c + newlib/libm/machine/spu/wf_atan2.c + newlib/libm/machine/spu/wf_atanh.c + newlib/libm/machine/spu/wf_cosh.c + newlib/libm/machine/spu/wf_hypot.c + newlib/libm/machine/spu/wf_lgamma.c + newlib/libm/machine/spu/wf_pow.c + newlib/libm/machine/spu/wf_sincos.c + newlib/libm/machine/spu/wf_sinh.c + newlib/libm/machine/spu/wf_sqrt.c + newlib/libm/machine/spu/wf_tgamma.c +Copyright: 2006,2008, International Business Machines Corporation +License: BSD3-36 + +Files: newlib/libm/machine/spu/headers/acosf4.h + newlib/libm/machine/spu/headers/asinf4.h + newlib/libm/machine/spu/headers/atanf4.h + newlib/libm/machine/spu/headers/cos_sin.h + newlib/libm/machine/spu/headers/cosd2.h + newlib/libm/machine/spu/headers/cosf4.h + newlib/libm/machine/spu/headers/divd2.h + newlib/libm/machine/spu/headers/divf4.h + newlib/libm/machine/spu/headers/exp2d2.h + newlib/libm/machine/spu/headers/exp2f4.h + newlib/libm/machine/spu/headers/expd2.h + newlib/libm/machine/spu/headers/expf4.h + newlib/libm/machine/spu/headers/floord2.h + newlib/libm/machine/spu/headers/floorf4.h + newlib/libm/machine/spu/headers/ldexpd2.h + newlib/libm/machine/spu/headers/ldexpf4.h + newlib/libm/machine/spu/headers/log10d2.h + newlib/libm/machine/spu/headers/log2d2.h + newlib/libm/machine/spu/headers/log2f4.h + newlib/libm/machine/spu/headers/logd2.h + newlib/libm/machine/spu/headers/logf4.h + newlib/libm/machine/spu/headers/powd2.h + newlib/libm/machine/spu/headers/powf4.h + newlib/libm/machine/spu/headers/recipd2.h + newlib/libm/machine/spu/headers/recipf4.h + newlib/libm/machine/spu/headers/sind2.h + newlib/libm/machine/spu/headers/sinf4.h + newlib/libm/machine/spu/headers/sqrtd2.h + newlib/libm/machine/spu/headers/sqrtf4.h + newlib/libm/machine/spu/headers/tand2.h + newlib/libm/machine/spu/headers/tanf4.h + newlib/libm/machine/spu/headers/truncd2.h + newlib/libm/machine/spu/headers/truncf4.h +Copyright: 2001,2008, International Business Machines Corporation, Sony Computer Entertainment, Incorporated, Toshiba Corporation, +License: BSD3-36 + +Files: newlib/libm/machine/spu/headers/acoshd2.h + newlib/libm/machine/spu/headers/acoshf4.h + newlib/libm/machine/spu/headers/asinhd2.h + newlib/libm/machine/spu/headers/asinhf4.h + newlib/libm/machine/spu/headers/atan2d2.h + newlib/libm/machine/spu/headers/atan2f4.h + newlib/libm/machine/spu/headers/atand2.h + newlib/libm/machine/spu/headers/atanhd2.h + newlib/libm/machine/spu/headers/atanhf4.h + newlib/libm/machine/spu/headers/erf_utils.h + newlib/libm/machine/spu/headers/erfcd2.h + newlib/libm/machine/spu/headers/erfcf4.h + newlib/libm/machine/spu/headers/erfd2.h + newlib/libm/machine/spu/headers/erff4.h + newlib/libm/machine/spu/headers/expm1d2.h + newlib/libm/machine/spu/headers/expm1f4.h + newlib/libm/machine/spu/headers/hypotf4.h + newlib/libm/machine/spu/headers/lgammad2.h + newlib/libm/machine/spu/headers/lgammaf4.h + newlib/libm/machine/spu/headers/log1pd2.h + newlib/libm/machine/spu/headers/log1pf4.h + newlib/libm/machine/spu/headers/nextafterd2.h + newlib/libm/machine/spu/headers/nextafterf4.h + newlib/libm/machine/spu/headers/sincosd2.h + newlib/libm/machine/spu/headers/sincosf4.h + newlib/libm/machine/spu/headers/tanhd2.h + newlib/libm/machine/spu/headers/tanhf4.h + newlib/libm/machine/spu/headers/tgammad2.h + newlib/libm/machine/spu/headers/tgammaf4.h +Copyright: 2007,2008, International Business Machines Corporation +License: BSD3-36 + +Files: newlib/libm/machine/spu/headers/nearbyintf4.h + newlib/libm/machine/spu/headers/rintf4.h + newlib/libm/machine/spu/headers/scalbnf4.h +Copyright: 2006,2008, International Business Machines Corporation, Sony Computer Entertainment, Incorporated, Toshiba Corporation, +License: BSD3-36 + +Files: .clang-format + .editorconfig + .gitattributes + .github/Dockerfile + .github/Dockerfile-coreboot + .github/Dockerfile-zephyr + .github/do-build + .github/do-cmake-test + .github/do-linux + .github/do-many + .github/do-test + .github/do-test-noopt + .github/do-zephyr + .github/linux-files.txt + .github/linux-packages.txt + .github/workflows/Makefile + .github/workflows/coreboot.yml + .github/workflows/head + .github/workflows/head-coreboot + .github/workflows/head-zephyr + .github/workflows/linux.yml + .github/workflows/make-workflow + .github/workflows/make-workflow-coreboot + .github/workflows/make-workflow-zephyr + .github/workflows/steps-head + .github/workflows/variants + .github/workflows/zephyr.yml + .github/zephyr + .github/zephyr-files.txt + .github/zephyr-packages.txt + .gitignore + README.md + cmake/TC-clang-thumbv6m.cmake + cmake/TC-clang-thumbv7m.cmake + cmake/TC-rx.cmake + cmake/TC-thumbv6m.cmake + cmake/TC-thumbv7m.cmake + cross.tmpl + doc/build.md + doc/ctype.md + doc/embedsource.md + doc/init.md + doc/linking.md + doc/locking.md + doc/os.md + doc/picolibc.svg + doc/printf.md + doc/releasing.md + doc/testing.md + doc/tls.md + doc/using.md + hello-world/README.md + newlib/HOWTO + newlib/README + newlib/doc/doc.str + newlib/libc/ctype/ctype.tex + newlib/libc/include/sys/_tz_structs.h + newlib/libc/libc.in.xml + newlib/libc/machine/aarch64/sys/fcntl.h + newlib/libc/machine/necv70/necv70.tex + newlib/libc/machine/nvptx/clock.c + newlib/libc/machine/riscv/xlenint.h + newlib/libc/machine/xtensa/xtensa.tex + newlib/libc/ssp/ssp.tex + newlib/libc/stdio/sfputs.c + newlib/libc/stdio/sfputws.c + newlib/libc/stdio/sprint.c + newlib/libc/stdio/ssprint.c + newlib/libc/stdio/ssputs.c + newlib/libc/stdio/ssputws.c + newlib/libc/stdio/sswprint.c + newlib/libc/stdio/swprint.c + newlib/libc/stdlib/mul_overflow.h + newlib/libc/string/wcstrings.tex + newlib/libc/time/strftime.c + newlib/libc/time/tzset.c + newlib/libc/xdr/README + newlib/libm/complex/CMakeLists.txt + newlib/libm/complex/complex.tex + newlib/libm/fenv/fenv.tex + newlib/libm/ld/files + newlib/libm/libm.in.xml + newlib/man.xsl + newlib/refcontainers.xslt + newlib/testsuite/newlib.time/tzset.c + picocrt/machine/aarch64/crt0.S + picolibc.h.in + picolibc.ld.in + picolibc.specs.in + scripts/cross-aarch64-linux-gnu.txt + scripts/cross-aarch64-zephyr-elf.txt + scripts/cross-arc-zephyr-elf.txt + scripts/cross-arc64-zephyr-elf.txt + scripts/cross-arm-none-eabi.txt + scripts/cross-arm-zephyr-eabi.txt + scripts/cross-avr.txt + scripts/cross-clang-aarch64-none-elf.txt + scripts/cross-clang-arm-none-eabi.txt + scripts/cross-clang-cortex-r82.txt + scripts/cross-clang-msp430.txt + scripts/cross-clang-riscv64-unknown-elf.txt + scripts/cross-clang-riscv64-zephyr-elf.txt + scripts/cross-clang-rv32imafc.txt + scripts/cross-clang-rv32imafdc-unknown-elf.txt + scripts/cross-clang-thumb-none-eabi.txt + scripts/cross-clang-thumbv6m-none-eabi.txt + scripts/cross-clang-thumbv7-a-none-eabi.txt + scripts/cross-clang-thumbv7e+dp-none-eabi.txt + scripts/cross-clang-thumbv7e+fp-none-eabi.txt + scripts/cross-clang-thumbv7m-none-eabi.txt + scripts/cross-clang-x86.txt + scripts/cross-clang-x86_64.txt + scripts/cross-coreboot-arm-eabi.txt + scripts/cross-coreboot-i386-elf.txt + scripts/cross-coreboot-riscv-elf.txt + scripts/cross-coreboot-x86_64-elf.txt + scripts/cross-cortex-a9-none-eabi.txt + scripts/cross-i686-linux-gnu.txt + scripts/cross-lm32-unknown-elf.txt + scripts/cross-loongarch64-unknown-elf.txt + scripts/cross-m68k-linux-gnu.txt + scripts/cross-m68k-unknown-elf.txt + scripts/cross-microblazeel-zephyr-elf.txt + scripts/cross-mips-linux-gnu.txt + scripts/cross-mips-zephyr-elf.txt + scripts/cross-mips64-linux-gnuabi64.txt + scripts/cross-mipsel-linux-gnu.txt + scripts/cross-msp430-unknown-elf.txt + scripts/cross-msp430.txt + scripts/cross-nios2-zephyr-elf.txt + scripts/cross-or1k-elf.txt + scripts/cross-or1k-unknown-elf.txt + scripts/cross-power9-fp128.txt + scripts/cross-power9.txt + scripts/cross-powerpc64-linux-gnu.txt + scripts/cross-powerpc64le-linux-gnu.txt + scripts/cross-riscv64-unknown-elf.txt + scripts/cross-riscv64-zephyr-elf.txt + scripts/cross-rv32imac.txt + scripts/cross-rv32imac_zicsr_zbb.txt + scripts/cross-rx-zephyr-elf.txt + scripts/cross-sh-unknown-elf.txt + scripts/cross-sparc-zephyr-elf.txt + scripts/cross-sparc64-linux-gnu.txt + scripts/cross-thumbv8_1m-none-eabi.txt + scripts/cross-thumbv8m_main_fp-none-eabi.txt + scripts/cross-x86-linux-gnu.txt + scripts/cross-x86_64-linux-gnu.txt + scripts/cross-x86_64-zephyr-elf.txt + scripts/cross-xtensa-dc233c_zephyr-elf.txt + scripts/cross-xtensa-esp32-elf.txt + scripts/cross-xtensa-espressif_esp32_zephyr-elf.txt + scripts/cross-xtensa-espressif_esp32s2_zephyr-elf.txt + scripts/cross-xtensa-intel_apl_adsp_zephyr-elf.txt + scripts/cross-xtensa-intel_s1000_zephyr-elf.txt + scripts/cross-xtensa-lx106-elf.txt + scripts/cross-xtensa-nxp_imx8m_adsp_zephyr-elf.txt + scripts/cross-xtensa-nxp_imx_adsp_zephyr-elf.txt + scripts/cross-xtensa-sample_controller_zephyr-elf.txt + scripts/do-arm-tk + scripts/duplicate-names + scripts/monitor-e9 + scripts/run-lm32 + scripts/test-picolibc + semihost/machine/x86/bios.ld + test/CP720 + test/complex-funcs.c + test/long_double_gen.5c + test/long_double_vec.h + test/test-atomic.c + test/time-sprintf.c +Copyright: 2020 The Newlib Project +License: Default-1 + +Files: newlib/doc/chapter-texi2docbook.py + newlib/doc/makedocbook.py +Copyright: 2016 Jon Turney +License: Default-1 + +Files: newlib/libc/ctype/caseconv.c + newlib/libc/ctype/ctype_.h + newlib/libc/ctype/isalnum_l.c + newlib/libc/ctype/isalpha_l.c + newlib/libc/ctype/isascii_l.c + newlib/libc/ctype/isblank_l.c + newlib/libc/ctype/iscntrl_l.c + newlib/libc/ctype/isdigit_l.c + newlib/libc/ctype/isgraph_l.c + newlib/libc/ctype/islower_l.c + newlib/libc/ctype/isprint_l.c + newlib/libc/ctype/ispunct_l.c + newlib/libc/ctype/isspace_l.c + newlib/libc/ctype/isupper_l.c + newlib/libc/ctype/iswalnum_l.c + newlib/libc/ctype/iswalpha_l.c + newlib/libc/ctype/iswblank_l.c + newlib/libc/ctype/iswcntrl_l.c + newlib/libc/ctype/iswctype_l.c + newlib/libc/ctype/iswdigit_l.c + newlib/libc/ctype/iswgraph_l.c + newlib/libc/ctype/iswlower_l.c + newlib/libc/ctype/iswprint_l.c + newlib/libc/ctype/iswpunct_l.c + newlib/libc/ctype/iswupper_l.c + newlib/libc/ctype/iswxdigit_l.c + newlib/libc/ctype/isxdigit_l.c + newlib/libc/ctype/toascii_l.c + newlib/libc/ctype/tolower_l.c + newlib/libc/ctype/toupper_l.c + newlib/libc/ctype/towctrans_l.c + newlib/libc/ctype/towlower_l.c + newlib/libc/ctype/towupper_l.c + newlib/libc/ctype/wctrans_l.c + newlib/libc/ctype/wctype_l.c + newlib/libc/include/sys/_locale.h + newlib/libc/string/strcasecmp_l.c + newlib/libc/string/strcoll_l.c + newlib/libc/string/strncasecmp_l.c + newlib/libc/string/strxfrm_l.c + newlib/libc/string/wcscasecmp_l.c + newlib/libc/string/wcscoll_l.c + newlib/libc/string/wcsncasecmp_l.c + newlib/libc/string/wcsxfrm_l.c +Copyright: 2016 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/ctype/categories.h +Copyright: 2017 Thomas Wolff towo@towo.net +License: Default-1 + +Files: newlib/libc/ctype/isblank.c + newlib/libc/stdlib/btowc.c + newlib/libc/stdlib/mbrlen.c + newlib/libc/stdlib/mbrtowc.c + newlib/libc/stdlib/mbsinit.c + newlib/libc/stdlib/mbsrtowcs.c + newlib/libc/stdlib/wcrtomb.c + newlib/libc/stdlib/wcsrtombs.c + newlib/libc/stdlib/wctob.c + newlib/libm/math/s_sincos.c + newlib/libm/math/sf_sincos.c +Copyright: 2002 Thomas Fitzsimmons +License: Default-1 + +Files: newlib/libc/ctype/mkcaseconv + newlib/libc/ctype/mkcategories + newlib/libc/ctype/mkunidata + newlib/libc/string/mkunidata + newlib/libc/string/mkwide + newlib/libc/string/mkwidthA +Copyright: 2018 Thomas Wolff +License: Default-1 + +Files: newlib/libc/include/_newlib_version.h +Copyright: 2016 Jeff Johnston +License: Default-1 + +Files: newlib/libc/include/alloca.h +Copyright: 2000 Werner Almesberger +License: Default-1 + +Files: newlib/libc/include/arpa/inet.h + newlib/libc/include/machine/endian.h + newlib/libc/include/machine/param.h + newlib/libc/machine/arm/machine/param.h +Copyright: 2004 Jeff Johnston +License: Default-1 + +Files: newlib/libc/include/cpio.h + newlib/libm/complex/clog10.c + newlib/libm/complex/clog10f.c + newlib/libm/complex/clog10l.c +Copyright: 2016 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/include/libgen.h + newlib/libc/include/sys/string.h + newlib/libc/time/gettzinfo.c +Copyright: 2005 Jeff Johnston +License: Default-1 + +Files: newlib/libc/include/limits.h + newlib/libc/include/machine/malloc.h + newlib/libc/include/machine/stdlib.h + newlib/libc/include/machine/termios.h + newlib/libc/include/sys/lock.h + newlib/libc/include/wctype.h + newlib/libc/stdlib/_Exit.c + newlib/libc/stdlib/a64l.c + newlib/libc/stdlib/l64a.c + newlib/libc/string/memccpy.c + newlib/libc/string/mempcpy.c + newlib/libc/string/strdup.c + newlib/libc/string/strerror_r.c + newlib/libc/string/strndup.c + newlib/libc/string/strnlen.c + newlib/libc/time/local.h + newlib/testsuite/newlib.wctype/tiswctype.c + newlib/testsuite/newlib.wctype/twctrans.c +Copyright: 2002 Jeff Johnston +License: Default-1 + +Files: newlib/libc/include/machine/_default_types.h + newlib/libc/machine/spu/creat.c + newlib/libc/machine/spu/sys/errno.h + newlib/libc/machine/spu/sys/sched.h + newlib/libc/machine/spu/sys/syscall.h + newlib/libc/machine/spu/sys/uio.h + newlib/libc/machine/spu/sys/utime.h +Copyright: 2007 Patrick Mansfield +License: Default-1 + +Files: newlib/libc/include/machine/_endian.h + newlib/libc/include/machine/_time.h + newlib/libc/include/memory.h +Copyright: 2016 Sebastian Huber +License: Default-1 + +Files: newlib/libc/include/machine/_types.h +Copyright: 2005 Ralf Corsepious +License: Default-1 + +Files: newlib/libc/include/machine/ansi.h +Copyright: 2001 Jeff Johnston +License: Default-1 + +Files: newlib/libc/include/ssp/stdlib.h + newlib/libc/include/ssp/wchar.h + newlib/libc/ssp/stack_protector.c + newlib/libc/string/wmempcpy.c +Copyright: 2017 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/include/sys/_default_fcntl.h + newlib/libc/include/sys/custom_file.h + newlib/libc/machine/x86/machine/fastmath.h +Copyright: 2007 Jeff Johnston +License: Default-1 + +Files: newlib/libc/include/sys/dir.h +Copyright: 2010 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/include/tar.h +Copyright: 2007 Ralf Corsepius +License: Default-1 + +Files: newlib/libc/machine/aarch64/asmdefs.h +Copyright: 2019-2023, Arm Limited. SPDX-License-Identifier: MIT +License: Default-1 + +Files: newlib/libc/machine/aarch64/memchr.S +Copyright: 2014-2022, Arm Limited. SPDX-License-Identifier: MIT +License: Default-1 + +Files: newlib/libc/machine/aarch64/memcmp.S +Copyright: 2013-2022, Arm Limited. SPDX-License-Identifier: MIT +License: Default-1 + +Files: newlib/libc/machine/aarch64/memcpy.S + newlib/libc/machine/aarch64/memset.S + newlib/libc/machine/aarch64/strcmp.S +Copyright: 2012-2022, Arm Limited. SPDX-License-Identifier: MIT +License: Default-1 + +Files: newlib/libc/machine/aarch64/memrchr-stub.c +Copyright: 2023 embedded brains GmbH & Co. KG +License: Default-1 + +Files: newlib/libc/machine/aarch64/memrchr.S +Copyright: 2020-2022, Arm Limited. SPDX-License-Identifier: MIT +License: Default-1 + +Files: newlib/libc/machine/aarch64/stpcpy.S +Copyright: 2020, Arm Limited. SPDX-License-Identifier: MIT +License: Default-1 + +Files: newlib/libc/machine/arm/setjmp.S +Copyright: 1997 Nick Clifton, Cygnus Solutions +License: Default-1 + +Files: newlib/libc/machine/cr16/setjmp.S + newlib/libc/machine/crx/setjmp.S +Copyright: 2004 National Semiconductor Corporation +License: Default-1 + +Files: newlib/libc/machine/frv/setjmp.S +Copyright: 2002 Dave Brolley +License: Default-1 + +Files: newlib/libc/machine/h8300/h8sx_strcpy.S +Copyright: 2003 Richard Sandiford +License: Default-1 + +Files: newlib/libc/machine/h8300/setarch.h +Copyright: 2003 Kazu Hirata +License: Default-1 + +Files: newlib/libc/machine/iq2000/setjmp.S +Copyright: 2003 Anthony Green +License: Default-1 + +Files: newlib/libc/machine/m68k/m68kasm.h +Copyright: 2008 Jeff Johnston +License: Default-1 + +Files: newlib/libc/machine/mep/setjmp.S +Copyright: 2003 DJ Delorie, Red Hat Inc. +License: Default-1 + +Files: newlib/libc/machine/microblaze/mb_endian.h +Copyright: 2013 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/machine/mt/setjmp.S +Copyright: 2005 Aldy Hernandez +License: Default-1 + +Files: newlib/libc/machine/rx/memchr.S + newlib/libc/machine/rx/memcpy.S + newlib/libc/machine/rx/memmove.S + newlib/libc/machine/rx/mempcpy.S + newlib/libc/machine/rx/memset.S + newlib/libc/machine/rx/setjmp.S + newlib/libc/machine/rx/strcat.S + newlib/libc/machine/rx/strcmp.S + newlib/libc/machine/rx/strcpy.S + newlib/libc/machine/rx/strlen.S + newlib/libc/machine/rx/strncat.S + newlib/libc/machine/rx/strncmp.S + newlib/libc/machine/rx/strncpy.S +Copyright: 2009 Nick Clifton +License: Default-1 + +Files: newlib/libc/machine/sh/memcpy.S + newlib/libc/machine/sh/memset.S + newlib/libc/machine/sh/strcmp.S + newlib/libc/machine/sh/strcpy.S + newlib/libc/machine/sh/strlen.S +Copyright: 2002 SuperH Ltd. +License: Default-1 + +Files: newlib/libc/machine/sh/strncpy.S +Copyright: 2003 SuperH Ltd. +License: Default-1 + +Files: newlib/libc/machine/spu/assert.c + newlib/libc/machine/spu/sleep.c +Copyright: 2008 Patrick Mansfield +License: Default-1 + +Files: newlib/libc/machine/spu/usleep.c +Copyright: 2002 Jeff Johnston +License: Default-1 + +Files: newlib/libc/machine/spu/vfiprintf.c + newlib/libc/machine/spu/vfiscanf.c + newlib/libc/machine/spu/viprintf.c + newlib/libc/machine/spu/viscanf.c + newlib/libc/machine/spu/vsiprintf.c + newlib/libc/machine/spu/vsiscanf.c + newlib/libc/machine/spu/vsniprintf.c +Copyright: 2007 Kazunori Asayama +License: Default-1 + +Files: newlib/libc/machine/xstormy16/mallocr.c + newlib/libc/machine/xstormy16/tiny-malloc.c +Copyright: 2002 Geoffrey Keating +License: Default-1 + +Files: newlib/libc/misc/lock.c +Copyright: 2016 Thomas Preud'homme +License: Default-1 + +Files: newlib/libc/search/bsd_qsort_r.c + newlib/libc/search/qsort_r.c + newlib/libc/stdio/stdio_ext.c +Copyright: 2014 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/signal/psignal.c +Copyright: 2002, 2011 Red Hat Inc. +License: Default-1 + +Files: newlib/libc/ssp/chk_fail.c +Copyright: 2017 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/stdio/getdelim.c + newlib/libc/stdio/getline.c +Copyright: 2002, Red Hat Inc. - +License: Default-1 + +Files: newlib/libc/stdio/stdio_ext.h +Copyright: 2011 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/stdio64/fdopen64.c +Copyright: 2003 Christopher Faylor +License: Default-1 + +Files: newlib/libc/stdlib/__atexit.c + newlib/libc/stdlib/__call_atexit.c + newlib/libc/stdlib/cxa_atexit.c + newlib/libc/stdlib/cxa_finalize.c +Copyright: 2004 Paul Brook +License: Default-1 + +Files: newlib/libc/stdlib/abort.c + newlib/libc/stdlib/abs.c + newlib/libc/stdlib/assert.c + newlib/libc/stdlib/assert_func.c + newlib/libc/stdlib/assert_no_arg.c + newlib/libc/stdlib/atexit.c + newlib/libc/stdlib/atexit.h + newlib/libc/stdlib/atof.c + newlib/libc/stdlib/atoff.c + newlib/libc/stdlib/atoi.c + newlib/libc/stdlib/atol.c + newlib/libc/stdlib/ecvtbuf.c + newlib/libc/stdlib/efgcvt.c + newlib/libc/stdlib/eprintf.c + newlib/libc/stdlib/exit.c + newlib/libc/stdlib/labs.c + newlib/libc/stdlib/local.h + newlib/libc/stdlib/mallocr.c + newlib/libc/stdlib/mbctype.h + newlib/libc/stdlib/mblen.c + newlib/libc/stdlib/mbstowcs.c + newlib/libc/stdlib/mbtowc.c + newlib/libc/stdlib/mbtowc_r.c + newlib/libc/stdlib/on_exit.c + newlib/libc/stdlib/rand.c + newlib/libc/stdlib/rand_r.c + newlib/libc/stdlib/srand.c + newlib/libc/stdlib/stdlib.tex + newlib/libc/stdlib/system.c + newlib/libc/stdlib/wcstombs.c + newlib/libc/stdlib/wctomb.c + newlib/libc/stdlib/wctomb_r.c +Copyright: 1990 Regents of the University of California. +License: Default-1 + +Files: newlib/libc/stdlib/getenv_r.c +Copyright: 1991 DJ Delorie. +License: Default-1 + +Files: newlib/libc/stdlib/itoa.c + newlib/libc/stdlib/utoa.c +Copyright: 2014 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/stdlib/mbsnrtowcs.c + newlib/libc/stdlib/sb_charsets.c + newlib/libc/stdlib/wcsnrtombs.c + newlib/libc/string/local.h + newlib/libc/string/wcscasecmp.c + newlib/libc/string/wcsdup.c + newlib/libc/string/wcsncasecmp.c +Copyright: 2009 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/stdlib/random.c + newlib/libc/stdlib/srandom.c +Copyright: 2016 Joel Sherrill +License: Default-1 + +Files: newlib/libc/string/memrchr.c +Copyright: 2012 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/string/rawmemchr.c +Copyright: 2013 Yaakov Selkowitz +License: Default-1 + +Files: newlib/libc/string/stpcpy.c + newlib/libc/string/stpncpy.c + newlib/libc/string/wcpcpy.c + newlib/libc/string/wcpncpy.c + newlib/libc/string/wcsxfrm.c +Copyright: 2007 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/string/strchrnul.c +Copyright: 2011 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/string/strnstr.c +Copyright: 2017 Sichen Zhao <1473996754@qq.com> +License: Default-1 + +Files: newlib/libc/string/strsep.c +Copyright: 2002, Red Hat Inc. +License: Default-1 + +Files: newlib/libc/string/swab.c +Copyright: 2000 Alexandre Oliva +License: Default-1 + +Files: newlib/libc/string/uniset +Copyright: 2018 Markus Kuhn +License: Default-1 + +Files: newlib/libc/string/wcscoll.c + newlib/libc/string/wcswidth.c + newlib/libc/string/wcwidth.c +Copyright: 2003 Corinna Vinschen +License: Default-1 + +Files: newlib/libc/string/xpg_strerror_r.c +Copyright: 2011 Eric Blake +License: Default-1 + +Files: newlib/libc/time/month_lengths.c + newlib/libc/time/tzcalc_limits.c +Copyright: 2002 Arthur David Olson +License: Default-1 + +Files: newlib/libc/time/tzvars.c +Copyright: 2005 Tom Walsh +License: Default-1 + +Files: newlib/libc/time/wcsftime.c +Copyright: 2009 Craig Howland +License: Default-1 + +Files: newlib/libm/machine/x86/fenv.c +Copyright: 2010-2019 Red Hat, Inc. +License: Default-1 + +Files: scripts/cross-clang-aarch64-none-elf-fvp.txt +Copyright: 2024 Arm Limited and/or its affiliates +License: Default-1 + +Files: zephyr/Kconfig +Copyright: 2021 Amazon.com, Inc. or its affiliates. SPDX-License-Identifier: Apache-2.0 +License: Default-1 + +Files: newlib/libc/include/fenv.h + newlib/libc/machine/riscv/asm.h + newlib/libc/machine/riscv/ieeefp.c + newlib/libc/machine/riscv/machine/fenv.h + newlib/libc/machine/riscv/memcpy.c + newlib/libc/machine/riscv/memset.S + newlib/libc/machine/riscv/rv_string.h + newlib/libc/machine/riscv/setjmp.S + newlib/libc/machine/riscv/strcmp.S + newlib/libc/machine/riscv/strcpy.c + newlib/libc/machine/riscv/strlen.c +Copyright: 2017 SiFive Inc. +License: FreeBSD-1 + +Files: newlib/libc/machine/csky/setjmp.S +Copyright: 2020 C-SKY Microsystems +License: FreeBSD-1 + +Files: newlib/libc/machine/loongarch/setjmp.S +Copyright: 2024 Jiaxun Yang +License: FreeBSD-1 + +Files: newlib/libc/machine/riscv/memcpy-asm.S + newlib/libc/machine/riscv/memmove-stub.c + newlib/libc/machine/riscv/memmove.S +Copyright: 2019 SiFive Inc. +License: FreeBSD-1 + +Files: newlib/libc/machine/riscv/stpcpy.c +Copyright: 2025 SiFive Inc. +License: FreeBSD-1 + +Files: test/printf-tests.c + test/testcases.c +Copyright: 2013 Bart Massey +License: GPL2-1 + +Files: newlib/libc/argz/argz_add.c + newlib/libc/argz/argz_add_sep.c + newlib/libc/argz/argz_append.c + newlib/libc/argz/argz_count.c + newlib/libc/argz/argz_create.c + newlib/libc/argz/argz_create_sep.c + newlib/libc/argz/argz_delete.c + newlib/libc/argz/argz_extract.c + newlib/libc/argz/argz_next.c + newlib/libc/argz/argz_replace.c + newlib/libc/argz/argz_stringify.c + newlib/libc/argz/buf_findstr.c + newlib/libc/argz/buf_findstr.h + newlib/libc/argz/envz_add.c + newlib/libc/argz/envz_entry.c + newlib/libc/argz/envz_get.c + newlib/libc/argz/envz_merge.c + newlib/libc/argz/envz_remove.c + newlib/libc/argz/envz_strip.c + newlib/libc/include/argz.h + newlib/libc/include/envz.h + newlib/libm/common/s_fdim.c + newlib/libm/common/s_fma.c + newlib/libm/common/s_fmax.c + newlib/libm/common/s_fmin.c + newlib/libm/common/s_signbit.c + newlib/libm/common/sf_fdim.c + newlib/libm/common/sf_fma.c + newlib/libm/common/sf_fmax.c + newlib/libm/common/sf_fmin.c + newlib/libm/machine/spu/sf_fpclassify.c + newlib/testsuite/config/default.exp + newlib/testsuite/include/check.h + newlib/testsuite/lib/checkoutput.exp + newlib/testsuite/lib/newlib.exp + newlib/testsuite/lib/passfail.exp + newlib/testsuite/newlib.elix/elix.exp + newlib/testsuite/newlib.elix/tmmap.c + newlib/testsuite/newlib.locale/UTF-8.c + newlib/testsuite/newlib.locale/UTF-8.exp + newlib/testsuite/newlib.locale/locale.exp + newlib/testsuite/newlib.search/hsearchtest.exp + newlib/testsuite/newlib.stdlib/atexit.c + newlib/testsuite/newlib.stdlib/atexit.exp + newlib/testsuite/newlib.string/string.exp + newlib/testsuite/newlib.string/tstring.c + newlib/testsuite/newlib.wctype/twctype.c + newlib/testsuite/newlib.wctype/wctype.exp +Copyright: 2002 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/libc/argz/argz_insert.c +Copyright: 2002, 2005 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/libc/include/inttypes.h + newlib/libc/include/stdint.h + newlib/libc/include/sys/_intsup.h + newlib/libc/include/sys/_stdint.h +Copyright: 2004, 2005 by Ralf Corsepius, Ulm/Germany. +License: Other-1 + +Files: newlib/libc/include/wordexp.h +Copyright: 2002, 2010 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/libc/machine/x86/memchr-32.S + newlib/libc/machine/x86/memset-32.S + newlib/libc/machine/x86/strchr-32.S + newlib/libc/machine/x86/strlen-32.S +Copyright: 1998, 2002, 2008 Red Hat Inc. +License: Other-1 + +Files: newlib/libc/machine/x86/memcmp-32.S + newlib/libc/machine/x86/memcpy-32.S + newlib/libc/machine/x86/memmove-32.S + newlib/libm/machine/x86/f_atan2.S + newlib/libm/machine/x86/f_atan2f.S + newlib/libm/machine/x86/f_exp.c + newlib/libm/machine/x86/f_expf.c + newlib/libm/machine/x86/f_frexp.S + newlib/libm/machine/x86/f_frexpf.S + newlib/libm/machine/x86/f_ldexp.S + newlib/libm/machine/x86/f_ldexpf.S + newlib/libm/machine/x86/f_log.S + newlib/libm/machine/x86/f_log10.S + newlib/libm/machine/x86/f_log10f.S + newlib/libm/machine/x86/f_logf.S + newlib/libm/machine/x86/f_math.h + newlib/libm/machine/x86/f_pow.c + newlib/libm/machine/x86/f_powf.c + newlib/libm/machine/x86/f_tan.S + newlib/libm/machine/x86/f_tanf.S + newlib/libm/machine/x86/i386mach.h +Copyright: 1998, 2002 Red Hat Inc. +License: Other-1 + +Files: newlib/libc/machine/x86/memcpy-64.S + newlib/libc/machine/x86/memset-64.S + newlib/libc/machine/x86/setjmp-64.S + newlib/libc/machine/x86/x86_64mach.h +Copyright: 2007 Ellips BV. +License: Other-1 + +Files: newlib/libc/machine/xstormy16/setjmp.S +Copyright: 2001 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/libc/posix/basename.c + newlib/libc/posix/dirname.c +Copyright: 2005 Shaun Jackman +License: Other-1 + +Files: newlib/libc/stdio/asniprintf.c + newlib/libc/stdio/asnprintf.c + newlib/libc/stdio/vasniprintf.c +Copyright: 2007, 2008 Eric Blake +License: Other-1 + +Files: newlib/libc/stdio/diprintf.c +Copyright: 2005, 2007 Shaun Jackman +License: Other-1 + +Files: newlib/libc/stdio/dprintf.c + newlib/libc/stdio/vdiprintf.c + newlib/libc/stdio/vdprintf.c +Copyright: 2005, 2007 Shaun Jackman +License: Other-1 + +Files: newlib/libc/stdio/fmemopen.c + newlib/libc/stdio/fopencookie.c + newlib/libc/stdio/funopen.c + newlib/libc/stdio/open_memstream.c + newlib/libc/stdio/vasnprintf.c +Copyright: 2007 Eric Blake +License: Other-1 + +Files: newlib/libc/stdio/fpurge.c +Copyright: 2009 Eric Blake +License: Other-1 + +Files: newlib/libc/string/gnu_basename.c +Copyright: 2015 Red Hat, Inc. +License: Other-1 + +Files: newlib/libc/string/str-two-way.h +Copyright: 2008, 2010 Eric Blake +License: Other-1 + +Files: newlib/libm/common/s_fpclassify.c + newlib/libm/common/sf_fpclassify.c + newlib/libm/ld/ld128/s_fpclassifyl.c + newlib/libm/ld/ld80/s_fpclassifyl.c +Copyright: 2002, 2007 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/libm/complex/cabsl.c + newlib/libm/complex/cimagl.c + newlib/libm/complex/creall.c + newlib/libm/math/sl_hypot.c +Copyright: 2015 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/libm/ld/common/s_sincosl.c +Copyright: 2013 Elliot Saba Developed at the University of Washington +License: Other-1 + +Files: newlib/testsuite/lib/flags.exp +Copyright: 2002, 2011 Red Hat, Incorporated. +License: Other-1 + +Files: newlib/testsuite/newlib.stdio/nulprintf.c +Copyright: 2014 ARM Ltd. +License: Other-1 + +Files: newlib/testsuite/newlib.stdio/stdio.exp + newlib/testsuite/newlib.stdio/swprintf.c +Copyright: 2011 ARM Ltd. +License: Other-1 + +Files: newlib/testsuite/newlib.stdlib/size_max.c + newlib/testsuite/newlib.stdlib/stdlib.exp +Copyright: 2008 CodeSourcery, Inc. +License: Other-1 + +Files: newlib/testsuite/newlib.time/time.exp +Copyright: 2022 jdoubleu. +License: Other-1 + +Files: newlib/libc/include/complex.h +Copyright: 2010 Matthias Drochner. +License: Other-2 + +Files: newlib/libc/string/explicit_bzero.c +Copyright: 2014 Ted Unangst +License: Other-2 + +Files: newlib/libc/machine/xtensa/machine/core-isa.h +Copyright: 1999-2010 Tensilica Inc. +License: Other-3 + +Files: newlib/libc/machine/xtensa/memcpy.S +Copyright: 2002-2008 Tensilica Inc. +License: Other-3 + +Files: newlib/libc/machine/xtensa/memset.S + newlib/libc/machine/xtensa/strcpy.S + newlib/libc/machine/xtensa/strlen.S + newlib/libc/machine/xtensa/strncpy.S +Copyright: 2001-2008 Tensilica Inc. +License: Other-3 + +Files: newlib/libc/machine/xtensa/setjmp.S +Copyright: 2001-2006 Tensilica Inc. +License: Other-3 + +Files: newlib/libc/machine/xtensa/strcmp.S +Copyright: 2001-20012 Tensilica Inc. +License: Other-3 + +Files: newlib/libc/machine/xtensa/xtensa-asm.h +Copyright: 2006 Tensilica Inc. +License: Other-3 + +Files: newlib/libc/string/strverscmp.c + newlib/libm/common/nexttowardf.c +Copyright: 2005-2014 Rich Felker, et al. +License: Other-3 + +Files: test/libc-testsuite/basename.c + test/libc-testsuite/dirname.c + test/libc-testsuite/fnmatch.c + test/libc-testsuite/qsort.c + test/libc-testsuite/snprintf.c + test/libc-testsuite/sscanf.c + test/libc-testsuite/string.c + test/libc-testsuite/strtod.c + test/libc-testsuite/strtol.c + test/libc-testsuite/wcstol.c +Copyright: 2005-2020 Rich Felker +License: Other-3 + +Files: newlib/libc/include/getopt.h +Copyright: 1997 Gregory Pietsch +License: Other-4 + +Files: newlib/libc/include/machine/_arc4random.h + newlib/libc/stdlib/arc4random.c + newlib/libc/stdlib/chacha_private.h +Copyright: 1996, David Mazieres + 2008, Damien Miller + 2013, Markus Friedl + 2014, Theo de Raadt +License: Other-5 + +Files: newlib/libc/stdlib/arc4random_uniform.c +Copyright: 2008, Damien Miller +License: Other-5 + +Files: newlib/libc/stdlib/reallocarray.c +Copyright: 2008 Otto Moerbeek +License: Other-5 + +Files: newlib/libc/string/strlcat.c + newlib/libc/string/strlcpy.c + newlib/libc/string/wcslcat.c + newlib/libc/string/wcslcpy.c +Copyright: 1998, 2015 Todd C. Miller +License: Other-5 + +Files: newlib/libc/string/timingsafe_bcmp.c +Copyright: 2010 Damien Miller. +License: Other-5 + +Files: newlib/libc/string/timingsafe_memcmp.c +Copyright: 2014 Google Inc. +License: Other-5 + +Files: newlib/libm/ld/common/polevll.c + newlib/libm/ld/ld128/e_expl.c + newlib/libm/ld/ld128/e_lgammal_r.c + newlib/libm/ld/ld128/e_log10l.c + newlib/libm/ld/ld128/e_log2l.c + newlib/libm/ld/ld128/e_logl.c + newlib/libm/ld/ld128/s_expm1l.c + newlib/libm/ld/ld128/s_log1pl.c + newlib/libm/ld/ld80/e_expl.c + newlib/libm/ld/ld80/e_log10l.c + newlib/libm/ld/ld80/e_log2l.c + newlib/libm/ld/ld80/e_logl.c + newlib/libm/ld/ld80/e_powl.c + newlib/libm/ld/ld80/e_tgammal.c + newlib/libm/ld/ld80/s_expm1l.c + newlib/libm/ld/ld80/s_log1pl.c +Copyright: 2008 Stephen L. Moshier +License: Other-5 + +Files: newlib/libm/ld/ld128/e_tgammal.c +Copyright: 2011 Martynas Venckus +License: Other-5 + +Files: newlib/libc/include/machine/fastmath.h + newlib/libc/include/machine/ieeefp.h + newlib/libc/include/machine/setjmp.h + newlib/libc/include/machine/time.h + newlib/libc/include/machine/types.h + newlib/libc/machine/x86/setjmp-32.S +Copyright: 1991 DJ Delorie +License: Other-6 + +Files: newlib/libc/include/sched.h + newlib/libc/include/sys/sched.h +Copyright: 1989-2010. On-Line Applications Research Corporation (OAR). +License: Other-7 + +Files: newlib/libc/include/sys/features.h +Copyright: 1989-2014. On-Line Applications Research Corporation (OAR). +License: Other-7 + +Files: newlib/libc/string/strsignal.c +Copyright: 2010, 2017. On-Line Applications Research Corporation (OAR). +License: Other-7 + +Files: newlib/libc/machine/amdgcn/abort.c + newlib/libc/machine/amdgcn/atexit.c + newlib/libc/machine/amdgcn/getreent.c + newlib/libc/machine/amdgcn/signal.c +Copyright: 2014-2017 Mentor Graphics. +License: Other-8 + +Files: newlib/libc/machine/amdgcn/exit-value.h + newlib/libc/machine/amdgcn/mlock.c +Copyright: 2017 Mentor Graphics. +License: Other-8 + +Files: newlib/libc/machine/bfin/longjmp.S + newlib/libc/machine/bfin/setjmp.S +Copyright: 2006 Analog Devices, Inc. +License: Other-8 + +Files: newlib/libc/machine/cr16/getenv.c + newlib/libc/machine/cr16/sys/libh.h + newlib/libc/machine/cr16/sys/syscall.h + newlib/libc/machine/crx/getenv.c + newlib/libc/machine/crx/sys/asm.h + newlib/libc/machine/crx/sys/libh.h + newlib/libc/machine/crx/sys/syscall.h +Copyright: 2004 National Semiconductor Corporation +License: Other-8 + +Files: newlib/libc/machine/cr16/sys/asm.h +Copyright: 2012 National Semiconductor Corporation +License: Other-8 + +Files: newlib/libc/machine/ft32/memcpy.S + newlib/libc/machine/ft32/memset.S + newlib/libc/machine/ft32/setjmp.S + newlib/libc/machine/ft32/stpcmp.S + newlib/libc/machine/ft32/strcmp.S + newlib/libc/machine/ft32/strcpy.S + newlib/libc/machine/ft32/strlen.S +Copyright: 2014 FTDI (support@ftdichip.com) +License: Other-8 + +Files: newlib/libc/machine/m68hc11/setjmp.S +Copyright: 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr) +License: Other-8 + +Files: newlib/libc/machine/m68k/memcpy.S + newlib/libc/machine/m68k/memset.S +Copyright: 2007 mocom software GmbH & Co KG) +License: Other-8 + +Files: newlib/libc/machine/mips/strlen.c +Copyright: 2001, 2002 Red Hat, Inc. +License: Other-8 + +Files: newlib/libc/machine/mips/strncpy.c +Copyright: 2001 Red Hat, Inc. +License: Other-8 + +Files: newlib/libc/machine/moxie/setjmp.S +Copyright: 2009, 2019 Anthony Green +License: Other-8 + +Files: newlib/libc/machine/nvptx/_exit.c + newlib/libc/machine/nvptx/abort.c + newlib/libc/machine/nvptx/calloc.c + newlib/libc/machine/nvptx/callocr.c + newlib/libc/machine/nvptx/mallocr.c + newlib/libc/machine/nvptx/misc.c + newlib/libc/machine/nvptx/reallocr.c + newlib/libc/machine/nvptx/write.c +Copyright: 2014-2018 Mentor Graphics. +License: Other-8 + +Files: newlib/libc/machine/nvptx/assert.c + newlib/libc/machine/nvptx/free.c + newlib/libc/machine/nvptx/malloc.c + newlib/libc/machine/nvptx/realloc.c +Copyright: 2016-2018 Mentor Graphics. +License: Other-8 + +Files: newlib/libc/machine/nvptx/printf.c + newlib/libc/machine/nvptx/putchar.c + newlib/libc/machine/nvptx/puts.c +Copyright: 2015-2018 Mentor Graphics. +License: Other-8 + +Files: newlib/libc/machine/cris/include/pthread.h + newlib/libc/machine/cris/sys/errno.h + newlib/libc/machine/cris/sys/fcntl.h + newlib/libc/machine/cris/sys/signal.h +Copyright: 2001, 2004, 2005 Axis Communications AB. +License: Other-9 + +Files: newlib/libc/machine/cris/libcdtor.c +Copyright: 1999, 2000, 2003, 2004, 2005 Axis Communications. +License: Other-9 + +Files: newlib/libc/machine/cris/memcpy.c +Copyright: 1994-2005 Axis Communications. +License: Other-9 + +Files: newlib/libc/machine/cris/memmove.c +Copyright: 2000-2005 Axis Communications. +License: Other-9 + +Files: newlib/libc/machine/cris/memset.c +Copyright: 1999-2005 Axis Communications. +License: Other-9 + +Files: newlib/libc/machine/cris/setjmp.c +Copyright: 1993-2005 Axis Communications. +License: Other-9 + +Files: newlib/testsuite/newlib.string/memmove1.c +Copyright: 2005 Axis Communications. +License: Other-9 + +Files: newlib/libc/machine/hppa/memchr.S + newlib/libc/machine/hppa/memcmp.S + newlib/libc/machine/hppa/memcpy.S + newlib/libc/machine/hppa/memset.S + newlib/libc/machine/hppa/pcc_prefix.s + newlib/libc/machine/hppa/strcat.S + newlib/libc/machine/hppa/strcmp.S + newlib/libc/machine/hppa/strcpy.S + newlib/libc/machine/hppa/strlen.S + newlib/libc/machine/hppa/strncat.S + newlib/libc/machine/hppa/strncmp.S + newlib/libc/machine/hppa/strncpy.S +Copyright: 1986 HEWLETT-PACKARD COMPANY +License: Other-10 + +Files: newlib/libc/machine/i960/memccpy.S + newlib/libc/machine/i960/memccpy_ca.S + newlib/libc/machine/i960/memchr.S + newlib/libc/machine/i960/memchr_ca.S + newlib/libc/machine/i960/memcmp.S + newlib/libc/machine/i960/memcmp_ca.S + newlib/libc/machine/i960/memcpy.S + newlib/libc/machine/i960/memcpy_ca.S + newlib/libc/machine/i960/memset.S + newlib/libc/machine/i960/setjmp.S + newlib/libc/machine/i960/strchr.S + newlib/libc/machine/i960/strchr_ca.S + newlib/libc/machine/i960/strcmp.S + newlib/libc/machine/i960/strcmp_ca.S + newlib/libc/machine/i960/strcpy.S + newlib/libc/machine/i960/strcpy_ca.S + newlib/libc/machine/i960/strcspn.S + newlib/libc/machine/i960/strdup.S + newlib/libc/machine/i960/strlen.S + newlib/libc/machine/i960/strlen_ca.S + newlib/libc/machine/i960/strncat.S + newlib/libc/machine/i960/strncat_ca.S + newlib/libc/machine/i960/strncmp.S + newlib/libc/machine/i960/strncmp_ca.S + newlib/libc/machine/i960/strncpy.S + newlib/libc/machine/i960/strncpy_ca.S + newlib/libc/machine/i960/strpbrk.S + newlib/libc/machine/i960/strrchr.S +Copyright: 1993 Intel Corporation +License: Other-11 + +Files: newlib/libc/machine/msp430/setjmp.S +Copyright: 2013 Red Hat, Inc. +License: Other-12 + +Files: newlib/libc/machine/tic4x/setjmp.S +Copyright: 2004 Michael Hayes . +License: Other-13 + +Files: newlib/libc/machine/xc16x/putchar.c + newlib/libc/machine/xc16x/puts.c + newlib/libc/machine/xc16x/setjmp.S +Copyright: 2006 KPIT Cummins + 2009 Conny Marco Menebröcker +License: Other-14 + +Files: newlib/libc/machine/z8k/memcmp.S + newlib/libc/machine/z8k/memcpy.S + newlib/libc/machine/z8k/memmove.S + newlib/libc/machine/z8k/memset.S +Copyright: 2004 Christian Groessler +License: Other-15 + +Files: newlib/libc/misc/fini.c +Copyright: 2010 CodeSourcery, Inc. +License: Other-15 + +Files: newlib/libc/misc/init.c +Copyright: 2004 CodeSourcery, LLC +License: Other-15 + +Files: newlib/libc/signal/signal.c + newlib/libc/signal/signal.tex + newlib/libc/string/bcmp.c + newlib/libc/string/bcopy.c + newlib/libc/string/bzero.c + newlib/libc/string/index.c + newlib/libc/string/memchr.c + newlib/libc/string/memcmp.c + newlib/libc/string/memcpy.c + newlib/libc/string/memmove.c + newlib/libc/string/memset.c + newlib/libc/string/rindex.c + newlib/libc/string/strcasecmp.c + newlib/libc/string/strcat.c + newlib/libc/string/strchr.c + newlib/libc/string/strcmp.c + newlib/libc/string/strcoll.c + newlib/libc/string/strcpy.c + newlib/libc/string/strcspn.c + newlib/libc/string/strerror.c + newlib/libc/string/strings.tex + newlib/libc/string/strlen.c + newlib/libc/string/strlwr.c + newlib/libc/string/strncasecmp.c + newlib/libc/string/strncat.c + newlib/libc/string/strncmp.c + newlib/libc/string/strncpy.c + newlib/libc/string/strpbrk.c + newlib/libc/string/strrchr.c + newlib/libc/string/strspn.c + newlib/libc/string/strtok.c + newlib/libc/string/strupr.c + newlib/libc/string/strxfrm.c + newlib/libc/time/asctime.c + newlib/libc/time/asctime_r.c + newlib/libc/time/clock.c + newlib/libc/time/ctime.c + newlib/libc/time/ctime_r.c + newlib/libc/time/difftime.c + newlib/libc/time/gmtime.c + newlib/libc/time/gmtime_r.c + newlib/libc/time/lcltime.c + newlib/libc/time/lcltime_buf.c + newlib/libc/time/lcltime_r.c + newlib/libc/time/mktime.c + newlib/libc/time/time.c + newlib/libc/time/time.tex + newlib/libm/test/acos_vec.c + newlib/libm/test/acosf_vec.c + newlib/libm/test/acosh_vec.c + newlib/libm/test/acoshf_vec.c + newlib/libm/test/asin_vec.c + newlib/libm/test/asinf_vec.c + newlib/libm/test/asinh_vec.c + newlib/libm/test/asinhf_vec.c + newlib/libm/test/atan2_vec.c + newlib/libm/test/atan2f_vec.c + newlib/libm/test/atan_vec.c + newlib/libm/test/atanf_vec.c + newlib/libm/test/atanh_vec.c + newlib/libm/test/atanhf_vec.c + newlib/libm/test/ceil_vec.c + newlib/libm/test/ceilf_vec.c + newlib/libm/test/conv_vec.c + newlib/libm/test/convert.c + newlib/libm/test/cos_vec.c + newlib/libm/test/cosf_vec.c + newlib/libm/test/cosh_vec.c + newlib/libm/test/coshf_vec.c + newlib/libm/test/dcvt.c + newlib/libm/test/dvec.c + newlib/libm/test/erf_vec.c + newlib/libm/test/erfc_vec.c + newlib/libm/test/erfcf_vec.c + newlib/libm/test/erff_vec.c + newlib/libm/test/exp_vec.c + newlib/libm/test/expf_vec.c + newlib/libm/test/fabs_vec.c + newlib/libm/test/fabsf_vec.c + newlib/libm/test/floor_vec.c + newlib/libm/test/floorf_vec.c + newlib/libm/test/fmod_vec.c + newlib/libm/test/fmodf_vec.c + newlib/libm/test/gamma_vec.c + newlib/libm/test/gammaf_vec.c + newlib/libm/test/hypot_vec.c + newlib/libm/test/hypotf_vec.c + newlib/libm/test/iconv_vec.c + newlib/libm/test/j0_vec.c + newlib/libm/test/j0f_vec.c + newlib/libm/test/j1_vec.c + newlib/libm/test/j1f_vec.c + newlib/libm/test/jn_vec.c + newlib/libm/test/jnf_vec.c + newlib/libm/test/log10_vec.c + newlib/libm/test/log10f_vec.c + newlib/libm/test/log1p_vec.c + newlib/libm/test/log1pf_vec.c + newlib/libm/test/log2_vec.c + newlib/libm/test/log2f_vec.c + newlib/libm/test/log_vec.c + newlib/libm/test/logf_vec.c + newlib/libm/test/math.c + newlib/libm/test/math2.c + newlib/libm/test/sin_vec.c + newlib/libm/test/sinf_vec.c + newlib/libm/test/sinh_vec.c + newlib/libm/test/sinhf_vec.c + newlib/libm/test/sprint_ivec.c + newlib/libm/test/sprint_vec.c + newlib/libm/test/sqrt_vec.c + newlib/libm/test/sqrtf_vec.c + newlib/libm/test/string.c + newlib/libm/test/tan_vec.c + newlib/libm/test/tanf_vec.c + newlib/libm/test/tanh_vec.c + newlib/libm/test/tanhf_vec.c + newlib/libm/test/test.c + newlib/libm/test/test.h + newlib/libm/test/test_ieee.c + newlib/libm/test/test_is.c + newlib/libm/test/trunc_vec.c + newlib/libm/test/truncf_vec.c + newlib/libm/test/y0_vec.c + newlib/libm/test/y0f_vec.c + newlib/libm/test/y1_vec.c + newlib/libm/test/y1f_vec.c + newlib/libm/test/yn_vec.c + newlib/libm/test/ynf_vec.c +Copyright: 1994 Cygnus Support. +License: Other-16 + +Files: newlib/libc/stdio/vfieeefp.h + newlib/libc/stdlib/dtoa.c + newlib/libc/stdlib/mprec.c + newlib/libc/stdlib/mprec.h +Copyright: 1991 AT&T. +License: Other-17 + +Files: newlib/libc/stdlib/drand48.c + newlib/libc/stdlib/erand48.c + newlib/libc/stdlib/jrand48.c + newlib/libc/stdlib/lcong48.c + newlib/libc/stdlib/lrand48.c + newlib/libc/stdlib/mrand48.c + newlib/libc/stdlib/nrand48.c + newlib/libc/stdlib/rand48.c + newlib/libc/stdlib/rand48.h + newlib/libc/stdlib/seed48.c + newlib/libc/stdlib/srand48.c +Copyright: 1993 Martin Birgmeier +License: Other-18 + +Files: newlib/libc/stdlib/gdtoa-gethex.c + newlib/libc/stdlib/gdtoa.h +Copyright: 1998 Lucent Technologies +License: Other-19 + +Files: newlib/libc/stdlib/gdtoa-hexnan.c +Copyright: 2000 Lucent Technologies +License: Other-19 + +Files: newlib/libc/stdlib/strtod.c + newlib/libc/stdlib/strtodg.c +Copyright: 1998-2001 Lucent Technologies +License: Other-19 + +Files: newlib/libc/stdlib/strtorx.c +Copyright: 1998, 2000 Lucent Technologies +License: Other-19 + +Files: newlib/libc/stdlib/getopt.c +Copyright: 1997 Gregory Pietsch +License: Other-20 + +Files: newlib/libc/stdlib/ldtoa.c +Copyright: 1984,2000 S.L. Moshier +License: Other-21 + +Files: newlib/libc/string/wcsnlen.c +Copyright: 2003, Artem B. Bityuckiy (dedekind@mail.ru). +License: Other-22 + +Files: newlib/libc/tinystdio/atod_ryu.c + newlib/libc/tinystdio/atof_ryu.c + newlib/libc/tinystdio/ryu/ryu_parse.h +Copyright: 2019 Ulf Adams +License: Other-23 + +Files: newlib/libc/tinystdio/dtoa_ryu.c + newlib/libc/tinystdio/ftoa_ryu.c + newlib/libc/tinystdio/ryu/common.h + newlib/libc/tinystdio/ryu/d2s_intrinsics.h + newlib/libc/tinystdio/ryu/digit_table.h + newlib/libc/tinystdio/ryu/f2s_intrinsics.h + newlib/libc/tinystdio/ryu/ryu.h + newlib/libc/tinystdio/ryu_divpow2.c + newlib/libc/tinystdio/ryu_log10.c + newlib/libc/tinystdio/ryu_log2pow5.c + newlib/libc/tinystdio/ryu_pow5bits.c + newlib/libc/tinystdio/ryu_table.c + newlib/libc/tinystdio/ryu_umul128.c +Copyright: 2018 Ulf Adams +License: Other-23 + +Files: newlib/libc/xdr/xdr_private.c + newlib/libc/xdr/xdr_private.h +Copyright: 2009 Charles S. Wilson +License: Other-24 + +Files: newlib/libm/common/fdlibm.h + newlib/libm/common/isgreater.c + newlib/libm/common/s_cbrt.c + newlib/libm/common/s_copysign.c + newlib/libm/common/s_exp10.c + newlib/libm/common/s_expm1.c + newlib/libm/common/s_finite.c + newlib/libm/common/s_ilogb.c + newlib/libm/common/s_infinity.c + newlib/libm/common/s_isinf.c + newlib/libm/common/s_isnan.c + newlib/libm/common/s_llrint.c + newlib/libm/common/s_llround.c + newlib/libm/common/s_log1p.c + newlib/libm/common/s_log2.c + newlib/libm/common/s_logb.c + newlib/libm/common/s_lrint.c + newlib/libm/common/s_lround.c + newlib/libm/common/s_modf.c + newlib/libm/common/s_nan.c + newlib/libm/common/s_nearbyint.c + newlib/libm/common/s_nextafter.c + newlib/libm/common/s_pow10.c + newlib/libm/common/s_rint.c + newlib/libm/common/s_round.c + newlib/libm/common/s_scalbln.c + newlib/libm/common/s_scalbn.c + newlib/libm/common/s_trunc.c + newlib/libm/common/sf_cbrt.c + newlib/libm/common/sf_copysign.c + newlib/libm/common/sf_exp10.c + newlib/libm/common/sf_expm1.c + newlib/libm/common/sf_finite.c + newlib/libm/common/sf_ilogb.c + newlib/libm/common/sf_infinity.c + newlib/libm/common/sf_isinf.c + newlib/libm/common/sf_isnan.c + newlib/libm/common/sf_llrint.c + newlib/libm/common/sf_llround.c + newlib/libm/common/sf_log1p.c + newlib/libm/common/sf_logb.c + newlib/libm/common/sf_lrint.c + newlib/libm/common/sf_lround.c + newlib/libm/common/sf_modf.c + newlib/libm/common/sf_nan.c + newlib/libm/common/sf_nearbyint.c + newlib/libm/common/sf_nextafter.c + newlib/libm/common/sf_pow10.c + newlib/libm/common/sf_rint.c + newlib/libm/common/sf_round.c + newlib/libm/common/sf_scalbln.c + newlib/libm/common/sf_scalbn.c + newlib/libm/common/sf_trunc.c + newlib/libm/ld/common/s_atanl.c + newlib/libm/ld/common/s_ilogbl.c + newlib/libm/ld/common/s_logbl.c + newlib/libm/ld/common/s_scalbnl.c + newlib/libm/ld/ld128/e_acoshl.c + newlib/libm/ld/ld128/e_atanhl.c + newlib/libm/ld/ld128/e_coshl.c + newlib/libm/ld/ld128/e_fmodl.c + newlib/libm/ld/ld128/e_hypotl.c + newlib/libm/ld/ld128/e_powl.c + newlib/libm/ld/ld128/e_sinhl.c + newlib/libm/ld/ld128/s_asinhl.c + newlib/libm/ld/ld128/s_ceill.c + newlib/libm/ld/ld128/s_copysignl.c + newlib/libm/ld/ld128/s_erfl.c + newlib/libm/ld/ld128/s_floorl.c + newlib/libm/ld/ld128/s_modfl.c + newlib/libm/ld/ld128/s_nextafterl.c + newlib/libm/ld/ld128/s_nexttoward.c + newlib/libm/ld/ld128/s_nexttowardf.c + newlib/libm/ld/ld128/s_tanhl.c + newlib/libm/ld/ld128/s_truncl.c + newlib/libm/ld/ld80/e_acoshl.c + newlib/libm/ld/ld80/e_atanhl.c + newlib/libm/ld/ld80/e_coshl.c + newlib/libm/ld/ld80/e_hypotl.c + newlib/libm/ld/ld80/e_lgammal_r.c + newlib/libm/ld/ld80/e_sinhl.c + newlib/libm/ld/ld80/s_asinhl.c + newlib/libm/ld/ld80/s_ceill.c + newlib/libm/ld/ld80/s_copysignl.c + newlib/libm/ld/ld80/s_erfl.c + newlib/libm/ld/ld80/s_floorl.c + newlib/libm/ld/ld80/s_modfl.c + newlib/libm/ld/ld80/s_nextafterl.c + newlib/libm/ld/ld80/s_nexttoward.c + newlib/libm/ld/ld80/s_nexttowardf.c + newlib/libm/ld/ld80/s_tanhl.c + newlib/libm/ld/ld80/s_truncl.c + newlib/libm/ld/math_private_openbsd.h + newlib/libm/math/k_cos.c + newlib/libm/math/k_rem_pio2.c + newlib/libm/math/k_sin.c + newlib/libm/math/k_tan.c + newlib/libm/math/kf_cos.c + newlib/libm/math/kf_rem_pio2.c + newlib/libm/math/kf_sin.c + newlib/libm/math/kf_tan.c + newlib/libm/math/math.tex + newlib/libm/math/s_acos.c + newlib/libm/math/s_acosh.c + newlib/libm/math/s_asin.c + newlib/libm/math/s_asinh.c + newlib/libm/math/s_atan.c + newlib/libm/math/s_atan2.c + newlib/libm/math/s_atanh.c + newlib/libm/math/s_ceil.c + newlib/libm/math/s_cos.c + newlib/libm/math/s_cosh.c + newlib/libm/math/s_drem.c + newlib/libm/math/s_erf.c + newlib/libm/math/s_exp.c + newlib/libm/math/s_exp2.c + newlib/libm/math/s_fabs.c + newlib/libm/math/s_floor.c + newlib/libm/math/s_fmod.c + newlib/libm/math/s_frexp.c + newlib/libm/math/s_gamma.c + newlib/libm/math/s_hypot.c + newlib/libm/math/s_j0.c + newlib/libm/math/s_j1.c + newlib/libm/math/s_jn.c + newlib/libm/math/s_log.c + newlib/libm/math/s_log10.c + newlib/libm/math/s_pow.c + newlib/libm/math/s_rem_pio2.c + newlib/libm/math/s_remainder.c + newlib/libm/math/s_scalb.c + newlib/libm/math/s_signif.c + newlib/libm/math/s_sin.c + newlib/libm/math/s_sinh.c + newlib/libm/math/s_sqrt.c + newlib/libm/math/s_tan.c + newlib/libm/math/s_tanh.c + newlib/libm/math/s_tgamma.c + newlib/libm/math/sf_acos.c + newlib/libm/math/sf_acosh.c + newlib/libm/math/sf_asin.c + newlib/libm/math/sf_asinh.c + newlib/libm/math/sf_atan.c + newlib/libm/math/sf_atan2.c + newlib/libm/math/sf_atanh.c + newlib/libm/math/sf_ceil.c + newlib/libm/math/sf_cos.c + newlib/libm/math/sf_cosh.c + newlib/libm/math/sf_drem.c + newlib/libm/math/sf_erf.c + newlib/libm/math/sf_exp.c + newlib/libm/math/sf_exp2.c + newlib/libm/math/sf_fabs.c + newlib/libm/math/sf_floor.c + newlib/libm/math/sf_fmod.c + newlib/libm/math/sf_frexp.c + newlib/libm/math/sf_gamma.c + newlib/libm/math/sf_hypot.c + newlib/libm/math/sf_j0.c + newlib/libm/math/sf_j1.c + newlib/libm/math/sf_jn.c + newlib/libm/math/sf_lgamma.c + newlib/libm/math/sf_log.c + newlib/libm/math/sf_log10.c + newlib/libm/math/sf_log2.c + newlib/libm/math/sf_pow.c + newlib/libm/math/sf_rem_pio2.c + newlib/libm/math/sf_remainder.c + newlib/libm/math/sf_scalb.c + newlib/libm/math/sf_signif.c + newlib/libm/math/sf_sin.c + newlib/libm/math/sf_sinh.c + newlib/libm/math/sf_sqrt.c + newlib/libm/math/sf_tan.c + newlib/libm/math/sf_tanh.c + newlib/libm/math/sf_tgamma.c + newlib/libm/math/sr_lgamma.c + newlib/libm/math/srf_lgamma.c +Copyright: 1993 Sun Microsystems, Inc. +License: Other-25 + +Files: newlib/libm/common/s_remquo.c + newlib/libm/common/sf_remquo.c + newlib/libm/ld/common/e_acosl.c + newlib/libm/ld/common/e_asinl.c + newlib/libm/ld/common/e_atan2l.c + newlib/libm/ld/common/e_lgammal.c + newlib/libm/ld/common/k_rem_pio2.c + newlib/libm/ld/ld128/s_remquol.c + newlib/libm/ld/ld80/e_fmodl.c + newlib/libm/ld/ld80/s_remquol.c +Copyright: 1993 Sun Microsystems, Inc. +License: Other-26 + +Files: newlib/libm/ld/common/s_cbrtl.c +Copyright: 1993 Sun Microsystems, Inc. +License: Other-27 + +Files: newlib/libm/ld/ld128/e_rem_pio2l.h + newlib/libm/ld/ld80/e_rem_pio2l.h +Copyright: 1993 Sun Microsystems, Inc. +License: Other-28 + +Files: newlib/libm/ld/ld128/k_cosl.c + newlib/libm/ld/ld128/k_sinl.c + newlib/libm/ld/ld80/k_cosl.c + newlib/libm/ld/ld80/k_sinl.c +Copyright: 1993 Sun Microsystems, Inc. +License: Other-29 + +Files: newlib/libm/ld/ld128/k_tanl.c + newlib/libm/ld/ld80/k_tanl.c +Copyright: 2004 Sun Microsystems, Inc. +License: Other-30 + +Files: newlib/libm/machine/x86/f_llrint.c + newlib/libm/machine/x86/f_llrintf.c + newlib/libm/machine/x86/f_llrintl.c + newlib/libm/machine/x86/f_lrint.c + newlib/libm/machine/x86/f_lrintf.c + newlib/libm/machine/x86/f_lrintl.c + newlib/libm/machine/x86/f_rint.c + newlib/libm/machine/x86/f_rintf.c + newlib/libm/machine/x86/f_rintl.c +Copyright: 2007 Dave Korn +License: Other-31 + +Files: newlib/libc/machine/d10v/setjmp.S + newlib/libc/machine/d30v/setjmp.S + newlib/libc/machine/fr30/setjmp.S + newlib/libc/machine/h8300/defines.h + newlib/libc/machine/h8300/memcpy.S + newlib/libc/machine/h8300/memset.S + newlib/libc/machine/h8300/reg_memcpy.S + newlib/libc/machine/h8300/reg_memset.S + newlib/libc/machine/h8300/setjmp.S + newlib/libc/machine/h8300/strcmp.S + newlib/libc/machine/h8500/cmpsi.c + newlib/libc/machine/h8500/divhi3.S + newlib/libc/machine/h8500/divsi3.c + newlib/libc/machine/h8500/mulhi3.c + newlib/libc/machine/h8500/mulsi3.c + newlib/libc/machine/h8500/negsi2.c + newlib/libc/machine/h8500/psi.S + newlib/libc/machine/h8500/setjmp.S + newlib/libc/machine/h8500/shifts.c + newlib/libc/machine/hppa/DEFS.h + newlib/libc/machine/m32r/setjmp.S + newlib/libc/machine/m68k/setjmp.S + newlib/libc/machine/m68k/strcpy.c + newlib/libc/machine/m68k/strlen.c + newlib/libc/machine/m88k/setjmp.S + newlib/libc/machine/mips/setjmp.S + newlib/libc/machine/mn10200/setjmp.S + newlib/libc/machine/mn10300/memchr.S + newlib/libc/machine/mn10300/memcmp.S + newlib/libc/machine/mn10300/memcpy.S + newlib/libc/machine/mn10300/memset.S + newlib/libc/machine/mn10300/setjmp.S + newlib/libc/machine/mn10300/strchr.S + newlib/libc/machine/mn10300/strcmp.S + newlib/libc/machine/mn10300/strcpy.S + newlib/libc/machine/mn10300/strlen.S + newlib/libc/machine/necv70/fastmath.S + newlib/libc/machine/necv70/machine/registers.h + newlib/libc/machine/necv70/setjmp.S + newlib/libc/machine/powerpc/setjmp.S + newlib/libc/machine/sh/asm.h + newlib/libc/machine/sh/setjmp.S + newlib/libc/machine/sparc/machine/sparclet.h + newlib/libc/machine/sparc/scan.c + newlib/libc/machine/sparc/shuffle.c + newlib/libc/machine/tic80/setjmp.S + newlib/libc/machine/v850/setjmp.S + newlib/libc/machine/w65/cmpsi.c + newlib/libc/machine/w65/divsi3.c + newlib/libc/machine/w65/lshrhi.S + newlib/libc/machine/w65/mulsi3.c + newlib/libc/machine/w65/sdivhi3.S + newlib/libc/machine/w65/smulhi3.S + newlib/libc/machine/w65/udivhi3.S + newlib/libc/machine/w65/umodhi3.S + newlib/libc/machine/x86/i386mach.h + newlib/libc/machine/z8k/args.h + newlib/libc/machine/z8k/setjmp.S + newlib/libc/stdio/asiprintf.c + newlib/libc/stdio/clearerr.c + newlib/libc/stdio/fclose.c + newlib/libc/stdio/fcloseall.c + newlib/libc/stdio/fdopen.c + newlib/libc/stdio/feof.c + newlib/libc/stdio/ferror.c + newlib/libc/stdio/fflush.c + newlib/libc/stdio/fgetc.c + newlib/libc/stdio/fgetpos.c + newlib/libc/stdio/fgets.c + newlib/libc/stdio/fileno.c + newlib/libc/stdio/findfp.c + newlib/libc/stdio/fiprintf.c + newlib/libc/stdio/fiscanf.c + newlib/libc/stdio/floatio.h + newlib/libc/stdio/fopen.c + newlib/libc/stdio/fprintf.c + newlib/libc/stdio/fputc.c + newlib/libc/stdio/fputs.c + newlib/libc/stdio/fscanf.c + newlib/libc/stdio/fseek.c + newlib/libc/stdio/fseeko.c + newlib/libc/stdio/fsetpos.c + newlib/libc/stdio/ftell.c + newlib/libc/stdio/ftello.c + newlib/libc/stdio/fvwrite.c + newlib/libc/stdio/fwalk.c + newlib/libc/stdio/fwprintf.c + newlib/libc/stdio/fwrite.c + newlib/libc/stdio/fwscanf.c + newlib/libc/stdio/getc.c + newlib/libc/stdio/getc_u.c + newlib/libc/stdio/getchar.c + newlib/libc/stdio/getchar_u.c + newlib/libc/stdio/gets.c + newlib/libc/stdio/getw.c + newlib/libc/stdio/iprintf.c + newlib/libc/stdio/iscanf.c + newlib/libc/stdio/nano-vfscanf.c + newlib/libc/stdio/nano-vfscanf_float.c + newlib/libc/stdio/nano-vfscanf_local.h + newlib/libc/stdio/perror.c + newlib/libc/stdio/printf.c + newlib/libc/stdio/putc.c + newlib/libc/stdio/putc_u.c + newlib/libc/stdio/putchar.c + newlib/libc/stdio/putchar_u.c + newlib/libc/stdio/puts.c + newlib/libc/stdio/putw.c + newlib/libc/stdio/refill.c + newlib/libc/stdio/remove.c + newlib/libc/stdio/rewind.c + newlib/libc/stdio/rget.c + newlib/libc/stdio/scanf.c + newlib/libc/stdio/sccl.c + newlib/libc/stdio/setbuf.c + newlib/libc/stdio/setbuffer.c + newlib/libc/stdio/setlinebuf.c + newlib/libc/stdio/setvbuf.c + newlib/libc/stdio/siprintf.c + newlib/libc/stdio/siscanf.c + newlib/libc/stdio/sprintf.c + newlib/libc/stdio/sscanf.c + newlib/libc/stdio/stdio.c + newlib/libc/stdio/stdio.h + newlib/libc/stdio/stdio.tex + newlib/libc/stdio/swscanf.c + newlib/libc/stdio/sys/stdio.h + newlib/libc/stdio/tmpfile.c + newlib/libc/stdio/tmpnam.c + newlib/libc/stdio/ungetc.c + newlib/libc/stdio/vfscanf.c + newlib/libc/stdio/vfwscanf.c + newlib/libc/stdio/viprintf.c + newlib/libc/stdio/viscanf.c + newlib/libc/stdio/vprintf.c + newlib/libc/stdio/vscanf.c + newlib/libc/stdio/vsiprintf.c + newlib/libc/stdio/vsiscanf.c + newlib/libc/stdio/vsnprintf.c + newlib/libc/stdio/vsprintf.c + newlib/libc/stdio/vsscanf.c + newlib/libc/stdio/vswprintf.c + newlib/libc/stdio/vswscanf.c + newlib/libc/stdio/vwprintf.c + newlib/libc/stdio/vwscanf.c + newlib/libc/stdio/wbuf.c + newlib/libc/stdio/wbufw.c + newlib/libc/stdio/wprintf.c + newlib/libc/stdio/wscanf.c + newlib/libc/stdio64/fgetpos64.c + newlib/libc/stdio64/fopen64.c + newlib/libc/stdio64/freopen64.c + newlib/libc/stdio64/fseeko64.c + newlib/libc/stdio64/fsetpos64.c + newlib/libc/stdio64/ftello64.c + newlib/libc/stdio64/stdio64.c + newlib/libc/stdio64/stdio64.tex + newlib/libc/stdio64/tmpfile64.c + newlib/libc/tinystdio/fgetpos.c + newlib/libc/tinystdio/fsetpos.c +Copyright: 1990 The Regents of the University of California. +License: UCB-1 + +Files: newlib/libc/stdio/asprintf.c + newlib/libc/stdio/fread.c + newlib/libc/stdio/freopen.c + newlib/libc/stdio/fvwrite.h + newlib/libc/stdio/local.h + newlib/libc/stdio/makebuf.c + newlib/libc/stdio/sniprintf.c + newlib/libc/stdio/snprintf.c + newlib/libc/stdio/swprintf.c + newlib/libc/stdio/vasiprintf.c + newlib/libc/stdio/vasprintf.c + newlib/libc/stdio/vsniprintf.c + newlib/libc/stdio/wsetup.c +Copyright: 1990, 2007 The Regents of the University of California. +License: UCB-1 + +Files: newlib/libc/stdio/flags.c + newlib/libc/tinystdio/sflags.c +Copyright: 1990 Regents of the University of California. +License: UCB-1 + +Files: newlib/libc/stdio/mktemp.c + newlib/libc/stdlib/setenv.c + newlib/libc/tinystdio/mktemp.c +Copyright: 1987 Regents of the University of California. +License: UCB-2 + +Files: newlib/libc/stdlib/getenv.c +Copyright: 1987, 2000 Regents of the University of California. +License: UCB-2 + +Files: newlib/libc/stdlib/putenv.c +Copyright: 1988 The Regents of the University of California. +License: UCB-2 + +License: AGPL3-1 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + . + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +License: BSD2-1 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD2-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-3 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-4 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-5 + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + . + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-6 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + +License: BSD2-7 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + TENSILICA INCORPORATED BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-8 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD2-9 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD2-10 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-11 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice unmodified, this list of conditions, and the following + disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD2-12 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-1 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + . + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-3 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-4 + c) UNIX System Laboratories, Inc. + All or some portions of this file are derived from material licensed + to the University of California by American Telephone and Telegraph + Co. or Unix System Laboratories, Inc. and are reproduced herein with + the permission of UNIX System Laboratories, Inc. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-5 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-6 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + Neither the name of Sun Microsystems, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-7 + c) UNIX System Laboratories, Inc. + All or some portions of this file are derived from material licensed + to the University of California by American Telephone and Telegraph + Co. or Unix System Laboratories, Inc. and are reproduced herein with + the permission of UNIX System Laboratories, Inc. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-8 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-9 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the name of the Linaro nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-10 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the name of the company nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-11 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + 1) Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + 2) Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + 3) Neither the name of the Synopsys, Inc., nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-12 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + Neither the name of Linaro Limited nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-13 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + . + Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-14 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the name of Adapteva nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-15 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-16 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + . + 1. Redistributions source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + 3. Neither the name of Xilinx nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-17 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above + copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with + the distribution. + Neither the name of MIPS Technologies Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-18 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the MIPS Technologies, Inc., nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-19 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the MIPS Technologies, Inc., nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY IMAGINATION TECHNOLOGIES LIMITED ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL IMAGINATION TECHNOLOGIES LIMITED BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-20 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-21 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + o Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + o Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + o Neither the name of Altera Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY ALTERA CORPORATION, THE COPYRIGHT HOLDER, + AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-22 + This software was developed by the Computer Systems Engineering group + at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + contributed to Berkeley. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-23 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the name of IBM nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-24 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the names of Toshiba nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-25 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-26 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + . + Neither the name of Texas Instruments Incorporated nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-27 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the name of Rolls-Royce Controls and Data Services Limited nor + the names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-28 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-29 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-30 + SPDX-License-Identifier: BSD-3-Clause + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-31 + Portions of this software were developed by David Chisnall + under sponsorship from the FreeBSD Foundation. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD3-32 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + 3. Neither the name of KTH nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-33 + Rewritten in C by Soren Kuula + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-34 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + Neither the name of Mentor Graphics nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL CODESOURCERY BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-35 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer + in this position and unchanged. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD3-36 + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the + following conditions are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + . + Neither the name of IBM Corporation nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: Default-1 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + . + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +License: FreeBSD-1 + This copyrighted material is made available to anyone wishing to use, + modify, copy, or redistribute it subject to the terms and conditions + of the FreeBSD License. This program is distributed in the hope that + it will be useful, but WITHOUT ANY WARRANTY expressed or implied, + including the implied warranties of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. A copy of this license is available at + http://www.opensource.org/licenses. + +License: GPL2-1 + This program is licensed under the GPL version 2 or later. + Please see the file COPYING.GPL2 in this distribution for + license terms. + +License: Other-1 + Permission to use, copy, modify, and distribute this software + is freely granted, provided that this notice is preserved. + +License: Other-2 + Public domain. + +License: Other-3 + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License: Other-4 + This file and the accompanying getopt.c implementation file are hereby + placed in the public domain without restrictions. Just give the author + credit, don't claim you wrote it or prevent anyone else from using it. + . + Gregory Pietsch's current e-mail address: + gpietsch@comcast.net + +License: Other-5 + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +License: Other-6 + Redistribution, modification, and use in source and binary forms is permitted + provided that the above copyright notice and following paragraph are + duplicated in all such forms. + . + This file is distributed WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +License: Other-7 + Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software. + . + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION + OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS + SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +License: Other-8 + The authors hereby grant permission to use, copy, modify, distribute, + and license this software and its documentation for any purpose, provided + that existing copyright notices are retained in all copies and that this + notice is included verbatim in any distributions. No written agreement, + license, or royalty fee is required for any of the authorized uses. + Modifications to this software may be copyrighted by their authors + and need not follow the licensing terms described here, provided that + the new terms are clearly indicated on the first page of each file where + they apply. + +License: Other-9 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Neither the name of Axis Communications nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS + AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS + COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: Other-10 + To anyone who acknowledges that this file is provided "AS IS" + without any express or implied warranty: + permission to use, copy, modify, and distribute this file + for any purpose is hereby granted without fee, provided that + the above copyright notice and this notice appears in all + copies, and that the name of Hewlett-Packard Company not be + used in advertising or publicity pertaining to distribution + of the software without specific, written prior permission. + Hewlett-Packard Company makes no representations about the + suitability of this software for any purpose. + +License: Other-11 + Intel hereby grants you permission to copy, modify, and distribute this + software and its documentation. Intel grants this permission provided + that the above copyright notice appears in all copies and that both the + copyright notice and this permission notice appear in supporting + documentation. In addition, Intel grants this permission provided that + you prominently mark as "not part of the original" any modifications + made to this software or documentation, and that the name of Intel + Corporation not be used in advertising or publicity pertaining to + distribution of the software or the documentation without specific, + written prior permission. + . + Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY + +License: Other-12 + This copyrighted material is made available to anyone wishing to use, + modify, copy, or redistribute it subject to the terms and conditions + of the BSD License. This program is distributed in the hope that + it will be useful, but WITHOUT ANY WARRANTY expressed or implied, + including the implied warranties of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. A copy of this license is available at + http://www.opensource.org/licenses. Any Red Hat trademarks that are + incorporated in the source code or documentation are not subject to + the BSD License and may only be used or replicated with the express + permission of Red Hat, Inc. + +License: Other-13 + The author hereby grant permission to use, copy, modify, distribute, + and license this software and its documentation for any purpose, provided + that existing copyright notices are retained in all copies and that this + notice is included verbatim in any distributions. No written agreement, + license, or royalty fee is required for any of the authorized uses. + Modifications to this software may be copyrighted by their authors + and need not follow the licensing terms described here, provided that + the new terms are clearly indicated on the first page of each file where + they apply. + +License: Other-14 + Redistribution and use in source and binary forms is permitted + provided that the above copyright notice and following paragraph are + duplicated in all such forms. + . + This file is distributed WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +License: Other-15 + Permission to use, copy, modify, and distribute this file + for any purpose is hereby granted without fee, provided that + the above copyright notice and this notice appears in all + copies. + . + This file is distributed WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +License: Other-16 + Redistribution and use in source and binary forms are permitted + provided that the above copyright notice and this paragraph are + duplicated in all such forms and that any documentation, + and/or other materials related to such + distribution and use acknowledge that the software was developed + at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to + endorse or promote products derived from this software without + specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +License: Other-17 + Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software and in all copies of the supporting + documentation for such software. + . + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY + REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +License: Other-18 + You may redistribute unmodified or modified versions of this source + code provided that the above copyright notice and this and the + following conditions are retained. + . + This software is provided ``as is'', and comes with no warranties + of any kind. I shall in no event be liable for anything that happens + to anyone/anything when using this software. + +License: Other-19 + Permission to use, copy, modify, and distribute this software and + its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of Lucent or any of its entities + not be used in advertising or publicity pertaining to + distribution of the software without specific, written prior + permission. + . + LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + +License: Other-20 + This file and the accompanying getopt.h header file are hereby placed in the + public domain without restrictions. Just give the author credit, don't + claim you wrote it or prevent anyone else from using it. + . + Gregory Pietsch's current e-mail address: + gpietsch@comcast.net + +License: Other-21 + Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software and in all copies of the supporting + documentation for such software. + . + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION + OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS + SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +License: Other-22 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the above copyright notice, + this condition statement, and the following disclaimer are retained + in any redistributions of the source code. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: Other-23 + The contents of this file may be used under the terms of the Apache License, + Version 2.0. + . + See accompanying file LICENSE-Apache or copy at + http://www.apache.org/licenses/LICENSE-2.0) + . + Alternatively, the contents of this file may be used under the terms of + the Boost Software License, Version 1.0. + See accompanying file LICENSE-Boost or copy at + https://www.boost.org/LICENSE_1_0.txt) + . + Unless required by applicable law or agreed to in writing, this software + is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. + +License: Other-24 + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +License: Other-25 + Developed at SunPro, a Sun Microsystems, Inc. business. + Permission to use, copy, modify, and distribute this + software is freely granted, provided that this notice + is preserved. + +License: Other-26 + Developed at SunSoft, a Sun Microsystems, Inc. business. + Permission to use, copy, modify, and distribute this + software is freely granted, provided that this notice + is preserved. + +License: Other-27 + Copyright (c) 2009-2011, Bruce D. Evans, Steven G. Kargl, David Schultz. + . + Developed at SunPro, a Sun Microsystems, Inc. business. + Permission to use, copy, modify, and distribute this + software is freely granted, provided that this notice + is preserved. + . + . + The argument reduction and testing for exceptional cases was + written by Steven G. Kargl with input from Bruce D. Evans + and David A. Schultz. + +License: Other-28 + Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. + . + Developed at SunSoft, a Sun Microsystems, Inc. business. + Permission to use, copy, modify, and distribute this + software is freely granted, provided that this notice + is preserved. + . + . + Optimized by Bruce D. Evans. + +License: Other-29 + Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. + . + Developed at SunSoft, a Sun Microsystems, Inc. business. + Permission to use, copy, modify, and distribute this + software is freely granted, provided that this notice + is preserved. + +License: Other-30 + Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. + . + Permission to use, copy, modify, and distribute this + software is freely granted, provided that this notice + is preserved. + +License: Other-31 + x87 FP implementation contributed to Newlib by + Dave Korn, November 2007. This file is placed in the + public domain. Permission to use, copy, modify, and + distribute this software is freely granted. -musl as a whole is licensed under the following standard MIT license: - ----------------------------------------------------------------------- -Copyright © 2005-2020 Rich Felker, et al. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- - -Authors/contributors include: - -A. Wilcox -Ada Worcester -Alex Dowad -Alex Suykov -Alexander Monakov -Andre McCurdy -Andrew Kelley -Anthony G. Basile -Aric Belsito -Arvid Picciani -Bartosz Brachaczek -Benjamin Peterson -Bobby Bingham -Boris Brezillon -Brent Cook -Chris Spiegel -Clément Vasseur -Daniel Micay -Daniel Sabogal -Daurnimator -David Carlier -David Edelsohn -Denys Vlasenko -Dmitry Ivanov -Dmitry V. Levin -Drew DeVault -Emil Renner Berthing -Fangrui Song -Felix Fietkau -Felix Janda -Gianluca Anzolin -Hauke Mehrtens -He X -Hiltjo Posthuma -Isaac Dunham -Jaydeep Patil -Jens Gustedt -Jeremy Huntwork -Jo-Philipp Wich -Joakim Sindholt -John Spencer -Julien Ramseier -Justin Cormack -Kaarle Ritvanen -Khem Raj -Kylie McClain -Leah Neukirchen -Luca Barbato -Luka Perkov -M Farkas-Dyck (Strake) -Mahesh Bodapati -Markus Wichmann -Masanori Ogino -Michael Clark -Michael Forney -Mikhail Kremnyov -Natanael Copa -Nicholas J. Kain -orc -Pascal Cuoq -Patrick Oppenlander -Petr Hosek -Petr Skocik -Pierre Carrier -Reini Urban -Rich Felker -Richard Pennington -Ryan Fairfax -Samuel Holland -Segev Finer -Shiz -sin -Solar Designer -Stefan Kristiansson -Stefan O'Rear -Szabolcs Nagy -Timo Teräs -Trutz Behn -Valentin Ochs -Will Dietz -William Haddon -William Pitcock - -Portions of this software are derived from third-party works licensed -under terms compatible with the above MIT license: - -The TRE regular expression implementation (src/regex/reg* and -src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed -under a 2-clause BSD license (license text in the source files). The -included version has been heavily modified by Rich Felker in 2012, in -the interests of size, simplicity, and namespace cleanliness. - -Much of the math library code (src/math/* and src/complex/*) is -Copyright © 1993,2004 Sun Microsystems or -Copyright © 2003-2011 David Schultz or -Copyright © 2003-2009 Steven G. Kargl or -Copyright © 2003-2009 Bruce D. Evans or -Copyright © 2008 Stephen L. Moshier or -Copyright © 2017-2018 Arm Limited -and labelled as such in comments in the individual source files. All -have been licensed under extremely permissive terms. - -The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 -The Android Open Source Project and is licensed under a two-clause BSD -license. It was taken from Bionic libc, used on Android. - -The AArch64 memcpy and memset code (src/string/aarch64/*) are -Copyright © 1999-2019, Arm Limited. - -The implementation of DES for crypt (src/crypt/crypt_des.c) is -Copyright © 1994 David Burren. It is licensed under a BSD license. - -The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was -originally written by Solar Designer and placed into the public -domain. The code also comes with a fallback permissive license for use -in jurisdictions that may not recognize the public domain. - -The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 -Valentin Ochs and is licensed under an MIT-style license. - -The x86_64 port was written by Nicholas J. Kain and is licensed under -the standard MIT terms. - -The mips and microblaze ports were originally written by Richard -Pennington for use in the ellcc project. The original code was adapted -by Rich Felker for build system and code conventions during upstream -integration. It is licensed under the standard MIT terms. - -The mips64 port was contributed by Imagination Technologies and is -licensed under the standard MIT terms. - -The powerpc port was also originally written by Richard Pennington, -and later supplemented and integrated by John Spencer. It is licensed -under the standard MIT terms. - -All other files which have no copyright comments are original works -produced specifically for use as part of this library, written either -by Rich Felker, the main author of the library, or by one or more -contributors listed above. Details on authorship of individual files -can be found in the git version control history of the project. The -omission of copyright and license comments in each file is in the -interest of source tree size. - -In addition, permission is hereby granted for all public header files -(include/* and arch/*/bits/*) and crt files intended to be linked into -applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit -the copyright notice and permission notice otherwise required by the -license, and to use these files without any requirement of -attribution. These files include substantial contributions from: - -Bobby Bingham -John Spencer -Nicholas J. Kain -Rich Felker -Richard Pennington -Stefan Kristiansson -Szabolcs Nagy - -all of whom have explicitly granted such permission. - -This file previously contained text expressing a belief that most of -the files covered by the above exception were sufficiently trivial not -to be subject to copyright, resulting in confusion over whether it -negated the permissions granted in the license. In the spirit of -permissive licensing, and of not having licensing issues being an -obstacle to adoption, that text has been removed. +License: UCB-1 + Redistribution and use in source and binary forms are permitted + provided that the above copyright notice and this paragraph are + duplicated in all such forms and that any documentation, + and/or other materials related to such + distribution and use acknowledge that the software was developed + by the University of California, Berkeley. The name of the + University may not be used to endorse or promote products derived + from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +License: UCB-2 + Redistribution and use in source and binary forms are permitted + provided that: (1) source distributions retain this entire copyright + notice and comment, and (2) distributions including binaries display + the following acknowledgement: ``This product includes software + developed by the University of California, Berkeley and its contributors'' + in the documentation or other materials provided with the distribution. + Neither the name of the University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. diff --git a/c.just b/c.just index d83776cc5..4590905be 100644 --- a/c.just +++ b/c.just @@ -2,9 +2,9 @@ mkdir := if os() == "windows" { "mkdir -f -p" } else { "mkdir -p"} # Elf options # We don't support stack protectors at the moment, but Arch Linux clang auto-enables them for -linux platforms, so explicitly disable them. -c-compile-options-elf := '-nobuiltininc -H --target=x86_64-unknown-linux-none -fno-stack-protector -fstack-clash-protection -mstack-probe-size=4096 -fPIC' -c-include-flags-elf := "-I " + root / "src/hyperlight_guest_capi/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/musl/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/musl/arch/x86_64" + " -I " + root / "src/hyperlight_guest_bin/third_party/printf" -c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie' +c-compile-options-elf := '-nostdlibinc -H --target=x86_64-unknown-linux-none -fno-stack-protector -fstack-clash-protection -mstack-probe-size=4096 -fPIC' +c-include-flags-elf := "-I " + root / "src/hyperlight_guest_capi/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/picolibc/newlib/libc/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/picolibc/newlib/libc/tinystdio/" +c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie --no-dynamic-linker' c-flags-debug-elf := '-O0' c-flags-release-elf := '-O3' diff --git a/hack/clippy-package-features.sh b/hack/clippy-package-features.sh index dddf582d8..fbc7cb069 100755 --- a/hack/clippy-package-features.sh +++ b/hack/clippy-package-features.sh @@ -19,7 +19,7 @@ PROFILE=$([ "$TARGET" = "debug" ] && echo "dev" || echo "$TARGET") if [[ "$PACKAGE" == "hyperlight-host" ]]; then REQUIRED_FEATURES=("kvm" "mshv3") elif [[ "$PACKAGE" == "hyperlight-guest-bin" ]]; then - REQUIRED_FEATURES=("printf") + REQUIRED_FEATURES=("libc") else REQUIRED_FEATURES=() fi @@ -68,4 +68,4 @@ if [[ -n "$features" ]]; then echo "Testing $PACKAGE with all features: $all_features" (set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$all_features" --profile="$PROFILE" -- -D warnings) fi -fi \ No newline at end of file +fi diff --git a/src/hyperlight_guest_bin/.cargo/config.toml b/src/hyperlight_guest_bin/.cargo/config.toml index d430fa44c..9f7ec9d53 100644 --- a/src/hyperlight_guest_bin/.cargo/config.toml +++ b/src/hyperlight_guest_bin/.cargo/config.toml @@ -1,2 +1,3 @@ [build] target = "x86_64-unknown-none" +rustflags = ["-Zdirect-access-external-data"] diff --git a/src/hyperlight_guest_bin/Cargo.toml b/src/hyperlight_guest_bin/Cargo.toml index c21d00c91..5b6f61e0d 100644 --- a/src/hyperlight_guest_bin/Cargo.toml +++ b/src/hyperlight_guest_bin/Cargo.toml @@ -14,9 +14,8 @@ and third-party code used by our C-API needed to build a native hyperlight-guest """ [features] -default = ["libc", "printf"] -libc = [] # compile musl libc -printf = [ "libc" ] # compile printf +default = ["libc"] +libc = [] # compile libc from picolibc trace_guest = ["hyperlight-common/trace_guest", "hyperlight-guest/trace_guest", "hyperlight-guest-tracing/trace"] mem_profile = ["hyperlight-common/unwind_guest","hyperlight-common/mem_profile"] @@ -24,14 +23,15 @@ mem_profile = ["hyperlight-common/unwind_guest","hyperlight-common/mem_profile"] hyperlight-guest = { workspace = true, default-features = false } hyperlight-common = { workspace = true, default-features = false } hyperlight-guest-tracing = { workspace = true, default-features = false } -buddy_system_allocator = "0.11.0" log = { version = "0.4", default-features = false } spin = "0.10.0" +libc_alloc = "1.0.7" [lints] workspace = true [build-dependencies] +anyhow = "1" cc = "1.2" cfg-if = "1.0" glob = "0.3.3" diff --git a/src/hyperlight_guest_bin/build.rs b/src/hyperlight_guest_bin/build.rs index a7bce651b..a2d1833e4 100644 --- a/src/hyperlight_guest_bin/build.rs +++ b/src/hyperlight_guest_bin/build.rs @@ -14,69 +14,216 @@ See the License for the specific language governing permissions and limitations under the License. */ +mod build_files; + +use std::io::Write; use std::path::{Path, PathBuf}; +use std::process::{Command, Stdio}; use std::{env, fs}; -fn copy_includes, Q: AsRef + std::fmt::Debug>(include_dir: P, base: Q) { - let entries = fs::read_dir(&base) - .unwrap_or_else(|e| panic!("could not open include dir {:?}: {}", base, e)); +use anyhow::{Context, Result, bail}; +use build_files::{LIBC_FILES, LIBC_FILES_X86, LIBM_FILES, LIBM_FILES_X86}; + +fn copy_includes, Q: AsRef + std::fmt::Debug>( + include_dir: P, + base: Q, +) -> Result<()> { + let entries = + fs::read_dir(&base).with_context(|| format!("could not open include dir {:?}", base))?; + for entry in entries { - let entry = - entry.unwrap_or_else(|e| panic!("could not read include dir {:?}: {}", base, e)); + let entry = entry.with_context(|| format!("could not read include dir {:?}", base))?; let src = entry.path(); let dst = include_dir.as_ref().join(entry.file_name()); let kind = entry .file_type() - .unwrap_or_else(|e| panic!("could not find type of {:?}: {}", src, e)); + .with_context(|| format!("could not find type of {:?}", src))?; + if kind.is_dir() { fs::create_dir_all(&dst) - .unwrap_or_else(|e| panic!("could not create include dir {:?}, {}", &dst, e)); - copy_includes(&dst, src); + .with_context(|| format!("could not create include dir {:?}", &dst))?; + copy_includes(&dst, src)?; } else if Some(std::ffi::OsStr::new("h")) == src.extension() { - fs::copy(&src, &dst) - .unwrap_or_else(|e| panic!("could not copy header {:?}, {}", &src, e)); + fs::copy(&src, &dst).with_context(|| format!("could not copy header {:?}", &src))?; } } + + Ok(()) } -fn cargo_main() { - println!("cargo:rerun-if-changed=third_party"); +fn detect_cc_feature(test_code: &str) -> Result { + let cc = std::env::var("HYPERLIGHT_GUEST_clang").unwrap_or_else(|_| "clang".into()); - let mut cfg = cc::Build::new(); + let mut cmd = Command::new(&cc) + .arg("-std=c18") + .arg("-x") + .arg("c") + .arg("-") + .arg("-fsyntax-only") + .stdin(Stdio::piped()) + .stderr(Stdio::null()) + .stdout(Stdio::null()) + .spawn() + .with_context(|| "failed to spawn compiler for feature test")?; - if cfg!(feature = "printf") { - cfg.include("third_party/printf") - .file("third_party/printf/printf.c"); - } + cmd.stdin + .as_mut() + .unwrap() + .write_all(test_code.as_bytes()) + .with_context(|| "failed to write test code")?; - if cfg!(feature = "libc") { - let entries = glob::glob("third_party/musl/**/*.[cs]") // .c and .s files - .expect("glob pattern should be valid") - .filter_map(Result::ok); - cfg.files(entries); - - cfg.include("third_party/musl/src/include") - .include("third_party/musl/include") - .include("third_party/musl/src/internal") - .include("third_party/musl/arch/generic") - .include("third_party/musl/arch/x86_64"); + Ok(cmd + .wait() + .with_context(|| "failed to wait on cc command")? + .success()) +} + +fn gen_config_file(config_dir: &Path) -> Result<()> { + let config_h = config_dir.join("picolibc.h"); + + let mut file = fs::File::create(&config_h) + .with_context(|| format!("Could not create config file {:?}", config_h))?; + + writeln!(file, "/* Generated by hyperlight build script */")?; + writeln!(file, "#pragma once")?; + writeln!(file)?; + + writeln!(file, "#define _NEWLIB_VERSION \"4.3.0\"")?; + writeln!(file, "#define __NEWLIB_VERSION__ \"4.3.0\"")?; + writeln!(file, "#define __NEWLIB__ 4")?; + writeln!(file, "#define __NEWLIB_MINOR__ 3")?; + writeln!(file, "#define __NEWLIB_PATCHLEVEL__ 0")?; + writeln!(file, "#define __PICOLIBC_VERSION__ \"1.8.10\"")?; + writeln!(file, "#define __PICOLIBC__ 1")?; + writeln!(file, "#define __PICOLIBC_MINOR__ 8")?; + writeln!(file, "#define __PICOLIBC_PATCHLEVEL__ 10")?; + writeln!(file)?; + + // Static configuration + writeln!(file, "#define __ASSERT_VERBOSE")?; + writeln!(file, "#define __SINGLE_THREAD")?; // -Dsingle-thread=true + writeln!(file, "#define __GLOBAL_ERRNO")?; // -Dnewlib-global-errno=true + writeln!(file, "#define __INIT_FINI_ARRAY")?; // -Dinitfini-array=true + writeln!(file, "#define __TINY_STDIO")?; // -Dtinystdio=true + writeln!(file, "#define __IO_DEFAULT 'd'")?; // -Dformat-default=d (full printf functionality) + writeln!(file, "#define __IO_FLOAT_EXACT")?; // tinystdio default + writeln!(file, "#define __IO_WCHAR")?; // -Dio-wchar=true + writeln!(file, "#define __IEEE_LIBM")?; // math library without errno + writeln!(file, "#define __FAST_STRCMP")?; // default optimization + writeln!(file, "#define __PICO_EXIT")?; // picoexit enabled by default + writeln!(file, "#define __FAST_BUFIO")?; // -Dfast-bufio=true + + // tinystdio-specific settings + writeln!(file, "#define __IO_SMALL_ULTOA")?; // avoid division in conversion + + for test in &[ + "__builtin_alloca", + "__builtin_ffs", + "__builtin_ffsl", + "__builtin_ffsll", + "__builtin_ctz", + "__builtin_ctzl", + "__builtin_ctzll", + "__builtin_copysign", + "__builtin_copysignl", + "__builtin_isinf", + "__builtin_isinfl", + "__builtin_isnan", + "__builtin_isnanl", + "__builtin_isfinite", + "__builtin_finitel", + "__builtin_issignalingl", + "__builtin_expect", + "__builtin_complex", + "__builtin_add_overflow", + "__builtin_mul_overflow", + ] { + let code = format!( + r#" + #if __has_builtin({test}) + int main() {{ return 0; }} + #else + #error "Builtin not supported" + #endif + "# + ); + + let has = if detect_cc_feature(&code)? { 1 } else { 0 }; + writeln!( + file, + "#define __HAVE_BUILTIN_{} {has}", + test.trim_start_matches("__builtin_").to_uppercase() + )?; } - if cfg!(any(feature = "printf", feature = "libc")) { - cfg.define("HYPERLIGHT", None); // used in certain musl files for conditional compilation - - // silence compiler warnings - cfg.flag("-Wno-unused-command-line-argument") // including .s files makes clang believe arguments are unused - .flag("-Wno-sign-compare") - .flag("-Wno-bitwise-op-parentheses") - .flag("-Wno-unknown-pragmas") - .flag("-Wno-shift-op-parentheses") - .flag("-Wno-logical-op-parentheses") - .flag("-Wno-unused-but-set-variable") - .flag("-Wno-unused-parameter") - .flag("-Wno-string-plus-int"); - - cfg.flag("-fPIC"); + let code = r#"_Complex double x = 1.0 + 2.0*I; int main() { return 0; }"#; + let has = if detect_cc_feature(code)? { 1 } else { 0 }; + writeln!(file, "#define __HAVE_COMPLEX {has}")?; + + let code = r#"long long x = 0; int main() { return 0; }"#; + let has = if detect_cc_feature(code)? { 1 } else { 0 }; + writeln!(file, "#define __IO_LONG_LONG {has}")?; + + // Static undefs + writeln!(file, "#undef __ARM_SEMIHOST")?; // -Dsemihost=false + writeln!(file, "#undef __SEMIHOST")?; // -Dsemihost=false + writeln!(file, "#undef __THREAD_LOCAL_STORAGE")?; // -Dthread-local-storage=false + writeln!(file, "#undef __THREAD_LOCAL_STORAGE_API")?; + writeln!(file, "#undef __THREAD_LOCAL_STORAGE_RP2040")?; + writeln!(file, "#undef __THREAD_LOCAL_STORAGE_STACK_GUARD")?; + writeln!(file, "#undef __NANO_MALLOC")?; // -Dnewlib-nano-malloc=false + writeln!(file, "#undef __NANO_MALLOC_CLEAR_FREED")?; + writeln!(file, "#undef __MB_CAPABLE")?; // no multibyte support + writeln!(file, "#undef __HAVE_FCNTL")?; // freestanding environment + writeln!(file, "#undef __STDIO_LOCKING")?; // single-thread + writeln!(file, "#undef __IO_C99_FORMATS")?; // -Dio-c99-formats=false + writeln!(file, "#undef __IO_LONG_DOUBLE")?; // not enabled + writeln!(file, "#undef __IO_LONG_LONG")?; // minimal format + writeln!(file, "#undef __IO_MINIMAL_LONG_LONG")?; + writeln!(file, "#undef __IO_PERCENT_B")?; // not enabled + writeln!(file, "#undef __IO_PERCENT_N")?; // not enabled + writeln!(file, "#undef __IO_POS_ARGS")?; // not enabled + writeln!(file, "#undef __MATH_ERRNO")?; // IEEE math only + writeln!(file, "#undef __OBSOLETE_MATH")?; + writeln!(file, "#undef __OBSOLETE_MATH_DOUBLE")?; + writeln!(file, "#undef __OBSOLETE_MATH_FLOAT")?; + writeln!(file, "#undef __PREFER_SIZE_OVER_SPEED")?; // release build + writeln!(file, "#undef __ATOMIC_UNGETC")?; // single-thread + writeln!(file, "#undef __IEEEFP_FUNCS")?; + writeln!(file, "#undef __INIT_FINI_FUNCS")?; // using INIT_FINI_ARRAY instead + writeln!(file, "#undef __HAVE_BITFIELDS_IN_PACKED_STRUCTS")?; + + Ok(()) +} + +fn cc_build(picolibc_dir: &PathBuf, target: &str) -> Result { + let mut build = cc::Build::new(); + let compiler = env::var("HYPERLIGHT_GUEST_clang").unwrap_or("clang".to_string()); + + build.compiler(compiler).std("c18").opt_level(3); + + build + .flag("-fPIC") + .flag("-nostdlib") + .flag("-ffreestanding") + .flag("-fno-common") + .flag("-fno-builtin") + .flag("-fdiagnostics-color=always") + .flag("-fno-common") + .flag("-Wall") + .flag("-Wextra") + .flag("-Winvalid-pch") + .flag("-Wno-unused-command-line-argument") + .flag("-Wno-unsupported-floating-point-opt") + .flag("-Wno-unused-parameter") + // We don't support stack protectors at the moment, but Arch Linux clang + // auto-enables them for -linux platforms, so explicitly disable them. + .flag("-fno-stack-protector") + .flag("-fstack-clash-protection") + .flag("-mstack-probe-size=4096") + // We don't use a different stack for all interrupts, so there + // can be no red zone + .flag("-mno-red-zone") // This is a terrible hack, because // - we need stack clash protection, because we have put the // stack right smack in the middle of everything in the guest @@ -86,46 +233,138 @@ fn cargo_main() { // https://github.com/llvm/llvm-project/blob/1bb52e9/clang/lib/Driver/ToolChains/Clang.cpp#L3724). // Hopefully a flag to force stack clash protection on generic // targets will eventually show up. - cfg.flag("--target=x86_64-unknown-linux-none"); + .flag("--target=x86_64-unknown-linux-none"); - // We don't use a different stack for all interrupts, so there - // can be no red zone - cfg.flag("-mno-red-zone"); + build + .flag_if_supported("-fdirect-access-external-data") + .flag_if_supported("-frounding-math") + .flag_if_supported("-fsignaling-nans") + .flag_if_supported("-fno-builtin-copysignl"); - // We don't support stack protectors at the moment, but Arch Linux clang - // auto-enables them for -linux platforms, so explicitly disable them. - cfg.flag("-fno-stack-protector"); - cfg.flag("-fstack-clash-protection"); - cfg.flag("-mstack-probe-size=4096"); - cfg.compiler( - env::var("HYPERLIGHT_GUEST_clang") - .as_deref() - .unwrap_or("clang"), - ); + build + .define("_FORTIFY_SOURCE", None) + .define("ABORT_PROVIDED", "1") + .define("DEFINE_MEMALIGN", "1") + .define("DEFINE_POSIX_MEMALIGN", "1") + .define("_LIBC", None) + .define("_FILE_OFFSET_BITS", "64"); - if cfg!(windows) { - unsafe { env::set_var("AR_x86_64_unknown_none", "llvm-ar") }; + // TODO: this is wrong, it should generate config file to out_dir/include + // but how downstream crates get at it then? And TBH I think having piclibc + // headers (features.h) depend on a build time header is wrong is odd to say + // at least. + gen_config_file(&picolibc_dir.join("newlib/libc/include"))?; + + match target { + "x86" | "x86_64" => { + build.include(picolibc_dir.join("newlib/libm/machine/x86")); + build.include(picolibc_dir.join("newlib/libc/machine/x86")); } - cfg.compile("hyperlight_guest_bin"); + arch => { + bail!("Unsupported target architecture: {arch}"); + } + } + + build + .include(picolibc_dir) + .include(picolibc_dir.join("newlib/libc/tinystdio")) + .include(picolibc_dir.join("newlib/libc/locale")) + .include(picolibc_dir.join("newlib/libc/include")); + + Ok(build) +} + +fn add_mimalloc(build: &mut cc::Build, mimalloc_dir: &Path, _target: &str) -> Result<()> { + build.define("MI_MALLOC_OVERRIDE", "1"); + build.define("__wasi__", "1"); + build.include(mimalloc_dir.join("include")); + build.include(mimalloc_dir.join("src")); + build.file(mimalloc_dir.join("src/static.c")); + + Ok(()) +} + +fn add_libc(build: &mut cc::Build, picolibc_dir: &Path, target: &str) -> Result<()> { + let base = LIBC_FILES.iter(); + let files = match target { + "x86" | "x86_64" => base.chain(LIBC_FILES_X86.iter()), + arch => bail!("Unsupported target architecture: {arch}"), + }; + + for file in files { + let source_path = picolibc_dir.join("newlib/libc").join(file); + build.file(&source_path); } + build.files(&["c/clock.c", "c/mimalloc.c"]); + Ok(()) +} + +fn add_libm(build: &mut cc::Build, picolibc_dir: &Path, target: &str) -> Result<()> { + build.include(picolibc_dir.join("newlib")); + build.include(picolibc_dir.join("newlib/libm/common")); + + let base = LIBM_FILES.iter(); + let files = match target { + "x86" | "x86_64" => base.chain(LIBM_FILES_X86.iter()), + arch => bail!("Unsupported target architecture: {arch}"), + }; + + for file in files { + let source_path = picolibc_dir.join("newlib/libm").join(file); + build.file(&source_path); + } + + Ok(()) +} + +fn cargo_main() -> Result<()> { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=third_party/picolibc"); + println!("cargo:rerun-if-env-changed=HYPERLIGHT_GUEST_TOOLCHAIN_ROOT"); + let out_dir = env::var("OUT_DIR").expect("cargo OUT_DIR not set"); + let target = env::var("CARGO_CFG_TARGET_ARCH").expect("cargo TARGET_ARCH not set"); + let include_dir = PathBuf::from(&out_dir).join("include"); fs::create_dir_all(&include_dir) - .unwrap_or_else(|e| panic!("Could not create include dir {:?}: {}", &include_dir, e)); - if cfg!(feature = "printf") { - copy_includes(&include_dir, "third_party/printf/"); - } + .with_context(|| format!("Could not create include dir {include_dir:?}"))?; + if cfg!(feature = "libc") { - copy_includes(&include_dir, "third_party/musl/include"); - copy_includes(&include_dir, "third_party/musl/arch/generic"); - copy_includes(&include_dir, "third_party/musl/arch/x86_64"); - copy_includes(&include_dir, "third_party/musl/src/internal"); + if !Path::new("third_party/picolibc/COPYING.picolibc").exists() { + eprintln!("Setting up submodules"); + + let mut cmd = Command::new("git") + .arg("submodule") + .arg("update") + .arg("--init") + .spawn() + .with_context(|| "failed to spawn git submodule command")?; + + cmd.wait() + .with_context(|| "failed to wait on git submodule command")?; + } + + let picolibc_dir = PathBuf::from("third_party/picolibc"); + let mimalloc_dir = PathBuf::from("third_party/mimalloc"); + let mut build = cc_build(&picolibc_dir, &target)?; + + add_libc(&mut build, &picolibc_dir, &target)?; + add_libm(&mut build, &picolibc_dir, &target)?; + add_mimalloc(&mut build, &mimalloc_dir, &target)?; + + if cfg!(windows) { + unsafe { env::set_var("AR_x86_64_unknown_none", "llvm-ar") }; + } + + build.compile("hyperlight_guest_bin"); + copy_includes(&include_dir, "third_party/picolibc/newlib/libc/include")?; } - /* do not canonicalize: clang has trouble with UNC paths */ + let include_str = include_dir .to_str() - .expect("out dir include dir was not valid utf-8"); + .with_context(|| "out dir include dir was not valid utf-8")?; + println!("cargo::metadata=include={}", include_str); /* Correctly setting up the libc include paths for downstream @@ -183,6 +422,8 @@ fn cargo_main() { fs::copy(&binpath, binroot.join("clang")).expect("Could not copy to clang"); fs::copy(&binpath, binroot.join("clang.exe")).expect("Could not copy to clang.exe"); } + + Ok(()) } #[derive(PartialEq)] @@ -190,6 +431,7 @@ enum Tool { CargoBuildScript, Clang, } + impl From<&std::ffi::OsStr> for Tool { fn from(x: &std::ffi::OsStr) -> Tool { if x == "clang" || x == "clang.exe" { @@ -204,6 +446,7 @@ fn find_next(root_dir: &Path, tool_name: &str) -> PathBuf { if let Some(path) = env::var_os(format!("HYPERLIGHT_GUEST_{tool_name}")) { return path.into(); } + let path = env::var_os("PATH").expect("$PATH should exist"); let paths: Vec<_> = env::split_paths(&path).collect(); for path in &paths { @@ -230,10 +473,15 @@ fn main() -> std::process::ExitCode { let exe = env::current_exe().expect("expected program name"); let name = Path::file_name(exe.as_ref()).expect("program name should not be directory"); let tool: Tool = name.into(); + if tool == Tool::CargoBuildScript { - cargo_main(); + if let Err(err) = cargo_main() { + eprintln!("{:#}", err); + return std::process::ExitCode::FAILURE; + } return std::process::ExitCode::SUCCESS; } + let exe_abs = fs::canonicalize(&exe).expect("program name should be possible to canonicalize"); let root_dir = exe_abs .parent() diff --git a/src/hyperlight_guest_bin/build_files.rs b/src/hyperlight_guest_bin/build_files.rs new file mode 100644 index 000000000..107d351b9 --- /dev/null +++ b/src/hyperlight_guest_bin/build_files.rs @@ -0,0 +1,921 @@ +/* +Copyright 2025 The Hyperlight Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +pub(crate) const LIBC_FILES: &[&str] = &[ + "string/strcmp.c", + "argz/argz_add.c", + "argz/argz_add_sep.c", + "argz/argz_append.c", + "argz/argz_count.c", + "argz/argz_create.c", + "argz/argz_create_sep.c", + "argz/argz_delete.c", + "argz/argz_extract.c", + "argz/argz_insert.c", + "argz/argz_next.c", + "argz/argz_replace.c", + "argz/argz_stringify.c", + "argz/buf_findstr.c", + "argz/envz_add.c", + "argz/envz_entry.c", + "argz/envz_get.c", + "argz/envz_merge.c", + "argz/envz_remove.c", + "argz/envz_strip.c", + "ctype/caseconv.c", + "ctype/ctype_.c", + "ctype/ctype_table.c", + "ctype/ctype_wide.c", + "ctype/isalnum.c", + "ctype/isalnum_l.c", + "ctype/isalpha.c", + "ctype/isalpha_l.c", + "ctype/isascii.c", + "ctype/isascii_l.c", + "ctype/isblank.c", + "ctype/isblank_l.c", + "ctype/iscntrl.c", + "ctype/iscntrl_l.c", + "ctype/isdigit.c", + "ctype/isdigit_l.c", + "ctype/isgraph.c", + "ctype/isgraph_l.c", + "ctype/islower.c", + "ctype/islower_l.c", + "ctype/isprint.c", + "ctype/isprint_l.c", + "ctype/ispunct.c", + "ctype/ispunct_l.c", + "ctype/isspace.c", + "ctype/isspace_l.c", + "ctype/isupper.c", + "ctype/isupper_l.c", + "ctype/iswalnum.c", + "ctype/iswalnum_l.c", + "ctype/iswalpha.c", + "ctype/iswalpha_l.c", + "ctype/iswblank.c", + "ctype/iswblank_l.c", + "ctype/iswcntrl.c", + "ctype/iswcntrl_l.c", + "ctype/iswctype.c", + "ctype/iswctype_l.c", + "ctype/iswdigit.c", + "ctype/iswdigit_l.c", + "ctype/iswgraph.c", + "ctype/iswgraph_l.c", + "ctype/iswlower.c", + "ctype/iswlower_l.c", + "ctype/iswprint.c", + "ctype/iswprint_l.c", + "ctype/iswpunct.c", + "ctype/iswpunct_l.c", + "ctype/iswspace.c", + "ctype/iswspace_l.c", + "ctype/iswupper.c", + "ctype/iswupper_l.c", + "ctype/iswxdigit.c", + "ctype/iswxdigit_l.c", + "ctype/isxdigit.c", + "ctype/isxdigit_l.c", + "ctype/jp2uc.c", + "ctype/toascii.c", + "ctype/toascii_l.c", + "ctype/tolower.c", + "ctype/tolower_l.c", + "ctype/toupper.c", + "ctype/toupper_l.c", + "ctype/towctrans.c", + "ctype/towctrans_l.c", + "ctype/towlower.c", + "ctype/towlower_l.c", + "ctype/towupper.c", + "ctype/towupper_l.c", + "ctype/wctrans.c", + "ctype/wctrans_l.c", + "ctype/wctype.c", + "ctype/wctype_l.c", + "errno/errno.c", + "iconv/iconv.c", + "iconv/iconv_close.c", + "iconv/iconv_open.c", + "locale/duplocale.c", + "locale/freelocale.c", + "locale/getlocalename_l.c", + "locale/localeconv.c", + "locale/localedata.c", + "locale/locale_ctype_ptr.c", + "locale/locale_ctype_ptr_l.c", + "locale/locale_mb_cur_max.c", + "locale/locale_names.c", + "locale/newlocale.c", + "locale/nl_langinfo.c", + "locale/setlocale.c", + "locale/timedata.c", + "locale/uselocale.c", + "misc/ffs.c", + "misc/fini.c", + "misc/init.c", + "misc/lock.c", + "misc/unctrl.c", + "posix/basename.c", + "posix/collcmp.c", + "posix/dirname.c", + "posix/fnmatch.c", + "posix/fpathconf.c", + "posix/pathconf.c", + "posix/regcomp.c", + "posix/regerror.c", + "posix/regexec.c", + "posix/regfree.c", + "search/bsd_qsort_r.c", + "search/bsearch.c", + "search/hash_bigkey.c", + "search/hash_buf.c", + "search/hash.c", + "search/hash_func.c", + "search/hash_log2.c", + "search/hash_page.c", + "search/hcreate.c", + "search/hcreate_r.c", + "search/ndbm.c", + "search/qsort.c", + "search/qsort_r.c", + "search/tdelete.c", + "search/tdestroy.c", + "search/tfind.c", + "search/tsearch.c", + "search/twalk.c", + "signal/psignal.c", + "signal/sig2str.c", + "signal/signal.c", + "ssp/chk_fail.c", + "ssp/gets_chk.c", + "ssp/memcpy_chk.c", + "ssp/memmove_chk.c", + "ssp/mempcpy_chk.c", + "ssp/memset_chk.c", + "ssp/snprintf_chk.c", + "ssp/sprintf_chk.c", + "ssp/stack_protector.c", + "ssp/stpcpy_chk.c", + "ssp/stpncpy_chk.c", + "ssp/strcat_chk.c", + "ssp/strcpy_chk.c", + "ssp/strncat_chk.c", + "ssp/strncpy_chk.c", + "ssp/vsnprintf_chk.c", + "ssp/vsprintf_chk.c", + "stdlib/a64l.c", + "stdlib/abort.c", + "stdlib/abs.c", + "stdlib/aligned_alloc.c", + "stdlib/arc4random.c", + "stdlib/arc4random_uniform.c", + "stdlib/assert.c", + "stdlib/assert_func.c", + "stdlib/assert_no_arg.c", + "stdlib/atof.c", + "stdlib/atoff.c", + "stdlib/atoi.c", + "stdlib/atol.c", + "stdlib/atoll.c", + "stdlib/btowc.c", + "stdlib/div.c", + "stdlib/drand48.c", + "stdlib/environ.c", + "stdlib/eprintf.c", + "stdlib/erand48.c", + "stdlib/_Exit.c", + "stdlib/getenv.c", + "stdlib/getenv_r.c", + "stdlib/getopt.c", + "stdlib/getsubopt.c", + "stdlib/imaxabs.c", + "stdlib/imaxdiv.c", + "stdlib/itoa.c", + "stdlib/jrand48.c", + "stdlib/l64a.c", + "stdlib/labs.c", + "stdlib/lcong48.c", + "stdlib/ldiv.c", + "stdlib/llabs.c", + "stdlib/lldiv.c", + "stdlib/lrand48.c", + "stdlib/mblen.c", + "stdlib/mbrlen.c", + "stdlib/mbrtowc.c", + "stdlib/mbsinit.c", + "stdlib/mbsnrtowcs.c", + "stdlib/mbsrtowcs.c", + "stdlib/mbstowcs.c", + "stdlib/mbtowc.c", + "stdlib/mbtowc_r.c", + "stdlib/mrand48.c", + "stdlib/nrand48.c", + "stdlib/putenv.c", + "stdlib/rand48.c", + "stdlib/rand.c", + "stdlib/random.c", + "stdlib/rand_r.c", + "stdlib/reallocarray.c", + "stdlib/reallocf.c", + "stdlib/rpmatch.c", + "stdlib/sb_charsets.c", + "stdlib/seed48.c", + "stdlib/setenv.c", + "stdlib/srand.c", + "stdlib/srand48.c", + "stdlib/srandom.c", + "stdlib/system.c", + "stdlib/utoa.c", + "stdlib/wcrtomb.c", + "stdlib/wcsnrtombs.c", + "stdlib/wcsrtombs.c", + "stdlib/wcstombs.c", + "stdlib/wctob.c", + "stdlib/wctomb.c", + "stdlib/wctomb_r.c", + "stdlib/set_constraint_handler_s.c", + "stdlib/ignore_handler_s.c", + "stdlib/pico-atexit.c", + "stdlib/pico-exit.c", + "stdlib/pico-onexit.c", + "stdlib/pico-cxa-atexit.c", + "stdlib/pico-exitprocs.c", + "string/bcmp.c", + "string/bcopy.c", + "string/bzero.c", + "string/explicit_bzero.c", + "string/ffsl.c", + "string/ffsll.c", + "string/fls.c", + "string/flsl.c", + "string/flsll.c", + "string/gnu_basename.c", + "string/index.c", + "string/memccpy.c", + "string/memmem.c", + "string/mempcpy.c", + "string/memrchr.c", + "string/memset_explicit.c", + "string/rawmemchr.c", + "string/rindex.c", + "string/stpcpy.c", + "string/stpncpy.c", + "string/strcasecmp.c", + "string/strcasecmp_l.c", + "string/strcasestr.c", + "string/strcat.c", + "string/strchrnul.c", + "string/strcoll.c", + "string/strcoll_l.c", + "string/strcpy.c", + "string/strcspn.c", + "string/strdup.c", + "string/strerror.c", + "string/strerror_r.c", + "string/strlcat.c", + "string/strlcpy.c", + "string/strlwr.c", + "string/strncasecmp.c", + "string/strncasecmp_l.c", + "string/strncat.c", + "string/strncmp.c", + "string/strncpy.c", + "string/strndup.c", + "string/strnlen.c", + "string/strnstr.c", + "string/strpbrk.c", + "string/strrchr.c", + "string/strsep.c", + "string/strsignal.c", + "string/strspn.c", + "string/strstr.c", + "string/strtok.c", + "string/strtok_r.c", + "string/strupr.c", + "string/strverscmp.c", + "string/strxfrm.c", + "string/strxfrm_l.c", + "string/swab.c", + "string/timingsafe_bcmp.c", + "string/timingsafe_memcmp.c", + "string/wcpcpy.c", + "string/wcpncpy.c", + "string/wcscasecmp.c", + "string/wcscasecmp_l.c", + "string/wcscat.c", + "string/wcschr.c", + "string/wcscmp.c", + "string/wcscoll.c", + "string/wcscoll_l.c", + "string/wcscpy.c", + "string/wcscspn.c", + "string/wcsdup.c", + "string/wcslcat.c", + "string/wcslcpy.c", + "string/wcslen.c", + "string/wcsncasecmp.c", + "string/wcsncasecmp_l.c", + "string/wcsncat.c", + "string/wcsncmp.c", + "string/wcsncpy.c", + "string/wcsnlen.c", + "string/wcspbrk.c", + "string/wcsrchr.c", + "string/wcsspn.c", + "string/wcsstr.c", + "string/wcstok.c", + "string/wcswidth.c", + "string/wcsxfrm.c", + "string/wcsxfrm_l.c", + "string/wcwidth.c", + "string/wmemchr.c", + "string/wmemcmp.c", + "string/wmemcpy.c", + "string/wmemmove.c", + "string/wmempcpy.c", + "string/wmemset.c", + "string/xpg_strerror_r.c", + "string/memcpy_s.c", + "string/memmove_s.c", + "string/memset_s.c", + "string/strcat_s.c", + "string/strcpy_s.c", + "string/strerror_s.c", + "string/strerrorlen_s.c", + "string/strncat_s.c", + "string/strncpy_s.c", + "string/strnlen_s.c", + "time/asctime.c", + "time/asctime_r.c", + "time/clock.c", + "time/ctime.c", + "time/ctime_r.c", + "time/difftime.c", + "time/gettzinfo.c", + "time/gmtime.c", + "time/gmtime_r.c", + "time/lcltime.c", + "time/lcltime_r.c", + "time/lcltime_buf.c", + "time/mktime.c", + "time/month_lengths.c", + "time/strftime.c", + "time/strptime.c", + "time/time.c", + "time/tzcalc_limits.c", + "time/tzset.c", + "time/tzvars.c", + "time/wcsftime.c", + "xdr/xdr_array.c", + "xdr/xdr.c", + "xdr/xdr_float.c", + "xdr/xdr_mem.c", + "xdr/xdr_private.c", + "xdr/xdr_rec.c", + "xdr/xdr_reference.c", + "xdr/xdr_sizeof.c", + "xdr/xdr_stdio.c", + "uchar/c8rtomb.c", + "uchar/c16rtomb.c", + "uchar/c32rtomb.c", + "uchar/mbrtoc8.c", + "uchar/mbrtoc16.c", + "uchar/mbrtoc32.c", + "ubsan/ubsan_cfi_type_check_to_string.c", + "ubsan/ubsan_error.c", + "ubsan/ubsan_handle_add_overflow.c", + "ubsan/ubsan_handle_alignment_assumption.c", + "ubsan/ubsan_handle_builtin_unreachable.c", + "ubsan/ubsan_handle_cfi_bad_type.c", + "ubsan/ubsan_handle_cfi_check_fail.c", + "ubsan/ubsan_handle_divrem_overflow.c", + "ubsan/ubsan_handle_dynamic_type_cache_miss.c", + "ubsan/ubsan_handle_float_cast_overflow.c", + "ubsan/ubsan_handle_function_type_mismatch.c", + "ubsan/ubsan_handle_implicit_conversion.c", + "ubsan/ubsan_handle_invalid_builtin.c", + "ubsan/ubsan_handle_invalid_objc_cast.c", + "ubsan/ubsan_handle_load_invalid_value.c", + "ubsan/ubsan_handle_missing_return.c", + "ubsan/ubsan_handle_mul_overflow.c", + "ubsan/ubsan_handle_negate_overflow.c", + "ubsan/ubsan_handle_nonnull_arg.c", + "ubsan/ubsan_handle_nonnull_return.c", + "ubsan/ubsan_handle_nonnull_return_v1.c", + "ubsan/ubsan_handle_nullability_arg.c", + "ubsan/ubsan_handle_nullability_return.c", + "ubsan/ubsan_handle_nullability_return_v1.c", + "ubsan/ubsan_handle_out_of_bounds.c", + "ubsan/ubsan_handle_pointer_overflow.c", + "ubsan/ubsan_handle_shift_out_of_bounds.c", + "ubsan/ubsan_handle_sub_overflow.c", + "ubsan/ubsan_handle_type_mismatch.c", + "ubsan/ubsan_handle_type_mismatch_v1.c", + "ubsan/ubsan_handle_vla_bound_not_positive.c", + "ubsan/ubsan_message.c", + "ubsan/ubsan_type_check_to_string.c", + "ubsan/ubsan_val_to_imax.c", + "ubsan/ubsan_val_to_string.c", + "ubsan/ubsan_val_to_umax.c", + "ubsan/ubsan_warning.c", + "picolib/dso_handle.c", + "picolib/getauxval.c", + "picolib/machine/x86/interrupt.c", + "picolib/machine/x86/interrupt.S", + "tinystdio/asnprintf.c", + "tinystdio/asprintf.c", + "tinystdio/atomic_load.c", + "tinystdio/atold_engine.c", + "tinystdio/bufio.c", + "tinystdio/clearerr.c", + "tinystdio/compare_exchange.c", + "tinystdio/dtox_engine.c", + "tinystdio/ecvt.c", + "tinystdio/ecvtf.c", + "tinystdio/ecvtf_r.c", + "tinystdio/ecvtl.c", + "tinystdio/ecvtl_r.c", + "tinystdio/ecvt_r.c", + "tinystdio/exchange.c", + "tinystdio/fclose.c", + "tinystdio/fcvt.c", + "tinystdio/fcvtf.c", + "tinystdio/fcvtf_r.c", + "tinystdio/fcvtl.c", + "tinystdio/fcvtl_r.c", + "tinystdio/fcvt_r.c", + "tinystdio/fdevopen.c", + "tinystdio/fdopen.c", + "tinystdio/feof.c", + "tinystdio/ferror.c", + "tinystdio/fflush.c", + "tinystdio/fgetc.c", + "tinystdio/fgetpos.c", + "tinystdio/fgets.c", + "tinystdio/fgetwc.c", + "tinystdio/fgetws.c", + "tinystdio/fileno.c", + "tinystdio/filestrget.c", + "tinystdio/filestrputalloc.c", + "tinystdio/filestrput.c", + "tinystdio/filewstrget.c", + "tinystdio/flockfile.c", + "tinystdio/flockfile_init.c", + "tinystdio/fmemopen.c", + "tinystdio/fopen.c", + "tinystdio/fprintf.c", + "tinystdio/fputc.c", + "tinystdio/fputs.c", + "tinystdio/fputwc.c", + "tinystdio/fputws.c", + "tinystdio/fread.c", + "tinystdio/freopen.c", + "tinystdio/fscanf.c", + "tinystdio/fseek.c", + "tinystdio/fseeko.c", + "tinystdio/fsetpos.c", + "tinystdio/ftell.c", + "tinystdio/ftello.c", + "tinystdio/ftox_engine.c", + "tinystdio/ftrylockfile.c", + "tinystdio/funlockfile.c", + "tinystdio/funopen.c", + "tinystdio/fwide.c", + "tinystdio/fwprintf.c", + "tinystdio/fwrite.c", + "tinystdio/fwscanf.c", + "tinystdio/gcvt.c", + "tinystdio/gcvtf.c", + "tinystdio/gcvtl.c", + "tinystdio/getchar.c", + "tinystdio/getdelim.c", + "tinystdio/getline.c", + "tinystdio/gets.c", + "tinystdio/getwchar.c", + "tinystdio/ldtoa_engine.c", + "tinystdio/ldtox_engine.c", + "tinystdio/matchcaseprefix.c", + "tinystdio/mktemp.c", + "tinystdio/perror.c", + "tinystdio/posixiob_stdin.c", + "tinystdio/posixiob_stdout.c", + "tinystdio/posixiob_stderr.c", + "tinystdio/printf.c", + "tinystdio/putchar.c", + "tinystdio/puts.c", + "tinystdio/putwchar.c", + "tinystdio/remove.c", + "tinystdio/rewind.c", + "tinystdio/scanf.c", + "tinystdio/setbuf.c", + "tinystdio/setbuffer.c", + "tinystdio/setlinebuf.c", + "tinystdio/setvbuf.c", + "tinystdio/sflags.c", + "tinystdio/snprintf.c", + "tinystdio/snprintfd.c", + "tinystdio/snprintff.c", + "tinystdio/sprintf.c", + "tinystdio/sprintfd.c", + "tinystdio/sprintff.c", + "tinystdio/sscanf.c", + "tinystdio/strfromd.c", + "tinystdio/strfromf.c", + "tinystdio/strfroml.c", + "tinystdio/strtod.c", + "tinystdio/strtod_l.c", + "tinystdio/strtof.c", + "tinystdio/strtof_l.c", + "tinystdio/strtoimax.c", + "tinystdio/strtoimax_l.c", + "tinystdio/strtol.c", + "tinystdio/strtold.c", + "tinystdio/strtold_l.c", + "tinystdio/strtol_l.c", + "tinystdio/strtoll.c", + "tinystdio/strtoll_l.c", + "tinystdio/strtoul.c", + "tinystdio/strtoul_l.c", + "tinystdio/strtoull.c", + "tinystdio/strtoull_l.c", + "tinystdio/strtoumax.c", + "tinystdio/strtoumax_l.c", + "tinystdio/swprintf.c", + "tinystdio/swscanf.c", + "tinystdio/tmpfile.c", + "tinystdio/tmpnam.c", + "tinystdio/ungetc.c", + "tinystdio/ungetwc.c", + "tinystdio/vasnprintf.c", + "tinystdio/vasprintf.c", + "tinystdio/vffprintf.c", + "tinystdio/vffscanf.c", + "tinystdio/vfiprintf.c", + "tinystdio/vfiscanf.c", + "tinystdio/vflprintf.c", + "tinystdio/vflscanf.c", + "tinystdio/vfmprintf.c", + "tinystdio/vfmscanf.c", + "tinystdio/vfprintf.c", + "tinystdio/vfscanf.c", + "tinystdio/vfwprintf.c", + "tinystdio/vfwscanf.c", + "tinystdio/vprintf.c", + "tinystdio/vscanf.c", + "tinystdio/vsnprintf.c", + "tinystdio/vsprintf.c", + "tinystdio/vsscanf.c", + "tinystdio/vswprintf.c", + "tinystdio/vswscanf.c", + "tinystdio/vwprintf.c", + "tinystdio/vwscanf.c", + "tinystdio/wcstod.c", + "tinystdio/wcstod_l.c", + "tinystdio/wcstof.c", + "tinystdio/wcstof_l.c", + "tinystdio/wcstoimax.c", + "tinystdio/wcstoimax_l.c", + "tinystdio/wcstol.c", + "tinystdio/wcstold.c", + "tinystdio/wcstold_l.c", + "tinystdio/wcstol_l.c", + "tinystdio/wcstoll.c", + "tinystdio/wcstoll_l.c", + "tinystdio/wcstoul.c", + "tinystdio/wcstoul_l.c", + "tinystdio/wcstoull.c", + "tinystdio/wcstoull_l.c", + "tinystdio/wcstoumax.c", + "tinystdio/wcstoumax_l.c", + "tinystdio/wprintf.c", + "tinystdio/wscanf.c", + "tinystdio/sprintf_s.c", + "tinystdio/vfprintf_s.c", + "tinystdio/vsnprintf_s.c", + "tinystdio/atod_ryu.c", + "tinystdio/atof_ryu.c", + "tinystdio/dtoa_ryu.c", + "tinystdio/ftoa_ryu.c", + "tinystdio/ryu_divpow2.c", + "tinystdio/ryu_log10.c", + "tinystdio/ryu_log2pow5.c", + "tinystdio/ryu_pow5bits.c", + "tinystdio/ryu_table.c", + "tinystdio/ryu_umul128.c", +]; + +pub(crate) const LIBC_FILES_X86: &[&str] = &[ + "machine/x86/memcpy.S", + "machine/x86/memset.S", + "machine/x86/setjmp.S", + "machine/x86/memchr.c", + "machine/x86/memcmp.c", + "machine/x86/memmove.c", + "machine/x86/strchr.c", + "machine/x86/strlen.c", + "machine/x86/memchr.S", + "machine/x86/memcmp.S", + "machine/x86/memmove.S", + "machine/x86/strchr.S", + "machine/x86/strlen.S", +]; + +pub(crate) const LIBM_FILES: &[&str] = &[ + "math/k_cos.c", + "math/k_rem_pio2.c", + "math/k_sin.c", + "math/k_tan.c", + "math/kf_cos.c", + "math/kf_rem_pio2.c", + "math/kf_sin.c", + "math/kf_tan.c", + "math/s_acos.c", + "math/s_acosh.c", + "math/s_asin.c", + "math/s_asinh.c", + "math/s_atan.c", + "math/s_atan2.c", + "math/s_atanh.c", + "math/s_ceil.c", + "math/s_cos.c", + "math/s_cosh.c", + "math/s_drem.c", + "math/s_erf.c", + "math/s_exp.c", + "math/s_exp2.c", + "math/s_fabs.c", + "math/s_floor.c", + "math/s_fmod.c", + "math/s_frexp.c", + "math/s_hypot.c", + "math/s_j0.c", + "math/s_j1.c", + "math/s_jn.c", + "math/s_lgamma.c", + "math/s_log.c", + "math/s_log10.c", + "math/s_pow.c", + "math/s_rem_pio2.c", + "math/s_remainder.c", + "math/s_scalb.c", + "math/s_signif.c", + "math/s_sin.c", + "math/s_sincos.c", + "math/s_sinh.c", + "math/s_sqrt.c", + "math/s_tan.c", + "math/s_tanh.c", + "math/s_tgamma.c", + "math/sf_acos.c", + "math/sf_acosh.c", + "math/sf_asin.c", + "math/sf_asinh.c", + "math/sf_atan.c", + "math/sf_atan2.c", + "math/sf_atanh.c", + "math/sf_ceil.c", + "math/sf_cos.c", + "math/sf_cosh.c", + "math/sf_drem.c", + "math/sf_erf.c", + "math/sf_exp.c", + "math/sf_exp2.c", + "math/sf_fabs.c", + "math/sf_floor.c", + "math/sf_fmod.c", + "math/sf_frexp.c", + "math/sf_hypot.c", + "math/sf_j0.c", + "math/sf_j1.c", + "math/sf_jn.c", + "math/sf_lgamma.c", + "math/sf_log.c", + "math/sf_log10.c", + "math/sf_log2.c", + "math/sf_pow.c", + "math/sf_rem_pio2.c", + "math/sf_remainder.c", + "math/sf_scalb.c", + "math/sf_signif.c", + "math/sf_sin.c", + "math/sf_sincos.c", + "math/sf_sinh.c", + "math/sf_sqrt.c", + "math/sf_tan.c", + "math/sf_tanh.c", + "math/sf_tgamma.c", + "math/sr_lgamma.c", + "math/srf_lgamma.c", + "math/sl_hypot.c", + "common/signgam.c", + "common/s_finite.c", + "common/s_copysign.c", + "common/s_modf.c", + "common/s_scalbn.c", + "common/s_cbrt.c", + "common/s_exp10.c", + "common/s_expm1.c", + "common/s_ilogb.c", + "common/s_infinity.c", + "common/s_iseqsig.c", + "common/s_isinf.c", + "common/s_isnan.c", + "common/s_issignaling.c", + "common/s_log1p.c", + "common/s_nan.c", + "common/s_nextafter.c", + "common/s_pow10.c", + "common/s_rint.c", + "common/s_log2.c", + "common/s_logb.c", + "common/s_fdim.c", + "common/s_fma.c", + "common/s_fmax.c", + "common/s_fmin.c", + "common/s_fpclassify.c", + "common/s_getpayload.c", + "common/s_lrint.c", + "common/s_llrint.c", + "common/s_lround.c", + "common/s_llround.c", + "common/s_nearbyint.c", + "common/s_remquo.c", + "common/s_round.c", + "common/s_scalbln.c", + "common/s_signbit.c", + "common/s_trunc.c", + "common/exp_data.c", + "common/math_denorm.c", + "common/math_denormf.c", + "common/math_denorml.c", + "common/math_err_with_errno.c", + "common/math_err_uflow.c", + "common/math_err_oflow.c", + "common/math_err_divzero.c", + "common/math_err_invalid.c", + "common/math_err_may_uflow.c", + "common/math_err_check_uflow.c", + "common/math_err_check_oflow.c", + "common/math_inexact.c", + "common/math_inexactf.c", + "common/log_data.c", + "common/log2_data.c", + "common/pow_log_data.c", + "common/sf_finite.c", + "common/sf_copysign.c", + "common/sf_modf.c", + "common/sf_scalbn.c", + "common/sf_cbrt.c", + "common/sf_exp10.c", + "common/sf_expm1.c", + "common/sf_getpayload.c", + "common/sf_ilogb.c", + "common/sf_infinity.c", + "common/sf_iseqsig.c", + "common/sf_isinf.c", + "common/sf_isnan.c", + "common/sf_issignaling.c", + "common/sf_log1p.c", + "common/sf_nan.c", + "common/sf_nextafter.c", + "common/sf_pow10.c", + "common/sf_rint.c", + "common/sf_logb.c", + "common/sf_fdim.c", + "common/sf_fma.c", + "common/sf_fmax.c", + "common/sf_fmin.c", + "common/sf_fpclassify.c", + "common/sf_lrint.c", + "common/sf_llrint.c", + "common/sf_lround.c", + "common/sf_llround.c", + "common/sf_nearbyint.c", + "common/sf_remquo.c", + "common/sf_round.c", + "common/sf_scalbln.c", + "common/sf_trunc.c", + "common/sf_exp2_data.c", + "common/sf_log_data.c", + "common/sf_log2_data.c", + "common/sf_pow_log2_data.c", + "common/sincosf_data.c", + "common/math_errf_with_errnof.c", + "common/math_errf_uflowf.c", + "common/math_errf_may_uflowf.c", + "common/math_errf_oflowf.c", + "common/math_errf_divzerof.c", + "common/math_errf_invalidf.c", + "common/math_errf_check_oflowf.c", + "common/math_errf_check_uflowf.c", + "common/copysignl.c", + "common/exp10l.c", + "common/fabsl.c", + "common/frexpl.c", + "common/math_inexactl.c", + "common/nanl.c", + "common/nexttoward.c", + "common/nexttowardf.c", + "common/sl_iseqsig.c", + "common/sl_issignaling.c", + "fenv/fegetmode.c", + "fenv/fesetmode.c", + "fenv/fe_dfl_env.c", + "ld/e_acoshl.c", + "ld/e_atanhl.c", + "ld/e_coshl.c", + "ld/e_expl.c", + "ld/e_fmodl.c", + "ld/e_hypotl.c", + "ld/e_lgammal_r.c", + "ld/e_log10l.c", + "ld/e_log2l.c", + "ld/e_logl.c", + "ld/e_powl.c", + "ld/e_sinhl.c", + "ld/e_tgammal.c", + "ld/invtrig.c", + "ld/k_cosl.c", + "ld/k_sinl.c", + "ld/k_tanl.c", + "ld/s_asinhl.c", + "ld/s_ceill.c", + "ld/s_copysignl.c", + "ld/s_erfl.c", + "ld/s_exp2l.c", + "ld/s_expm1l.c", + "ld/s_floorl.c", + "ld/s_fpclassifyl.c", + "ld/s_getpayloadl.c", + "ld/s_log1pl.c", + "ld/s_modfl.c", + "ld/s_nanl.c", + "ld/s_nextafterl.c", + "ld/s_nexttoward.c", + "ld/s_nexttowardf.c", + "ld/s_remquol.c", + "ld/s_significandl.c", + "ld/s_tanhl.c", + "ld/s_truncl.c", + "ld/e_acosl.c", + "ld/e_asinl.c", + "ld/e_atan2l.c", + "ld/e_lgammal.c", + "ld/e_remainderl.c", + "ld/e_sqrtl.c", + "ld/k_rem_pio2.c", + "ld/math_errl_check_oflowl.c", + "ld/math_errl_check_uflowl.c", + "ld/math_errl_divzerol.c", + "ld/math_errl_invalidl.c", + "ld/math_errl_oflowl.c", + "ld/math_errl_uflowl.c", + "ld/math_errl_with_errnol.c", + "ld/polevll.c", + "ld/s_atanl.c", + "ld/s_ilogbl.c", + "ld/s_cbrtl.c", + "ld/s_cosl.c", + "ld/s_fabsl.c", + "ld/s_fdiml.c", + "ld/s_finitel.c", + "ld/s_fmal.c", + "ld/s_fmaxl.c", + "ld/s_fminl.c", + "ld/s_frexpl.c", + "ld/s_isinfl.c", + "ld/s_isnanl.c", + "ld/s_issignalingl.c", + "ld/s_llrintl.c", + "ld/s_llroundl.c", + "ld/s_logbl.c", + "ld/s_lrintl.c", + "ld/s_lroundl.c", + "ld/s_rintl.c", + "ld/s_roundl.c", + "ld/s_scalbl.c", + "ld/s_scalbln.c", + "ld/s_scalbnl.c", + "ld/s_signbitl.c", + "ld/s_sincosl.c", + "ld/s_sinl.c", + "ld/s_tanl.c", +]; + +pub(crate) const LIBM_FILES_X86: &[&str] = &["machine/x86/fenv.c"]; diff --git a/src/hyperlight_guest_bin/c/clock.c b/src/hyperlight_guest_bin/c/clock.c new file mode 100644 index 000000000..edff24f8d --- /dev/null +++ b/src/hyperlight_guest_bin/c/clock.c @@ -0,0 +1,38 @@ +#define _POSIX_MONOTONIC_CLOCK 1 +#define _POSIX_C_SOURCE 200809L + +#include +#include +#include +#include +#include + +extern void _current_time(uint64_t *ts); + +int gettimeofday(struct timeval *__restrict tv, void *__restrict __tz) { + uint64_t current_time[2]; + (void)__tz; + + _current_time(current_time); + tv->tv_sec = current_time[0]; + tv->tv_usec = current_time[1] / 1000; + + return 0; +} + +int clock_gettime(clockid_t clk_id, struct timespec *tp) { + uint64_t current_time[2]; + switch (clk_id) { + case CLOCK_REALTIME: + case CLOCK_MONOTONIC: + _current_time(current_time); + tp->tv_sec = current_time[0]; + tp->tv_nsec = current_time[1]; + break; + default: + errno = EINVAL; + return -1; + } + + return 0; +} diff --git a/src/hyperlight_guest_bin/c/mimalloc.c b/src/hyperlight_guest_bin/c/mimalloc.c new file mode 100644 index 000000000..15a5c15f5 --- /dev/null +++ b/src/hyperlight_guest_bin/c/mimalloc.c @@ -0,0 +1,85 @@ +#include +#include +#include +#include +#include +#include + +// ----------------------------------------------------------------------------- +// Static variables for sbrk region_ +// ----------------------------------------------------------------------------- +static char *heap_start = NULL; +static char *heap_end = NULL; +static char *brk_ptr = NULL; + +/* + * Initialize a mimalloc arena on the donated memory region. + * After this call, all allocations use only the pre‐reserved arena. + */ +void init_arena(void *donated_ptr, size_t donated_size) { + /* do not use OS memory for allocation */ + mi_option_set_enabled(mi_option_limit_os_alloc, true); + + mi_arena_id_t arena_id = 0; + bool ok = mi_manage_os_memory_ex( + donated_ptr, + donated_size, + 1 /* committed */, + 0 /* large */, + 0 /* zero */, + -1 /* numa_node */, + 1 /* exclusive */, + &arena_id + ); + + if (!ok) { + fprintf(stderr, "mi_manage_os_memory_ex failed\n"); + abort(); + } + + /* create a heap in the donated arena and set it as default */ + mi_heap_t *heap = mi_heap_new_in_arena(arena_id); + mi_heap_set_default(heap); +} + +/* + * Register the heap region to be used by sbrk(). + * Must be called before any sbrk() invocation. + */ +void init_sbrk(void *start, size_t size) { + heap_start = (char*)start; + heap_end = heap_start + size; + brk_ptr = heap_start; +} + +/* + * Unix‐style sbrk implementation over the registered heap region. + * On success returns the previous break; on failure returns (void*)-1 + * and sets errno = ENOMEM. + */ +void *sbrk(ptrdiff_t incr) { + if (heap_start == NULL) { + errno = ENOMEM; + return (void*)-1; + } + + if (incr < 0) { + /* shrink: ensure we don't move below heap_start */ + size_t dec = (size_t)(-incr); + if ((size_t)(brk_ptr - heap_start) < dec) { + errno = ENOMEM; + return (void*)-1; + } + } else { + /* grow: ensure we don't move past heap_end */ + size_t inc = (size_t)incr; + if ((size_t)(heap_end - brk_ptr) < inc) { + errno = ENOMEM; + return (void*)-1; + } + } + + void *old_brk = brk_ptr; + brk_ptr += incr; + return old_brk; +} diff --git a/src/hyperlight_guest_bin/src/host_bridge.rs b/src/hyperlight_guest_bin/src/host_bridge.rs new file mode 100644 index 000000000..4e6b70315 --- /dev/null +++ b/src/hyperlight_guest_bin/src/host_bridge.rs @@ -0,0 +1,141 @@ +/* +Copyright 2025 The Hyperlight Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +use alloc::string::ToString; +use alloc::vec; +use alloc::vec::Vec; +use core::cell::OnceCell; +use core::ffi::*; +use core::sync::atomic::{AtomicU64, Ordering}; + +use hyperlight_common::flatbuffer_wrappers::function_types::{ParameterValue, ReturnType}; + +use crate::host_comm::{call_host_function, get_host_function_details}; + +static CURRENT_TIME: AtomicU64 = AtomicU64::new(0); +static CAPS: Caps = Caps::new(); + +// Host capability flags +struct Caps { + host_read: OnceCell, + host_clock: OnceCell, +} + +unsafe impl Sync for Caps {} + +impl Caps { + const fn new() -> Self { + Self { + host_read: OnceCell::new(), + host_clock: OnceCell::new(), + } + } + + #[inline] + fn query(name: &str) -> bool { + get_host_function_details() + .host_functions + .unwrap_or_default() + .iter() + .any(|f| f.function_name == name) + } + + #[inline] + fn host_read(&self) -> bool { + *self.host_read.get_or_init(|| Self::query("HostRead")) + } + + #[inline] + fn host_clock(&self) -> bool { + *self.host_clock.get_or_init(|| Self::query("CurrentTime")) + } +} + +#[unsafe(no_mangle)] +pub extern "C" fn read(fd: c_int, buf: *mut c_void, count: usize) -> isize { + // Only stdin (fd=0) and only if HostRead is defined + if fd != 0 || !CAPS.host_read() { + return 0; + } + + let bytes = call_host_function::>( + "HostRead", + Some(vec![ParameterValue::ULong(count as u64)]), + ReturnType::VecBytes, + ) + .unwrap_or_default(); + + let n = bytes.len(); + unsafe { + core::ptr::copy_nonoverlapping(bytes.as_ptr(), buf as *mut u8, n); + } + n as isize +} + +#[unsafe(no_mangle)] +pub extern "C" fn write(fd: c_int, buf: *const c_void, count: usize) -> isize { + // Only stdout (fd=1) and stderr (fd=2) + if fd != 1 && fd != 2 { + return count as isize; + } + + let slice = unsafe { core::slice::from_raw_parts(buf as *const u8, count) }; + let s = core::str::from_utf8(slice).unwrap_or(""); + let _ = call_host_function::( + "HostPrint", + Some(vec![ParameterValue::String(s.to_string())]), + ReturnType::Int, + ); + count as isize +} + +#[unsafe(no_mangle)] +pub extern "C" fn _current_time(ts: *mut u64) -> c_int { + let bytes = if !CAPS.host_clock() { + vec![] + } else { + call_host_function::>("CurrentTime", Some(vec![]), ReturnType::VecBytes).unwrap() + }; + + let (secs, nanos) = if bytes.len() == 16 { + let secs = u64::from_ne_bytes(bytes[0..8].try_into().unwrap()); + let nanos = u64::from_ne_bytes(bytes[8..16].try_into().unwrap()); + (secs, nanos) + } else { + let secs = 1609459200 + CURRENT_TIME.fetch_add(1, Ordering::Relaxed); + (secs, 0) + }; + + let ts = unsafe { core::slice::from_raw_parts_mut(ts, 2) }; + ts[0] = secs; + ts[1] = nanos; + 0 +} + +#[unsafe(no_mangle)] +pub extern "C" fn _exit(ec: c_int) -> ! { + hyperlight_guest::exit::abort_with_code(&[ec as u8]); +} + +#[unsafe(no_mangle)] +pub extern "C" fn lseek(_fd: c_int, _offset: c_long, _whence: c_int) -> c_long { + 0 // NOP +} + +#[unsafe(no_mangle)] +pub extern "C" fn close(_fd: c_int) -> c_int { + 0 // NOP +} diff --git a/src/hyperlight_guest_bin/src/lib.rs b/src/hyperlight_guest_bin/src/lib.rs index 27918ad3f..c6dfe7954 100644 --- a/src/hyperlight_guest_bin/src/lib.rs +++ b/src/hyperlight_guest_bin/src/lib.rs @@ -18,9 +18,9 @@ limitations under the License. // === Dependencies === extern crate alloc; +use core::ffi::c_void; use alloc::string::ToString; -use buddy_system_allocator::LockedHeap; #[cfg(target_arch = "x86_64")] use exceptions::{gdt::load_gdt, idtr::load_idt}; use guest_function::call::dispatch_function; @@ -34,6 +34,7 @@ use hyperlight_guest::exit::{abort_with_code_and_message, halt}; use hyperlight_guest::guest_handle::handle::GuestHandle; use hyperlight_guest_tracing::{trace, trace_function}; use log::LevelFilter; +use libc_alloc::LibcAlloc; use spin::Once; // === Modules === @@ -54,72 +55,17 @@ pub mod guest_function { pub mod guest_logger; pub mod host_comm; -pub mod memory; pub mod paging; -// Globals -#[cfg(feature = "mem_profile")] -struct ProfiledLockedHeap(LockedHeap); -#[cfg(feature = "mem_profile")] -unsafe impl alloc::alloc::GlobalAlloc for ProfiledLockedHeap { - unsafe fn alloc(&self, layout: core::alloc::Layout) -> *mut u8 { - let addr = unsafe { self.0.alloc(layout) }; - unsafe { - core::arch::asm!("out dx, al", - in("dx") OutBAction::TraceMemoryAlloc as u16, - in("rax") layout.size() as u64, - in("rcx") addr as u64); - } - addr - } - unsafe fn dealloc(&self, ptr: *mut u8, layout: core::alloc::Layout) { - unsafe { - core::arch::asm!("out dx, al", - in("dx") OutBAction::TraceMemoryFree as u16, - in("rax") layout.size() as u64, - in("rcx") ptr as u64); - self.0.dealloc(ptr, layout) - } - } - unsafe fn alloc_zeroed(&self, layout: core::alloc::Layout) -> *mut u8 { - let addr = unsafe { self.0.alloc_zeroed(layout) }; - unsafe { - core::arch::asm!("out dx, al", - in("dx") OutBAction::TraceMemoryAlloc as u16, - in("rax") layout.size() as u64, - in("rcx") addr as u64); - } - addr - } - unsafe fn realloc( - &self, - ptr: *mut u8, - layout: core::alloc::Layout, - new_size: usize, - ) -> *mut u8 { - let new_ptr = unsafe { self.0.realloc(ptr, layout, new_size) }; - unsafe { - core::arch::asm!("out dx, al", - in("dx") OutBAction::TraceMemoryFree as u16, - in("rax") layout.size() as u64, - in("rcx") ptr); - core::arch::asm!("out dx, al", - in("dx") OutBAction::TraceMemoryAlloc as u16, - in("rax") new_size as u64, - in("rcx") new_ptr); - } - new_ptr - } -} +#[cfg(feature = "libc")] +mod host_bridge; + + + // === Globals === -#[cfg(not(feature = "mem_profile"))] #[global_allocator] -pub(crate) static HEAP_ALLOCATOR: LockedHeap<32> = LockedHeap::<32>::empty(); -#[cfg(feature = "mem_profile")] -#[global_allocator] -pub(crate) static HEAP_ALLOCATOR: ProfiledLockedHeap<32> = - ProfiledLockedHeap(LockedHeap::<32>::empty()); +static ALLOCATOR: LibcAlloc = LibcAlloc; pub(crate) static mut GUEST_HANDLE: GuestHandle = GuestHandle::new(); pub(crate) static mut REGISTERED_GUEST_FUNCTIONS: GuestFunctionRegister = @@ -150,14 +96,18 @@ fn panic(info: &core::panic::PanicInfo) -> ! { unsafe extern "C" { fn hyperlight_main(); + + #[cfg(feature = "libc")] fn srand(seed: u32); + fn init_sbrk(donated_ptr: *const c_void, donated_size: usize); + fn init_arena(donated_ptr: *const c_void, donated_size: usize); } static INIT: Once = Once::new(); #[unsafe(no_mangle)] #[trace_function] -pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_level: u64) { +pub extern "C" fn entrypoint(peb_address: u64, _seed: u64, ops: u64, max_log_level: u64) { if peb_address == 0 { panic!("PEB address is null"); } @@ -168,10 +118,12 @@ pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_leve #[allow(static_mut_refs)] let peb_ptr = GUEST_HANDLE.peb().unwrap(); - let srand_seed = (((peb_address << 8) ^ (seed >> 4)) >> 32) as u32; - // Set the seed for the random number generator for C code using rand; - srand(srand_seed); + #[cfg(feature = "libc")] + { + let srand_seed = (((peb_address << 8) ^ (_seed >> 4)) >> 32) as u32; + srand(srand_seed); + } // This static is to make it easier to implement the __chkstk function in assembly. // It also means that should we change the layout of the struct in the future, we @@ -185,16 +137,10 @@ pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_leve load_idt(); } - let heap_start = (*peb_ptr).guest_heap.ptr as usize; + let heap_start = (*peb_ptr).guest_heap.ptr as *const c_void; let heap_size = (*peb_ptr).guest_heap.size as usize; - #[cfg(not(feature = "mem_profile"))] - let heap_allocator = &HEAP_ALLOCATOR; - #[cfg(feature = "mem_profile")] - let heap_allocator = &HEAP_ALLOCATOR.0; - heap_allocator - .try_lock() - .expect("Failed to access HEAP_ALLOCATOR") - .init(heap_start, heap_size); + init_arena(heap_start, heap_size); + init_sbrk(heap_start, heap_size); OS_PAGE_SIZE = ops as u32; diff --git a/src/hyperlight_guest_bin/src/memory.rs b/src/hyperlight_guest_bin/src/memory.rs deleted file mode 100644 index 5cc72c8ab..000000000 --- a/src/hyperlight_guest_bin/src/memory.rs +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2025 The Hyperlight Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -use core::alloc::Layout; -use core::ffi::c_void; -use core::mem::{align_of, size_of}; -use core::ptr; - -use hyperlight_common::flatbuffer_wrappers::guest_error::ErrorCode; -use hyperlight_guest::exit::abort_with_code; - -/* - C-wrappers for Rust's registered global allocator. - - Each memory allocation via `malloc/calloc/realloc` is stored together with a `alloc::Layout` describing - the size and alignment of the allocation. This layout is stored just before the actual raw memory returned to the caller. - - Example: A call to malloc(64) will allocate space for both an `alloc::Layout` and 64 bytes of memory: - - ---------------------------------------------------------------------------------------- - | Layout { size: 64 + size_of::(), ... } | 64 bytes of memory | ... - ---------------------------------------------------------------------------------------- - ^ - | - | - ptr returned to caller -*/ - -// We assume the maximum alignment for any value is the alignment of u128. -const DEFAULT_ALIGN: usize = align_of::(); -const HEADER_LEN: usize = size_of::
(); - -#[repr(transparent)] -// A header that stores the layout information for the allocated memory block. -struct Header(Layout); - -/// Allocates a block of memory with the given size. The memory is only guaranteed to be initialized to 0s if `zero` is true, otherwise -/// it may or may not be initialized. -/// -/// # Invariants -/// `alignment` must be non-zero and a power of two -/// -/// # Safety -/// The returned pointer must be freed with `memory::free` when it is no longer needed, otherwise memory will leak. -unsafe fn alloc_helper(size: usize, alignment: usize, zero: bool) -> *mut c_void { - if size == 0 { - return ptr::null_mut(); - } - - let actual_align = alignment.max(align_of::
()); - let data_offset = HEADER_LEN.next_multiple_of(actual_align); - - let Some(total_size) = data_offset.checked_add(size) else { - abort_with_code(&[ErrorCode::MallocFailed as u8]); - }; - - // Create layout for entire allocation - let layout = - Layout::from_size_align(total_size, actual_align).expect("Invalid layout parameters"); - - unsafe { - let raw_ptr = match zero { - true => alloc::alloc::alloc_zeroed(layout), - false => alloc::alloc::alloc(layout), - }; - - if raw_ptr.is_null() { - abort_with_code(&[ErrorCode::MallocFailed as u8]); - } - - // Place Header immediately before the user data region - let header_ptr = raw_ptr.add(data_offset - HEADER_LEN).cast::
(); - header_ptr.write(Header(layout)); - raw_ptr.add(data_offset) as *mut c_void - } -} - -/// Allocates a block of memory with the given size. -/// The memory is not guaranteed to be initialized to 0s. -/// -/// # Safety -/// The returned pointer must be freed with `memory::free` when it is no longer needed, otherwise memory will leak. -#[unsafe(no_mangle)] -pub unsafe extern "C" fn malloc(size: usize) -> *mut c_void { - unsafe { alloc_helper(size, DEFAULT_ALIGN, false) } -} - -/// Allocates a block of memory for an array of `nmemb` elements, each of `size` bytes. -/// The memory is initialized to 0s. -/// -/// # Safety -/// The returned pointer must be freed with `memory::free` when it is no longer needed, otherwise memory will leak. -#[unsafe(no_mangle)] -pub unsafe extern "C" fn calloc(nmemb: usize, size: usize) -> *mut c_void { - unsafe { - let total_size = nmemb - .checked_mul(size) - .expect("nmemb * size should not overflow in calloc"); - - alloc_helper(total_size, DEFAULT_ALIGN, true) - } -} - -/// Allocates aligned memory. -/// -/// # Safety -/// The returned pointer must be freed with `free` when it is no longer needed. -#[unsafe(no_mangle)] -pub unsafe extern "C" fn aligned_alloc(alignment: usize, size: usize) -> *mut c_void { - // Validate alignment - if alignment == 0 || (alignment & (alignment - 1)) != 0 { - return ptr::null_mut(); - } - - unsafe { alloc_helper(size, alignment, false) } -} - -/// Frees the memory block pointed to by `ptr`. -/// -/// # Safety -/// `ptr` must be a pointer to a memory block previously allocated by `memory::malloc`, `memory::calloc`, or `memory::realloc`. -#[unsafe(no_mangle)] -pub unsafe extern "C" fn free(ptr: *mut c_void) { - if ptr.is_null() { - return; - } - - let user_ptr = ptr as *const u8; - - unsafe { - // Read the Header just before the user data - let header_ptr = user_ptr.sub(HEADER_LEN).cast::
(); - let layout = header_ptr.read().0; - - // Deallocate from the original base pointer - let offset = HEADER_LEN.next_multiple_of(layout.align()); - let raw_ptr = user_ptr.sub(offset) as *mut u8; - alloc::alloc::dealloc(raw_ptr, layout); - } -} - -/// Changes the size of the memory block pointed to by `ptr` to `size` bytes. If the returned ptr is non-null, -/// any usage of the old memory block is immediately undefined behavior. -/// -/// # Safety -/// `ptr` must be a pointer to a memory block previously allocated by `memory::malloc`, `memory::calloc`, or `memory::realloc`. -#[unsafe(no_mangle)] -pub unsafe extern "C" fn realloc(ptr: *mut c_void, size: usize) -> *mut c_void { - if ptr.is_null() { - // If the pointer is null, treat as a malloc - return unsafe { malloc(size) }; - } - - if size == 0 { - // If the size is 0, treat as a free and return null - unsafe { - free(ptr); - } - return ptr::null_mut(); - } - - let user_ptr = ptr as *const u8; - - unsafe { - let header_ptr = user_ptr.sub(HEADER_LEN).cast::
(); - - let old_layout = header_ptr.read().0; - let old_offset = HEADER_LEN.next_multiple_of(old_layout.align()); - let old_user_size = old_layout.size() - old_offset; - - let new_ptr = alloc_helper(size, old_layout.align(), false); - if new_ptr.is_null() { - return ptr::null_mut(); - } - - let copy_size = old_user_size.min(size); - ptr::copy_nonoverlapping(user_ptr, new_ptr as *mut u8, copy_size); - - free(ptr); - new_ptr - } -} diff --git a/src/hyperlight_guest_bin/third_party/README.md b/src/hyperlight_guest_bin/third_party/README.md index deaf7ba5b..b959a1f6c 100644 --- a/src/hyperlight_guest_bin/third_party/README.md +++ b/src/hyperlight_guest_bin/third_party/README.md @@ -2,15 +2,7 @@ This project makes use of the following third party libraries, each of which is contained in a subdirectory of `third_party` with a COPYRIGHT/LICENSE file in the root of the subdirectory. These libraries are used under the terms of their respective licenses. They are also listed in the NOTICE file in the root of the repository +## picolibc -## printf +[`picolibc`](https://github.com/picolibc/picolibc) is used by hyperlight and is located in the [picolibc](./picolibc) directory as a git subtree. -This implementation of printf is from [here](https://github.com/mpaland/printf.git) -The copy was taken at version at [version 4.0](https://github.com/mpaland/printf/releases/tag/v4.0.0) -Changes have been applied to the original code for Hyperlight using this [patch](./printf/printf.patch) - -## libc - -A partial version of musl libc is used by hyperlight and is located in the [musl](./musl) directory as a git subtree. - -The current version is release [v1.2.5](https://git.musl-libc.org/cgit/musl/tag/?h=v1.2.5). Many files have been deleted and changes have been made to some of the remaining files. diff --git a/src/hyperlight_guest_bin/third_party/mimalloc b/src/hyperlight_guest_bin/third_party/mimalloc new file mode 160000 index 000000000..09a27098a --- /dev/null +++ b/src/hyperlight_guest_bin/third_party/mimalloc @@ -0,0 +1 @@ +Subproject commit 09a27098aa6e9286518bd9c74e6ffa7199c3f04e diff --git a/src/hyperlight_guest_bin/third_party/musl/COPYRIGHT b/src/hyperlight_guest_bin/third_party/musl/COPYRIGHT deleted file mode 100644 index c1628e9ac..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/COPYRIGHT +++ /dev/null @@ -1,193 +0,0 @@ -musl as a whole is licensed under the following standard MIT license: - ----------------------------------------------------------------------- -Copyright © 2005-2020 Rich Felker, et al. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- - -Authors/contributors include: - -A. Wilcox -Ada Worcester -Alex Dowad -Alex Suykov -Alexander Monakov -Andre McCurdy -Andrew Kelley -Anthony G. Basile -Aric Belsito -Arvid Picciani -Bartosz Brachaczek -Benjamin Peterson -Bobby Bingham -Boris Brezillon -Brent Cook -Chris Spiegel -Clément Vasseur -Daniel Micay -Daniel Sabogal -Daurnimator -David Carlier -David Edelsohn -Denys Vlasenko -Dmitry Ivanov -Dmitry V. Levin -Drew DeVault -Emil Renner Berthing -Fangrui Song -Felix Fietkau -Felix Janda -Gianluca Anzolin -Hauke Mehrtens -He X -Hiltjo Posthuma -Isaac Dunham -Jaydeep Patil -Jens Gustedt -Jeremy Huntwork -Jo-Philipp Wich -Joakim Sindholt -John Spencer -Julien Ramseier -Justin Cormack -Kaarle Ritvanen -Khem Raj -Kylie McClain -Leah Neukirchen -Luca Barbato -Luka Perkov -M Farkas-Dyck (Strake) -Mahesh Bodapati -Markus Wichmann -Masanori Ogino -Michael Clark -Michael Forney -Mikhail Kremnyov -Natanael Copa -Nicholas J. Kain -orc -Pascal Cuoq -Patrick Oppenlander -Petr Hosek -Petr Skocik -Pierre Carrier -Reini Urban -Rich Felker -Richard Pennington -Ryan Fairfax -Samuel Holland -Segev Finer -Shiz -sin -Solar Designer -Stefan Kristiansson -Stefan O'Rear -Szabolcs Nagy -Timo Teräs -Trutz Behn -Valentin Ochs -Will Dietz -William Haddon -William Pitcock - -Portions of this software are derived from third-party works licensed -under terms compatible with the above MIT license: - -The TRE regular expression implementation (src/regex/reg* and -src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed -under a 2-clause BSD license (license text in the source files). The -included version has been heavily modified by Rich Felker in 2012, in -the interests of size, simplicity, and namespace cleanliness. - -Much of the math library code (src/math/* and src/complex/*) is -Copyright © 1993,2004 Sun Microsystems or -Copyright © 2003-2011 David Schultz or -Copyright © 2003-2009 Steven G. Kargl or -Copyright © 2003-2009 Bruce D. Evans or -Copyright © 2008 Stephen L. Moshier or -Copyright © 2017-2018 Arm Limited -and labelled as such in comments in the individual source files. All -have been licensed under extremely permissive terms. - -The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 -The Android Open Source Project and is licensed under a two-clause BSD -license. It was taken from Bionic libc, used on Android. - -The AArch64 memcpy and memset code (src/string/aarch64/*) are -Copyright © 1999-2019, Arm Limited. - -The implementation of DES for crypt (src/crypt/crypt_des.c) is -Copyright © 1994 David Burren. It is licensed under a BSD license. - -The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was -originally written by Solar Designer and placed into the public -domain. The code also comes with a fallback permissive license for use -in jurisdictions that may not recognize the public domain. - -The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 -Valentin Ochs and is licensed under an MIT-style license. - -The x86_64 port was written by Nicholas J. Kain and is licensed under -the standard MIT terms. - -The mips and microblaze ports were originally written by Richard -Pennington for use in the ellcc project. The original code was adapted -by Rich Felker for build system and code conventions during upstream -integration. It is licensed under the standard MIT terms. - -The mips64 port was contributed by Imagination Technologies and is -licensed under the standard MIT terms. - -The powerpc port was also originally written by Richard Pennington, -and later supplemented and integrated by John Spencer. It is licensed -under the standard MIT terms. - -All other files which have no copyright comments are original works -produced specifically for use as part of this library, written either -by Rich Felker, the main author of the library, or by one or more -contibutors listed above. Details on authorship of individual files -can be found in the git version control history of the project. The -omission of copyright and license comments in each file is in the -interest of source tree size. - -In addition, permission is hereby granted for all public header files -(include/* and arch/*/bits/*) and crt files intended to be linked into -applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit -the copyright notice and permission notice otherwise required by the -license, and to use these files without any requirement of -attribution. These files include substantial contributions from: - -Bobby Bingham -John Spencer -Nicholas J. Kain -Rich Felker -Richard Pennington -Stefan Kristiansson -Szabolcs Nagy - -all of whom have explicitly granted such permission. - -This file previously contained text expressing a belief that most of -the files covered by the above exception were sufficiently trivial not -to be subject to copyright, resulting in confusion over whether it -negated the permissions granted in the license. In the spirit of -permissive licensing, and of not having licensing issues being an -obstacle to adoption, that text has been removed. diff --git a/src/hyperlight_guest_bin/third_party/musl/README b/src/hyperlight_guest_bin/third_party/musl/README deleted file mode 100644 index a30eb1127..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/README +++ /dev/null @@ -1,23 +0,0 @@ - - musl libc - -musl, pronounced like the word "mussel", is an MIT-licensed -implementation of the standard C library targetting the Linux syscall -API, suitable for use in a wide range of deployment environments. musl -offers efficient static and dynamic linking support, lightweight code -and low runtime overhead, strong fail-safe guarantees under correct -usage, and correctness in the sense of standards conformance and -safety. musl is built on the principle that these goals are best -achieved through simple code that is easy to understand and maintain. - -The 1.1 release series for musl features coverage for all interfaces -defined in ISO C99 and POSIX 2008 base, along with a number of -non-standardized interfaces for compatibility with Linux, BSD, and -glibc functionality. - -For basic installation instructions, see the included INSTALL file. -Information on full musl-targeted compiler toolchains, system -bootstrapping, and Linux distributions built on musl can be found on -the project website: - - http://www.musl-libc.org/ diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/generic/bits/errno.h b/src/hyperlight_guest_bin/third_party/musl/arch/generic/bits/errno.h deleted file mode 100644 index d2e1eeee0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/generic/bits/errno.h +++ /dev/null @@ -1,134 +0,0 @@ -#define EPERM 1 -#define ENOENT 2 -#define ESRCH 3 -#define EINTR 4 -#define EIO 5 -#define ENXIO 6 -#define E2BIG 7 -#define ENOEXEC 8 -#define EBADF 9 -#define ECHILD 10 -#define EAGAIN 11 -#define ENOMEM 12 -#define EACCES 13 -#define EFAULT 14 -#define ENOTBLK 15 -#define EBUSY 16 -#define EEXIST 17 -#define EXDEV 18 -#define ENODEV 19 -#define ENOTDIR 20 -#define EISDIR 21 -#define EINVAL 22 -#define ENFILE 23 -#define EMFILE 24 -#define ENOTTY 25 -#define ETXTBSY 26 -#define EFBIG 27 -#define ENOSPC 28 -#define ESPIPE 29 -#define EROFS 30 -#define EMLINK 31 -#define EPIPE 32 -#define EDOM 33 -#define ERANGE 34 -#define EDEADLK 35 -#define ENAMETOOLONG 36 -#define ENOLCK 37 -#define ENOSYS 38 -#define ENOTEMPTY 39 -#define ELOOP 40 -#define EWOULDBLOCK EAGAIN -#define ENOMSG 42 -#define EIDRM 43 -#define ECHRNG 44 -#define EL2NSYNC 45 -#define EL3HLT 46 -#define EL3RST 47 -#define ELNRNG 48 -#define EUNATCH 49 -#define ENOCSI 50 -#define EL2HLT 51 -#define EBADE 52 -#define EBADR 53 -#define EXFULL 54 -#define ENOANO 55 -#define EBADRQC 56 -#define EBADSLT 57 -#define EDEADLOCK EDEADLK -#define EBFONT 59 -#define ENOSTR 60 -#define ENODATA 61 -#define ETIME 62 -#define ENOSR 63 -#define ENONET 64 -#define ENOPKG 65 -#define EREMOTE 66 -#define ENOLINK 67 -#define EADV 68 -#define ESRMNT 69 -#define ECOMM 70 -#define EPROTO 71 -#define EMULTIHOP 72 -#define EDOTDOT 73 -#define EBADMSG 74 -#define EOVERFLOW 75 -#define ENOTUNIQ 76 -#define EBADFD 77 -#define EREMCHG 78 -#define ELIBACC 79 -#define ELIBBAD 80 -#define ELIBSCN 81 -#define ELIBMAX 82 -#define ELIBEXEC 83 -#define EILSEQ 84 -#define ERESTART 85 -#define ESTRPIPE 86 -#define EUSERS 87 -#define ENOTSOCK 88 -#define EDESTADDRREQ 89 -#define EMSGSIZE 90 -#define EPROTOTYPE 91 -#define ENOPROTOOPT 92 -#define EPROTONOSUPPORT 93 -#define ESOCKTNOSUPPORT 94 -#define EOPNOTSUPP 95 -#define ENOTSUP EOPNOTSUPP -#define EPFNOSUPPORT 96 -#define EAFNOSUPPORT 97 -#define EADDRINUSE 98 -#define EADDRNOTAVAIL 99 -#define ENETDOWN 100 -#define ENETUNREACH 101 -#define ENETRESET 102 -#define ECONNABORTED 103 -#define ECONNRESET 104 -#define ENOBUFS 105 -#define EISCONN 106 -#define ENOTCONN 107 -#define ESHUTDOWN 108 -#define ETOOMANYREFS 109 -#define ETIMEDOUT 110 -#define ECONNREFUSED 111 -#define EHOSTDOWN 112 -#define EHOSTUNREACH 113 -#define EALREADY 114 -#define EINPROGRESS 115 -#define ESTALE 116 -#define EUCLEAN 117 -#define ENOTNAM 118 -#define ENAVAIL 119 -#define EISNAM 120 -#define EREMOTEIO 121 -#define EDQUOT 122 -#define ENOMEDIUM 123 -#define EMEDIUMTYPE 124 -#define ECANCELED 125 -#define ENOKEY 126 -#define EKEYEXPIRED 127 -#define EKEYREVOKED 128 -#define EKEYREJECTED 129 -#define EOWNERDEAD 130 -#define ENOTRECOVERABLE 131 -#define ERFKILL 132 -#define EHWPOISON 133 diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/generic/fp_arch.h b/src/hyperlight_guest_bin/third_party/musl/arch/generic/fp_arch.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/atomic_arch.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/atomic_arch.h deleted file mode 100644 index da4e20375..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/atomic_arch.h +++ /dev/null @@ -1,123 +0,0 @@ -#define a_cas a_cas -static inline int a_cas(volatile int *p, int t, int s) -{ - __asm__ __volatile__ ( - "lock ; cmpxchg %3, %1" - : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - return t; -} - -#define a_cas_p a_cas_p -static inline void *a_cas_p(volatile void *p, void *t, void *s) -{ - __asm__( "lock ; cmpxchg %3, %1" - : "=a"(t), "=m"(*(void *volatile *)p) - : "a"(t), "r"(s) : "memory" ); - return t; -} - -#define a_swap a_swap -static inline int a_swap(volatile int *p, int v) -{ - __asm__ __volatile__( - "xchg %0, %1" - : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - return v; -} - -#define a_fetch_add a_fetch_add -static inline int a_fetch_add(volatile int *p, int v) -{ - __asm__ __volatile__( - "lock ; xadd %0, %1" - : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - return v; -} - -#define a_and a_and -static inline void a_and(volatile int *p, int v) -{ - __asm__ __volatile__( - "lock ; and %1, %0" - : "=m"(*p) : "r"(v) : "memory" ); -} - -#define a_or a_or -static inline void a_or(volatile int *p, int v) -{ - __asm__ __volatile__( - "lock ; or %1, %0" - : "=m"(*p) : "r"(v) : "memory" ); -} - -#define a_and_64 a_and_64 -static inline void a_and_64(volatile uint64_t *p, uint64_t v) -{ - __asm__ __volatile( - "lock ; and %1, %0" - : "=m"(*p) : "r"(v) : "memory" ); -} - -#define a_or_64 a_or_64 -static inline void a_or_64(volatile uint64_t *p, uint64_t v) -{ - __asm__ __volatile__( - "lock ; or %1, %0" - : "=m"(*p) : "r"(v) : "memory" ); -} - -#define a_inc a_inc -static inline void a_inc(volatile int *p) -{ - __asm__ __volatile__( - "lock ; incl %0" - : "=m"(*p) : "m"(*p) : "memory" ); -} - -#define a_dec a_dec -static inline void a_dec(volatile int *p) -{ - __asm__ __volatile__( - "lock ; decl %0" - : "=m"(*p) : "m"(*p) : "memory" ); -} - -#define a_store a_store -static inline void a_store(volatile int *p, int x) -{ - __asm__ __volatile__( - "mov %1, %0 ; lock ; orl $0,(%%rsp)" - : "=m"(*p) : "r"(x) : "memory" ); -} - -#define a_barrier a_barrier -static inline void a_barrier() -{ - __asm__ __volatile__( "" : : : "memory" ); -} - -#define a_spin a_spin -static inline void a_spin() -{ - __asm__ __volatile__( "pause" : : : "memory" ); -} - -#define a_crash a_crash -static inline void a_crash() -{ - __asm__ __volatile__( "hlt" : : : "memory" ); -} - -#define a_ctz_64 a_ctz_64 -static inline int a_ctz_64(uint64_t x) -{ - __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) ); - return x; -} - -#define a_clz_64 a_clz_64 -static inline int a_clz_64(uint64_t x) -{ - __asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) ); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/alltypes.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/alltypes.h deleted file mode 100644 index 4082b8890..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/alltypes.h +++ /dev/null @@ -1,427 +0,0 @@ - -#ifdef _MSC_VER -#define _Int64 long long -#define _Addr long long -#define __LONG_MAX 0x7fffffffL -#else -#define _Int64 long -#define _Addr long -#define __LONG_MAX 0x7fffffffffffffffL -#endif -#define _Reg long - -#define __BYTE_ORDER 1234 - - -#ifndef __cplusplus -#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t) -#ifdef _MSC_VER -typedef unsigned short wchar_t; -#else -typedef int wchar_t; -#endif -#define __DEFINED_wchar_t -#endif - -#endif - -#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2 -#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) -typedef long double float_t; -#define __DEFINED_float_t -#endif - -#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) -typedef long double double_t; -#define __DEFINED_double_t -#endif - -#else -#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) -typedef float float_t; -#define __DEFINED_float_t -#endif - -#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) -typedef double double_t; -#define __DEFINED_double_t -#endif - -#endif - -#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t) -typedef struct { long long __ll; long double __ld; } max_align_t; -#define __DEFINED_max_align_t -#endif - -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -#define __USE_TIME_BITS64 1 - -#if defined(__NEED_size_t) && !defined(__DEFINED_size_t) -typedef unsigned _Addr size_t; -#define __DEFINED_size_t -#endif - -#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t) -typedef unsigned _Addr uintptr_t; -#define __DEFINED_uintptr_t -#endif - -#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t) -typedef _Addr ptrdiff_t; -#define __DEFINED_ptrdiff_t -#endif - -#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t) -typedef _Addr ssize_t; -#define __DEFINED_ssize_t -#endif - -#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t) -typedef _Addr intptr_t; -#define __DEFINED_intptr_t -#endif - -#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t) -typedef _Addr regoff_t; -#define __DEFINED_regoff_t -#endif - -#if defined(__NEED_register_t) && !defined(__DEFINED_register_t) -typedef _Reg register_t; -#define __DEFINED_register_t -#endif - -#if defined(__NEED_time_t) && !defined(__DEFINED_time_t) -typedef _Int64 time_t; -#define __DEFINED_time_t -#endif - -#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t) -typedef _Int64 suseconds_t; -#define __DEFINED_suseconds_t -#endif - - -#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t) -typedef signed char int8_t; -#define __DEFINED_int8_t -#endif - -#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t) -typedef signed short int16_t; -#define __DEFINED_int16_t -#endif - -#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t) -typedef signed int int32_t; -#define __DEFINED_int32_t -#endif - -#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t) -typedef signed _Int64 int64_t; -#define __DEFINED_int64_t -#endif - -#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t) -typedef signed _Int64 intmax_t; -#define __DEFINED_intmax_t -#endif - -#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t) -typedef unsigned char uint8_t; -#define __DEFINED_uint8_t -#endif - -#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t) -typedef unsigned short uint16_t; -#define __DEFINED_uint16_t -#endif - -#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t) -typedef unsigned int uint32_t; -#define __DEFINED_uint32_t -#endif - -#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t) -typedef unsigned _Int64 uint64_t; -#define __DEFINED_uint64_t -#endif - -#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t) -typedef unsigned _Int64 u_int64_t; -#define __DEFINED_u_int64_t -#endif - -#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t) -typedef unsigned _Int64 uintmax_t; -#define __DEFINED_uintmax_t -#endif - - -#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t) -typedef unsigned mode_t; -#define __DEFINED_mode_t -#endif - -#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t) -typedef unsigned _Reg nlink_t; -#define __DEFINED_nlink_t -#endif - -#if defined(__NEED_off_t) && !defined(__DEFINED_off_t) -typedef _Int64 off_t; -#define __DEFINED_off_t -#endif - -#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t) -typedef unsigned _Int64 ino_t; -#define __DEFINED_ino_t -#endif - -#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t) -typedef unsigned _Int64 dev_t; -#define __DEFINED_dev_t -#endif - -#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t) -typedef long blksize_t; -#define __DEFINED_blksize_t -#endif - -#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t) -typedef _Int64 blkcnt_t; -#define __DEFINED_blkcnt_t -#endif - -#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t) -typedef unsigned _Int64 fsblkcnt_t; -#define __DEFINED_fsblkcnt_t -#endif - -#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t) -typedef unsigned _Int64 fsfilcnt_t; -#define __DEFINED_fsfilcnt_t -#endif - - -#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t) -typedef unsigned wint_t; -#define __DEFINED_wint_t -#endif - -#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t) -typedef unsigned long wctype_t; -#define __DEFINED_wctype_t -#endif - - -#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t) -typedef void * timer_t; -#define __DEFINED_timer_t -#endif - -#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t) -typedef int clockid_t; -#define __DEFINED_clockid_t -#endif - -#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t) -typedef long clock_t; -#define __DEFINED_clock_t -#endif - -#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval) -struct timeval { time_t tv_sec; suseconds_t tv_usec; }; -#define __DEFINED_struct_timeval -#endif - -#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec) -struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); }; -#define __DEFINED_struct_timespec -#endif - - -#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t) -typedef int pid_t; -#define __DEFINED_pid_t -#endif - -#if defined(__NEED_id_t) && !defined(__DEFINED_id_t) -typedef unsigned id_t; -#define __DEFINED_id_t -#endif - -#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t) -typedef unsigned uid_t; -#define __DEFINED_uid_t -#endif - -#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t) -typedef unsigned gid_t; -#define __DEFINED_gid_t -#endif - -#if defined(__NEED_key_t) && !defined(__DEFINED_key_t) -typedef int key_t; -#define __DEFINED_key_t -#endif - -#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t) -typedef unsigned useconds_t; -#define __DEFINED_useconds_t -#endif - - -#ifdef __cplusplus -#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) -typedef unsigned long pthread_t; -#define __DEFINED_pthread_t -#endif - -#else -#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) -typedef struct __pthread * pthread_t; -#define __DEFINED_pthread_t -#endif - -#endif -#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t) -typedef int pthread_once_t; -#define __DEFINED_pthread_once_t -#endif - -#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t) -typedef unsigned pthread_key_t; -#define __DEFINED_pthread_key_t -#endif - -#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t) -typedef int pthread_spinlock_t; -#define __DEFINED_pthread_spinlock_t -#endif - -#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t) -typedef struct { unsigned __attr; } pthread_mutexattr_t; -#define __DEFINED_pthread_mutexattr_t -#endif - -#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t) -typedef struct { unsigned __attr; } pthread_condattr_t; -#define __DEFINED_pthread_condattr_t -#endif - -#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t) -typedef struct { unsigned __attr; } pthread_barrierattr_t; -#define __DEFINED_pthread_barrierattr_t -#endif - -#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t) -typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t; -#define __DEFINED_pthread_rwlockattr_t -#endif - - -#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE) -struct _IO_FILE { char __x; }; -#define __DEFINED_struct__IO_FILE -#endif - -#if defined(__NEED_FILE) && !defined(__DEFINED_FILE) -typedef struct _IO_FILE FILE; -#define __DEFINED_FILE -#endif - - -#if defined(__NEED_va_list) && !defined(__DEFINED_va_list) -typedef __builtin_va_list va_list; -#define __DEFINED_va_list -#endif - -#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list) -typedef __builtin_va_list __isoc_va_list; -#define __DEFINED___isoc_va_list -#endif - - -#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t) -typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t; -#define __DEFINED_mbstate_t -#endif - - -#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t) -typedef struct __locale_struct * locale_t; -#define __DEFINED_locale_t -#endif - - -#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t) -typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t; -#define __DEFINED_sigset_t -#endif - - -#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec) -struct iovec { void *iov_base; size_t iov_len; }; -#define __DEFINED_struct_iovec -#endif - - -#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize) -struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; }; -#define __DEFINED_struct_winsize -#endif - - -#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t) -typedef unsigned socklen_t; -#define __DEFINED_socklen_t -#endif - -#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t) -typedef unsigned short sa_family_t; -#define __DEFINED_sa_family_t -#endif - - -#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t) -typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t; -#define __DEFINED_pthread_attr_t -#endif - -#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t) -typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t; -#define __DEFINED_pthread_mutex_t -#endif - -#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t) -typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t; -#define __DEFINED_mtx_t -#endif - -#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t) -typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t; -#define __DEFINED_pthread_cond_t -#endif - -#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t) -typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t; -#define __DEFINED_cnd_t -#endif - -#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t) -typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t; -#define __DEFINED_pthread_rwlock_t -#endif - -#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t) -typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t; -#define __DEFINED_pthread_barrier_t -#endif - - -#undef _Addr -#undef _Int64 -#undef _Reg diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/fenv.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/fenv.h deleted file mode 100644 index 24df0417f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/fenv.h +++ /dev/null @@ -1,34 +0,0 @@ -#define FE_INVALID 1 -#define __FE_DENORM 2 -#define FE_DIVBYZERO 4 -#define FE_OVERFLOW 8 -#define FE_UNDERFLOW 16 -#define FE_INEXACT 32 - -#define FE_ALL_EXCEPT 63 - -#define FE_TONEAREST 0 -#define FE_DOWNWARD 0x400 -#define FE_UPWARD 0x800 -#define FE_TOWARDZERO 0xc00 - -typedef unsigned short fexcept_t; - -typedef struct { - unsigned short __control_word; - unsigned short __unused1; - unsigned short __status_word; - unsigned short __unused2; - unsigned short __tags; - unsigned short __unused3; - unsigned int __eip; - unsigned short __cs_selector; - unsigned int __opcode:11; - unsigned int __unused4:5; - unsigned int __data_offset; - unsigned short __data_selector; - unsigned short __unused5; - unsigned int __mxcsr; -} fenv_t; - -#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/float.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/float.h deleted file mode 100644 index 7b817feca..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/float.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifdef __FLT_EVAL_METHOD__ -#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ -#else -#define FLT_EVAL_METHOD 0 -#endif - -#ifdef _MSC_VER -#define LDBL_TRUE_MIN 4.9406564584124654e-324 -#define LDBL_MIN 2.2250738585072014e-308 -#define LDBL_MAX 1.7976931348623158e+308 -#define LDBL_EPSILON 2.2204460492503131e-016 - -#define LDBL_MANT_DIG 53 -#define LDBL_MIN_EXP (-1021) -#define LDBL_MAX_EXP 1024 - -#define LDBL_DIG 15 -#define LDBL_MIN_10_EXP (-307) -#define LDBL_MAX_10_EXP308 - -#define DECIMAL_DIG 17 -#else -#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L -#define LDBL_MIN 3.3621031431120935063e-4932L -#define LDBL_MAX 1.1897314953572317650e+4932L -#define LDBL_EPSILON 1.0842021724855044340e-19L - -#define LDBL_MANT_DIG 64 -#define LDBL_MIN_EXP (-16381) -#define LDBL_MAX_EXP 16384 - -#define LDBL_DIG 18 -#define LDBL_MIN_10_EXP (-4931) -#define LDBL_MAX_10_EXP 4932 - -#define DECIMAL_DIG 21 -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/io.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/io.h deleted file mode 100644 index dd5bddc96..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/io.h +++ /dev/null @@ -1,77 +0,0 @@ -static __inline void outb(unsigned char __val, unsigned short __port) -{ - __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port)); -} - -static __inline void outw(unsigned short __val, unsigned short __port) -{ - __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port)); -} - -static __inline void outl(unsigned int __val, unsigned short __port) -{ - __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port)); -} - -static __inline unsigned char inb(unsigned short __port) -{ - unsigned char __val; - __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port)); - return __val; -} - -static __inline unsigned short inw(unsigned short __port) -{ - unsigned short __val; - __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port)); - return __val; -} - -static __inline unsigned int inl(unsigned short __port) -{ - unsigned int __val; - __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port)); - return __val; -} - -static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n) -{ - __asm__ volatile ("cld; rep; outsb" - : "+S" (__buf), "+c" (__n) - : "d" (__port)); -} - -static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n) -{ - __asm__ volatile ("cld; rep; outsw" - : "+S" (__buf), "+c" (__n) - : "d" (__port)); -} - -static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n) -{ - __asm__ volatile ("cld; rep; outsl" - : "+S" (__buf), "+c"(__n) - : "d" (__port)); -} - -static __inline void insb(unsigned short __port, void *__buf, unsigned long __n) -{ - __asm__ volatile ("cld; rep; insb" - : "+D" (__buf), "+c" (__n) - : "d" (__port)); -} - -static __inline void insw(unsigned short __port, void *__buf, unsigned long __n) -{ - __asm__ volatile ("cld; rep; insw" - : "+D" (__buf), "+c" (__n) - : "d" (__port)); -} - -static __inline void insl(unsigned short __port, void *__buf, unsigned long __n) -{ - __asm__ volatile ("cld; rep; insl" - : "+D" (__buf), "+c" (__n) - : "d" (__port)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/limits.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/limits.h deleted file mode 100644 index 07743b6fd..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/limits.h +++ /dev/null @@ -1 +0,0 @@ -#define PAGESIZE 4096 diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/mman.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/mman.h deleted file mode 100644 index ba2d6f7a8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/mman.h +++ /dev/null @@ -1 +0,0 @@ -#define MAP_32BIT 0x40 diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/posix.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/posix.h deleted file mode 100644 index c37b94c14..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/posix.h +++ /dev/null @@ -1,2 +0,0 @@ -#define _POSIX_V6_LP64_OFF64 1 -#define _POSIX_V7_LP64_OFF64 1 diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/ptrace.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/ptrace.h deleted file mode 100644 index 7f8a09b52..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/ptrace.h +++ /dev/null @@ -1,13 +0,0 @@ -#define PTRACE_GET_THREAD_AREA 25 -#define PTRACE_SET_THREAD_AREA 26 -#define PTRACE_ARCH_PRCTL 30 -#define PTRACE_SYSEMU 31 -#define PTRACE_SYSEMU_SINGLESTEP 32 -#define PTRACE_SINGLEBLOCK 33 - -#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA -#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA -#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL -#define PT_SYSEMU PTRACE_SYSEMU -#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP -#define PT_STEPBLOCK PTRACE_SINGLEBLOCK diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/reg.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/reg.h deleted file mode 100644 index a4df04ced..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/reg.h +++ /dev/null @@ -1,29 +0,0 @@ -#undef __WORDSIZE -#define __WORDSIZE 64 -#define R15 0 -#define R14 1 -#define R13 2 -#define R12 3 -#define RBP 4 -#define RBX 5 -#define R11 6 -#define R10 7 -#define R9 8 -#define R8 9 -#define RAX 10 -#define RCX 11 -#define RDX 12 -#define RSI 13 -#define RDI 14 -#define ORIG_RAX 15 -#define RIP 16 -#define CS 17 -#define EFLAGS 18 -#define RSP 19 -#define SS 20 -#define FS_BASE 21 -#define GS_BASE 22 -#define DS 23 -#define ES 24 -#define FS 25 -#define GS 26 diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/setjmp.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/setjmp.h deleted file mode 100644 index 63973a800..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/setjmp.h +++ /dev/null @@ -1 +0,0 @@ -typedef unsigned long __jmp_buf[8]; diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/stdint.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/stdint.h deleted file mode 100644 index 1bb147f24..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/stdint.h +++ /dev/null @@ -1,20 +0,0 @@ -typedef int32_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef uint32_t uint_fast16_t; -typedef uint32_t uint_fast32_t; - -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN - -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX - -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX - -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX -#define SIZE_MAX UINT64_MAX diff --git a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/reloc.h b/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/reloc.h deleted file mode 100644 index fac0c0ae3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/arch/x86_64/reloc.h +++ /dev/null @@ -1,20 +0,0 @@ -#define LDSO_ARCH "x86_64" - -#define REL_SYMBOLIC R_X86_64_64 -#define REL_OFFSET32 R_X86_64_PC32 -#define REL_GOT R_X86_64_GLOB_DAT -#define REL_PLT R_X86_64_JUMP_SLOT -#define REL_RELATIVE R_X86_64_RELATIVE -#define REL_COPY R_X86_64_COPY -#define REL_DTPMOD R_X86_64_DTPMOD64 -#define REL_DTPOFF R_X86_64_DTPOFF64 -#define REL_TPOFF R_X86_64_TPOFF64 -#define REL_TLSDESC R_X86_64_TLSDESC - -#define CRTJMP(pc,sp) __asm__ __volatile__( \ - "mov %1,%%rsp ; jmp *%0" : : "r"(pc), "r"(sp) : "memory" ) - -#define GETFUNCSYM(fp, sym, got) __asm__ ( \ - ".hidden " #sym "\n" \ - " lea " #sym "(%%rip),%0\n" \ - : "=r"(*fp) : : "memory" ) diff --git a/src/hyperlight_guest_bin/third_party/musl/include/alloca.h b/src/hyperlight_guest_bin/third_party/musl/include/alloca.h deleted file mode 100644 index b8d183d14..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/alloca.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _ALLOCA_H -#define _ALLOCA_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define __NEED_size_t -#include - -void *alloca(size_t); - -#define alloca __builtin_alloca - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/assert.h b/src/hyperlight_guest_bin/third_party/musl/include/assert.h deleted file mode 100644 index d14ec94e7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/assert.h +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#undef assert - -#ifdef NDEBUG -#define assert(x) (void)0 -#else -#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0))) -#endif - -#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) -#define static_assert _Static_assert -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_Noreturn void __assert_fail (const char *, const char *, int, const char *); - -#ifdef __cplusplus -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/byteswap.h b/src/hyperlight_guest_bin/third_party/musl/include/byteswap.h deleted file mode 100644 index 00b9df3c9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/byteswap.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _BYTESWAP_H -#define _BYTESWAP_H - -#include -#include - -static __inline uint16_t __bswap_16(uint16_t __x) -{ - return __x<<8 | __x>>8; -} - -static __inline uint32_t __bswap_32(uint32_t __x) -{ - return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; -} - -static __inline uint64_t __bswap_64(uint64_t __x) -{ - return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32); -} - -#define bswap_16(x) __bswap_16(x) -#define bswap_32(x) __bswap_32(x) -#define bswap_64(x) __bswap_64(x) - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/complex.h b/src/hyperlight_guest_bin/third_party/musl/include/complex.h deleted file mode 100644 index 008b3c7e3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/complex.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef _COMPLEX_H -#define _COMPLEX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define complex _Complex -#ifdef __GNUC__ -#define _Complex_I (__extension__ (0.0f+1.0fi)) -#else -#define _Complex_I (0.0f+1.0fi) -#endif -#define I _Complex_I - -double complex cacos(double complex); -float complex cacosf(float complex); -long double complex cacosl(long double complex); - -double complex casin(double complex); -float complex casinf(float complex); -long double complex casinl(long double complex); - -double complex catan(double complex); -float complex catanf(float complex); -long double complex catanl(long double complex); - -double complex ccos(double complex); -float complex ccosf(float complex); -long double complex ccosl(long double complex); - -double complex csin(double complex); -float complex csinf(float complex); -long double complex csinl(long double complex); - -double complex ctan(double complex); -float complex ctanf(float complex); -long double complex ctanl(long double complex); - -double complex cacosh(double complex); -float complex cacoshf(float complex); -long double complex cacoshl(long double complex); - -double complex casinh(double complex); -float complex casinhf(float complex); -long double complex casinhl(long double complex); - -double complex catanh(double complex); -float complex catanhf(float complex); -long double complex catanhl(long double complex); - -double complex ccosh(double complex); -float complex ccoshf(float complex); -long double complex ccoshl(long double complex); - -double complex csinh(double complex); -float complex csinhf(float complex); -long double complex csinhl(long double complex); - -double complex ctanh(double complex); -float complex ctanhf(float complex); -long double complex ctanhl(long double complex); - -double complex cexp(double complex); -float complex cexpf(float complex); -long double complex cexpl(long double complex); - -double complex clog(double complex); -float complex clogf(float complex); -long double complex clogl(long double complex); - -double cabs(double complex); -float cabsf(float complex); -long double cabsl(long double complex); - -double complex cpow(double complex, double complex); -float complex cpowf(float complex, float complex); -long double complex cpowl(long double complex, long double complex); - -double complex csqrt(double complex); -float complex csqrtf(float complex); -long double complex csqrtl(long double complex); - -double carg(double complex); -float cargf(float complex); -long double cargl(long double complex); - -double cimag(double complex); -float cimagf(float complex); -long double cimagl(long double complex); - -double complex conj(double complex); -float complex conjf(float complex); -long double complex conjl(long double complex); - -double complex cproj(double complex); -float complex cprojf(float complex); -long double complex cprojl(long double complex); - -double creal(double complex); -float crealf(float complex); -long double creall(long double complex); - -#ifndef __cplusplus -#define __CIMAG(x, t) \ - (+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1]) - -#define creal(x) ((double)(x)) -#define crealf(x) ((float)(x)) -#define creall(x) ((long double)(x)) - -#define cimag(x) __CIMAG(x, double) -#define cimagf(x) __CIMAG(x, float) -#define cimagl(x) __CIMAG(x, long double) -#endif - -#if __STDC_VERSION__ >= 201112L -#if defined(_Imaginary_I) -#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y)) -#elif defined(__clang__) -#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) }) -#else -#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y))) -#endif -#define CMPLX(x, y) __CMPLX(x, y, double) -#define CMPLXF(x, y) __CMPLX(x, y, float) -#define CMPLXL(x, y) __CMPLX(x, y, long double) -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/ctype.h b/src/hyperlight_guest_bin/third_party/musl/include/ctype.h deleted file mode 100644 index 32bcef4da..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/ctype.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _CTYPE_H -#define _CTYPE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -int isalnum(int); -int isalpha(int); -int isblank(int); -int iscntrl(int); -int isdigit(int); -int isgraph(int); -int islower(int); -int isprint(int); -int ispunct(int); -int isspace(int); -int isupper(int); -int isxdigit(int); -int tolower(int); -int toupper(int); - -#ifndef __cplusplus -static __inline int __isspace(int _c) -{ - return _c == ' ' || (unsigned)_c-'\t' < 5; -} - -#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26) -#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10) -#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26) -#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26) -#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f) -#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e) -#define isspace(a) __isspace(a) -#endif - - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) - -#define __NEED_locale_t -#include - -int isalnum_l(int, locale_t); -int isalpha_l(int, locale_t); -int isblank_l(int, locale_t); -int iscntrl_l(int, locale_t); -int isdigit_l(int, locale_t); -int isgraph_l(int, locale_t); -int islower_l(int, locale_t); -int isprint_l(int, locale_t); -int ispunct_l(int, locale_t); -int isspace_l(int, locale_t); -int isupper_l(int, locale_t); -int isxdigit_l(int, locale_t); -int tolower_l(int, locale_t); -int toupper_l(int, locale_t); - -int isascii(int); -int toascii(int); -#define _tolower(a) ((a)|0x20) -#define _toupper(a) ((a)&0x5f) -#ifndef __cplusplus -#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/endian.h b/src/hyperlight_guest_bin/third_party/musl/include/endian.h deleted file mode 100644 index 172c43203..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/endian.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _ENDIAN_H -#define _ENDIAN_H - -#include - -#define __NEED_uint16_t -#define __NEED_uint32_t -#define __NEED_uint64_t - -#include - -#define __PDP_ENDIAN 3412 - -#define BIG_ENDIAN __BIG_ENDIAN -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define PDP_ENDIAN __PDP_ENDIAN -#define BYTE_ORDER __BYTE_ORDER - -static __inline uint16_t __bswap16(uint16_t __x) -{ - return __x<<8 | __x>>8; -} - -static __inline uint32_t __bswap32(uint32_t __x) -{ - return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; -} - -static __inline uint64_t __bswap64(uint64_t __x) -{ - return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32); -} - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define htobe16(x) __bswap16(x) -#define be16toh(x) __bswap16(x) -#define htobe32(x) __bswap32(x) -#define be32toh(x) __bswap32(x) -#define htobe64(x) __bswap64(x) -#define be64toh(x) __bswap64(x) -#define htole16(x) (uint16_t)(x) -#define le16toh(x) (uint16_t)(x) -#define htole32(x) (uint32_t)(x) -#define le32toh(x) (uint32_t)(x) -#define htole64(x) (uint64_t)(x) -#define le64toh(x) (uint64_t)(x) -#else -#define htobe16(x) (uint16_t)(x) -#define be16toh(x) (uint16_t)(x) -#define htobe32(x) (uint32_t)(x) -#define be32toh(x) (uint32_t)(x) -#define htobe64(x) (uint64_t)(x) -#define be64toh(x) (uint64_t)(x) -#define htole16(x) __bswap16(x) -#define le16toh(x) __bswap16(x) -#define htole32(x) __bswap32(x) -#define le32toh(x) __bswap32(x) -#define htole64(x) __bswap64(x) -#define le64toh(x) __bswap64(x) -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define betoh16(x) __bswap16(x) -#define betoh32(x) __bswap32(x) -#define betoh64(x) __bswap64(x) -#define letoh16(x) (uint16_t)(x) -#define letoh32(x) (uint32_t)(x) -#define letoh64(x) (uint64_t)(x) -#else -#define betoh16(x) (uint16_t)(x) -#define betoh32(x) (uint32_t)(x) -#define betoh64(x) (uint64_t)(x) -#define letoh16(x) __bswap16(x) -#define letoh32(x) __bswap32(x) -#define letoh64(x) __bswap64(x) -#endif -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/errno.h b/src/hyperlight_guest_bin/third_party/musl/include/errno.h deleted file mode 100644 index 0361b33ad..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/errno.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _ERRNO_H -#define _ERRNO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __GNUC__ -__attribute__((const)) -#endif -int *__errno_location(void); -#define errno (*__errno_location()) - -#ifdef _GNU_SOURCE -extern char *program_invocation_short_name, *program_invocation_name; -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/hyperlight_guest_bin/third_party/musl/include/features.h b/src/hyperlight_guest_bin/third_party/musl/include/features.h deleted file mode 100644 index 85cfb72a0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/features.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _FEATURES_H -#define _FEATURES_H - -#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE) -#define _GNU_SOURCE 1 -#endif - -#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE) -#define _BSD_SOURCE 1 -#endif - -#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \ - && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \ - && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__) -#define _BSD_SOURCE 1 -#define _XOPEN_SOURCE 700 -#endif - -#if __STDC_VERSION__ >= 199901L -#define __restrict restrict -#elif !defined(__GNUC__) -#define __restrict -#endif - -#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) -#define __inline inline -#elif !defined(__GNUC__) -#define __inline -#endif - -#if __STDC_VERSION__ >= 201112L -#elif defined(__GNUC__) -#define _Noreturn __attribute__((__noreturn__)) -#else -#define _Noreturn -#endif - -#define __REDIR(x,y) __typeof__(x) x __asm__(#y) - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/fenv.h b/src/hyperlight_guest_bin/third_party/musl/include/fenv.h deleted file mode 100644 index 05de990c0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/fenv.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _FENV_H -#define _FENV_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -int feclearexcept(int); -int fegetexceptflag(fexcept_t *, int); -int feraiseexcept(int); -int fesetexceptflag(const fexcept_t *, int); -int fetestexcept(int); - -int fegetround(void); -int fesetround(int); - -int fegetenv(fenv_t *); -int feholdexcept(fenv_t *); -int fesetenv(const fenv_t *); -int feupdateenv(const fenv_t *); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/src/hyperlight_guest_bin/third_party/musl/include/float.h b/src/hyperlight_guest_bin/third_party/musl/include/float.h deleted file mode 100644 index 713aadb90..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/float.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _FLOAT_H -#define _FLOAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -int __flt_rounds(void); -#define FLT_ROUNDS (__flt_rounds()) - -#define FLT_RADIX 2 - -#define FLT_TRUE_MIN 1.40129846432481707092e-45F -#define FLT_MIN 1.17549435082228750797e-38F -#define FLT_MAX 3.40282346638528859812e+38F -#define FLT_EPSILON 1.1920928955078125e-07F - -#define FLT_MANT_DIG 24 -#define FLT_MIN_EXP (-125) -#define FLT_MAX_EXP 128 -#define FLT_HAS_SUBNORM 1 - -#define FLT_DIG 6 -#define FLT_DECIMAL_DIG 9 -#define FLT_MIN_10_EXP (-37) -#define FLT_MAX_10_EXP 38 - -#define DBL_TRUE_MIN 4.94065645841246544177e-324 -#define DBL_MIN 2.22507385850720138309e-308 -#define DBL_MAX 1.79769313486231570815e+308 -#define DBL_EPSILON 2.22044604925031308085e-16 - -#define DBL_MANT_DIG 53 -#define DBL_MIN_EXP (-1021) -#define DBL_MAX_EXP 1024 -#define DBL_HAS_SUBNORM 1 - -#define DBL_DIG 15 -#define DBL_DECIMAL_DIG 17 -#define DBL_MIN_10_EXP (-307) -#define DBL_MAX_10_EXP 308 - -#define LDBL_HAS_SUBNORM 1 -#define LDBL_DECIMAL_DIG DECIMAL_DIG - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/inttypes.h b/src/hyperlight_guest_bin/third_party/musl/include/inttypes.h deleted file mode 100644 index 61dcb7273..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/inttypes.h +++ /dev/null @@ -1,229 +0,0 @@ -#ifndef _INTTYPES_H -#define _INTTYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#define __NEED_wchar_t -#include - -typedef struct { intmax_t quot, rem; } imaxdiv_t; - -intmax_t imaxabs(intmax_t); -imaxdiv_t imaxdiv(intmax_t, intmax_t); - -intmax_t strtoimax(const char *__restrict, char **__restrict, int); -uintmax_t strtoumax(const char *__restrict, char **__restrict, int); - -intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int); -uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int); - -#if UINTPTR_MAX == UINT64_MAX -#define __PRI64 "l" -#define __PRIPTR "l" -#else -#define __PRI64 "ll" -#define __PRIPTR "" -#endif - -#define PRId8 "d" -#define PRId16 "d" -#define PRId32 "d" -#define PRId64 __PRI64 "d" - -#define PRIdLEAST8 "d" -#define PRIdLEAST16 "d" -#define PRIdLEAST32 "d" -#define PRIdLEAST64 __PRI64 "d" - -#define PRIdFAST8 "d" -#define PRIdFAST16 "d" -#define PRIdFAST32 "d" -#define PRIdFAST64 __PRI64 "d" - -#define PRIi8 "i" -#define PRIi16 "i" -#define PRIi32 "i" -#define PRIi64 __PRI64 "i" - -#define PRIiLEAST8 "i" -#define PRIiLEAST16 "i" -#define PRIiLEAST32 "i" -#define PRIiLEAST64 __PRI64 "i" - -#define PRIiFAST8 "i" -#define PRIiFAST16 "i" -#define PRIiFAST32 "i" -#define PRIiFAST64 __PRI64 "i" - -#define PRIo8 "o" -#define PRIo16 "o" -#define PRIo32 "o" -#define PRIo64 __PRI64 "o" - -#define PRIoLEAST8 "o" -#define PRIoLEAST16 "o" -#define PRIoLEAST32 "o" -#define PRIoLEAST64 __PRI64 "o" - -#define PRIoFAST8 "o" -#define PRIoFAST16 "o" -#define PRIoFAST32 "o" -#define PRIoFAST64 __PRI64 "o" - -#define PRIu8 "u" -#define PRIu16 "u" -#define PRIu32 "u" -#define PRIu64 __PRI64 "u" - -#define PRIuLEAST8 "u" -#define PRIuLEAST16 "u" -#define PRIuLEAST32 "u" -#define PRIuLEAST64 __PRI64 "u" - -#define PRIuFAST8 "u" -#define PRIuFAST16 "u" -#define PRIuFAST32 "u" -#define PRIuFAST64 __PRI64 "u" - -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 __PRI64 "x" - -#define PRIxLEAST8 "x" -#define PRIxLEAST16 "x" -#define PRIxLEAST32 "x" -#define PRIxLEAST64 __PRI64 "x" - -#define PRIxFAST8 "x" -#define PRIxFAST16 "x" -#define PRIxFAST32 "x" -#define PRIxFAST64 __PRI64 "x" - -#define PRIX8 "X" -#define PRIX16 "X" -#define PRIX32 "X" -#define PRIX64 __PRI64 "X" - -#define PRIXLEAST8 "X" -#define PRIXLEAST16 "X" -#define PRIXLEAST32 "X" -#define PRIXLEAST64 __PRI64 "X" - -#define PRIXFAST8 "X" -#define PRIXFAST16 "X" -#define PRIXFAST32 "X" -#define PRIXFAST64 __PRI64 "X" - -#define PRIdMAX __PRI64 "d" -#define PRIiMAX __PRI64 "i" -#define PRIoMAX __PRI64 "o" -#define PRIuMAX __PRI64 "u" -#define PRIxMAX __PRI64 "x" -#define PRIXMAX __PRI64 "X" - -#define PRIdPTR __PRIPTR "d" -#define PRIiPTR __PRIPTR "i" -#define PRIoPTR __PRIPTR "o" -#define PRIuPTR __PRIPTR "u" -#define PRIxPTR __PRIPTR "x" -#define PRIXPTR __PRIPTR "X" - -#define SCNd8 "hhd" -#define SCNd16 "hd" -#define SCNd32 "d" -#define SCNd64 __PRI64 "d" - -#define SCNdLEAST8 "hhd" -#define SCNdLEAST16 "hd" -#define SCNdLEAST32 "d" -#define SCNdLEAST64 __PRI64 "d" - -#define SCNdFAST8 "hhd" -#define SCNdFAST16 "d" -#define SCNdFAST32 "d" -#define SCNdFAST64 __PRI64 "d" - -#define SCNi8 "hhi" -#define SCNi16 "hi" -#define SCNi32 "i" -#define SCNi64 __PRI64 "i" - -#define SCNiLEAST8 "hhi" -#define SCNiLEAST16 "hi" -#define SCNiLEAST32 "i" -#define SCNiLEAST64 __PRI64 "i" - -#define SCNiFAST8 "hhi" -#define SCNiFAST16 "i" -#define SCNiFAST32 "i" -#define SCNiFAST64 __PRI64 "i" - -#define SCNu8 "hhu" -#define SCNu16 "hu" -#define SCNu32 "u" -#define SCNu64 __PRI64 "u" - -#define SCNuLEAST8 "hhu" -#define SCNuLEAST16 "hu" -#define SCNuLEAST32 "u" -#define SCNuLEAST64 __PRI64 "u" - -#define SCNuFAST8 "hhu" -#define SCNuFAST16 "u" -#define SCNuFAST32 "u" -#define SCNuFAST64 __PRI64 "u" - -#define SCNo8 "hho" -#define SCNo16 "ho" -#define SCNo32 "o" -#define SCNo64 __PRI64 "o" - -#define SCNoLEAST8 "hho" -#define SCNoLEAST16 "ho" -#define SCNoLEAST32 "o" -#define SCNoLEAST64 __PRI64 "o" - -#define SCNoFAST8 "hho" -#define SCNoFAST16 "o" -#define SCNoFAST32 "o" -#define SCNoFAST64 __PRI64 "o" - -#define SCNx8 "hhx" -#define SCNx16 "hx" -#define SCNx32 "x" -#define SCNx64 __PRI64 "x" - -#define SCNxLEAST8 "hhx" -#define SCNxLEAST16 "hx" -#define SCNxLEAST32 "x" -#define SCNxLEAST64 __PRI64 "x" - -#define SCNxFAST8 "hhx" -#define SCNxFAST16 "x" -#define SCNxFAST32 "x" -#define SCNxFAST64 __PRI64 "x" - -#define SCNdMAX __PRI64 "d" -#define SCNiMAX __PRI64 "i" -#define SCNoMAX __PRI64 "o" -#define SCNuMAX __PRI64 "u" -#define SCNxMAX __PRI64 "x" - -#define SCNdPTR __PRIPTR "d" -#define SCNiPTR __PRIPTR "i" -#define SCNoPTR __PRIPTR "o" -#define SCNuPTR __PRIPTR "u" -#define SCNxPTR __PRIPTR "x" - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/hyperlight_guest_bin/third_party/musl/include/libgen.h b/src/hyperlight_guest_bin/third_party/musl/include/libgen.h deleted file mode 100644 index 7c7fd9c6d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/libgen.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _LIBGEN_H -#define _LIBGEN_H - -#ifdef __cplusplus -extern "C" { -#endif - -char *dirname(char *); -char *basename(char *); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/limits.h b/src/hyperlight_guest_bin/third_party/musl/include/limits.h deleted file mode 100644 index 53a27b9de..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/limits.h +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef _LIMITS_H -#define _LIMITS_H - -#include - -#include /* __LONG_MAX */ - -/* Support signed or unsigned plain-char */ - -#if '\xff' > 0 -#define CHAR_MIN 0 -#define CHAR_MAX 255 -#else -#define CHAR_MIN (-128) -#define CHAR_MAX 127 -#endif - -#define CHAR_BIT 8 -#define SCHAR_MIN (-128) -#define SCHAR_MAX 127 -#define UCHAR_MAX 255 -#define SHRT_MIN (-1-0x7fff) -#define SHRT_MAX 0x7fff -#define USHRT_MAX 0xffff -#define INT_MIN (-1-0x7fffffff) -#define INT_MAX 0x7fffffff -#define UINT_MAX 0xffffffffU -#define LONG_MIN (-LONG_MAX-1) -#define LONG_MAX __LONG_MAX -#define ULONG_MAX (2UL*LONG_MAX+1) -#define LLONG_MIN (-LLONG_MAX-1) -#define LLONG_MAX 0x7fffffffffffffffLL -#define ULLONG_MAX (2ULL*LLONG_MAX+1) - -#define MB_LEN_MAX 4 - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) - -#include - -#define PIPE_BUF 4096 -#define FILESIZEBITS 64 -#ifndef NAME_MAX -#define NAME_MAX 255 -#endif -#define PATH_MAX 4096 -#define NGROUPS_MAX 32 -#define ARG_MAX 131072 -#define IOV_MAX 1024 -#define SYMLOOP_MAX 40 -#define WORD_BIT 32 -#define SSIZE_MAX LONG_MAX -#define TZNAME_MAX 6 -#define TTY_NAME_MAX 32 -#define HOST_NAME_MAX 255 - -#if LONG_MAX == 0x7fffffffL -#define LONG_BIT 32 -#else -#define LONG_BIT 64 -#endif - -/* Implementation choices... */ - -#define PTHREAD_KEYS_MAX 128 -#define PTHREAD_STACK_MIN 2048 -#define PTHREAD_DESTRUCTOR_ITERATIONS 4 -#define SEM_VALUE_MAX 0x7fffffff -#define SEM_NSEMS_MAX 256 -#define DELAYTIMER_MAX 0x7fffffff -#define MQ_PRIO_MAX 32768 -#define LOGIN_NAME_MAX 256 - -/* Arbitrary numbers... */ - -#define BC_BASE_MAX 99 -#define BC_DIM_MAX 2048 -#define BC_SCALE_MAX 99 -#define BC_STRING_MAX 1000 -#define CHARCLASS_NAME_MAX 14 -#define COLL_WEIGHTS_MAX 2 -#define EXPR_NEST_MAX 32 -#define LINE_MAX 4096 -#define RE_DUP_MAX 255 - -#define NL_ARGMAX 9 -#define NL_MSGMAX 32767 -#define NL_SETMAX 255 -#define NL_TEXTMAX 2048 - -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) - -#ifdef PAGESIZE -#define PAGE_SIZE PAGESIZE -#endif -#define NZERO 20 -#define NL_LANGMAX 32 - -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \ - || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) - -#define NL_NMAX 16 - -#endif - -/* POSIX/SUS requirements follow. These numbers come directly - * from SUS and have nothing to do with the host system. */ - -#define _POSIX_AIO_LISTIO_MAX 2 -#define _POSIX_AIO_MAX 1 -#define _POSIX_ARG_MAX 4096 -#define _POSIX_CHILD_MAX 25 -#define _POSIX_CLOCKRES_MIN 20000000 -#define _POSIX_DELAYTIMER_MAX 32 -#define _POSIX_HOST_NAME_MAX 255 -#define _POSIX_LINK_MAX 8 -#define _POSIX_LOGIN_NAME_MAX 9 -#define _POSIX_MAX_CANON 255 -#define _POSIX_MAX_INPUT 255 -#define _POSIX_MQ_OPEN_MAX 8 -#define _POSIX_MQ_PRIO_MAX 32 -#define _POSIX_NAME_MAX 14 -#define _POSIX_NGROUPS_MAX 8 -#define _POSIX_OPEN_MAX 20 -#define _POSIX_PATH_MAX 256 -#define _POSIX_PIPE_BUF 512 -#define _POSIX_RE_DUP_MAX 255 -#define _POSIX_RTSIG_MAX 8 -#define _POSIX_SEM_NSEMS_MAX 256 -#define _POSIX_SEM_VALUE_MAX 32767 -#define _POSIX_SIGQUEUE_MAX 32 -#define _POSIX_SSIZE_MAX 32767 -#define _POSIX_STREAM_MAX 8 -#define _POSIX_SS_REPL_MAX 4 -#define _POSIX_SYMLINK_MAX 255 -#define _POSIX_SYMLOOP_MAX 8 -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -#define _POSIX_THREAD_KEYS_MAX 128 -#define _POSIX_THREAD_THREADS_MAX 64 -#define _POSIX_TIMER_MAX 32 -#define _POSIX_TRACE_EVENT_NAME_MAX 30 -#define _POSIX_TRACE_NAME_MAX 8 -#define _POSIX_TRACE_SYS_MAX 8 -#define _POSIX_TRACE_USER_EVENT_MAX 32 -#define _POSIX_TTY_NAME_MAX 9 -#define _POSIX_TZNAME_MAX 6 -#define _POSIX2_BC_BASE_MAX 99 -#define _POSIX2_BC_DIM_MAX 2048 -#define _POSIX2_BC_SCALE_MAX 99 -#define _POSIX2_BC_STRING_MAX 1000 -#define _POSIX2_CHARCLASS_NAME_MAX 14 -#define _POSIX2_COLL_WEIGHTS_MAX 2 -#define _POSIX2_EXPR_NEST_MAX 32 -#define _POSIX2_LINE_MAX 2048 -#define _POSIX2_RE_DUP_MAX 255 - -#define _XOPEN_IOV_MAX 16 -#define _XOPEN_NAME_MAX 255 -#define _XOPEN_PATH_MAX 1024 - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/math.h b/src/hyperlight_guest_bin/third_party/musl/include/math.h deleted file mode 100644 index 3b6246c14..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/math.h +++ /dev/null @@ -1,442 +0,0 @@ -#ifndef _MATH_H -#define _MATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_float_t -#define __NEED_double_t -#include - -#if 100*__GNUC__+__GNUC_MINOR__ >= 303 || defined (__clang__) && defined(_MSC_VER) -#define NAN __builtin_nanf("") -#define INFINITY __builtin_inff() -#else -#define NAN (0.0f/0.0f) -#define INFINITY 1e5000f -#endif - -#define HUGE_VALF INFINITY -#define HUGE_VAL ((double)INFINITY) -#define HUGE_VALL ((long double)INFINITY) - -#define MATH_ERRNO 1 -#define MATH_ERREXCEPT 2 -#define math_errhandling 2 - -#define FP_ILOGBNAN (-1-0x7fffffff) -#define FP_ILOGB0 FP_ILOGBNAN - -#define FP_NAN 0 -#define FP_INFINITE 1 -#define FP_ZERO 2 -#define FP_SUBNORMAL 3 -#define FP_NORMAL 4 - -#ifdef __FP_FAST_FMA -#define FP_FAST_FMA 1 -#endif - -#ifdef __FP_FAST_FMAF -#define FP_FAST_FMAF 1 -#endif - -#ifdef __FP_FAST_FMAL -#define FP_FAST_FMAL 1 -#endif - -int __fpclassify(double); -int __fpclassifyf(float); -int __fpclassifyl(long double); - -static __inline unsigned __FLOAT_BITS(float __f) -{ - union {float __f; unsigned __i;} __u; - __u.__f = __f; - return __u.__i; -} -static __inline unsigned long long __DOUBLE_BITS(double __f) -{ - union {double __f; unsigned long long __i;} __u; - __u.__f = __f; - return __u.__i; -} - -#define fpclassify(x) ( \ - sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \ - sizeof(x) == sizeof(double) ? __fpclassify(x) : \ - __fpclassifyl(x) ) - -#define isinf(x) ( \ - sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \ - sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \ - __fpclassifyl(x) == FP_INFINITE) - -#define isnan(x) ( \ - sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \ - sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \ - __fpclassifyl(x) == FP_NAN) - -#define isnormal(x) ( \ - sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \ - sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \ - __fpclassifyl(x) == FP_NORMAL) - -#define isfinite(x) ( \ - sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \ - sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \ - __fpclassifyl(x) > FP_INFINITE) - -int __signbit(double); -int __signbitf(float); -int __signbitl(long double); - -#define signbit(x) ( \ - sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \ - sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \ - __signbitl(x) ) - -#define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y))) - -#define __ISREL_DEF(rel, op, type) \ -static __inline int __is##rel(type __x, type __y) \ -{ return !isunordered(__x,__y) && __x op __y; } - -__ISREL_DEF(lessf, <, float_t) -__ISREL_DEF(less, <, double_t) -__ISREL_DEF(lessl, <, long double) -__ISREL_DEF(lessequalf, <=, float_t) -__ISREL_DEF(lessequal, <=, double_t) -__ISREL_DEF(lessequall, <=, long double) -__ISREL_DEF(lessgreaterf, !=, float_t) -__ISREL_DEF(lessgreater, !=, double_t) -__ISREL_DEF(lessgreaterl, !=, long double) -__ISREL_DEF(greaterf, >, float_t) -__ISREL_DEF(greater, >, double_t) -__ISREL_DEF(greaterl, >, long double) -__ISREL_DEF(greaterequalf, >=, float_t) -__ISREL_DEF(greaterequal, >=, double_t) -__ISREL_DEF(greaterequall, >=, long double) - -#define __tg_pred_2(x, y, p) ( \ - sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \ - sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \ - p##l(x, y) ) - -#define isless(x, y) __tg_pred_2(x, y, __isless) -#define islessequal(x, y) __tg_pred_2(x, y, __islessequal) -#define islessgreater(x, y) __tg_pred_2(x, y, __islessgreater) -#define isgreater(x, y) __tg_pred_2(x, y, __isgreater) -#define isgreaterequal(x, y) __tg_pred_2(x, y, __isgreaterequal) - -double acos(double); -float acosf(float); -long double acosl(long double); - -double acosh(double); -float acoshf(float); -long double acoshl(long double); - -double asin(double); -float asinf(float); -long double asinl(long double); - -double asinh(double); -float asinhf(float); -long double asinhl(long double); - -double atan(double); -float atanf(float); -long double atanl(long double); - -double atan2(double, double); -float atan2f(float, float); -long double atan2l(long double, long double); - -double atanh(double); -float atanhf(float); -long double atanhl(long double); - -double cbrt(double); -float cbrtf(float); -long double cbrtl(long double); - -double ceil(double); -float ceilf(float); -long double ceill(long double); - -double copysign(double, double); -float copysignf(float, float); -long double copysignl(long double, long double); - -double cos(double); -float cosf(float); -long double cosl(long double); - -double cosh(double); -float coshf(float); -long double coshl(long double); - -double erf(double); -float erff(float); -long double erfl(long double); - -double erfc(double); -float erfcf(float); -long double erfcl(long double); - -double exp(double); -float expf(float); -long double expl(long double); - -double exp2(double); -float exp2f(float); -long double exp2l(long double); - -double expm1(double); -float expm1f(float); -long double expm1l(long double); - -double fabs(double); -float fabsf(float); -long double fabsl(long double); - -double fdim(double, double); -float fdimf(float, float); -long double fdiml(long double, long double); - -double floor(double); -float floorf(float); -long double floorl(long double); - -double fma(double, double, double); -float fmaf(float, float, float); -long double fmal(long double, long double, long double); - -double fmax(double, double); -float fmaxf(float, float); -long double fmaxl(long double, long double); - -double fmin(double, double); -float fminf(float, float); -long double fminl(long double, long double); - -double fmod(double, double); -float fmodf(float, float); -long double fmodl(long double, long double); - -double frexp(double, int *); -float frexpf(float, int *); -long double frexpl(long double, int *); - -double hypot(double, double); -float hypotf(float, float); -long double hypotl(long double, long double); - -int ilogb(double); -int ilogbf(float); -int ilogbl(long double); - -double ldexp(double, int); -float ldexpf(float, int); -long double ldexpl(long double, int); - -double lgamma(double); -float lgammaf(float); -long double lgammal(long double); - -long long llrint(double); -long long llrintf(float); -long long llrintl(long double); - -long long llround(double); -long long llroundf(float); -long long llroundl(long double); - -double log(double); -float logf(float); -long double logl(long double); - -double log10(double); -float log10f(float); -long double log10l(long double); - -double log1p(double); -float log1pf(float); -long double log1pl(long double); - -double log2(double); -float log2f(float); -long double log2l(long double); - -double logb(double); -float logbf(float); -long double logbl(long double); - -long lrint(double); -long lrintf(float); -long lrintl(long double); - -long lround(double); -long lroundf(float); -long lroundl(long double); - -double modf(double, double *); -float modff(float, float *); -long double modfl(long double, long double *); - -double nan(const char *); -float nanf(const char *); -long double nanl(const char *); - -double nearbyint(double); -float nearbyintf(float); -long double nearbyintl(long double); - -double nextafter(double, double); -float nextafterf(float, float); -long double nextafterl(long double, long double); - -double nexttoward(double, long double); -float nexttowardf(float, long double); -long double nexttowardl(long double, long double); - -double pow(double, double); -float powf(float, float); -long double powl(long double, long double); - -double remainder(double, double); -float remainderf(float, float); -long double remainderl(long double, long double); - -double remquo(double, double, int *); -float remquof(float, float, int *); -long double remquol(long double, long double, int *); - -double rint(double); -float rintf(float); -long double rintl(long double); - -double round(double); -float roundf(float); -long double roundl(long double); - -double scalbln(double, long); -float scalblnf(float, long); -long double scalblnl(long double, long); - -double scalbn(double, int); -float scalbnf(float, int); -long double scalbnl(long double, int); - -double sin(double); -float sinf(float); -long double sinl(long double); - -double sinh(double); -float sinhf(float); -long double sinhl(long double); - -double sqrt(double); -float sqrtf(float); -long double sqrtl(long double); - -double tan(double); -float tanf(float); -long double tanl(long double); - -double tanh(double); -float tanhf(float); -long double tanhl(long double); - -double tgamma(double); -float tgammaf(float); -long double tgammal(long double); - -double trunc(double); -float truncf(float); -long double truncl(long double); - - -#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) -#undef MAXFLOAT -#define MAXFLOAT 3.40282346638528859812e+38F -#endif - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define M_E 2.7182818284590452354 /* e */ -#define M_LOG2E 1.4426950408889634074 /* log_2 e */ -#define M_LOG10E 0.43429448190325182765 /* log_10 e */ -#define M_LN2 0.69314718055994530942 /* log_e 2 */ -#define M_LN10 2.30258509299404568402 /* log_e 10 */ -#define M_PI 3.14159265358979323846 /* pi */ -#define M_PI_2 1.57079632679489661923 /* pi/2 */ -#define M_PI_4 0.78539816339744830962 /* pi/4 */ -#define M_1_PI 0.31830988618379067154 /* 1/pi */ -#define M_2_PI 0.63661977236758134308 /* 2/pi */ -#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ -#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ - -extern int signgam; - -double j0(double); -double j1(double); -double jn(int, double); - -double y0(double); -double y1(double); -double yn(int, double); -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define HUGE 3.40282346638528859812e+38F - -double drem(double, double); -float dremf(float, float); - -int finite(double); -int finitef(float); - -double scalb(double, double); -float scalbf(float, float); - -double significand(double); -float significandf(float); - -double lgamma_r(double, int*); -float lgammaf_r(float, int*); - -float j0f(float); -float j1f(float); -float jnf(int, float); - -float y0f(float); -float y1f(float); -float ynf(int, float); -#endif - -#ifdef _GNU_SOURCE -long double lgammal_r(long double, int*); - -void sincos(double, double*, double*); -void sincosf(float, float*, float*); -void sincosl(long double, long double*, long double*); - -double exp10(double); -float exp10f(float); -long double exp10l(long double); - -double pow10(double); -float pow10f(float); -long double pow10l(long double); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/memory.h b/src/hyperlight_guest_bin/third_party/musl/include/memory.h deleted file mode 100644 index 3b2f59002..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/memory.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/src/hyperlight_guest_bin/third_party/musl/include/setjmp.h b/src/hyperlight_guest_bin/third_party/musl/include/setjmp.h deleted file mode 100644 index 2ccc2ac82..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/setjmp.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _SETJMP_H -#define _SETJMP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -typedef struct __jmp_buf_tag { - __jmp_buf __jb; - unsigned long __fl; - unsigned long __ss[128/sizeof(long)]; -} jmp_buf[1]; - -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) -#define __setjmp_attr __attribute__((__returns_twice__)) -#else -#define __setjmp_attr -#endif - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -typedef jmp_buf sigjmp_buf; -int sigsetjmp (sigjmp_buf, int) __setjmp_attr; -_Noreturn void siglongjmp (sigjmp_buf, int); -#endif - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -int _setjmp (jmp_buf) __setjmp_attr; -_Noreturn void _longjmp (jmp_buf, int); -#endif - -int setjmp (jmp_buf) __setjmp_attr; -_Noreturn void longjmp (jmp_buf, int); - -#define setjmp setjmp - -#undef __setjmp_attr - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/src/hyperlight_guest_bin/third_party/musl/include/stdarg.h b/src/hyperlight_guest_bin/third_party/musl/include/stdarg.h deleted file mode 100644 index 3256f8050..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/stdarg.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _STDARG_H -#define _STDARG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define __NEED_va_list - -#include - -#define va_start(v,l) __builtin_va_start(v,l) -#define va_end(v) __builtin_va_end(v) -#define va_arg(v,l) __builtin_va_arg(v,l) -#define va_copy(d,s) __builtin_va_copy(d,s) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/stdbool.h b/src/hyperlight_guest_bin/third_party/musl/include/stdbool.h deleted file mode 100644 index a9d7ab787..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/stdbool.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _STDBOOL_H -#define _STDBOOL_H - -#ifndef __cplusplus - -#define true 1 -#define false 0 -#define bool _Bool - -#endif - -#define __bool_true_false_are_defined 1 - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/stddef.h b/src/hyperlight_guest_bin/third_party/musl/include/stddef.h deleted file mode 100644 index f25b86396..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/stddef.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _STDDEF_H -#define _STDDEF_H - -#if __cplusplus >= 201103L -#define NULL nullptr -#elif defined(__cplusplus) -#define NULL 0L -#else -#define NULL ((void*)0) -#endif - -#define __NEED_ptrdiff_t -#define __NEED_size_t -#define __NEED_wchar_t -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __NEED_max_align_t -#endif - -#include - -#if __GNUC__ > 3 -#define offsetof(type, member) __builtin_offsetof(type, member) -#else -#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 )) -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/stdint.h b/src/hyperlight_guest_bin/third_party/musl/include/stdint.h deleted file mode 100644 index a2968197d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/stdint.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef _STDINT_H -#define _STDINT_H - -#define __NEED_int8_t -#define __NEED_int16_t -#define __NEED_int32_t -#define __NEED_int64_t - -#define __NEED_uint8_t -#define __NEED_uint16_t -#define __NEED_uint32_t -#define __NEED_uint64_t - -#define __NEED_intptr_t -#define __NEED_uintptr_t - -#define __NEED_intmax_t -#define __NEED_uintmax_t - -#include - -typedef int8_t int_fast8_t; -typedef int64_t int_fast64_t; - -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; - -typedef uint8_t uint_fast8_t; -typedef uint64_t uint_fast64_t; - -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -#define INT8_MIN (-1-0x7f) -#define INT16_MIN (-1-0x7fff) -#define INT32_MIN (-1-0x7fffffff) -#define INT64_MIN (-1-0x7fffffffffffffff) - -#define INT8_MAX (0x7f) -#define INT16_MAX (0x7fff) -#define INT32_MAX (0x7fffffff) -#define INT64_MAX (0x7fffffffffffffff) - -#define UINT8_MAX (0xff) -#define UINT16_MAX (0xffff) -#define UINT32_MAX (0xffffffffu) -#define UINT64_MAX (0xffffffffffffffffu) - -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST64_MIN INT64_MIN - -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST64_MAX INT64_MAX - -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST64_MAX UINT64_MAX - -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -#define WINT_MIN 0U -#define WINT_MAX UINT32_MAX - -#if L'\0'-1 > 0 -#define WCHAR_MAX (0xffffffffu+L'\0') -#define WCHAR_MIN (0+L'\0') -#else -#define WCHAR_MAX (0x7fffffff+L'\0') -#define WCHAR_MIN (-1-0x7fffffff+L'\0') -#endif - -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX - -#include - -#define INT8_C(c) c -#define INT16_C(c) c -#define INT32_C(c) c - -#define UINT8_C(c) c -#define UINT16_C(c) c -#define UINT32_C(c) c ## U - -#if UINTPTR_MAX == UINT64_MAX -#define INT64_C(c) c ## L -#define UINT64_C(c) c ## UL -#define INTMAX_C(c) c ## L -#define UINTMAX_C(c) c ## UL -#else -#define INT64_C(c) c ## LL -#define UINT64_C(c) c ## ULL -#define INTMAX_C(c) c ## LL -#define UINTMAX_C(c) c ## ULL -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/stdio.h b/src/hyperlight_guest_bin/third_party/musl/include/stdio.h deleted file mode 100644 index 375cd8cd0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/stdio.h +++ /dev/null @@ -1,228 +0,0 @@ -#ifndef _STDIO_H -#define _STDIO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_FILE -#define __NEED___isoc_va_list -#define __NEED_size_t - -#if __STDC_VERSION__ < 201112L -#define __NEED_struct__IO_FILE -#endif - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -#define __NEED_ssize_t -#define __NEED_off_t -#define __NEED_va_list -#endif - -#include - -#if __cplusplus >= 201103L -#define NULL nullptr -#elif defined(__cplusplus) -#define NULL 0L -#else -#define NULL ((void*)0) -#endif - -#undef EOF -#define EOF (-1) - -#undef SEEK_SET -#undef SEEK_CUR -#undef SEEK_END -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -#define _IOFBF 0 -#define _IOLBF 1 -#define _IONBF 2 - -#define BUFSIZ 1024 -#define FILENAME_MAX 4096 -#define FOPEN_MAX 1000 -#define TMP_MAX 10000 -#define L_tmpnam 20 - -typedef union _G_fpos64_t { - char __opaque[16]; - long long __lldata; - double __align; -} fpos_t; - -#ifndef HYPERLIGHT - -extern FILE *const stdin; -extern FILE *const stdout; -extern FILE *const stderr; - -#define stdin (stdin) -#define stdout (stdout) -#define stderr (stderr) - -FILE *fopen(const char *__restrict, const char *__restrict); -FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict); -int fclose(FILE *); - -int remove(const char *); -int rename(const char *, const char *); - -int feof(FILE *); -int ferror(FILE *); -int fflush(FILE *); -void clearerr(FILE *); - -int fseek(FILE *, long, int); -long ftell(FILE *); -void rewind(FILE *); - -int fgetpos(FILE *__restrict, fpos_t *__restrict); -int fsetpos(FILE *, const fpos_t *); - -size_t fread(void *__restrict, size_t, size_t, FILE *__restrict); -size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict); - -int fgetc(FILE *); -int getc(FILE *); -int getchar(void); -int ungetc(int, FILE *); - -int fputc(int, FILE *); -int putc(int, FILE *); -int putchar(int); - -char *fgets(char *__restrict, int, FILE *__restrict); -#if __STDC_VERSION__ < 201112L -char *gets(char *); -#endif - -int fputs(const char *__restrict, FILE *__restrict); -int puts(const char *); - -int printf(const char *__restrict, ...); -int fprintf(FILE *__restrict, const char *__restrict, ...); -int sprintf(char *__restrict, const char *__restrict, ...); -int snprintf(char *__restrict, size_t, const char *__restrict, ...); - -int vprintf(const char *__restrict, __isoc_va_list); -int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list); -int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list); -int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); - -int scanf(const char *__restrict, ...); -int fscanf(FILE *__restrict, const char *__restrict, ...); -int sscanf(const char *__restrict, const char *__restrict, ...); -int vscanf(const char *__restrict, __isoc_va_list); -int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list); -int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list); - -void perror(const char *); - -int setvbuf(FILE *__restrict, char *__restrict, int, size_t); -void setbuf(FILE *__restrict, char *__restrict); - -char *tmpnam(char *); -FILE *tmpfile(void); - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -FILE *fmemopen(void *__restrict, size_t, const char *__restrict); -FILE *open_memstream(char **, size_t *); -FILE *fdopen(int, const char *); -FILE *popen(const char *, const char *); -int pclose(FILE *); -int fileno(FILE *); -int fseeko(FILE *, off_t, int); -off_t ftello(FILE *); -int dprintf(int, const char *__restrict, ...); -int vdprintf(int, const char *__restrict, __isoc_va_list); -void flockfile(FILE *); -int ftrylockfile(FILE *); -void funlockfile(FILE *); -int getc_unlocked(FILE *); -int getchar_unlocked(void); -int putc_unlocked(int, FILE *); -int putchar_unlocked(int); -ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict); -ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict); -int renameat(int, const char *, int, const char *); -char *ctermid(char *); -#define L_ctermid 20 -#endif - - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -#define P_tmpdir "/tmp" -char *tempnam(const char *, const char *); -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define L_cuserid 20 -char *cuserid(char *); -void setlinebuf(FILE *); -void setbuffer(FILE *, char *, size_t); -int fgetc_unlocked(FILE *); -int fputc_unlocked(int, FILE *); -int fflush_unlocked(FILE *); -size_t fread_unlocked(void *, size_t, size_t, FILE *); -size_t fwrite_unlocked(const void *, size_t, size_t, FILE *); -void clearerr_unlocked(FILE *); -int feof_unlocked(FILE *); -int ferror_unlocked(FILE *); -int fileno_unlocked(FILE *); -int getw(FILE *); -int putw(int, FILE *); -char *fgetln(FILE *, size_t *); -int asprintf(char **, const char *, ...); -int vasprintf(char **, const char *, __isoc_va_list); -#endif - -#ifdef _GNU_SOURCE -char *fgets_unlocked(char *, int, FILE *); -int fputs_unlocked(const char *, FILE *); - -typedef ssize_t (cookie_read_function_t)(void *, char *, size_t); -typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t); -typedef int (cookie_seek_function_t)(void *, off_t *, int); -typedef int (cookie_close_function_t)(void *); - -typedef struct _IO_cookie_io_functions_t { - cookie_read_function_t *read; - cookie_write_function_t *write; - cookie_seek_function_t *seek; - cookie_close_function_t *close; -} cookie_io_functions_t; - -FILE *fopencookie(void *, const char *, cookie_io_functions_t); -#endif - -#if defined(_LARGEFILE64_SOURCE) -#define tmpfile64 tmpfile -#define fopen64 fopen -#define freopen64 freopen -#define fseeko64 fseeko -#define ftello64 ftello -#define fgetpos64 fgetpos -#define fsetpos64 fsetpos -#define fpos64_t fpos_t -#define off64_t off_t -#endif - -#ifdef __cplusplus -} -#endif - -#endif //HYPERLIGHT - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/stdlib.h b/src/hyperlight_guest_bin/third_party/musl/include/stdlib.h deleted file mode 100644 index d39dc504c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/stdlib.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef _STDLIB_H -#define _STDLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if __cplusplus >= 201103L -#define NULL nullptr -#elif defined(__cplusplus) -#define NULL 0L -#else -#define NULL ((void*)0) -#endif - -#define __NEED_size_t -#define __NEED_wchar_t - -#include - -int atoi (const char *); -long atol (const char *); -long long atoll (const char *); -double atof (const char *); - -float strtof (const char *__restrict, char **__restrict); -double strtod (const char *__restrict, char **__restrict); -long double strtold (const char *__restrict, char **__restrict); - -long strtol (const char *__restrict, char **__restrict, int); -unsigned long strtoul (const char *__restrict, char **__restrict, int); -long long strtoll (const char *__restrict, char **__restrict, int); -unsigned long long strtoull (const char *__restrict, char **__restrict, int); - -// These 5 functions are implemented in rust in hyperlight_guest_bin -_Noreturn void abort (void); -void *malloc (size_t); -void *calloc (size_t, size_t); -void *realloc (void *, size_t); -void free (void *); - -#ifndef HYPERLIGHT -int rand (void); -void srand (unsigned); - -void *aligned_alloc(size_t, size_t); - -int atexit (void (*) (void)); -_Noreturn void exit (int); -_Noreturn void _Exit (int); -int at_quick_exit (void (*) (void)); -_Noreturn void quick_exit (int); - -char *getenv (const char *); - -int system (const char *); -#endif // HYPERLIGHT - -void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); -void qsort (void *, size_t, size_t, int (*)(const void *, const void *)); - -int abs (int); -long labs (long); -long long llabs (long long); - -typedef struct { int quot, rem; } div_t; -typedef struct { long quot, rem; } ldiv_t; -typedef struct { long long quot, rem; } lldiv_t; - -div_t div (int, int); -ldiv_t ldiv (long, long); -lldiv_t lldiv (long long, long long); - -int mblen (const char *, size_t); -int mbtowc (wchar_t *__restrict, const char *__restrict, size_t); -int wctomb (char *, wchar_t); -size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t); -size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t); - -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 - -size_t __ctype_get_mb_cur_max(void); -#define MB_CUR_MAX (__ctype_get_mb_cur_max()) - -#define RAND_MAX (0x7fffffff) - - -#if (defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE)) && !defined(HYPERLIGHT) - -#define WNOHANG 1 -#define WUNTRACED 2 - -#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) -#define WTERMSIG(s) ((s) & 0x7f) -#define WSTOPSIG(s) WEXITSTATUS(s) -#define WIFEXITED(s) (!WTERMSIG(s)) -#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00) -#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu) - -int posix_memalign (void **, size_t, size_t); -int setenv (const char *, const char *, int); -int unsetenv (const char *); -int mkstemp (char *); -int mkostemp (char *, int); -char *mkdtemp (char *); -int getsubopt (char **, char *const *, char **); -int rand_r (unsigned *); - -#endif - - -#if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE)) && !defined(HYPERLIGHT) -char *realpath (const char *__restrict, char *__restrict); -long int random (void); -void srandom (unsigned int); -char *initstate (unsigned int, char *, size_t); -char *setstate (char *); -int putenv (char *); -int posix_openpt (int); -int grantpt (int); -int unlockpt (int); -char *ptsname (int); -char *l64a (long); -long a64l (const char *); -void setkey (const char *); -double drand48 (void); -double erand48 (unsigned short [3]); -long int lrand48 (void); -long int nrand48 (unsigned short [3]); -long mrand48 (void); -long jrand48 (unsigned short [3]); -void srand48 (long); -unsigned short *seed48 (unsigned short [3]); -void lcong48 (unsigned short [7]); -#endif - -#include -#if (defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(HYPERLIGHT) -char *mktemp (char *); -int mkstemps (char *, int); -int mkostemps (char *, int, int); -void *valloc (size_t); -void *memalign(size_t, size_t); -int getloadavg(double *, int); -int clearenv(void); -#define WCOREDUMP(s) ((s) & 0x80) -#define WIFCONTINUED(s) ((s) == 0xffff) -void *reallocarray (void *, size_t, size_t); -void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); -#endif - -#ifdef _GNU_SOURCE -int ptsname_r(int, char *, size_t); -char *ecvt(double, int, int *, int *); -char *fcvt(double, int, int *, int *); -char *gcvt(double, int, char *); -char *secure_getenv(const char *); -struct __locale_struct; -float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *); -double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *); -long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *); -#endif - -#if defined(_LARGEFILE64_SOURCE) -#define mkstemp64 mkstemp -#define mkostemp64 mkostemp -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define mkstemps64 mkstemps -#define mkostemps64 mkostemps -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/string.h b/src/hyperlight_guest_bin/third_party/musl/include/string.h deleted file mode 100644 index 83e2b9464..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/string.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef _STRING_H -#define _STRING_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if __cplusplus >= 201103L -#define NULL nullptr -#elif defined(__cplusplus) -#define NULL 0L -#else -#define NULL ((void*)0) -#endif - -#define __NEED_size_t -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -#define __NEED_locale_t -#endif - -#include - -void *memcpy (void *__restrict, const void *__restrict, size_t); -void *memmove (void *, const void *, size_t); -void *memset (void *, int, size_t); -int memcmp (const void *, const void *, size_t); -void *memchr (const void *, int, size_t); - -char *strcpy (char *__restrict, const char *__restrict); -char *strncpy (char *__restrict, const char *__restrict, size_t); - -char *strcat (char *__restrict, const char *__restrict); -char *strncat (char *__restrict, const char *__restrict, size_t); - -int strcmp (const char *, const char *); -int strncmp (const char *, const char *, size_t); - -int strcoll (const char *, const char *); -size_t strxfrm (char *__restrict, const char *__restrict, size_t); - -char *strchr (const char *, int); -char *strrchr (const char *, int); - -size_t strcspn (const char *, const char *); -size_t strspn (const char *, const char *); -char *strpbrk (const char *, const char *); -char *strstr (const char *, const char *); -char *strtok (char *__restrict, const char *__restrict); - -size_t strlen (const char *); - -char *strerror (int); - -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#include -#endif - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -char *strtok_r (char *__restrict, const char *__restrict, char **__restrict); -int strerror_r (int, char *, size_t); -char *stpcpy(char *__restrict, const char *__restrict); -char *stpncpy(char *__restrict, const char *__restrict, size_t); -size_t strnlen (const char *, size_t); -char *strdup (const char *); -char *strndup (const char *, size_t); -char *strsignal(int); -char *strerror_l (int, locale_t); -int strcoll_l (const char *, const char *, locale_t); -size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t); -void *memmem(const void *, size_t, const void *, size_t); -#endif - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -void *memccpy (void *__restrict, const void *__restrict, int, size_t); -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -char *strsep(char **, const char *); -size_t strlcat (char *, const char *, size_t); -size_t strlcpy (char *, const char *, size_t); -void explicit_bzero (void *, size_t); -#endif - -#ifdef _GNU_SOURCE -#define strdupa(x) strcpy(alloca(strlen(x)+1),x) -int strverscmp (const char *, const char *); -char *strchrnul(const char *, int); -char *strcasestr(const char *, const char *); -void *memrchr(const void *, int, size_t); -void *mempcpy(void *, const void *, size_t); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/strings.h b/src/hyperlight_guest_bin/third_party/musl/include/strings.h deleted file mode 100644 index b7a5ea089..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/strings.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _STRINGS_H -#define _STRINGS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_size_t -#define __NEED_locale_t -#include - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \ - || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \ - || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) -int bcmp (const void *, const void *, size_t); -void bcopy (const void *, void *, size_t); -void bzero (void *, size_t); -char *index (const char *, int); -char *rindex (const char *, int); -#endif - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -int ffs (int); -int ffsl (long); -int ffsll (long long); -#endif - -int strcasecmp (const char *, const char *); -int strncasecmp (const char *, const char *, size_t); - -int strcasecmp_l (const char *, const char *, locale_t); -int strncasecmp_l (const char *, const char *, size_t, locale_t); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/sys/select.h b/src/hyperlight_guest_bin/third_party/musl/include/sys/select.h deleted file mode 100644 index b3bab1d57..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/sys/select.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_size_t -#define __NEED_time_t -#define __NEED_suseconds_t -#define __NEED_struct_timeval -#define __NEED_struct_timespec -#define __NEED_sigset_t - -#include - -#define FD_SETSIZE 1024 - -typedef unsigned long fd_mask; - -typedef struct { - unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)]; -} fd_set; - -#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0) -#define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long))))) -#define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long))))) -#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long))))) - -int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict); -int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define NFDBITS (8*(int)sizeof(long)) -#endif - -#if _REDIR_TIME64 -__REDIR(select, __select_time64); -__REDIR(pselect, __pselect_time64); -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/sys/time.h b/src/hyperlight_guest_bin/third_party/musl/include/sys/time.h deleted file mode 100644 index 8d98aed3b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/sys/time.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _SYS_TIME_H -#define _SYS_TIME_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -int gettimeofday (struct timeval *__restrict, void *__restrict); - -#define ITIMER_REAL 0 -#define ITIMER_VIRTUAL 1 -#define ITIMER_PROF 2 - -struct itimerval { - struct timeval it_interval; - struct timeval it_value; -}; - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - -#ifndef HYPERLIGHT -int getitimer (int, struct itimerval *); -int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict); -int utimes (const char *, const struct timeval [2]); - -int futimes(int, const struct timeval [2]); -int futimesat(int, const char *, const struct timeval [2]); -int lutimes(const char *, const struct timeval [2]); -int settimeofday(const struct timeval *, const struct timezone *); -int adjtime (const struct timeval *, struct timeval *); -#endif // HYPERLIGHT - -#define timerisset(t) ((t)->tv_sec || (t)->tv_usec) -#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0) -#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \ - (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec) -#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \ - ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \ - ((a)->tv_usec -= 1000000, (a)->tv_sec++) ) -#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \ - ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \ - ((a)->tv_usec += 1000000, (a)->tv_sec--) ) -#endif - -#if defined(_GNU_SOURCE) -#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \ - (ts)->tv_sec = (tv)->tv_sec, \ - (ts)->tv_nsec = (tv)->tv_usec * 1000, \ - (void)0 ) -#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \ - (tv)->tv_sec = (ts)->tv_sec, \ - (tv)->tv_usec = (ts)->tv_nsec / 1000, \ - (void)0 ) -#endif - -#if _REDIR_TIME64 -__REDIR(gettimeofday, __gettimeofday_time64); -__REDIR(getitimer, __getitimer_time64); -__REDIR(setitimer, __setitimer_time64); -__REDIR(utimes, __utimes_time64); -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -__REDIR(futimes, __futimes_time64); -__REDIR(futimesat, __futimesat_time64); -__REDIR(lutimes, __lutimes_time64); -__REDIR(settimeofday, __settimeofday_time64); -__REDIR(adjtime, __adjtime64); -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/sys/types.h b/src/hyperlight_guest_bin/third_party/musl/include/sys/types.h deleted file mode 100644 index 3363374fd..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/sys/types.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_ino_t -#define __NEED_dev_t -#define __NEED_uid_t -#define __NEED_gid_t -#define __NEED_mode_t -#define __NEED_nlink_t -#define __NEED_off_t -#define __NEED_pid_t -#define __NEED_size_t -#define __NEED_ssize_t -#define __NEED_time_t -#define __NEED_timer_t -#define __NEED_clockid_t - -#define __NEED_blkcnt_t -#define __NEED_fsblkcnt_t -#define __NEED_fsfilcnt_t - -#define __NEED_id_t -#define __NEED_key_t -#define __NEED_clock_t -#define __NEED_suseconds_t -#define __NEED_blksize_t - -#define __NEED_pthread_t -#define __NEED_pthread_attr_t -#define __NEED_pthread_mutexattr_t -#define __NEED_pthread_condattr_t -#define __NEED_pthread_rwlockattr_t -#define __NEED_pthread_barrierattr_t -#define __NEED_pthread_mutex_t -#define __NEED_pthread_cond_t -#define __NEED_pthread_rwlock_t -#define __NEED_pthread_barrier_t -#define __NEED_pthread_spinlock_t -#define __NEED_pthread_key_t -#define __NEED_pthread_once_t -#define __NEED_useconds_t - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define __NEED_int8_t -#define __NEED_int16_t -#define __NEED_int32_t -#define __NEED_int64_t -#define __NEED_u_int64_t -#define __NEED_register_t -#endif - -#include - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -typedef unsigned char u_int8_t; -typedef unsigned short u_int16_t; -typedef unsigned u_int32_t; -typedef char *caddr_t; -typedef unsigned char u_char; -typedef unsigned short u_short, ushort; -typedef unsigned u_int, uint; -typedef unsigned long u_long, ulong; -typedef long long quad_t; -typedef unsigned long long u_quad_t; -#include -#include -#endif - -#if defined(_LARGEFILE64_SOURCE) -#define blkcnt64_t blkcnt_t -#define fsblkcnt64_t fsblkcnt_t -#define fsfilcnt64_t fsfilcnt_t -#define ino64_t ino_t -#define off64_t off_t -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/tar.h b/src/hyperlight_guest_bin/third_party/musl/include/tar.h deleted file mode 100644 index be589842a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/tar.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _TAR_H -#define _TAR_H - -#define TSUID 04000 -#define TSGID 02000 -#define TSVTX 01000 -#define TUREAD 00400 -#define TUWRITE 00200 -#define TUEXEC 00100 -#define TGREAD 00040 -#define TGWRITE 00020 -#define TGEXEC 00010 -#define TOREAD 00004 -#define TOWRITE 00002 -#define TOEXEC 00001 - -#define REGTYPE '0' -#define AREGTYPE '\0' -#define LNKTYPE '1' -#define SYMTYPE '2' -#define CHRTYPE '3' -#define BLKTYPE '4' -#define DIRTYPE '5' -#define FIFOTYPE '6' -#define CONTTYPE '7' - -#define TMAGIC "ustar" -#define TMAGLEN 6 - -#define TVERSION "00" -#define TVERSLEN 2 - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/time.h b/src/hyperlight_guest_bin/third_party/musl/include/time.h deleted file mode 100644 index 242abd4ad..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/time.h +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef _TIME_H -#define _TIME_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if __cplusplus >= 201103L -#define NULL nullptr -#elif defined(__cplusplus) -#define NULL 0L -#else -#define NULL ((void*)0) -#endif - - -#define __NEED_size_t -#define __NEED_time_t -#define __NEED_clock_t -#define __NEED_struct_timespec - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -#define __NEED_clockid_t -#define __NEED_timer_t -#define __NEED_pid_t -#define __NEED_locale_t -#endif - -#include - -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#define __tm_gmtoff tm_gmtoff -#define __tm_zone tm_zone -#endif - -struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - long __tm_gmtoff; - const char *__tm_zone; -}; - -#ifndef HYPERLIGHT -clock_t clock (void); -time_t time (time_t *); -double difftime (time_t, time_t); -time_t mktime (struct tm *); -size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict); -struct tm *gmtime (const time_t *); -struct tm *localtime (const time_t *); -char *asctime (const struct tm *); -char *ctime (const time_t *); -int timespec_get(struct timespec *, int); -#endif // HYPERLIGHT - -#define CLOCKS_PER_SEC 1000000L - -#define TIME_UTC 1 - -#if (defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE)) && !defined(HYPERLIGHT) - -size_t strftime_l (char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t); - -struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict); -struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict); -char *asctime_r (const struct tm *__restrict, char *__restrict); -char *ctime_r (const time_t *, char *); - -void tzset (void); - -struct itimerspec { - struct timespec it_interval; - struct timespec it_value; -}; - -#define CLOCK_REALTIME 0 -#define CLOCK_MONOTONIC 1 -#define CLOCK_PROCESS_CPUTIME_ID 2 -#define CLOCK_THREAD_CPUTIME_ID 3 -#define CLOCK_MONOTONIC_RAW 4 -#define CLOCK_REALTIME_COARSE 5 -#define CLOCK_MONOTONIC_COARSE 6 -#define CLOCK_BOOTTIME 7 -#define CLOCK_REALTIME_ALARM 8 -#define CLOCK_BOOTTIME_ALARM 9 -#define CLOCK_SGI_CYCLE 10 -#define CLOCK_TAI 11 - -#define TIMER_ABSTIME 1 - -int nanosleep (const struct timespec *, struct timespec *); -int clock_getres (clockid_t, struct timespec *); -int clock_gettime (clockid_t, struct timespec *); -int clock_settime (clockid_t, const struct timespec *); -int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *); -int clock_getcpuclockid (pid_t, clockid_t *); - -struct sigevent; -int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict); -int timer_delete (timer_t); -int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict); -int timer_gettime (timer_t, struct itimerspec *); -int timer_getoverrun (timer_t); - -extern char *tzname[2]; - -#endif - - -#if (defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)) && !defined(HYPERLIGHT) -char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict); -extern int daylight; -extern long timezone; -extern int getdate_err; -struct tm *getdate (const char *); -#endif - - -#if (defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(HYPERLIGHT) -int stime(const time_t *); -time_t timegm(struct tm *); -#endif - -#if _REDIR_TIME64 -__REDIR(time, __time64); -__REDIR(difftime, __difftime64); -__REDIR(mktime, __mktime64); -__REDIR(gmtime, __gmtime64); -__REDIR(localtime, __localtime64); -__REDIR(ctime, __ctime64); -__REDIR(timespec_get, __timespec_get_time64); -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) -__REDIR(gmtime_r, __gmtime64_r); -__REDIR(localtime_r, __localtime64_r); -__REDIR(ctime_r, __ctime64_r); -__REDIR(nanosleep, __nanosleep_time64); -__REDIR(clock_getres, __clock_getres_time64); -__REDIR(clock_gettime, __clock_gettime64); -__REDIR(clock_settime, __clock_settime64); -__REDIR(clock_nanosleep, __clock_nanosleep_time64); -__REDIR(timer_settime, __timer_settime64); -__REDIR(timer_gettime, __timer_gettime64); -#endif -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -__REDIR(stime, __stime64); -__REDIR(timegm, __timegm_time64); -#endif -#endif - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/wchar.h b/src/hyperlight_guest_bin/third_party/musl/include/wchar.h deleted file mode 100644 index 4e9d9ceab..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/wchar.h +++ /dev/null @@ -1,211 +0,0 @@ -#ifndef _WCHAR_H -#define _WCHAR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_FILE -#define __NEED___isoc_va_list -#define __NEED_size_t -#define __NEED_wchar_t -#define __NEED_wint_t -#define __NEED_mbstate_t - -#if __STDC_VERSION__ < 201112L -#define __NEED_struct__IO_FILE -#endif - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define __NEED_locale_t -#define __NEED_va_list -#endif - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define __NEED_wctype_t -#endif - -#include - -#if L'\0'-1 > 0 -#define WCHAR_MAX (0xffffffffu+L'\0') -#define WCHAR_MIN (0+L'\0') -#else -#define WCHAR_MAX (0x7fffffff+L'\0') -#define WCHAR_MIN (-1-0x7fffffff+L'\0') -#endif - -#if __cplusplus >= 201103L -#define NULL nullptr -#elif defined(__cplusplus) -#define NULL 0L -#else -#define NULL ((void*)0) -#endif - -#undef WEOF -#define WEOF 0xffffffffU - -wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict); -wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); - -wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict); -wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t); - -int wcscmp (const wchar_t *, const wchar_t *); -int wcsncmp (const wchar_t *, const wchar_t *, size_t); - -#ifndef HYPERLIGHT -int wcscoll(const wchar_t *, const wchar_t *); -size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t); -#endif - -wchar_t *wcschr (const wchar_t *, wchar_t); -wchar_t *wcsrchr (const wchar_t *, wchar_t); - -size_t wcscspn (const wchar_t *, const wchar_t *); -size_t wcsspn (const wchar_t *, const wchar_t *); -wchar_t *wcspbrk (const wchar_t *, const wchar_t *); - -wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict); - -size_t wcslen (const wchar_t *); - -wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict); -wchar_t *wcswcs (const wchar_t *, const wchar_t *); - -wchar_t *wmemchr (const wchar_t *, wchar_t, size_t); -int wmemcmp (const wchar_t *, const wchar_t *, size_t); -wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); -wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t); -wchar_t *wmemset (wchar_t *, wchar_t, size_t); - -wint_t btowc (int); -int wctob (wint_t); - -int mbsinit (const mbstate_t *); -size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict); -size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict); - -size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict); - -size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict); -size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict); - -float wcstof (const wchar_t *__restrict, wchar_t **__restrict); -double wcstod (const wchar_t *__restrict, wchar_t **__restrict); -long double wcstold (const wchar_t *__restrict, wchar_t **__restrict); - -long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int); -unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int); - -long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int); -unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int); - - -#ifndef HYPERLIGHT -int fwide (FILE *, int); - - -int wprintf (const wchar_t *__restrict, ...); -int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...); -int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...); - -int vwprintf (const wchar_t *__restrict, __isoc_va_list); -int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); -int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list); - -int wscanf (const wchar_t *__restrict, ...); -int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...); -int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...); - -int vwscanf (const wchar_t *__restrict, __isoc_va_list); -int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); -int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list); - -wint_t fgetwc (FILE *); -wint_t getwc (FILE *); -wint_t getwchar (void); - -wint_t fputwc (wchar_t, FILE *); -wint_t putwc (wchar_t, FILE *); -wint_t putwchar (wchar_t); - -wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict); -int fputws (const wchar_t *__restrict, FILE *__restrict); - -wint_t ungetwc (wint_t, FILE *); -size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict); - -#endif // HYPERLIGHT -struct tm; - -#undef iswdigit - -#if defined(_GNU_SOURCE) -wint_t fgetwc_unlocked (FILE *); -wint_t getwc_unlocked (FILE *); -wint_t getwchar_unlocked (void); -wint_t fputwc_unlocked (wchar_t, FILE *); -wint_t putwc_unlocked (wchar_t, FILE *); -wint_t putwchar_unlocked (wchar_t); -wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict); -int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict); -#endif - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); -#endif - - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -FILE *open_wmemstream(wchar_t **, size_t *); -size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict); -size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict); -wchar_t *wcsdup(const wchar_t *); -size_t wcsnlen (const wchar_t *, size_t); -wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict); -wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); -int wcscasecmp(const wchar_t *, const wchar_t *); -int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); -int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); -int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); -int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); -size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t); -#endif - -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -int wcwidth (wchar_t); -int wcswidth (const wchar_t *, size_t); -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswblank(wint_t); -int iswcntrl(wint_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); -int iswctype(wint_t, wctype_t); -wint_t towlower(wint_t); -wint_t towupper(wint_t); -wctype_t wctype(const char *); - -#ifndef __cplusplus -#undef iswdigit -#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10) -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/include/wctype.h b/src/hyperlight_guest_bin/third_party/musl/include/wctype.h deleted file mode 100644 index bc2420d3f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/include/wctype.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _WCTYPE_H -#define _WCTYPE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define __NEED_wint_t -#define __NEED_wctype_t - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define __NEED_locale_t -#endif - -#include - -typedef const int * wctrans_t; - -#undef WEOF -#define WEOF 0xffffffffU - -#undef iswdigit - -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswblank(wint_t); -int iswcntrl(wint_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); -int iswctype(wint_t, wctype_t); -wint_t towctrans(wint_t, wctrans_t); -wint_t towlower(wint_t); -wint_t towupper(wint_t); -wctrans_t wctrans(const char *); -wctype_t wctype(const char *); - -#ifndef __cplusplus -#undef iswdigit -#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10) -#endif - -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) - -int iswalnum_l(wint_t, locale_t); -int iswalpha_l(wint_t, locale_t); -int iswblank_l(wint_t, locale_t); -int iswcntrl_l(wint_t, locale_t); -int iswdigit_l(wint_t, locale_t); -int iswgraph_l(wint_t, locale_t); -int iswlower_l(wint_t, locale_t); -int iswprint_l(wint_t, locale_t); -int iswpunct_l(wint_t, locale_t); -int iswspace_l(wint_t, locale_t); -int iswupper_l(wint_t, locale_t); -int iswxdigit_l(wint_t, locale_t); -int iswctype_l(wint_t, wctype_t, locale_t); -wint_t towlower_l(wint_t, locale_t); -wint_t towupper_l(wint_t, locale_t); -wint_t towctrans_l(wint_t, wctrans_t, locale_t); -wctrans_t wctrans_l(const char *, locale_t); -wctype_t wctype_l(const char *, locale_t); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/__cexp.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/__cexp.c deleted file mode 100644 index 003d20af6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/__cexp.c +++ /dev/null @@ -1,87 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_exp.c */ -/*- - * Copyright (c) 2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "complex_impl.h" - -static const uint32_t k = 1799; /* constant for reduction */ -static const double kln2 = 1246.97177782734161156; /* k * ln2 */ - -/* - * Compute exp(x), scaled to avoid spurious overflow. An exponent is - * returned separately in 'expt'. - * - * Input: ln(DBL_MAX) <= x < ln(2 * DBL_MAX / DBL_MIN_DENORM) ~= 1454.91 - * Output: 2**1023 <= y < 2**1024 - */ -static double __frexp_exp(double x, int *expt) -{ - double exp_x; - uint32_t hx; - - /* - * We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to - * minimize |exp(kln2) - 2**k|. We also scale the exponent of - * exp_x to MAX_EXP so that the result can be multiplied by - * a tiny number without losing accuracy due to denormalization. - */ - exp_x = exp(x - kln2); - GET_HIGH_WORD(hx, exp_x); - *expt = (hx >> 20) - (0x3ff + 1023) + k; - SET_HIGH_WORD(exp_x, (hx & 0xfffff) | ((0x3ff + 1023) << 20)); - return exp_x; -} - -/* - * __ldexp_cexp(x, expt) compute exp(x) * 2**expt. - * It is intended for large arguments (real part >= ln(DBL_MAX)) - * where care is needed to avoid overflow. - * - * The present implementation is narrowly tailored for our hyperbolic and - * exponential functions. We assume expt is small (0 or -1), and the caller - * has filtered out very large x, for which overflow would be inevitable. - */ -double complex __ldexp_cexp(double complex z, int expt) -{ - double x, y, exp_x, scale1, scale2; - int ex_expt, half_expt; - - x = creal(z); - y = cimag(z); - exp_x = __frexp_exp(x, &ex_expt); - expt += ex_expt; - - /* - * Arrange so that scale1 * scale2 == 2**expt. We use this to - * compensate for scalbn being horrendously slow. - */ - half_expt = expt / 2; - INSERT_WORDS(scale1, (0x3ff + half_expt) << 20, 0); - half_expt = expt - half_expt; - INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0); - - return CMPLX(cos(y) * exp_x * scale1 * scale2, sin(y) * exp_x * scale1 * scale2); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/__cexpf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/__cexpf.c deleted file mode 100644 index ee5ff2bce..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/__cexpf.c +++ /dev/null @@ -1,68 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_expf.c */ -/*- - * Copyright (c) 2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "complex_impl.h" - -static const uint32_t k = 235; /* constant for reduction */ -static const float kln2 = 162.88958740F; /* k * ln2 */ - -/* - * See __cexp.c for details. - * - * Input: ln(FLT_MAX) <= x < ln(2 * FLT_MAX / FLT_MIN_DENORM) ~= 192.7 - * Output: 2**127 <= y < 2**128 - */ -static float __frexp_expf(float x, int *expt) -{ - float exp_x; - uint32_t hx; - - exp_x = expf(x - kln2); - GET_FLOAT_WORD(hx, exp_x); - *expt = (hx >> 23) - (0x7f + 127) + k; - SET_FLOAT_WORD(exp_x, (hx & 0x7fffff) | ((0x7f + 127) << 23)); - return exp_x; -} - -float complex __ldexp_cexpf(float complex z, int expt) -{ - float x, y, exp_x, scale1, scale2; - int ex_expt, half_expt; - - x = crealf(z); - y = cimagf(z); - exp_x = __frexp_expf(x, &ex_expt); - expt += ex_expt; - - half_expt = expt / 2; - SET_FLOAT_WORD(scale1, (0x7f + half_expt) << 23); - half_expt = expt - half_expt; - SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23); - - return CMPLXF(cosf(y) * exp_x * scale1 * scale2, - sinf(y) * exp_x * scale1 * scale2); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cabs.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cabs.c deleted file mode 100644 index c5ad58ab9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cabs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -double cabs(double complex z) -{ - return hypot(creal(z), cimag(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cabsf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cabsf.c deleted file mode 100644 index 619f28d39..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cabsf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -float cabsf(float complex z) -{ - return hypotf(crealf(z), cimagf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cabsl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cabsl.c deleted file mode 100644 index d37e3f2ea..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cabsl.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double cabsl(long double complex z) -{ - return cabs(z); -} -#else -long double cabsl(long double complex z) -{ - return hypotl(creall(z), cimagl(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacos.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cacos.c deleted file mode 100644 index c39d257b4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacos.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "complex_impl.h" - -// FIXME: Hull et al. "Implementing the complex arcsine and arccosine functions using exception handling" 1997 - -/* acos(z) = pi/2 - asin(z) */ - -double complex cacos(double complex z) -{ - z = casin(z); - return CMPLX(M_PI_2 - creal(z), -cimag(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosf.c deleted file mode 100644 index ed8acf0f5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "complex_impl.h" - -// FIXME - -static const float float_pi_2 = M_PI_2; - -float complex cacosf(float complex z) -{ - z = casinf(z); - return CMPLXF(float_pi_2 - crealf(z), -cimagf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosh.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosh.c deleted file mode 100644 index 76127f75f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosh.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "complex_impl.h" - -/* acosh(z) = i acos(z) */ - -double complex cacosh(double complex z) -{ - int zineg = signbit(cimag(z)); - - z = cacos(z); - if (zineg) return CMPLX(cimag(z), -creal(z)); - else return CMPLX(-cimag(z), creal(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshf.c deleted file mode 100644 index 8bd80581a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "complex_impl.h" - -float complex cacoshf(float complex z) -{ - int zineg = signbit(cimagf(z)); - - z = cacosf(z); - if (zineg) return CMPLXF(cimagf(z), -crealf(z)); - else return CMPLXF(-cimagf(z), crealf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshl.c deleted file mode 100644 index 3a284be9c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshl.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex cacoshl(long double complex z) -{ - return cacosh(z); -} -#else -long double complex cacoshl(long double complex z) -{ - int zineg = signbit(cimagl(z)); - - z = cacosl(z); - if (zineg) return CMPLXL(cimagl(z), -creall(z)); - else return CMPLXL(-cimagl(z), creall(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosl.c deleted file mode 100644 index cc20dcd7d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cacosl.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex cacosl(long double complex z) -{ - return cacos(z); -} -#else -// FIXME -#define PI_2 1.57079632679489661923132169163975144L -long double complex cacosl(long double complex z) -{ - z = casinl(z); - return CMPLXL(PI_2 - creall(z), -cimagl(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/carg.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/carg.c deleted file mode 100644 index dfe9b97a0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/carg.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -double carg(double complex z) -{ - return atan2(cimag(z), creal(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cargf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cargf.c deleted file mode 100644 index 9a6c19b63..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cargf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -float cargf(float complex z) -{ - return atan2f(cimagf(z), crealf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cargl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cargl.c deleted file mode 100644 index 88f95f96e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cargl.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double cargl(long double complex z) -{ - return carg(z); -} -#else -long double cargl(long double complex z) -{ - return atan2l(cimagl(z), creall(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/casin.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/casin.c deleted file mode 100644 index 3244bebb1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/casin.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "complex_impl.h" - -// FIXME - -/* asin(z) = -i log(i z + sqrt(1 - z*z)) */ - -double complex casin(double complex z) -{ - double complex w; - double x, y; - - x = creal(z); - y = cimag(z); - w = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y); - double complex r = clog(CMPLX(-y, x) + csqrt(w)); - return CMPLX(cimag(r), -creal(r)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/casinf.c deleted file mode 100644 index 2cda2f086..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinf.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "complex_impl.h" - -// FIXME - -float complex casinf(float complex z) -{ - float complex w; - float x, y; - - x = crealf(z); - y = cimagf(z); - w = CMPLXF(1.0 - (x - y)*(x + y), -2.0*x*y); - float complex r = clogf(CMPLXF(-y, x) + csqrtf(w)); - return CMPLXF(cimagf(r), -crealf(r)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinh.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/casinh.c deleted file mode 100644 index 50bf27ce8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinh.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "complex_impl.h" - -/* asinh(z) = -i asin(i z) */ - -double complex casinh(double complex z) -{ - z = casin(CMPLX(-cimag(z), creal(z))); - return CMPLX(cimag(z), -creal(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinhf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/casinhf.c deleted file mode 100644 index 93d82e5f4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinhf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -float complex casinhf(float complex z) -{ - z = casinf(CMPLXF(-cimagf(z), crealf(z))); - return CMPLXF(cimagf(z), -crealf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinhl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/casinhl.c deleted file mode 100644 index 68ba3ddfc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinhl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex casinhl(long double complex z) -{ - return casinh(z); -} -#else -long double complex casinhl(long double complex z) -{ - z = casinl(CMPLXL(-cimagl(z), creall(z))); - return CMPLXL(cimagl(z), -creall(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/casinl.c deleted file mode 100644 index 072adc450..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/casinl.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex casinl(long double complex z) -{ - return casin(z); -} -#else -// FIXME -long double complex casinl(long double complex z) -{ - long double complex w; - long double x, y; - - x = creall(z); - y = cimagl(z); - w = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y); - long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w)); - return CMPLXL(cimagl(r), -creall(r)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/catan.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/catan.c deleted file mode 100644 index ccc2fb539..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/catan.c +++ /dev/null @@ -1,107 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/s_catan.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Complex circular arc tangent - * - * - * SYNOPSIS: - * - * double complex catan(); - * double complex z, w; - * - * w = catan (z); - * - * - * DESCRIPTION: - * - * If - * z = x + iy, - * - * then - * 1 ( 2x ) - * Re w = - arctan(-----------) + k PI - * 2 ( 2 2) - * (1 - x - y ) - * - * ( 2 2) - * 1 (x + (y+1) ) - * Im w = - log(------------) - * 4 ( 2 2) - * (x + (y-1) ) - * - * Where k is an arbitrary integer. - * - * catan(z) = -i catanh(iz). - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * DEC -10,+10 5900 1.3e-16 7.8e-18 - * IEEE -10,+10 30000 2.3e-15 8.5e-17 - * The check catan( ctan(z) ) = z, with |x| and |y| < PI/2, - * had peak relative error 1.5e-16, rms relative error - * 2.9e-17. See also clog(). - */ - -#include "complex_impl.h" - -#define MAXNUM 1.0e308 - -static const double DP1 = 3.14159265160560607910E0; -static const double DP2 = 1.98418714791870343106E-9; -static const double DP3 = 1.14423774522196636802E-17; - -static double _redupi(double x) -{ - double t; - long i; - - t = x/M_PI; - if (t >= 0.0) - t += 0.5; - else - t -= 0.5; - - i = t; /* the multiple */ - t = i; - t = ((x - t * DP1) - t * DP2) - t * DP3; - return t; -} - -double complex catan(double complex z) -{ - double complex w; - double a, t, x, x2, y; - - x = creal(z); - y = cimag(z); - - x2 = x * x; - a = 1.0 - x2 - (y * y); - - t = 0.5 * atan2(2.0 * x, a); - w = _redupi(t); - - t = y - 1.0; - a = x2 + (t * t); - - t = y + 1.0; - a = (x2 + t * t)/a; - w = CMPLX(w, 0.25 * log(a)); - return w; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/catanf.c deleted file mode 100644 index 1d569f2da..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanf.c +++ /dev/null @@ -1,105 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/s_catanf.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Complex circular arc tangent - * - * - * SYNOPSIS: - * - * float complex catanf(); - * float complex z, w; - * - * w = catanf( z ); - * - * - * DESCRIPTION: - * - * If - * z = x + iy, - * - * then - * 1 ( 2x ) - * Re w = - arctan(-----------) + k PI - * 2 ( 2 2) - * (1 - x - y ) - * - * ( 2 2) - * 1 (x + (y+1) ) - * Im w = - log(------------) - * 4 ( 2 2) - * (x + (y-1) ) - * - * Where k is an arbitrary integer. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -10,+10 30000 2.3e-6 5.2e-8 - */ - -#include "complex_impl.h" - -#define MAXNUMF 1.0e38F - -static const double DP1 = 3.140625; -static const double DP2 = 9.67502593994140625E-4; -static const double DP3 = 1.509957990978376432E-7; - -static const float float_pi = M_PI; - -static float _redupif(float xx) -{ - float x, t; - long i; - - x = xx; - t = x/float_pi; - if (t >= 0.0f) - t += 0.5f; - else - t -= 0.5f; - - i = t; /* the multiple */ - t = i; - t = ((x - t * DP1) - t * DP2) - t * DP3; - return t; -} - -float complex catanf(float complex z) -{ - float complex w; - float a, t, x, x2, y; - - x = crealf(z); - y = cimagf(z); - - x2 = x * x; - a = 1.0f - x2 - (y * y); - - t = 0.5f * atan2f(2.0f * x, a); - w = _redupif(t); - - t = y - 1.0f; - a = x2 + (t * t); - - t = y + 1.0f; - a = (x2 + (t * t))/a; - w = CMPLXF(w, 0.25f * logf(a)); - return w; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanh.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/catanh.c deleted file mode 100644 index c324c7f2b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanh.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "complex_impl.h" - -/* atanh = -i atan(i z) */ - -double complex catanh(double complex z) -{ - z = catan(CMPLX(-cimag(z), creal(z))); - return CMPLX(cimag(z), -creal(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanhf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/catanhf.c deleted file mode 100644 index b0505f605..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanhf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -float complex catanhf(float complex z) -{ - z = catanf(CMPLXF(-cimagf(z), crealf(z))); - return CMPLXF(cimagf(z), -crealf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanhl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/catanhl.c deleted file mode 100644 index 6025c4140..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanhl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex catanhl(long double complex z) -{ - return catanh(z); -} -#else -long double complex catanhl(long double complex z) -{ - z = catanl(CMPLXL(-cimagl(z), creall(z))); - return CMPLXL(cimagl(z), -creall(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/catanl.c deleted file mode 100644 index e62526c00..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/catanl.c +++ /dev/null @@ -1,114 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/s_catanl.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Complex circular arc tangent - * - * - * SYNOPSIS: - * - * long double complex catanl(); - * long double complex z, w; - * - * w = catanl( z ); - * - * - * DESCRIPTION: - * - * If - * z = x + iy, - * - * then - * 1 ( 2x ) - * Re w = - arctan(-----------) + k PI - * 2 ( 2 2) - * (1 - x - y ) - * - * ( 2 2) - * 1 (x + (y+1) ) - * Im w = - log(------------) - * 4 ( 2 2) - * (x + (y-1) ) - * - * Where k is an arbitrary integer. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * DEC -10,+10 5900 1.3e-16 7.8e-18 - * IEEE -10,+10 30000 2.3e-15 8.5e-17 - * The check catan( ctan(z) ) = z, with |x| and |y| < PI/2, - * had peak relative error 1.5e-16, rms relative error - * 2.9e-17. See also clog(). - */ - -#include -#include -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex catanl(long double complex z) -{ - return catan(z); -} -#else -static const long double PIL = 3.141592653589793238462643383279502884197169L; -static const long double DP1 = 3.14159265358979323829596852490908531763125L; -static const long double DP2 = 1.6667485837041756656403424829301998703007e-19L; -static const long double DP3 = 1.8830410776607851167459095484560349402753e-39L; - -static long double redupil(long double x) -{ - long double t; - long i; - - t = x / PIL; - if (t >= 0.0L) - t += 0.5L; - else - t -= 0.5L; - - i = t; /* the multiple */ - t = i; - t = ((x - t * DP1) - t * DP2) - t * DP3; - return t; -} - -long double complex catanl(long double complex z) -{ - long double complex w; - long double a, t, x, x2, y; - - x = creall(z); - y = cimagl(z); - - x2 = x * x; - a = 1.0L - x2 - (y * y); - - t = atan2l(2.0L * x, a) * 0.5L; - w = redupil(t); - - t = y - 1.0L; - a = x2 + (t * t); - - t = y + 1.0L; - a = (x2 + (t * t)) / a; - w = CMPLXF(w, 0.25L * logl(a)); - return w; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccos.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ccos.c deleted file mode 100644 index f32e1fadf..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccos.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "complex_impl.h" - -/* cos(z) = cosh(i z) */ - -double complex ccos(double complex z) -{ - return ccosh(CMPLX(-cimag(z), creal(z))); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosf.c deleted file mode 100644 index 490be9b3f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -float complex ccosf(float complex z) -{ - return ccoshf(CMPLXF(-cimagf(z), crealf(z))); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosh.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosh.c deleted file mode 100644 index c995da7bb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosh.c +++ /dev/null @@ -1,140 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_ccosh.c */ -/*- - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Hyperbolic cosine of a complex argument z = x + i y. - * - * cosh(z) = cosh(x+iy) - * = cosh(x) cos(y) + i sinh(x) sin(y). - * - * Exceptional values are noted in the comments within the source code. - * These values and the return value were taken from n1124.pdf. - */ - -#include "complex_impl.h" - -static const double huge = 0x1p1023; - -double complex ccosh(double complex z) -{ - double x, y, h; - int32_t hx, hy, ix, iy, lx, ly; - - x = creal(z); - y = cimag(z); - - EXTRACT_WORDS(hx, lx, x); - EXTRACT_WORDS(hy, ly, y); - - ix = 0x7fffffff & hx; - iy = 0x7fffffff & hy; - - /* Handle the nearly-non-exceptional cases where x and y are finite. */ - if (ix < 0x7ff00000 && iy < 0x7ff00000) { - if ((iy | ly) == 0) - return CMPLX(cosh(x), x * y); - if (ix < 0x40360000) /* small x: normal case */ - return CMPLX(cosh(x) * cos(y), sinh(x) * sin(y)); - - /* |x| >= 22, so cosh(x) ~= exp(|x|) */ - if (ix < 0x40862e42) { - /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return CMPLX(h * cos(y), copysign(h, x) * sin(y)); - } else if (ix < 0x4096bbaa) { - /* x < 1455: scale to avoid overflow */ - z = __ldexp_cexp(CMPLX(fabs(x), y), -1); - return CMPLX(creal(z), cimag(z) * copysign(1, x)); - } else { - /* x >= 1455: the result always overflows */ - h = huge * x; - return CMPLX(h * h * cos(y), h * sin(y)); - } - } - - /* - * cosh(+-0 +- I Inf) = dNaN + I sign(d(+-0, dNaN))0. - * The sign of 0 in the result is unspecified. Choice = normally - * the same as dNaN. Raise the invalid floating-point exception. - * - * cosh(+-0 +- I NaN) = d(NaN) + I sign(d(+-0, NaN))0. - * The sign of 0 in the result is unspecified. Choice = normally - * the same as d(NaN). - */ - if ((ix | lx) == 0 && iy >= 0x7ff00000) - return CMPLX(y - y, copysign(0, x * (y - y))); - - /* - * cosh(+-Inf +- I 0) = +Inf + I (+-)(+-)0. - * - * cosh(NaN +- I 0) = d(NaN) + I sign(d(NaN, +-0))0. - * The sign of 0 in the result is unspecified. - */ - if ((iy | ly) == 0 && ix >= 0x7ff00000) { - if (((hx & 0xfffff) | lx) == 0) - return CMPLX(x * x, copysign(0, x) * y); - return CMPLX(x * x, copysign(0, (x + x) * y)); - } - - /* - * cosh(x +- I Inf) = dNaN + I dNaN. - * Raise the invalid floating-point exception for finite nonzero x. - * - * cosh(x + I NaN) = d(NaN) + I d(NaN). - * Optionally raises the invalid floating-point exception for finite - * nonzero x. Choice = don't raise (except for signaling NaNs). - */ - if (ix < 0x7ff00000 && iy >= 0x7ff00000) - return CMPLX(y - y, x * (y - y)); - - /* - * cosh(+-Inf + I NaN) = +Inf + I d(NaN). - * - * cosh(+-Inf +- I Inf) = +Inf + I dNaN. - * The sign of Inf in the result is unspecified. Choice = always +. - * Raise the invalid floating-point exception. - * - * cosh(+-Inf + I y) = +Inf cos(y) +- I Inf sin(y) - */ - if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) { - if (iy >= 0x7ff00000) - return CMPLX(x * x, x * (y - y)); - return CMPLX((x * x) * cos(y), x * sin(y)); - } - - /* - * cosh(NaN + I NaN) = d(NaN) + I d(NaN). - * - * cosh(NaN +- I Inf) = d(NaN) + I d(NaN). - * Optionally raises the invalid floating-point exception. - * Choice = raise. - * - * cosh(NaN + I y) = d(NaN) + I d(NaN). - * Optionally raises the invalid floating-point exception for finite - * nonzero y. Choice = don't raise (except for signaling NaNs). - */ - return CMPLX((x * x) * (y - y), (x + x) * (y - y)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshf.c deleted file mode 100644 index 189ce946d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshf.c +++ /dev/null @@ -1,90 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_ccoshf.c */ -/*- - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Hyperbolic cosine of a complex argument. See s_ccosh.c for details. - */ - -#include "complex_impl.h" - -static const float huge = 0x1p127; - -float complex ccoshf(float complex z) -{ - float x, y, h; - int32_t hx, hy, ix, iy; - - x = crealf(z); - y = cimagf(z); - - GET_FLOAT_WORD(hx, x); - GET_FLOAT_WORD(hy, y); - - ix = 0x7fffffff & hx; - iy = 0x7fffffff & hy; - - if (ix < 0x7f800000 && iy < 0x7f800000) { - if (iy == 0) - return CMPLXF(coshf(x), x * y); - if (ix < 0x41100000) /* small x: normal case */ - return CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y)); - - /* |x| >= 9, so cosh(x) ~= exp(|x|) */ - if (ix < 0x42b17218) { - /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5f; - return CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y)); - } else if (ix < 0x4340b1e7) { - /* x < 192.7: scale to avoid overflow */ - z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); - return CMPLXF(crealf(z), cimagf(z) * copysignf(1, x)); - } else { - /* x >= 192.7: the result always overflows */ - h = huge * x; - return CMPLXF(h * h * cosf(y), h * sinf(y)); - } - } - - if (ix == 0 && iy >= 0x7f800000) - return CMPLXF(y - y, copysignf(0, x * (y - y))); - - if (iy == 0 && ix >= 0x7f800000) { - if ((hx & 0x7fffff) == 0) - return CMPLXF(x * x, copysignf(0, x) * y); - return CMPLXF(x * x, copysignf(0, (x + x) * y)); - } - - if (ix < 0x7f800000 && iy >= 0x7f800000) - return CMPLXF(y - y, x * (y - y)); - - if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) { - if (iy >= 0x7f800000) - return CMPLXF(x * x, x * (y - y)); - return CMPLXF((x * x) * cosf(y), x * sinf(y)); - } - - return CMPLXF((x * x) * (y - y), (x + x) * (y - y)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshl.c deleted file mode 100644 index ffb4d8a14..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -//FIXME -long double complex ccoshl(long double complex z) -{ - return ccosh(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosl.c deleted file mode 100644 index 2530006bf..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ccosl.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex ccosl(long double complex z) -{ - return ccos(z); -} -#else -long double complex ccosl(long double complex z) -{ - return ccoshl(CMPLXL(-cimagl(z), creall(z))); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cexp.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cexp.c deleted file mode 100644 index 7fb489bb9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cexp.c +++ /dev/null @@ -1,83 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cexp.c */ -/*- - * Copyright (c) 2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "complex_impl.h" - -static const uint32_t -exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */ -cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ - -double complex cexp(double complex z) -{ - double x, y, exp_x; - uint32_t hx, hy, lx, ly; - - x = creal(z); - y = cimag(z); - - EXTRACT_WORDS(hy, ly, y); - hy &= 0x7fffffff; - - /* cexp(x + I 0) = exp(x) + I 0 */ - if ((hy | ly) == 0) - return CMPLX(exp(x), y); - EXTRACT_WORDS(hx, lx, x); - /* cexp(0 + I y) = cos(y) + I sin(y) */ - if (((hx & 0x7fffffff) | lx) == 0) - return CMPLX(cos(y), sin(y)); - - if (hy >= 0x7ff00000) { - if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) { - /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ - return CMPLX(y - y, y - y); - } else if (hx & 0x80000000) { - /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ - return CMPLX(0.0, 0.0); - } else { - /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ - return CMPLX(x, y - y); - } - } - - if (hx >= exp_ovfl && hx <= cexp_ovfl) { - /* - * x is between 709.7 and 1454.3, so we must scale to avoid - * overflow in exp(x). - */ - return __ldexp_cexp(z, 0); - } else { - /* - * Cases covered here: - * - x < exp_ovfl and exp(x) won't overflow (common case) - * - x > cexp_ovfl, so exp(x) * s overflows for all s > 0 - * - x = +-Inf (generated by exp()) - * - x = NaN (spurious inexact exception from y) - */ - exp_x = exp(x); - return CMPLX(exp_x * cos(y), exp_x * sin(y)); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cexpf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cexpf.c deleted file mode 100644 index 00d258f3f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cexpf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cexpf.c */ -/*- - * Copyright (c) 2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "complex_impl.h" - -static const uint32_t -exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */ -cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ - -float complex cexpf(float complex z) -{ - float x, y, exp_x; - uint32_t hx, hy; - - x = crealf(z); - y = cimagf(z); - - GET_FLOAT_WORD(hy, y); - hy &= 0x7fffffff; - - /* cexp(x + I 0) = exp(x) + I 0 */ - if (hy == 0) - return CMPLXF(expf(x), y); - GET_FLOAT_WORD(hx, x); - /* cexp(0 + I y) = cos(y) + I sin(y) */ - if ((hx & 0x7fffffff) == 0) - return CMPLXF(cosf(y), sinf(y)); - - if (hy >= 0x7f800000) { - if ((hx & 0x7fffffff) != 0x7f800000) { - /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ - return CMPLXF(y - y, y - y); - } else if (hx & 0x80000000) { - /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ - return CMPLXF(0.0, 0.0); - } else { - /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ - return CMPLXF(x, y - y); - } - } - - if (hx >= exp_ovfl && hx <= cexp_ovfl) { - /* - * x is between 88.7 and 192, so we must scale to avoid - * overflow in expf(x). - */ - return __ldexp_cexpf(z, 0); - } else { - /* - * Cases covered here: - * - x < exp_ovfl and exp(x) won't overflow (common case) - * - x > cexp_ovfl, so exp(x) * s overflows for all s > 0 - * - x = +-Inf (generated by exp()) - * - x = NaN (spurious inexact exception from y) - */ - exp_x = expf(x); - return CMPLXF(exp_x * cosf(y), exp_x * sinf(y)); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cexpl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cexpl.c deleted file mode 100644 index d4df950e3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cexpl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -//FIXME -long double complex cexpl(long double complex z) -{ - return cexp(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cimag.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cimag.c deleted file mode 100644 index d6b0e6838..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cimag.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -double (cimag)(double complex z) -{ - return cimag(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cimagf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cimagf.c deleted file mode 100644 index b7166dcfa..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cimagf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -float (cimagf)(float complex z) -{ - return cimagf(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cimagl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cimagl.c deleted file mode 100644 index 4db77f201..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cimagl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -long double (cimagl)(long double complex z) -{ - return cimagl(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/clog.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/clog.c deleted file mode 100644 index b587c2915..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/clog.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "complex_impl.h" - -// FIXME - -/* log(z) = log(|z|) + i arg(z) */ - -double complex clog(double complex z) -{ - double r, phi; - - r = cabs(z); - phi = carg(z); - return CMPLX(log(r), phi); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/clogf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/clogf.c deleted file mode 100644 index 0389d4723..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/clogf.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "complex_impl.h" - -// FIXME - -float complex clogf(float complex z) -{ - float r, phi; - - r = cabsf(z); - phi = cargf(z); - return CMPLXF(logf(r), phi); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/clogl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/clogl.c deleted file mode 100644 index 88e83e87c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/clogl.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex clogl(long double complex z) -{ - return clog(z); -} -#else -// FIXME -long double complex clogl(long double complex z) -{ - long double r, phi; - - r = cabsl(z); - phi = cargl(z); - return CMPLXL(logl(r), phi); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/conj.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/conj.c deleted file mode 100644 index a3b19a4aa..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/conj.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -double complex conj(double complex z) -{ - return CMPLX(creal(z), -cimag(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/conjf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/conjf.c deleted file mode 100644 index b2195c840..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/conjf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -float complex conjf(float complex z) -{ - return CMPLXF(crealf(z), -cimagf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/conjl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/conjl.c deleted file mode 100644 index 87a4ebecc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/conjl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -long double complex conjl(long double complex z) -{ - return CMPLXL(creall(z), -cimagl(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cpow.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cpow.c deleted file mode 100644 index 1137d3911..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cpow.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "complex_impl.h" - -/* pow(z, c) = exp(c log(z)), See C99 G.6.4.1 */ - -double complex cpow(double complex z, double complex c) -{ - return cexp(c * clog(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cpowf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cpowf.c deleted file mode 100644 index f3fd4b7b7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cpowf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "complex_impl.h" - -float complex cpowf(float complex z, float complex c) -{ - return cexpf(c * clogf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cpowl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cpowl.c deleted file mode 100644 index be36f0461..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cpowl.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex cpowl(long double complex z, long double complex c) -{ - return cpow(z, c); -} -#else -long double complex cpowl(long double complex z, long double complex c) -{ - return cexpl(c * clogl(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cproj.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cproj.c deleted file mode 100644 index d2b8f5a97..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cproj.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "complex_impl.h" - -double complex cproj(double complex z) -{ - if (isinf(creal(z)) || isinf(cimag(z))) - return CMPLX(INFINITY, copysign(0.0, cimag(z))); - return z; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cprojf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cprojf.c deleted file mode 100644 index 15a874bb2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cprojf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "complex_impl.h" - -float complex cprojf(float complex z) -{ - if (isinf(crealf(z)) || isinf(cimagf(z))) - return CMPLXF(INFINITY, copysignf(0.0, cimagf(z))); - return z; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/cprojl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/cprojl.c deleted file mode 100644 index 531ffa1c5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/cprojl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex cprojl(long double complex z) -{ - return cproj(z); -} -#else -long double complex cprojl(long double complex z) -{ - if (isinf(creall(z)) || isinf(cimagl(z))) - return CMPLXL(INFINITY, copysignl(0.0, cimagl(z))); - return z; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/creal.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/creal.c deleted file mode 100644 index f6703040d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/creal.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -double (creal)(double complex z) -{ - return creal(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/crealf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/crealf.c deleted file mode 100644 index 5dc3ff1d3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/crealf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -float (crealf)(float complex z) -{ - return crealf(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/creall.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/creall.c deleted file mode 100644 index fd9dc3470..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/creall.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long double (creall)(long double complex z) -{ - return creall(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csin.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csin.c deleted file mode 100644 index 535c4bf8b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csin.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "complex_impl.h" - -/* sin(z) = -i sinh(i z) */ - -double complex csin(double complex z) -{ - z = csinh(CMPLX(-cimag(z), creal(z))); - return CMPLX(cimag(z), -creal(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csinf.c deleted file mode 100644 index 69f5164eb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -float complex csinf(float complex z) -{ - z = csinhf(CMPLXF(-cimagf(z), crealf(z))); - return CMPLXF(cimagf(z), -crealf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinh.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csinh.c deleted file mode 100644 index eda0ab59f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinh.c +++ /dev/null @@ -1,141 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_csinh.c */ -/*- - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Hyperbolic sine of a complex argument z = x + i y. - * - * sinh(z) = sinh(x+iy) - * = sinh(x) cos(y) + i cosh(x) sin(y). - * - * Exceptional values are noted in the comments within the source code. - * These values and the return value were taken from n1124.pdf. - */ - -#include "complex_impl.h" - -static const double huge = 0x1p1023; - -double complex csinh(double complex z) -{ - double x, y, h; - int32_t hx, hy, ix, iy, lx, ly; - - x = creal(z); - y = cimag(z); - - EXTRACT_WORDS(hx, lx, x); - EXTRACT_WORDS(hy, ly, y); - - ix = 0x7fffffff & hx; - iy = 0x7fffffff & hy; - - /* Handle the nearly-non-exceptional cases where x and y are finite. */ - if (ix < 0x7ff00000 && iy < 0x7ff00000) { - if ((iy | ly) == 0) - return CMPLX(sinh(x), y); - if (ix < 0x40360000) /* small x: normal case */ - return CMPLX(sinh(x) * cos(y), cosh(x) * sin(y)); - - /* |x| >= 22, so cosh(x) ~= exp(|x|) */ - if (ix < 0x40862e42) { - /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return CMPLX(copysign(h, x) * cos(y), h * sin(y)); - } else if (ix < 0x4096bbaa) { - /* x < 1455: scale to avoid overflow */ - z = __ldexp_cexp(CMPLX(fabs(x), y), -1); - return CMPLX(creal(z) * copysign(1, x), cimag(z)); - } else { - /* x >= 1455: the result always overflows */ - h = huge * x; - return CMPLX(h * cos(y), h * h * sin(y)); - } - } - - /* - * sinh(+-0 +- I Inf) = sign(d(+-0, dNaN))0 + I dNaN. - * The sign of 0 in the result is unspecified. Choice = normally - * the same as dNaN. Raise the invalid floating-point exception. - * - * sinh(+-0 +- I NaN) = sign(d(+-0, NaN))0 + I d(NaN). - * The sign of 0 in the result is unspecified. Choice = normally - * the same as d(NaN). - */ - if ((ix | lx) == 0 && iy >= 0x7ff00000) - return CMPLX(copysign(0, x * (y - y)), y - y); - - /* - * sinh(+-Inf +- I 0) = +-Inf + I +-0. - * - * sinh(NaN +- I 0) = d(NaN) + I +-0. - */ - if ((iy | ly) == 0 && ix >= 0x7ff00000) { - if (((hx & 0xfffff) | lx) == 0) - return CMPLX(x, y); - return CMPLX(x, copysign(0, y)); - } - - /* - * sinh(x +- I Inf) = dNaN + I dNaN. - * Raise the invalid floating-point exception for finite nonzero x. - * - * sinh(x + I NaN) = d(NaN) + I d(NaN). - * Optionally raises the invalid floating-point exception for finite - * nonzero x. Choice = don't raise (except for signaling NaNs). - */ - if (ix < 0x7ff00000 && iy >= 0x7ff00000) - return CMPLX(y - y, x * (y - y)); - - /* - * sinh(+-Inf + I NaN) = +-Inf + I d(NaN). - * The sign of Inf in the result is unspecified. Choice = normally - * the same as d(NaN). - * - * sinh(+-Inf +- I Inf) = +Inf + I dNaN. - * The sign of Inf in the result is unspecified. Choice = always +. - * Raise the invalid floating-point exception. - * - * sinh(+-Inf + I y) = +-Inf cos(y) + I Inf sin(y) - */ - if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) { - if (iy >= 0x7ff00000) - return CMPLX(x * x, x * (y - y)); - return CMPLX(x * cos(y), INFINITY * sin(y)); - } - - /* - * sinh(NaN + I NaN) = d(NaN) + I d(NaN). - * - * sinh(NaN +- I Inf) = d(NaN) + I d(NaN). - * Optionally raises the invalid floating-point exception. - * Choice = raise. - * - * sinh(NaN + I y) = d(NaN) + I d(NaN). - * Optionally raises the invalid floating-point exception for finite - * nonzero y. Choice = don't raise (except for signaling NaNs). - */ - return CMPLX((x * x) * (y - y), (x + x) * (y - y)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinhf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csinhf.c deleted file mode 100644 index eb1d98c52..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinhf.c +++ /dev/null @@ -1,90 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_csinhf.c */ -/*- - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Hyperbolic sine of a complex argument z. See s_csinh.c for details. - */ - -#include "complex_impl.h" - -static const float huge = 0x1p127; - -float complex csinhf(float complex z) -{ - float x, y, h; - int32_t hx, hy, ix, iy; - - x = crealf(z); - y = cimagf(z); - - GET_FLOAT_WORD(hx, x); - GET_FLOAT_WORD(hy, y); - - ix = 0x7fffffff & hx; - iy = 0x7fffffff & hy; - - if (ix < 0x7f800000 && iy < 0x7f800000) { - if (iy == 0) - return CMPLXF(sinhf(x), y); - if (ix < 0x41100000) /* small x: normal case */ - return CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y)); - - /* |x| >= 9, so cosh(x) ~= exp(|x|) */ - if (ix < 0x42b17218) { - /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5f; - return CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y)); - } else if (ix < 0x4340b1e7) { - /* x < 192.7: scale to avoid overflow */ - z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); - return CMPLXF(crealf(z) * copysignf(1, x), cimagf(z)); - } else { - /* x >= 192.7: the result always overflows */ - h = huge * x; - return CMPLXF(h * cosf(y), h * h * sinf(y)); - } - } - - if (ix == 0 && iy >= 0x7f800000) - return CMPLXF(copysignf(0, x * (y - y)), y - y); - - if (iy == 0 && ix >= 0x7f800000) { - if ((hx & 0x7fffff) == 0) - return CMPLXF(x, y); - return CMPLXF(x, copysignf(0, y)); - } - - if (ix < 0x7f800000 && iy >= 0x7f800000) - return CMPLXF(y - y, x * (y - y)); - - if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) { - if (iy >= 0x7f800000) - return CMPLXF(x * x, x * (y - y)); - return CMPLXF(x * cosf(y), INFINITY * sinf(y)); - } - - return CMPLXF((x * x) * (y - y), (x + x) * (y - y)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinhl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csinhl.c deleted file mode 100644 index 09fd18f93..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinhl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -//FIXME -long double complex csinhl(long double complex z) -{ - return csinh(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csinl.c deleted file mode 100644 index 90a4eb377..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csinl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex csinl(long double complex z) -{ - return csin(z); -} -#else -long double complex csinl(long double complex z) -{ - z = csinhl(CMPLXL(-cimagl(z), creall(z))); - return CMPLXL(cimagl(z), -creall(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrt.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrt.c deleted file mode 100644 index c36de0019..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrt.c +++ /dev/null @@ -1,100 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_csqrt.c */ -/*- - * Copyright (c) 2007 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "complex_impl.h" - -/* - * gcc doesn't implement complex multiplication or division correctly, - * so we need to handle infinities specially. We turn on this pragma to - * notify conforming c99 compilers that the fast-but-incorrect code that - * gcc generates is acceptable, since the special cases have already been - * handled. - */ -#pragma STDC CX_LIMITED_RANGE ON - -/* We risk spurious overflow for components >= DBL_MAX / (1 + sqrt(2)). */ -#define THRESH 0x1.a827999fcef32p+1022 - -double complex csqrt(double complex z) -{ - double complex result; - double a, b; - double t; - int scale; - - a = creal(z); - b = cimag(z); - - /* Handle special cases. */ - if (z == 0) - return CMPLX(0, b); - if (isinf(b)) - return CMPLX(INFINITY, b); - if (isnan(a)) { - t = (b - b) / (b - b); /* raise invalid if b is not a NaN */ - return CMPLX(a, t); /* return NaN + NaN i */ - } - if (isinf(a)) { - /* - * csqrt(inf + NaN i) = inf + NaN i - * csqrt(inf + y i) = inf + 0 i - * csqrt(-inf + NaN i) = NaN +- inf i - * csqrt(-inf + y i) = 0 + inf i - */ - if (signbit(a)) - return CMPLX(fabs(b - b), copysign(a, b)); - else - return CMPLX(a, copysign(b - b, b)); - } - /* - * The remaining special case (b is NaN) is handled just fine by - * the normal code path below. - */ - - /* Scale to avoid overflow. */ - if (fabs(a) >= THRESH || fabs(b) >= THRESH) { - a *= 0.25; - b *= 0.25; - scale = 1; - } else { - scale = 0; - } - - /* Algorithm 312, CACM vol 10, Oct 1967. */ - if (a >= 0) { - t = sqrt((a + hypot(a, b)) * 0.5); - result = CMPLX(t, b / (2 * t)); - } else { - t = sqrt((-a + hypot(a, b)) * 0.5); - result = CMPLX(fabs(b) / (2 * t), copysign(t, b)); - } - - /* Rescale. */ - if (scale) - result *= 2; - return result; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtf.c deleted file mode 100644 index a6163974d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtf.c +++ /dev/null @@ -1,82 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_csqrtf.c */ -/*- - * Copyright (c) 2007 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "complex_impl.h" - -/* - * gcc doesn't implement complex multiplication or division correctly, - * so we need to handle infinities specially. We turn on this pragma to - * notify conforming c99 compilers that the fast-but-incorrect code that - * gcc generates is acceptable, since the special cases have already been - * handled. - */ -#pragma STDC CX_LIMITED_RANGE ON - -float complex csqrtf(float complex z) -{ - float a = crealf(z), b = cimagf(z); - double t; - - /* Handle special cases. */ - if (z == 0) - return CMPLXF(0, b); - if (isinf(b)) - return CMPLXF(INFINITY, b); - if (isnan(a)) { - t = (b - b) / (b - b); /* raise invalid if b is not a NaN */ - return CMPLXF(a, t); /* return NaN + NaN i */ - } - if (isinf(a)) { - /* - * csqrtf(inf + NaN i) = inf + NaN i - * csqrtf(inf + y i) = inf + 0 i - * csqrtf(-inf + NaN i) = NaN +- inf i - * csqrtf(-inf + y i) = 0 + inf i - */ - if (signbit(a)) - return CMPLXF(fabsf(b - b), copysignf(a, b)); - else - return CMPLXF(a, copysignf(b - b, b)); - } - /* - * The remaining special case (b is NaN) is handled just fine by - * the normal code path below. - */ - - /* - * We compute t in double precision to avoid overflow and to - * provide correct rounding in nearly all cases. - * This is Algorithm 312, CACM vol 10, Oct 1967. - */ - if (a >= 0) { - t = sqrt((a + hypot(a, b)) * 0.5); - return CMPLXF(t, b / (2.0 * t)); - } else { - t = sqrt((-a + hypot(a, b)) * 0.5); - return CMPLXF(fabsf(b) / (2.0 * t), copysignf(t, b)); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtl.c deleted file mode 100644 index 225393790..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -//FIXME -long double complex csqrtl(long double complex z) -{ - return csqrt(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctan.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ctan.c deleted file mode 100644 index 918717bfc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctan.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "complex_impl.h" - -/* tan(z) = -i tanh(i z) */ - -double complex ctan(double complex z) -{ - z = ctanh(CMPLX(-cimag(z), creal(z))); - return CMPLX(cimag(z), -creal(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanf.c deleted file mode 100644 index 04c3ff198..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -float complex ctanf(float complex z) -{ - z = ctanhf(CMPLXF(-cimagf(z), crealf(z))); - return CMPLXF(cimagf(z), -crealf(z)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanh.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanh.c deleted file mode 100644 index 54004cd7d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanh.c +++ /dev/null @@ -1,129 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_ctanh.c */ -/*- - * Copyright (c) 2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Hyperbolic tangent of a complex argument z = x + i y. - * - * The algorithm is from: - * - * W. Kahan. Branch Cuts for Complex Elementary Functions or Much - * Ado About Nothing's Sign Bit. In The State of the Art in - * Numerical Analysis, pp. 165 ff. Iserles and Powell, eds., 1987. - * - * Method: - * - * Let t = tan(x) - * beta = 1/cos^2(y) - * s = sinh(x) - * rho = cosh(x) - * - * We have: - * - * tanh(z) = sinh(z) / cosh(z) - * - * sinh(x) cos(y) + i cosh(x) sin(y) - * = --------------------------------- - * cosh(x) cos(y) + i sinh(x) sin(y) - * - * cosh(x) sinh(x) / cos^2(y) + i tan(y) - * = ------------------------------------- - * 1 + sinh^2(x) / cos^2(y) - * - * beta rho s + i t - * = ---------------- - * 1 + beta s^2 - * - * Modifications: - * - * I omitted the original algorithm's handling of overflow in tan(x) after - * verifying with nearpi.c that this can't happen in IEEE single or double - * precision. I also handle large x differently. - */ - -#include "complex_impl.h" - -double complex ctanh(double complex z) -{ - double x, y; - double t, beta, s, rho, denom; - uint32_t hx, ix, lx; - - x = creal(z); - y = cimag(z); - - EXTRACT_WORDS(hx, lx, x); - ix = hx & 0x7fffffff; - - /* - * ctanh(NaN + i 0) = NaN + i 0 - * - * ctanh(NaN + i y) = NaN + i NaN for y != 0 - * - * The imaginary part has the sign of x*sin(2*y), but there's no - * special effort to get this right. - * - * ctanh(+-Inf +- i Inf) = +-1 +- 0 - * - * ctanh(+-Inf + i y) = +-1 + 0 sin(2y) for y finite - * - * The imaginary part of the sign is unspecified. This special - * case is only needed to avoid a spurious invalid exception when - * y is infinite. - */ - if (ix >= 0x7ff00000) { - if ((ix & 0xfffff) | lx) /* x is NaN */ - return CMPLX(x, (y == 0 ? y : x * y)); - SET_HIGH_WORD(x, hx - 0x40000000); /* x = copysign(1, x) */ - return CMPLX(x, copysign(0, isinf(y) ? y : sin(y) * cos(y))); - } - - /* - * ctanh(+-0 + i NAN) = +-0 + i NaN - * ctanh(+-0 +- i Inf) = +-0 + i NaN - * ctanh(x + i NAN) = NaN + i NaN - * ctanh(x +- i Inf) = NaN + i NaN - */ - if (!isfinite(y)) - return CMPLX(x ? y - y : x, y - y); - - /* - * ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the - * approximation sinh^2(huge) ~= exp(2*huge) / 4. - * We use a modified formula to avoid spurious overflow. - */ - if (ix >= 0x40360000) { /* x >= 22 */ - double exp_mx = exp(-fabs(x)); - return CMPLX(copysign(1, x), 4 * sin(y) * cos(y) * exp_mx * exp_mx); - } - - /* Kahan's algorithm */ - t = tan(y); - beta = 1.0 + t * t; /* = 1 / cos^2(y) */ - s = sinh(x); - rho = sqrt(1 + s * s); /* = cosh(x) */ - denom = 1 + beta * s * s; - return CMPLX((beta * rho * s) / denom, t / denom); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhf.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhf.c deleted file mode 100644 index 7f422ba7f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhf.c +++ /dev/null @@ -1,66 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_ctanhf.c */ -/*- - * Copyright (c) 2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Hyperbolic tangent of a complex argument z. See s_ctanh.c for details. - */ - -#include "complex_impl.h" - -float complex ctanhf(float complex z) -{ - float x, y; - float t, beta, s, rho, denom; - uint32_t hx, ix; - - x = crealf(z); - y = cimagf(z); - - GET_FLOAT_WORD(hx, x); - ix = hx & 0x7fffffff; - - if (ix >= 0x7f800000) { - if (ix & 0x7fffff) - return CMPLXF(x, (y == 0 ? y : x * y)); - SET_FLOAT_WORD(x, hx - 0x40000000); - return CMPLXF(x, copysignf(0, isinf(y) ? y : sinf(y) * cosf(y))); - } - - if (!isfinite(y)) - return CMPLXF(ix ? y - y : x, y - y); - - if (ix >= 0x41300000) { /* x >= 11 */ - float exp_mx = expf(-fabsf(x)); - return CMPLXF(copysignf(1, x), 4 * sinf(y) * cosf(y) * exp_mx * exp_mx); - } - - t = tanf(y); - beta = 1.0 + t * t; - s = sinhf(x); - rho = sqrtf(1 + s * s); - denom = 1 + beta * s * s; - return CMPLXF((beta * rho * s) / denom, t / denom); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhl.c deleted file mode 100644 index 45d5862c8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "complex_impl.h" - -//FIXME -long double complex ctanhl(long double complex z) -{ - return ctanh(z); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanl.c b/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanl.c deleted file mode 100644 index 4b87420d8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/complex/ctanl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "complex_impl.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double complex ctanl(long double complex z) -{ - return ctan(z); -} -#else -long double complex ctanl(long double complex z) -{ - z = ctanhl(CMPLXL(-cimagl(z), creall(z))); - return CMPLXL(cimagl(z), -creall(z)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isalnum.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isalnum.c deleted file mode 100644 index 8018a2bc7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isalnum.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int isalnum(int c) -{ - return isalpha(c) || isdigit(c); -} - -int __isalnum_l(int c, locale_t l) -{ - return isalnum(c); -} - -weak_alias(__isalnum_l, isalnum_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isalpha.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isalpha.c deleted file mode 100644 index a87a93759..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isalpha.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef isalpha - -int isalpha(int c) -{ - return ((unsigned)c|32)-'a' < 26; -} - -int __isalpha_l(int c, locale_t l) -{ - return isalpha(c); -} - -weak_alias(__isalpha_l, isalpha_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isdigit.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isdigit.c deleted file mode 100644 index 16beddb4c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isdigit.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef isdigit - -int isdigit(int c) -{ - return (unsigned)c-'0' < 10; -} - -int __isdigit_l(int c, locale_t l) -{ - return isdigit(c); -} - -weak_alias(__isdigit_l, isdigit_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isgraph.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isgraph.c deleted file mode 100644 index 292d1983e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isgraph.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef isgraph - -int isgraph(int c) -{ - return (unsigned)c-0x21 < 0x5e; -} - -int __isgraph_l(int c, locale_t l) -{ - return isgraph(c); -} - -weak_alias(__isgraph_l, isgraph_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/islower.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/islower.c deleted file mode 100644 index c3fa74c4c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/islower.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef islower - -int islower(int c) -{ - return (unsigned)c-'a' < 26; -} - -int __islower_l(int c, locale_t l) -{ - return islower(c); -} - -weak_alias(__islower_l, islower_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isprint.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isprint.c deleted file mode 100644 index b950816bc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isprint.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef isprint - -int isprint(int c) -{ - return (unsigned)c-0x20 < 0x5f; -} - -int __isprint_l(int c, locale_t l) -{ - return isprint(c); -} - -weak_alias(__isprint_l, isprint_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isspace.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isspace.c deleted file mode 100644 index 428813e79..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isspace.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef isspace - -int isspace(int c) -{ - return c == ' ' || (unsigned)c-'\t' < 5; -} - -int __isspace_l(int c, locale_t l) -{ - return isspace(c); -} - -weak_alias(__isspace_l, isspace_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isupper.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isupper.c deleted file mode 100644 index bfd15acdb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isupper.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#undef isupper - -int isupper(int c) -{ - return (unsigned)c-'A' < 26; -} - -int __isupper_l(int c, locale_t l) -{ - return isupper(c); -} - -weak_alias(__isupper_l, isupper_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isxdigit.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/isxdigit.c deleted file mode 100644 index aab1a745b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/isxdigit.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int isxdigit(int c) -{ - return isdigit(c) || ((unsigned)c|32)-'a' < 6; -} - -int __isxdigit_l(int c, locale_t l) -{ - return isxdigit(c); -} - -weak_alias(__isxdigit_l, isxdigit_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/tolower.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/tolower.c deleted file mode 100644 index f10132ec2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/tolower.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int tolower(int c) -{ - if (isupper(c)) return c | 32; - return c; -} - -int __tolower_l(int c, locale_t l) -{ - return tolower(c); -} - -weak_alias(__tolower_l, tolower_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/ctype/toupper.c b/src/hyperlight_guest_bin/third_party/musl/src/ctype/toupper.c deleted file mode 100644 index 4e74a55c6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/ctype/toupper.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int toupper(int c) -{ - if (islower(c)) return c & 0x5f; - return c; -} - -int __toupper_l(int c, locale_t l) -{ - return toupper(c); -} - -weak_alias(__toupper_l, toupper_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/errno/__errno_location.c b/src/hyperlight_guest_bin/third_party/musl/src/errno/__errno_location.c deleted file mode 100644 index 229f2a71e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/errno/__errno_location.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int errno_val; - -int *__errno_location(void) -{ - return &errno_val; -} - -weak_alias(__errno_location, ___errno_location); \ No newline at end of file diff --git a/src/hyperlight_guest_bin/third_party/musl/src/exit/assert.c b/src/hyperlight_guest_bin/third_party/musl/src/exit/assert.c deleted file mode 100644 index 8b3c28df4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/exit/assert.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include -#include "printf.h" - -_Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func) -{ - printf("Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line); - abort(); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/__flt_rounds.c b/src/hyperlight_guest_bin/third_party/musl/src/fenv/__flt_rounds.c deleted file mode 100644 index ec0b3689e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/__flt_rounds.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -int __flt_rounds() -{ - switch (fegetround()) { -#ifdef FE_TOWARDZERO - case FE_TOWARDZERO: return 0; -#endif - case FE_TONEAREST: return 1; -#ifdef FE_UPWARD - case FE_UPWARD: return 2; -#endif -#ifdef FE_DOWNWARD - case FE_DOWNWARD: return 3; -#endif - } - return -1; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/fegetexceptflag.c b/src/hyperlight_guest_bin/third_party/musl/src/fenv/fegetexceptflag.c deleted file mode 100644 index bab0b44fb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/fegetexceptflag.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int fegetexceptflag(fexcept_t *fp, int mask) -{ - *fp = fetestexcept(mask); - return 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/feholdexcept.c b/src/hyperlight_guest_bin/third_party/musl/src/fenv/feholdexcept.c deleted file mode 100644 index 73ff1fad3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/feholdexcept.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int feholdexcept(fenv_t *envp) -{ - fegetenv(envp); - feclearexcept(FE_ALL_EXCEPT); - return 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetexceptflag.c b/src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetexceptflag.c deleted file mode 100644 index af5f102d2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetexceptflag.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int fesetexceptflag(const fexcept_t *fp, int mask) -{ - feclearexcept(~*fp & mask); - feraiseexcept(*fp & mask); - return 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetround.c b/src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetround.c deleted file mode 100644 index 4e2f164dd..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetround.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -/* __fesetround wrapper for arch independent argument check */ - -hidden int __fesetround(int); - -int fesetround(int r) -{ - if (r != FE_TONEAREST -#ifdef FE_DOWNWARD - && r != FE_DOWNWARD -#endif -#ifdef FE_UPWARD - && r != FE_UPWARD -#endif -#ifdef FE_TOWARDZERO - && r != FE_TOWARDZERO -#endif - ) - return -1; - return __fesetround(r); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/feupdateenv.c b/src/hyperlight_guest_bin/third_party/musl/src/fenv/feupdateenv.c deleted file mode 100644 index 50cef8e5c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/feupdateenv.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int feupdateenv(const fenv_t *envp) -{ - int ex = fetestexcept(FE_ALL_EXCEPT); - fesetenv(envp); - feraiseexcept(ex); - return 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/fenv/x86_64/fenv.s b/src/hyperlight_guest_bin/third_party/musl/src/fenv/x86_64/fenv.s deleted file mode 100644 index 12bbe260e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/fenv/x86_64/fenv.s +++ /dev/null @@ -1,90 +0,0 @@ -.global feclearexcept -feclearexcept: - # maintain exceptions in the sse mxcsr, clear x87 exceptions - mov %edi,%ecx - and $0x3f,%ecx - fnstsw %ax - test %eax,%ecx - jz 1f - fnclex -1: stmxcsr -8(%rsp) - and $0x3f,%eax - or %eax,-8(%rsp) - test %ecx,-8(%rsp) - jz 1f - not %ecx - and %ecx,-8(%rsp) - ldmxcsr -8(%rsp) -1: xor %eax,%eax - ret - -.global feraiseexcept -feraiseexcept: - and $0x3f,%edi - stmxcsr -8(%rsp) - or %edi,-8(%rsp) - ldmxcsr -8(%rsp) - xor %eax,%eax - ret - -.global __fesetround -__fesetround: - push %rax - xor %eax,%eax - mov %edi,%ecx - fnstcw (%rsp) - andb $0xf3,1(%rsp) - or %ch,1(%rsp) - fldcw (%rsp) - stmxcsr (%rsp) - shl $3,%ch - andb $0x9f,1(%rsp) - or %ch,1(%rsp) - ldmxcsr (%rsp) - pop %rcx - ret - -.global fegetround -fegetround: - push %rax - stmxcsr (%rsp) - pop %rax - shr $3,%eax - and $0xc00,%eax - ret - -.global fegetenv -fegetenv: - xor %eax,%eax - fnstenv (%rdi) - stmxcsr 28(%rdi) - ret - -.global fesetenv -fesetenv: - xor %eax,%eax - inc %rdi - jz 1f - fldenv -1(%rdi) - ldmxcsr 27(%rdi) - ret -1: push %rax - push %rax - pushq $0xffff - pushq $0x37f - fldenv (%rsp) - pushq $0x1f80 - ldmxcsr (%rsp) - add $40,%rsp - ret - -.global fetestexcept -fetestexcept: - and $0x3f,%edi - push %rax - stmxcsr (%rsp) - pop %rsi - fnstsw %ax - or %esi,%eax - and %edi,%eax - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/include/errno.h b/src/hyperlight_guest_bin/third_party/musl/src/include/errno.h deleted file mode 100644 index 8ec493777..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/include/errno.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ERRNO_H -#define ERRNO_H - -#include "../../include/errno.h" - -#ifdef __GNUC__ -__attribute__((const)) -#endif -hidden int *___errno_location(void); - -#undef errno -#define errno (*___errno_location()) - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/include/features.h b/src/hyperlight_guest_bin/third_party/musl/src/include/features.h deleted file mode 100644 index f17bd1516..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/include/features.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef FEATURES_H -#define FEATURES_H - -#include "../../include/features.h" - -#define weak __attribute__((__weak__)) -#define hidden __attribute__((__visibility__("hidden"))) -#define weak_alias(old, new) \ - extern __typeof(old) new __attribute__((__weak__, __alias__(#old))) - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/include/stdlib.h b/src/hyperlight_guest_bin/third_party/musl/src/include/stdlib.h deleted file mode 100644 index 812b04de2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/include/stdlib.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef STDLIB_H -#define STDLIB_H - -#include "../../include/stdlib.h" - -hidden int __putenv(char *, size_t, char *); -hidden void __env_rm_add(char *, char *); -hidden int __mkostemps(char *, int, int); -hidden int __ptsname_r(int, char *, size_t); -hidden char *__randname(char *); -hidden void __qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); - -hidden void *__libc_malloc(size_t); -hidden void *__libc_malloc_impl(size_t); -hidden void *__libc_calloc(size_t, size_t); -hidden void *__libc_realloc(void *, size_t); -hidden void __libc_free(void *); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/include/string.h b/src/hyperlight_guest_bin/third_party/musl/src/include/string.h deleted file mode 100644 index 2133b5c1e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/include/string.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef STRING_H -#define STRING_H - -#include "../../include/string.h" - -hidden void *__memrchr(const void *, int, size_t); -hidden char *__stpcpy(char *, const char *); -hidden char *__stpncpy(char *, const char *, size_t); -hidden char *__strchrnul(const char *, int); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/include/sys/time.h b/src/hyperlight_guest_bin/third_party/musl/src/include/sys/time.h deleted file mode 100644 index fb9622e51..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/include/sys/time.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SYS_TIME_H -#define SYS_TIME_H - -#include "../../../include/sys/time.h" - -hidden int __futimesat(int, const char *, const struct timeval [2]); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/include/time.h b/src/hyperlight_guest_bin/third_party/musl/src/include/time.h deleted file mode 100644 index cbabde476..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/include/time.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef TIME_H -#define TIME_H - -#include "../../include/time.h" - -hidden int __clock_gettime(clockid_t, struct timespec *); -hidden int __clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); - -hidden char *__asctime_r(const struct tm *, char *); -hidden struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict); -hidden struct tm *__localtime_r(const time_t *restrict, struct tm *restrict); - -hidden size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/atomic.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/atomic.h deleted file mode 100644 index 96c1552d6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/atomic.h +++ /dev/null @@ -1,333 +0,0 @@ -#ifndef _ATOMIC_H -#define _ATOMIC_H - -#include - -#include "atomic_arch.h" - -#ifdef a_ll - -#ifndef a_pre_llsc -#define a_pre_llsc() -#endif - -#ifndef a_post_llsc -#define a_post_llsc() -#endif - -#ifndef a_cas -#define a_cas a_cas -static inline int a_cas(volatile int *p, int t, int s) -{ - int old; - a_pre_llsc(); - do old = a_ll(p); - while (old==t && !a_sc(p, s)); - a_post_llsc(); - return old; -} -#endif - -#ifndef a_swap -#define a_swap a_swap -static inline int a_swap(volatile int *p, int v) -{ - int old; - a_pre_llsc(); - do old = a_ll(p); - while (!a_sc(p, v)); - a_post_llsc(); - return old; -} -#endif - -#ifndef a_fetch_add -#define a_fetch_add a_fetch_add -static inline int a_fetch_add(volatile int *p, int v) -{ - int old; - a_pre_llsc(); - do old = a_ll(p); - while (!a_sc(p, (unsigned)old + v)); - a_post_llsc(); - return old; -} -#endif - -#ifndef a_fetch_and -#define a_fetch_and a_fetch_and -static inline int a_fetch_and(volatile int *p, int v) -{ - int old; - a_pre_llsc(); - do old = a_ll(p); - while (!a_sc(p, old & v)); - a_post_llsc(); - return old; -} -#endif - -#ifndef a_fetch_or -#define a_fetch_or a_fetch_or -static inline int a_fetch_or(volatile int *p, int v) -{ - int old; - a_pre_llsc(); - do old = a_ll(p); - while (!a_sc(p, old | v)); - a_post_llsc(); - return old; -} -#endif - -#endif - -#ifdef a_ll_p - -#ifndef a_cas_p -#define a_cas_p a_cas_p -static inline void *a_cas_p(volatile void *p, void *t, void *s) -{ - void *old; - a_pre_llsc(); - do old = a_ll_p(p); - while (old==t && !a_sc_p(p, s)); - a_post_llsc(); - return old; -} -#endif - -#endif - -#ifndef a_cas -#error missing definition of a_cas -#endif - -#ifndef a_swap -#define a_swap a_swap -static inline int a_swap(volatile int *p, int v) -{ - int old; - do old = *p; - while (a_cas(p, old, v) != old); - return old; -} -#endif - -#ifndef a_fetch_add -#define a_fetch_add a_fetch_add -static inline int a_fetch_add(volatile int *p, int v) -{ - int old; - do old = *p; - while (a_cas(p, old, (unsigned)old+v) != old); - return old; -} -#endif - -#ifndef a_fetch_and -#define a_fetch_and a_fetch_and -static inline int a_fetch_and(volatile int *p, int v) -{ - int old; - do old = *p; - while (a_cas(p, old, old&v) != old); - return old; -} -#endif -#ifndef a_fetch_or -#define a_fetch_or a_fetch_or -static inline int a_fetch_or(volatile int *p, int v) -{ - int old; - do old = *p; - while (a_cas(p, old, old|v) != old); - return old; -} -#endif - -#ifndef a_and -#define a_and a_and -static inline void a_and(volatile int *p, int v) -{ - a_fetch_and(p, v); -} -#endif - -#ifndef a_or -#define a_or a_or -static inline void a_or(volatile int *p, int v) -{ - a_fetch_or(p, v); -} -#endif - -#ifndef a_inc -#define a_inc a_inc -static inline void a_inc(volatile int *p) -{ - a_fetch_add(p, 1); -} -#endif - -#ifndef a_dec -#define a_dec a_dec -static inline void a_dec(volatile int *p) -{ - a_fetch_add(p, -1); -} -#endif - -#ifndef a_store -#define a_store a_store -static inline void a_store(volatile int *p, int v) -{ -#ifdef a_barrier - a_barrier(); - *p = v; - a_barrier(); -#else - a_swap(p, v); -#endif -} -#endif - -#ifndef a_barrier -#define a_barrier a_barrier -static void a_barrier() -{ - volatile int tmp = 0; - a_cas(&tmp, 0, 0); -} -#endif - -#ifndef a_spin -#define a_spin a_barrier -#endif - -#ifndef a_and_64 -#define a_and_64 a_and_64 -static inline void a_and_64(volatile uint64_t *p, uint64_t v) -{ - union { uint64_t v; uint32_t r[2]; } u = { v }; - if (u.r[0]+1) a_and((int *)p, u.r[0]); - if (u.r[1]+1) a_and((int *)p+1, u.r[1]); -} -#endif - -#ifndef a_or_64 -#define a_or_64 a_or_64 -static inline void a_or_64(volatile uint64_t *p, uint64_t v) -{ - union { uint64_t v; uint32_t r[2]; } u = { v }; - if (u.r[0]) a_or((int *)p, u.r[0]); - if (u.r[1]) a_or((int *)p+1, u.r[1]); -} -#endif - -#ifndef a_cas_p -typedef char a_cas_p_undefined_but_pointer_not_32bit[-sizeof(char) == 0xffffffff ? 1 : -1]; -#define a_cas_p a_cas_p -static inline void *a_cas_p(volatile void *p, void *t, void *s) -{ - return (void *)a_cas((volatile int *)p, (int)t, (int)s); -} -#endif - -#ifndef a_or_l -#define a_or_l a_or_l -static inline void a_or_l(volatile void *p, long v) -{ - if (sizeof(long) == sizeof(int)) a_or(p, v); - else a_or_64(p, v); -} -#endif - -#ifndef a_crash -#define a_crash a_crash -static inline void a_crash() -{ - *(volatile char *)0=0; -} -#endif - -#ifndef a_ctz_32 -#define a_ctz_32 a_ctz_32 -static inline int a_ctz_32(uint32_t x) -{ -#ifdef a_clz_32 - return 31-a_clz_32(x&-x); -#else - static const char debruijn32[32] = { - 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, - 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14 - }; - return debruijn32[(x&-x)*0x076be629 >> 27]; -#endif -} -#endif - -#ifndef a_ctz_64 -#define a_ctz_64 a_ctz_64 -static inline int a_ctz_64(uint64_t x) -{ - static const char debruijn64[64] = { - 0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28, - 62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11, - 63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10, - 51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12 - }; - if (sizeof(long) < 8) { - uint32_t y = x; - if (!y) { - y = x>>32; - return 32 + a_ctz_32(y); - } - return a_ctz_32(y); - } - return debruijn64[(x&-x)*0x022fdd63cc95386dull >> 58]; -} -#endif - -static inline int a_ctz_l(unsigned long x) -{ - return (sizeof(long) < 8) ? a_ctz_32(x) : a_ctz_64(x); -} - -#ifndef a_clz_64 -#define a_clz_64 a_clz_64 -static inline int a_clz_64(uint64_t x) -{ -#ifdef a_clz_32 - if (x>>32) - return a_clz_32(x>>32); - return a_clz_32(x) + 32; -#else - uint32_t y; - int r; - if (x>>32) y=x>>32, r=0; else y=x, r=32; - if (y>>16) y>>=16; else r |= 16; - if (y>>8) y>>=8; else r |= 8; - if (y>>4) y>>=4; else r |= 4; - if (y>>2) y>>=2; else r |= 2; - return r | !(y>>1); -#endif -} -#endif - -#ifndef a_clz_32 -#define a_clz_32 a_clz_32 -static inline int a_clz_32(uint32_t x) -{ - x >>= 1; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - x |= x >> 8; - x |= x >> 16; - x++; - return 31-a_ctz_32(x); -} -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/complex_impl.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/complex_impl.h deleted file mode 100644 index 51fb298ac..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/complex_impl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _COMPLEX_IMPL_H -#define _COMPLEX_IMPL_H - -#include -#include "libm.h" - -#undef __CMPLX -#undef CMPLX -#undef CMPLXF -#undef CMPLXL - -#define __CMPLX(x, y, t) \ - ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z) - -#define CMPLX(x, y) __CMPLX(x, y, double) -#define CMPLXF(x, y) __CMPLX(x, y, float) -#define CMPLXL(x, y) __CMPLX(x, y, long double) - -hidden double complex __ldexp_cexp(double complex,int); -hidden float complex __ldexp_cexpf(float complex,int); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.c b/src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.c deleted file mode 100644 index 8c0828fcb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.c +++ /dev/null @@ -1,507 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "shgetc.h" -#include "floatscan.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 - -#define LD_B1B_DIG 2 -#define LD_B1B_MAX 9007199, 254740991 -#define KMAX 128 - -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 - -#define LD_B1B_DIG 3 -#define LD_B1B_MAX 18, 446744073, 709551615 -#define KMAX 2048 - -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 - -#define LD_B1B_DIG 4 -#define LD_B1B_MAX 10384593, 717069655, 257060992, 658440191 -#define KMAX 2048 - -#else -#error Unsupported long double representation -#endif - -#define MASK (KMAX-1) - -static long long scanexp(FILE *f, int pok) -{ - int c; - int x; - long long y; - int neg = 0; - - c = shgetc(f); - if (c=='+' || c=='-') { - neg = (c=='-'); - c = shgetc(f); - if (c-'0'>=10U && pok) shunget(f); - } - if (c-'0'>=10U) { - shunget(f); - return LLONG_MIN; - } - for (x=0; c-'0'<10U && x=0) { - shunget(f); - } - if (!gotdig) { - errno = EINVAL; - shlim(f, 0); - return 0; - } - - /* Handle zero specially to avoid nasty special cases later */ - if (!x[0]) return sign * 0.0; - - /* Optimize small integers (w/no exponent) and over/under-flow */ - if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0)) - return sign * (long double)x[0]; - if (lrp > -emin/2) { - errno = ERANGE; - return sign * LDBL_MAX * LDBL_MAX; - } - if (lrp < emin-2*LDBL_MANT_DIG) { - errno = ERANGE; - return sign * LDBL_MIN * LDBL_MIN; - } - - /* Align incomplete final B1B digit */ - if (j) { - for (; j<9; j++) x[k]*=10; - k++; - j=0; - } - - a = 0; - z = k; - e2 = 0; - rp = lrp; - - /* Optimize small to mid-size integers (even in exp. notation) */ - if (lnz<9 && lnz<=rp && rp < 18) { - if (rp == 9) return sign * (long double)x[0]; - if (rp < 9) return sign * (long double)x[0] / p10s[8-rp]; - int bitlim = bits-3*(int)(rp-9); - if (bitlim>30 || x[0]>>bitlim==0) - return sign * (long double)x[0] * p10s[rp-10]; - } - - /* Drop trailing zeros */ - for (; !x[z-1]; z--); - - /* Align radix point to B1B digit boundary */ - if (rp % 9) { - int rpm9 = rp>=0 ? rp%9 : rp%9+9; - int p10 = p10s[8-rpm9]; - uint32_t carry = 0; - for (k=a; k!=z; k++) { - uint32_t tmp = x[k] % p10; - x[k] = x[k]/p10 + carry; - carry = 1000000000/p10 * tmp; - if (k==a && !x[k]) { - a = (a+1 & MASK); - rp -= 9; - } - } - if (carry) x[z++] = carry; - rp += 9-rpm9; - } - - /* Upscale until desired number of bits are left of radix point */ - while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a] 1000000000) { - carry = tmp / 1000000000; - x[k] = tmp % 1000000000; - } else { - carry = 0; - x[k] = tmp; - } - if (k==(z-1 & MASK) && k!=a && !x[k]) z = k; - if (k==a) break; - } - if (carry) { - rp += 9; - a = (a-1 & MASK); - if (a == z) { - z = (z-1 & MASK); - x[z-1 & MASK] |= x[z]; - } - x[a] = carry; - } - } - - /* Downscale until exactly number of bits are left of radix point */ - for (;;) { - uint32_t carry = 0; - int sh = 1; - for (i=0; i th[i]) break; - } - if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break; - /* FIXME: find a way to compute optimal sh */ - if (rp > 9+9*LD_B1B_DIG) sh = 9; - e2 += sh; - for (k=a; k!=z; k=(k+1 & MASK)) { - uint32_t tmp = x[k] & (1<>sh) + carry; - carry = (1000000000>>sh) * tmp; - if (k==a && !x[k]) { - a = (a+1 & MASK); - i--; - rp -= 9; - } - } - if (carry) { - if ((z+1 & MASK) != a) { - x[z] = carry; - z = (z+1 & MASK); - } else x[z-1 & MASK] |= 1; - } - } - - /* Assemble desired bits into floating point variable */ - for (y=i=0; i LDBL_MANT_DIG+e2-emin) { - bits = LDBL_MANT_DIG+e2-emin; - if (bits<0) bits=0; - denormal = 1; - } - - /* Calculate bias term to force rounding, move out lower bits */ - if (bits < LDBL_MANT_DIG) { - bias = copysignl(scalbn(1, 2*LDBL_MANT_DIG-bits-1), y); - frac = fmodl(y, scalbn(1, LDBL_MANT_DIG-bits)); - y -= frac; - y += bias; - } - - /* Process tail of decimal input so it can affect rounding */ - if ((a+i & MASK) != z) { - uint32_t t = x[a+i & MASK]; - if (t < 500000000 && (t || (a+i+1 & MASK) != z)) - frac += 0.25*sign; - else if (t > 500000000) - frac += 0.75*sign; - else if (t == 500000000) { - if ((a+i+1 & MASK) == z) - frac += 0.5*sign; - else - frac += 0.75*sign; - } - if (LDBL_MANT_DIG-bits >= 2 && !fmodl(frac, 1)) - frac++; - } - - y += frac; - y -= bias; - - if ((e2+LDBL_MANT_DIG & INT_MAX) > emax-5) { - if (fabsl(y) >= 2/LDBL_EPSILON) { - if (denormal && bits==LDBL_MANT_DIG+e2-emin) - denormal = 0; - y *= 0.5; - e2++; - } - if (e2+LDBL_MANT_DIG>emax || (denormal && frac)) - errno = ERANGE; - } - - return scalbnl(y, e2); -} - -static long double hexfloat(FILE *f, int bits, int emin, int sign, int pok) -{ - uint32_t x = 0; - long double y = 0; - long double scale = 1; - long double bias = 0; - int gottail = 0, gotrad = 0, gotdig = 0; - long long rp = 0; - long long dc = 0; - long long e2 = 0; - int d; - int c; - - c = shgetc(f); - - /* Skip leading zeros */ - for (; c=='0'; c = shgetc(f)) gotdig = 1; - - if (c=='.') { - gotrad = 1; - c = shgetc(f); - /* Count zeros after the radix point before significand */ - for (rp=0; c=='0'; c = shgetc(f), rp--) gotdig = 1; - } - - for (; c-'0'<10U || (c|32)-'a'<6U || c=='.'; c = shgetc(f)) { - if (c=='.') { - if (gotrad) break; - rp = dc; - gotrad = 1; - } else { - gotdig = 1; - if (c > '9') d = (c|32)+10-'a'; - else d = c-'0'; - if (dc<8) { - x = x*16 + d; - } else if (dc < LDBL_MANT_DIG/4+1) { - y += d*(scale/=16); - } else if (d && !gottail) { - y += 0.5*scale; - gottail = 1; - } - dc++; - } - } - if (!gotdig) { - shunget(f); - if (pok) { - shunget(f); - if (gotrad) shunget(f); - } else { - shlim(f, 0); - } - return sign * 0.0; - } - if (!gotrad) rp = dc; - while (dc<8) x *= 16, dc++; - if ((c|32)=='p') { - e2 = scanexp(f, pok); - if (e2 == LLONG_MIN) { - if (pok) { - shunget(f); - } else { - shlim(f, 0); - return 0; - } - e2 = 0; - } - } else { - shunget(f); - } - e2 += 4*rp - 32; - - if (!x) return sign * 0.0; - if (e2 > -emin) { - errno = ERANGE; - return sign * LDBL_MAX * LDBL_MAX; - } - if (e2 < emin-2*LDBL_MANT_DIG) { - errno = ERANGE; - return sign * LDBL_MIN * LDBL_MIN; - } - - while (x < 0x80000000) { - if (y>=0.5) { - x += x + 1; - y += y - 1; - } else { - x += x; - y += y; - } - e2--; - } - - if (bits > 32+e2-emin) { - bits = 32+e2-emin; - if (bits<0) bits=0; - } - - if (bits < LDBL_MANT_DIG) - bias = copysignl(scalbn(1, 32+LDBL_MANT_DIG-bits-1), sign); - - if (bits<32 && y && !(x&1)) x++, y=0; - - y = bias + sign*(long double)x + sign*y; - y -= bias; - - if (!y) errno = ERANGE; - - return scalbnl(y, e2); -} - -long double __floatscan(FILE *f, int prec, int pok) -{ - int sign = 1; - size_t i; - int bits; - int emin; - int c; - - switch (prec) { - case 0: - bits = FLT_MANT_DIG; - emin = FLT_MIN_EXP-bits; - break; - case 1: - bits = DBL_MANT_DIG; - emin = DBL_MIN_EXP-bits; - break; - case 2: - bits = LDBL_MANT_DIG; - emin = LDBL_MIN_EXP-bits; - break; - default: - return 0; - } - - while (isspace((c=shgetc(f)))); - - if (c=='+' || c=='-') { - sign -= 2*(c=='-'); - c = shgetc(f); - } - - for (i=0; i<8 && (c|32)=="infinity"[i]; i++) - if (i<7) c = shgetc(f); - if (i==3 || i==8 || (i>3 && pok)) { - if (i!=8) { - shunget(f); - if (pok) for (; i>3; i--) shunget(f); - } - return sign * INFINITY; - } - if (!i) for (i=0; i<3 && (c|32)=="nan"[i]; i++) - if (i<2) c = shgetc(f); - if (i==3) { - if (shgetc(f) != '(') { - shunget(f); - return NAN; - } - for (i=1; ; i++) { - c = shgetc(f); - if (c-'0'<10U || c-'A'<26U || c-'a'<26U || c=='_') - continue; - if (c==')') return NAN; - shunget(f); - if (!pok) { - errno = EINVAL; - shlim(f, 0); - return 0; - } - while (i--) shunget(f); - return NAN; - } - return NAN; - } - - if (i) { - shunget(f); - errno = EINVAL; - shlim(f, 0); - return 0; - } - - if (c=='0') { - c = shgetc(f); - if ((c|32) == 'x') - return hexfloat(f, bits, emin, sign, pok); - shunget(f); - c = '0'; - } - - return decfloat(f, c, bits, emin, sign, pok); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.h deleted file mode 100644 index f2b1dcf45..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FLOATSCAN_H -#define FLOATSCAN_H - -#include - -hidden long double __floatscan(FILE *, int, int); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.c b/src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.c deleted file mode 100644 index a4a5ae861..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.c +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include -#include "shgetc.h" - -/* Lookup table for digit values. -1==255>=36 -> invalid */ -static const unsigned char table[] = { -1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, --1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, -25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1, --1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, -25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -}; - -unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long lim) -{ - const unsigned char *val = table+1; - int c, neg=0; - unsigned x; - unsigned long long y; - if (base > 36 || base == 1) { - errno = EINVAL; - return 0; - } - while (isspace((c=shgetc(f)))); - if (c=='+' || c=='-') { - neg = -(c=='-'); - c = shgetc(f); - } - if ((base == 0 || base == 16) && c=='0') { - c = shgetc(f); - if ((c|32)=='x') { - c = shgetc(f); - if (val[c]>=16) { - shunget(f); - if (pok) shunget(f); - else shlim(f, 0); - return 0; - } - base = 16; - } else if (base == 0) { - base = 8; - } - } else { - if (base == 0) base = 10; - if (val[c] >= base) { - shunget(f); - shlim(f, 0); - errno = EINVAL; - return 0; - } - } - if (base == 10) { - for (x=0; c-'0'<10U && x<=UINT_MAX/10-1; c=shgetc(f)) - x = x*10 + (c-'0'); - for (y=x; c-'0'<10U && y<=ULLONG_MAX/10 && 10*y<=ULLONG_MAX-(c-'0'); c=shgetc(f)) - y = y*10 + (c-'0'); - if (c-'0'>=10U) goto done; - } else if (!(base & base-1)) { - int bs = "\0\1\2\4\7\3\6\5"[(0x17*base)>>5&7]; - for (x=0; val[c]>bs; c=shgetc(f)) - y = y<=lim) { - if (!(lim&1) && !neg) { - errno = ERANGE; - return lim-1; - } else if (y>lim) { - errno = ERANGE; - return lim; - } - } - return (y^neg)-neg; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.h deleted file mode 100644 index ccf9f112a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef INTSCAN_H -#define INTSCAN_H - -#include - -hidden unsigned long long __intscan(FILE *, unsigned, int, unsigned long long); - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/libm.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/libm.h deleted file mode 100644 index 72ad17d8e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/libm.h +++ /dev/null @@ -1,274 +0,0 @@ -#ifndef _LIBM_H -#define _LIBM_H - -#include -#include -#include -#include -#include "fp_arch.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN -union ldshape { - long double f; - struct { - uint64_t m; - uint16_t se; - } i; -}; -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN -/* This is the m68k variant of 80-bit long double, and this definition only works - * on archs where the alignment requirement of uint64_t is <= 4. */ -union ldshape { - long double f; - struct { - uint16_t se; - uint16_t pad; - uint64_t m; - } i; -}; -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN -union ldshape { - long double f; - struct { - uint64_t lo; - uint32_t mid; - uint16_t top; - uint16_t se; - } i; - struct { - uint64_t lo; - uint64_t hi; - } i2; -}; -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN -union ldshape { - long double f; - struct { - uint16_t se; - uint16_t top; - uint32_t mid; - uint64_t lo; - } i; - struct { - uint64_t hi; - uint64_t lo; - } i2; -}; -#else -#error Unsupported long double representation -#endif - -/* Support non-nearest rounding mode. */ -#define WANT_ROUNDING 1 -/* Support signaling NaNs. */ -#define WANT_SNAN 0 - -#if WANT_SNAN -#error SNaN is unsupported -#else -#define issignalingf_inline(x) 0 -#define issignaling_inline(x) 0 -#endif - -#ifndef TOINT_INTRINSICS -#define TOINT_INTRINSICS 0 -#endif - -#if TOINT_INTRINSICS -/* Round x to nearest int in all rounding modes, ties have to be rounded - consistently with converttoint so the results match. If the result - would be outside of [-2^31, 2^31-1] then the semantics is unspecified. */ -static double_t roundtoint(double_t); - -/* Convert x to nearest int in all rounding modes, ties have to be rounded - consistently with roundtoint. If the result is not representible in an - int32_t then the semantics is unspecified. */ -static int32_t converttoint(double_t); -#endif - -/* Helps static branch prediction so hot path can be better optimized. */ -#ifdef __GNUC__ -#define predict_true(x) __builtin_expect(!!(x), 1) -#define predict_false(x) __builtin_expect(x, 0) -#else -#define predict_true(x) (x) -#define predict_false(x) (x) -#endif - -/* Evaluate an expression as the specified type. With standard excess - precision handling a type cast or assignment is enough (with - -ffloat-store an assignment is required, in old compilers argument - passing and return statement may not drop excess precision). */ - -static inline float eval_as_float(float x) -{ - float y = x; - return y; -} - -static inline double eval_as_double(double x) -{ - double y = x; - return y; -} - -/* fp_barrier returns its input, but limits code transformations - as if it had a side-effect (e.g. observable io) and returned - an arbitrary value. */ - -#ifndef fp_barrierf -#define fp_barrierf fp_barrierf -static inline float fp_barrierf(float x) -{ - volatile float y = x; - return y; -} -#endif - -#ifndef fp_barrier -#define fp_barrier fp_barrier -static inline double fp_barrier(double x) -{ - volatile double y = x; - return y; -} -#endif - -#ifndef fp_barrierl -#define fp_barrierl fp_barrierl -static inline long double fp_barrierl(long double x) -{ - volatile long double y = x; - return y; -} -#endif - -/* fp_force_eval ensures that the input value is computed when that's - otherwise unused. To prevent the constant folding of the input - expression, an additional fp_barrier may be needed or a compilation - mode that does so (e.g. -frounding-math in gcc). Then it can be - used to evaluate an expression for its fenv side-effects only. */ - -#ifndef fp_force_evalf -#define fp_force_evalf fp_force_evalf -static inline void fp_force_evalf(float x) -{ - volatile float y; - y = x; -} -#endif - -#ifndef fp_force_eval -#define fp_force_eval fp_force_eval -static inline void fp_force_eval(double x) -{ - volatile double y; - y = x; -} -#endif - -#ifndef fp_force_evall -#define fp_force_evall fp_force_evall -static inline void fp_force_evall(long double x) -{ - volatile long double y; - y = x; -} -#endif - -#define FORCE_EVAL(x) do { \ - if (sizeof(x) == sizeof(float)) { \ - fp_force_evalf(x); \ - } else if (sizeof(x) == sizeof(double)) { \ - fp_force_eval(x); \ - } else { \ - fp_force_evall(x); \ - } \ -} while(0) - -#define asuint(f) ((union{float _f; uint32_t _i;}){f})._i -#define asfloat(i) ((union{uint32_t _i; float _f;}){i})._f -#define asuint64(f) ((union{double _f; uint64_t _i;}){f})._i -#define asdouble(i) ((union{uint64_t _i; double _f;}){i})._f - -#define EXTRACT_WORDS(hi,lo,d) \ -do { \ - uint64_t __u = asuint64(d); \ - (hi) = __u >> 32; \ - (lo) = (uint32_t)__u; \ -} while (0) - -#define GET_HIGH_WORD(hi,d) \ -do { \ - (hi) = asuint64(d) >> 32; \ -} while (0) - -#define GET_LOW_WORD(lo,d) \ -do { \ - (lo) = (uint32_t)asuint64(d); \ -} while (0) - -#define INSERT_WORDS(d,hi,lo) \ -do { \ - (d) = asdouble(((uint64_t)(hi)<<32) | (uint32_t)(lo)); \ -} while (0) - -#define SET_HIGH_WORD(d,hi) \ - INSERT_WORDS(d, hi, (uint32_t)asuint64(d)) - -#define SET_LOW_WORD(d,lo) \ - INSERT_WORDS(d, asuint64(d)>>32, lo) - -#define GET_FLOAT_WORD(w,d) \ -do { \ - (w) = asuint(d); \ -} while (0) - -#define SET_FLOAT_WORD(d,w) \ -do { \ - (d) = asfloat(w); \ -} while (0) - -hidden int __rem_pio2_large(double*,double*,int,int,int); - -hidden int __rem_pio2(double,double*); -hidden double __sin(double,double,int); -hidden double __cos(double,double); -hidden double __tan(double,double,int); -hidden double __expo2(double,double); - -hidden int __rem_pio2f(float,double*); -hidden float __sindf(double); -hidden float __cosdf(double); -hidden float __tandf(double,int); -hidden float __expo2f(float,float); - -hidden int __rem_pio2l(long double, long double *); -hidden long double __sinl(long double, long double, int); -hidden long double __cosl(long double, long double); -hidden long double __tanl(long double, long double, int); - -hidden long double __polevll(long double, const long double *, int); -hidden long double __p1evll(long double, const long double *, int); - -extern int __signgam; -hidden double __lgamma_r(double, int *); -hidden float __lgammaf_r(float, int *); - -/* error handling functions */ -hidden float __math_xflowf(uint32_t, float); -hidden float __math_uflowf(uint32_t); -hidden float __math_oflowf(uint32_t); -hidden float __math_divzerof(uint32_t); -hidden float __math_invalidf(float); -hidden double __math_xflow(uint32_t, double); -hidden double __math_uflow(uint32_t); -hidden double __math_oflow(uint32_t); -hidden double __math_divzero(uint32_t); -hidden double __math_invalid(double); -#if LDBL_MANT_DIG != DBL_MANT_DIG -hidden long double __math_invalidl(long double); -#endif - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/shgetc.c b/src/hyperlight_guest_bin/third_party/musl/src/internal/shgetc.c deleted file mode 100644 index 7455d2f00..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/shgetc.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "shgetc.h" - -/* The shcnt field stores the number of bytes read so far, offset by - * the value of buf-rpos at the last function call (__shlim or __shgetc), - * so that between calls the inline shcnt macro can add rpos-buf to get - * the actual count. */ - -void __shlim(FILE *f, off_t lim) -{ - f->shlim = lim; - f->shcnt = f->buf - f->rpos; - /* If lim is nonzero, rend must be a valid pointer. */ - if (lim && f->rend - f->rpos > lim) - f->shend = f->rpos + lim; - else - f->shend = f->rend; -} - -int __shgetc(FILE *f) -{ - int c; - off_t cnt = shcnt(f); - if (f->shlim && cnt >= f->shlim || (c=__uflow(f)) < 0) { - f->shcnt = f->buf - f->rpos + cnt; - f->shend = f->rpos; - f->shlim = -1; - return EOF; - } - cnt++; - if (f->shlim && f->rend - f->rpos > f->shlim - cnt) - f->shend = f->rpos + (f->shlim - cnt); - else - f->shend = f->rend; - f->shcnt = f->buf - f->rpos + cnt; - if (f->rpos <= f->buf) f->rpos[-1] = c; - return c; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/shgetc.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/shgetc.h deleted file mode 100644 index 9435381a6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/shgetc.h +++ /dev/null @@ -1,32 +0,0 @@ -#include "stdio_impl.h" - -/* Scan helper "stdio" functions for use by scanf-family and strto*-family - * functions. These accept either a valid stdio FILE, or a minimal pseudo - * FILE whose buffer pointers point into a null-terminated string. In the - * latter case, the sh_fromstring macro should be used to setup the FILE; - * the rest of the structure can be left uninitialized. - * - * To begin using these functions, shlim must first be called on the FILE - * to set a field width limit, or 0 for no limit. For string pseudo-FILEs, - * a nonzero limit is not valid and produces undefined behavior. After that, - * shgetc, shunget, and shcnt are valid as long as no other stdio functions - * are called on the stream. - * - * When used with a real FILE object, shunget has only one byte of pushback - * available. Further shunget (up to a limit of the stdio UNGET buffer size) - * will adjust the position but will not restore the data to be read again. - * This functionality is needed for the wcsto*-family functions, where it's - * okay because the FILE will be discarded immediately anyway. When used - * with string pseudo-FILEs, shunget has unlimited pushback, back to the - * beginning of the string. */ - -hidden void __shlim(FILE *, off_t); -hidden int __shgetc(FILE *); - -#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->buf)) -#define shlim(f, lim) __shlim((f), (lim)) -#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : __shgetc(f)) -#define shunget(f) ((f)->shlim>=0 ? (void)(f)->rpos-- : (void)0) - -#define sh_fromstring(f, s) \ - ((f)->buf = (f)->rpos = (void *)(s), (f)->rend = (void*)-1) diff --git a/src/hyperlight_guest_bin/third_party/musl/src/internal/stdio_impl.h b/src/hyperlight_guest_bin/third_party/musl/src/internal/stdio_impl.h deleted file mode 100644 index 5e6ac39db..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/internal/stdio_impl.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef _STDIO_IMPL_H -#define _STDIO_IMPL_H - -#include -#ifndef HYPERLIGHT -#include "syscall.h" - -#define UNGET 8 - -#define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0) -#define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0) -#define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0) -#endif // HYPERLIGHT - -#define F_PERM 1 -#define F_NORD 4 -#define F_NOWR 8 -#define F_EOF 16 -#define F_ERR 32 -#define F_SVB 64 -#define F_APP 128 - -struct _IO_FILE { - unsigned flags; - unsigned char *rpos, *rend; - int (*close)(FILE *); - unsigned char *wend, *wpos; - unsigned char *mustbezero_1; - unsigned char *wbase; - size_t (*read)(FILE *, unsigned char *, size_t); - size_t (*write)(FILE *, const unsigned char *, size_t); - off_t (*seek)(FILE *, off_t, int); - unsigned char *buf; - size_t buf_size; - FILE *prev, *next; - int fd; - int pipe_pid; - long lockcount; - int mode; - volatile int lock; - int lbf; - void *cookie; - off_t off; - char *getln_buf; - void *mustbezero_2; - unsigned char *shend; - off_t shlim, shcnt; - FILE *prev_locked, *next_locked; - struct __locale_struct *locale; -}; - -hidden int __toread(FILE *); -hidden int __towrite(FILE *); -int __uflow(FILE *); - -#ifndef HYPERLIGHT -extern hidden FILE *volatile __stdin_used; -extern hidden FILE *volatile __stdout_used; -extern hidden FILE *volatile __stderr_used; - -hidden int __lockfile(FILE *); -hidden void __unlockfile(FILE *); - -hidden size_t __stdio_read(FILE *, unsigned char *, size_t); -hidden size_t __stdio_write(FILE *, const unsigned char *, size_t); -hidden size_t __stdout_write(FILE *, const unsigned char *, size_t); -hidden off_t __stdio_seek(FILE *, off_t, int); -hidden int __stdio_close(FILE *); - -hidden void __stdio_exit(void); -hidden void __stdio_exit_needed(void); - -#if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303) -__attribute__((visibility("protected"))) -#endif -int __overflow(FILE *, int); - -hidden int __fseeko(FILE *, off_t, int); -hidden int __fseeko_unlocked(FILE *, off_t, int); -hidden off_t __ftello(FILE *); -hidden off_t __ftello_unlocked(FILE *); -hidden size_t __fwritex(const unsigned char *, size_t, FILE *); -hidden int __putc_unlocked(int, FILE *); - -hidden FILE *__fdopen(int, const char *); -hidden int __fmodeflags(const char *); - -hidden FILE *__ofl_add(FILE *f); -hidden FILE **__ofl_lock(void); -hidden void __ofl_unlock(void); - -struct __pthread; -hidden void __register_locked_file(FILE *, struct __pthread *); -hidden void __unlist_locked_file(FILE *); -hidden void __do_orphaned_stdio_locks(void); - -#define MAYBE_WAITERS 0x40000000 - -hidden void __getopt_msg(const char *, const char *, const char *, size_t); - -#define feof(f) ((f)->flags & F_EOF) -#define ferror(f) ((f)->flags & F_ERR) - -#define getc_unlocked(f) \ - ( ((f)->rpos != (f)->rend) ? *(f)->rpos++ : __uflow((f)) ) - -#define putc_unlocked(c, f) \ - ( (((unsigned char)(c)!=(f)->lbf && (f)->wpos!=(f)->wend)) \ - ? *(f)->wpos++ = (unsigned char)(c) \ - : __overflow((f),(unsigned char)(c)) ) - -/* Caller-allocated FILE * operations */ -hidden FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t); -hidden int __fclose_ca(FILE *); - -#endif -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__cos.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__cos.c deleted file mode 100644 index 46cefb381..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__cos.c +++ /dev/null @@ -1,71 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_cos.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * __cos( x, y ) - * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * - * Algorithm - * 1. Since cos(-x) = cos(x), we need only to consider positive x. - * 2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0. - * 3. cos(x) is approximated by a polynomial of degree 14 on - * [0,pi/4] - * 4 14 - * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x - * where the remez error is - * - * | 2 4 6 8 10 12 14 | -58 - * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 - * | | - * - * 4 6 8 10 12 14 - * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then - * cos(x) ~ 1 - x*x/2 + r - * since cos(x+y) ~ cos(x) - sin(x)*y - * ~ cos(x) - x*y, - * a correction term is necessary in cos(x) and hence - * cos(x+y) = 1 - (x*x/2 - (r - x*y)) - * For better accuracy, rearrange to - * cos(x+y) ~ w + (tmp + (r-x*y)) - * where w = 1 - x*x/2 and tmp is a tiny correction term - * (1 - x*x/2 == w + tmp exactly in infinite precision). - * The exactness of w + tmp in infinite precision depends on w - * and tmp having the same precision as x. If they have extra - * precision due to compiler bugs, then the extra precision is - * only good provided it is retained in all terms of the final - * expression for cos(). Retention happens in all cases tested - * under FreeBSD, so don't pessimize things by forcibly clipping - * any extra precision in w. - */ - -#include "libm.h" - -static const double -C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ -C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ -C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ -C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ -C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ -C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ - -double __cos(double x, double y) -{ - double_t hz,z,r,w; - - z = x*x; - w = z*z; - r = z*(C1+z*(C2+z*C3)) + w*w*(C4+z*(C5+z*C6)); - hz = 0.5*z; - w = 1.0-hz; - return w + (((1.0-w)-hz) + (z*r-x*y)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__cosdf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__cosdf.c deleted file mode 100644 index 2124989b3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__cosdf.c +++ /dev/null @@ -1,35 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_cosf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Debugged and optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */ -static const double -C0 = -0x1ffffffd0c5e81.0p-54, /* -0.499999997251031003120 */ -C1 = 0x155553e1053a42.0p-57, /* 0.0416666233237390631894 */ -C2 = -0x16c087e80f1e27.0p-62, /* -0.00138867637746099294692 */ -C3 = 0x199342e0ee5069.0p-68; /* 0.0000243904487962774090654 */ - -float __cosdf(double x) -{ - double_t r, w, z; - - /* Try to optimize for parallel evaluation as in __tandf.c. */ - z = x*x; - w = z*z; - r = C2+z*C3; - return ((1.0+z*C0) + w*C1) + (w*z)*r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__cosl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__cosl.c deleted file mode 100644 index fa522ddd7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__cosl.c +++ /dev/null @@ -1,96 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/ld80/k_cosl.c */ -/* origin: FreeBSD /usr/src/lib/msun/ld128/k_cosl.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - - -#include "libm.h" - -#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#if LDBL_MANT_DIG == 64 -/* - * ld80 version of __cos.c. See __cos.c for most comments. - */ -/* - * Domain [-0.7854, 0.7854], range ~[-2.43e-23, 2.425e-23]: - * |cos(x) - c(x)| < 2**-75.1 - * - * The coefficients of c(x) were generated by a pari-gp script using - * a Remez algorithm that searches for the best higher coefficients - * after rounding leading coefficients to a specified precision. - * - * Simpler methods like Chebyshev or basic Remez barely suffice for - * cos() in 64-bit precision, because we want the coefficient of x^2 - * to be precisely -0.5 so that multiplying by it is exact, and plain - * rounding of the coefficients of a good polynomial approximation only - * gives this up to about 64-bit precision. Plain rounding also gives - * a mediocre approximation for the coefficient of x^4, but a rounding - * error of 0.5 ulps for this coefficient would only contribute ~0.01 - * ulps to the final error, so this is unimportant. Rounding errors in - * higher coefficients are even less important. - * - * In fact, coefficients above the x^4 one only need to have 53-bit - * precision, and this is more efficient. We get this optimization - * almost for free from the complications needed to search for the best - * higher coefficients. - */ -static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -static const double -C2 = -0.0013888888888888874, /* -0x16c16c16c16c10.0p-62 */ -C3 = 0.000024801587301571716, /* 0x1a01a01a018e22.0p-68 */ -C4 = -0.00000027557319215507120, /* -0x127e4fb7602f22.0p-74 */ -C5 = 0.0000000020876754400407278, /* 0x11eed8caaeccf1.0p-81 */ -C6 = -1.1470297442401303e-11, /* -0x19393412bd1529.0p-89 */ -C7 = 4.7383039476436467e-14; /* 0x1aac9d9af5c43e.0p-97 */ -#define POLY(z) (z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*C7))))))) -#elif LDBL_MANT_DIG == 113 -/* - * ld128 version of __cos.c. See __cos.c for most comments. - */ -/* - * Domain [-0.7854, 0.7854], range ~[-1.80e-37, 1.79e-37]: - * |cos(x) - c(x))| < 2**-122.0 - * - * 113-bit precision requires more care than 64-bit precision, since - * simple methods give a minimax polynomial with coefficient for x^2 - * that is 1 ulp below 0.5, but we want it to be precisely 0.5. See - * above for more details. - */ -static const long double -C1 = 0.04166666666666666666666666666666658424671L, -C2 = -0.001388888888888888888888888888863490893732L, -C3 = 0.00002480158730158730158730158600795304914210L, -C4 = -0.2755731922398589065255474947078934284324e-6L, -C5 = 0.2087675698786809897659225313136400793948e-8L, -C6 = -0.1147074559772972315817149986812031204775e-10L, -C7 = 0.4779477332386808976875457937252120293400e-13L; -static const double -C8 = -0.1561920696721507929516718307820958119868e-15, -C9 = 0.4110317413744594971475941557607804508039e-18, -C10 = -0.8896592467191938803288521958313920156409e-21, -C11 = 0.1601061435794535138244346256065192782581e-23; -#define POLY(z) (z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+ \ - z*(C8+z*(C9+z*(C10+z*C11))))))))))) -#endif - -long double __cosl(long double x, long double y) -{ - long double hz,z,r,w; - - z = x*x; - r = POLY(z); - hz = 0.5*z; - w = 1.0-hz; - return w + (((1.0-w)-hz) + (z*r-x*y)); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__expo2.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__expo2.c deleted file mode 100644 index 248f052b9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__expo2.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "libm.h" - -/* k is such that k*ln2 has minimal relative error and x - kln2 > log(DBL_MIN) */ -static const int k = 2043; -static const double kln2 = 0x1.62066151add8bp+10; - -/* exp(x)/2 for x >= log(DBL_MAX), slightly better than 0.5*exp(x/2)*exp(x/2) */ -double __expo2(double x, double sign) -{ - double scale; - - /* note that k is odd and scale*scale overflows */ - INSERT_WORDS(scale, (uint32_t)(0x3ff + k/2) << 20, 0); - /* exp(x - k ln2) * 2**(k-1) */ - /* in directed rounding correct sign before rounding or overflow is important */ - return exp(x - kln2) * (sign * scale) * scale; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__expo2f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__expo2f.c deleted file mode 100644 index 538eb09c0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__expo2f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "libm.h" - -/* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN) */ -static const int k = 235; -static const float kln2 = 0x1.45c778p+7f; - -/* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */ -float __expo2f(float x, float sign) -{ - float scale; - - /* note that k is odd and scale*scale overflows */ - SET_FLOAT_WORD(scale, (uint32_t)(0x7f + k/2) << 23); - /* exp(x - k ln2) * 2**(k-1) */ - /* in directed rounding correct sign before rounding or overflow is important */ - return expf(x - kln2) * (sign * scale) * scale; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassify.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassify.c deleted file mode 100644 index f7c0e2dfa..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassify.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int __fpclassify(double x) -{ - union {double f; uint64_t i;} u = {x}; - int e = u.i>>52 & 0x7ff; - if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; - if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; - return FP_NORMAL; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyf.c deleted file mode 100644 index fd00eb1bc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int __fpclassifyf(float x) -{ - union {float f; uint32_t i;} u = {x}; - int e = u.i>>23 & 0xff; - if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; - if (e==0xff) return u.i<<9 ? FP_NAN : FP_INFINITE; - return FP_NORMAL; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyl.c deleted file mode 100644 index e41781b68..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyl.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -int __fpclassifyl(long double x) -{ - return __fpclassify(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -int __fpclassifyl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - int msb = u.i.m>>63; - if (!e && !msb) - return u.i.m ? FP_SUBNORMAL : FP_ZERO; - if (e == 0x7fff) { - /* The x86 variant of 80-bit extended precision only admits - * one representation of each infinity, with the mantissa msb - * necessarily set. The version with it clear is invalid/nan. - * The m68k variant, however, allows either, and tooling uses - * the version with it clear. */ - if (__BYTE_ORDER == __LITTLE_ENDIAN && !msb) - return FP_NAN; - return u.i.m << 1 ? FP_NAN : FP_INFINITE; - } - if (!msb) - return FP_NAN; - return FP_NORMAL; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -int __fpclassifyl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - u.i.se = 0; - if (!e) - return u.i2.lo | u.i2.hi ? FP_SUBNORMAL : FP_ZERO; - if (e == 0x7fff) - return u.i2.lo | u.i2.hi ? FP_NAN : FP_INFINITE; - return FP_NORMAL; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.c deleted file mode 100644 index 48f83aaf8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include "__invtrigl.h" - -#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -static const long double -pS0 = 1.66666666666666666631e-01L, -pS1 = -4.16313987993683104320e-01L, -pS2 = 3.69068046323246813704e-01L, -pS3 = -1.36213932016738603108e-01L, -pS4 = 1.78324189708471965733e-02L, -pS5 = -2.19216428382605211588e-04L, -pS6 = -7.10526623669075243183e-06L, -qS1 = -2.94788392796209867269e+00L, -qS2 = 3.27309890266528636716e+00L, -qS3 = -1.68285799854822427013e+00L, -qS4 = 3.90699412641738801874e-01L, -qS5 = -3.14365703596053263322e-02L; - -const long double pio2_hi = 1.57079632679489661926L; -const long double pio2_lo = -2.50827880633416601173e-20L; - -/* used in asinl() and acosl() */ -/* R(x^2) is a rational approximation of (asin(x)-x)/x^3 with Remez algorithm */ -long double __invtrigl_R(long double z) -{ - long double p, q; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*(pS5+z*pS6)))))); - q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*(qS4+z*qS5)))); - return p/q; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -static const long double -pS0 = 1.66666666666666666666666666666700314e-01L, -pS1 = -7.32816946414566252574527475428622708e-01L, -pS2 = 1.34215708714992334609030036562143589e+00L, -pS3 = -1.32483151677116409805070261790752040e+00L, -pS4 = 7.61206183613632558824485341162121989e-01L, -pS5 = -2.56165783329023486777386833928147375e-01L, -pS6 = 4.80718586374448793411019434585413855e-02L, -pS7 = -4.42523267167024279410230886239774718e-03L, -pS8 = 1.44551535183911458253205638280410064e-04L, -pS9 = -2.10558957916600254061591040482706179e-07L, -qS1 = -4.84690167848739751544716485245697428e+00L, -qS2 = 9.96619113536172610135016921140206980e+00L, -qS3 = -1.13177895428973036660836798461641458e+01L, -qS4 = 7.74004374389488266169304117714658761e+00L, -qS5 = -3.25871986053534084709023539900339905e+00L, -qS6 = 8.27830318881232209752469022352928864e-01L, -qS7 = -1.18768052702942805423330715206348004e-01L, -qS8 = 8.32600764660522313269101537926539470e-03L, -qS9 = -1.99407384882605586705979504567947007e-04L; - -const long double pio2_hi = 1.57079632679489661923132169163975140L; -const long double pio2_lo = 4.33590506506189051239852201302167613e-35L; - -long double __invtrigl_R(long double z) -{ - long double p, q; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*(pS5+z*(pS6+z*(pS7+z*(pS8+z*pS9))))))))); - q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*(qS4+z*(qS5+z*(qS6+z*(qS7+z*(qS8+z*qS9)))))))); - return p/q; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.h b/src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.h deleted file mode 100644 index bee793172..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.h +++ /dev/null @@ -1,8 +0,0 @@ -#include - -/* shared by acosl, asinl and atan2l */ -#define pio2_hi __pio2_hi -#define pio2_lo __pio2_lo -hidden extern const long double pio2_hi, pio2_lo; - -hidden long double __invtrigl_R(long double z); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzero.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzero.c deleted file mode 100644 index 59d213500..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzero.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -double __math_divzero(uint32_t sign) -{ - return fp_barrier(sign ? -1.0 : 1.0) / 0.0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzerof.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzerof.c deleted file mode 100644 index ce046f3e3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzerof.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -float __math_divzerof(uint32_t sign) -{ - return fp_barrierf(sign ? -1.0f : 1.0f) / 0.0f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalid.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalid.c deleted file mode 100644 index 177404900..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalid.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -double __math_invalid(double x) -{ - return (x - x) / (x - x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidf.c deleted file mode 100644 index 357d4b121..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -float __math_invalidf(float x) -{ - return (x - x) / (x - x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidl.c deleted file mode 100644 index 1fca99de4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidl.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "libm.h" - -#if LDBL_MANT_DIG != DBL_MANT_DIG -long double __math_invalidl(long double x) -{ - return (x - x) / (x - x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflow.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflow.c deleted file mode 100644 index c85dbf982..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflow.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -double __math_oflow(uint32_t sign) -{ - return __math_xflow(sign, 0x1p769); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflowf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflowf.c deleted file mode 100644 index fa7d06208..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflowf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -float __math_oflowf(uint32_t sign) -{ - return __math_xflowf(sign, 0x1p97f); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflow.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflow.c deleted file mode 100644 index b90594aee..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflow.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -double __math_uflow(uint32_t sign) -{ - return __math_xflow(sign, 0x1p-767); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflowf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflowf.c deleted file mode 100644 index 94d50f2bf..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflowf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -float __math_uflowf(uint32_t sign) -{ - return __math_xflowf(sign, 0x1p-95f); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflow.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflow.c deleted file mode 100644 index 744203c4c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflow.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -double __math_xflow(uint32_t sign, double y) -{ - return eval_as_double(fp_barrier(sign ? -y : y) * y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflowf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflowf.c deleted file mode 100644 index f2c84784f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflowf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "libm.h" - -float __math_xflowf(uint32_t sign, float y) -{ - return eval_as_float(fp_barrierf(sign ? -y : y) * y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__polevll.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__polevll.c deleted file mode 100644 index ce1a84046..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__polevll.c +++ /dev/null @@ -1,93 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/polevll.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Evaluate polynomial - * - * - * SYNOPSIS: - * - * int N; - * long double x, y, coef[N+1], polevl[]; - * - * y = polevll( x, coef, N ); - * - * - * DESCRIPTION: - * - * Evaluates polynomial of degree N: - * - * 2 N - * y = C + C x + C x +...+ C x - * 0 1 2 N - * - * Coefficients are stored in reverse order: - * - * coef[0] = C , ..., coef[N] = C . - * N 0 - * - * The function p1evll() assumes that coef[N] = 1.0 and is - * omitted from the array. Its calling arguments are - * otherwise the same as polevll(). - * - * - * SPEED: - * - * In the interest of speed, there are no checks for out - * of bounds arithmetic. This routine is used by most of - * the functions in the library. Depending on available - * equipment features, the user may wish to rewrite the - * program in microcode or assembly language. - * - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -#else -/* - * Polynomial evaluator: - * P[0] x^n + P[1] x^(n-1) + ... + P[n] - */ -long double __polevll(long double x, const long double *P, int n) -{ - long double y; - - y = *P++; - do { - y = y * x + *P++; - } while (--n); - - return y; -} - -/* - * Polynomial evaluator: - * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] - */ -long double __p1evll(long double x, const long double *P, int n) -{ - long double y; - - n -= 1; - y = x + *P++; - do { - y = y * x + *P++; - } while (--n); - - return y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2.c deleted file mode 100644 index dcf672fbd..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2.c +++ /dev/null @@ -1,190 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - * Optimized by Bruce D. Evans. - */ -/* __rem_pio2(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] - * use __rem_pio2_large() for large x - */ - -#include "libm.h" - -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif - -/* - * invpio2: 53 bits of 2/pi - * pio2_1: first 33 bit of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 33 bit of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 33 bit of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ -static const double -toint = 1.5/EPS, -pio4 = 0x1.921fb54442d18p-1, -invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ -pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ -pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ -pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ -pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ -pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ -pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ - -/* caller must handle the case when reduction is not needed: |x| ~<= pi/4 */ -int __rem_pio2(double x, double *y) -{ - union {double f; uint64_t i;} u = {x}; - double_t z,w,t,r,fn; - double tx[3],ty[2]; - uint32_t ix; - int sign, n, ex, ey, i; - - sign = u.i>>63; - ix = u.i>>32 & 0x7fffffff; - if (ix <= 0x400f6a7a) { /* |x| ~<= 5pi/4 */ - if ((ix & 0xfffff) == 0x921fb) /* |x| ~= pi/2 or 2pi/2 */ - goto medium; /* cancellation -- use medium case */ - if (ix <= 0x4002d97c) { /* |x| ~<= 3pi/4 */ - if (!sign) { - z = x - pio2_1; /* one round good to 85 bits */ - y[0] = z - pio2_1t; - y[1] = (z-y[0]) - pio2_1t; - return 1; - } else { - z = x + pio2_1; - y[0] = z + pio2_1t; - y[1] = (z-y[0]) + pio2_1t; - return -1; - } - } else { - if (!sign) { - z = x - 2*pio2_1; - y[0] = z - 2*pio2_1t; - y[1] = (z-y[0]) - 2*pio2_1t; - return 2; - } else { - z = x + 2*pio2_1; - y[0] = z + 2*pio2_1t; - y[1] = (z-y[0]) + 2*pio2_1t; - return -2; - } - } - } - if (ix <= 0x401c463b) { /* |x| ~<= 9pi/4 */ - if (ix <= 0x4015fdbc) { /* |x| ~<= 7pi/4 */ - if (ix == 0x4012d97c) /* |x| ~= 3pi/2 */ - goto medium; - if (!sign) { - z = x - 3*pio2_1; - y[0] = z - 3*pio2_1t; - y[1] = (z-y[0]) - 3*pio2_1t; - return 3; - } else { - z = x + 3*pio2_1; - y[0] = z + 3*pio2_1t; - y[1] = (z-y[0]) + 3*pio2_1t; - return -3; - } - } else { - if (ix == 0x401921fb) /* |x| ~= 4pi/2 */ - goto medium; - if (!sign) { - z = x - 4*pio2_1; - y[0] = z - 4*pio2_1t; - y[1] = (z-y[0]) - 4*pio2_1t; - return 4; - } else { - z = x + 4*pio2_1; - y[0] = z + 4*pio2_1t; - y[1] = (z-y[0]) + 4*pio2_1t; - return -4; - } - } - } - if (ix < 0x413921fb) { /* |x| ~< 2^20*(pi/2), medium size */ -medium: - /* rint(x/(pi/2)) */ - fn = (double_t)x*invpio2 + toint - toint; - n = (int32_t)fn; - r = x - fn*pio2_1; - w = fn*pio2_1t; /* 1st round, good to 85 bits */ - /* Matters with directed rounding. */ - if (predict_false(r - w < -pio4)) { - n--; - fn--; - r = x - fn*pio2_1; - w = fn*pio2_1t; - } else if (predict_false(r - w > pio4)) { - n++; - fn++; - r = x - fn*pio2_1; - w = fn*pio2_1t; - } - y[0] = r - w; - u.f = y[0]; - ey = u.i>>52 & 0x7ff; - ex = ix>>20; - if (ex - ey > 16) { /* 2nd round, good to 118 bits */ - t = r; - w = fn*pio2_2; - r = t - w; - w = fn*pio2_2t - ((t-r)-w); - y[0] = r - w; - u.f = y[0]; - ey = u.i>>52 & 0x7ff; - if (ex - ey > 49) { /* 3rd round, good to 151 bits, covers all cases */ - t = r; - w = fn*pio2_3; - r = t - w; - w = fn*pio2_3t - ((t-r)-w); - y[0] = r - w; - } - } - y[1] = (r - y[0]) - w; - return n; - } - /* - * all other (large) arguments - */ - if (ix >= 0x7ff00000) { /* x is inf or NaN */ - y[0] = y[1] = x - x; - return 0; - } - /* set z = scalbn(|x|,-ilogb(x)+23) */ - u.f = x; - u.i &= (uint64_t)-1>>12; - u.i |= (uint64_t)(0x3ff + 23)<<52; - z = u.f; - for (i=0; i < 2; i++) { - tx[i] = (double)(int32_t)z; - z = (z-tx[i])*0x1p24; - } - tx[i] = z; - /* skip zero terms, first term is non-zero */ - while (tx[i] == 0.0) - i--; - n = __rem_pio2_large(tx,ty,(int)(ix>>20)-(0x3ff+23),i+1,1); - if (sign) { - y[0] = -ty[0]; - y[1] = -ty[1]; - return -n; - } - y[0] = ty[0]; - y[1] = ty[1]; - return n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2_large.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2_large.c deleted file mode 100644 index 958f28c25..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2_large.c +++ /dev/null @@ -1,442 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_rem_pio2.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * __rem_pio2_large(x,y,e0,nx,prec) - * double x[],y[]; int e0,nx,prec; - * - * __rem_pio2_large return the last three digits of N with - * y = x - N*pi/2 - * so that |y| < pi/2. - * - * The method is to compute the integer (mod 8) and fraction parts of - * (2/pi)*x without doing the full multiplication. In general we - * skip the part of the product that are known to be a huge integer ( - * more accurately, = 0 mod 8 ). Thus the number of operations are - * independent of the exponent of the input. - * - * (2/pi) is represented by an array of 24-bit integers in ipio2[]. - * - * Input parameters: - * x[] The input value (must be positive) is broken into nx - * pieces of 24-bit integers in double precision format. - * x[i] will be the i-th 24 bit of x. The scaled exponent - * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 - * match x's up to 24 bits. - * - * Example of breaking a double positive z into x[0]+x[1]+x[2]: - * e0 = ilogb(z)-23 - * z = scalbn(z,-e0) - * for i = 0,1,2 - * x[i] = floor(z) - * z = (z-x[i])*2**24 - * - * - * y[] ouput result in an array of double precision numbers. - * The dimension of y[] is: - * 24-bit precision 1 - * 53-bit precision 2 - * 64-bit precision 2 - * 113-bit precision 3 - * The actual value is the sum of them. Thus for 113-bit - * precison, one may have to do something like: - * - * long double t,w,r_head, r_tail; - * t = (long double)y[2] + (long double)y[1]; - * w = (long double)y[0]; - * r_head = t+w; - * r_tail = w - (r_head - t); - * - * e0 The exponent of x[0]. Must be <= 16360 or you need to - * expand the ipio2 table. - * - * nx dimension of x[] - * - * prec an integer indicating the precision: - * 0 24 bits (single) - * 1 53 bits (double) - * 2 64 bits (extended) - * 3 113 bits (quad) - * - * External function: - * double scalbn(), floor(); - * - * - * Here is the description of some local variables: - * - * jk jk+1 is the initial number of terms of ipio2[] needed - * in the computation. The minimum and recommended value - * for jk is 3,4,4,6 for single, double, extended, and quad. - * jk+1 must be 2 larger than you might expect so that our - * recomputation test works. (Up to 24 bits in the integer - * part (the 24 bits of it that we compute) and 23 bits in - * the fraction part may be lost to cancelation before we - * recompute.) - * - * jz local integer variable indicating the number of - * terms of ipio2[] used. - * - * jx nx - 1 - * - * jv index for pointing to the suitable ipio2[] for the - * computation. In general, we want - * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 - * is an integer. Thus - * e0-3-24*jv >= 0 or (e0-3)/24 >= jv - * Hence jv = max(0,(e0-3)/24). - * - * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. - * - * q[] double array with integral value, representing the - * 24-bits chunk of the product of x and 2/pi. - * - * q0 the corresponding exponent of q[0]. Note that the - * exponent for q[i] would be q0-24*i. - * - * PIo2[] double precision array, obtained by cutting pi/2 - * into 24 bits chunks. - * - * f[] ipio2[] in floating point - * - * iq[] integer array by breaking up q[] in 24-bits chunk. - * - * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] - * - * ih integer. If >0 it indicates q[] is >= 0.5, hence - * it also indicates the *sign* of the result. - * - */ -/* - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "libm.h" - -static const int init_jk[] = {3,4,4,6}; /* initial value for jk */ - -/* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi - * - * integer array, contains the (24*i)-th to (24*i+23)-th - * bit of 2/pi after binary point. The corresponding - * floating value is - * - * ipio2[i] * 2^(-24(i+1)). - * - * NB: This table must have at least (e0-3)/24 + jk terms. - * For quad precision (e0 <= 16360, jk = 6), this is 686. - */ -static const int32_t ipio2[] = { -0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, -0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, -0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, -0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, -0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, -0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, -0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, -0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, -0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, -0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, -0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, - -#if LDBL_MAX_EXP > 1024 -0x47C419, 0xC367CD, 0xDCE809, 0x2A8359, 0xC4768B, 0x961CA6, -0xDDAF44, 0xD15719, 0x053EA5, 0xFF0705, 0x3F7E33, 0xE832C2, -0xDE4F98, 0x327DBB, 0xC33D26, 0xEF6B1E, 0x5EF89F, 0x3A1F35, -0xCAF27F, 0x1D87F1, 0x21907C, 0x7C246A, 0xFA6ED5, 0x772D30, -0x433B15, 0xC614B5, 0x9D19C3, 0xC2C4AD, 0x414D2C, 0x5D000C, -0x467D86, 0x2D71E3, 0x9AC69B, 0x006233, 0x7CD2B4, 0x97A7B4, -0xD55537, 0xF63ED7, 0x1810A3, 0xFC764D, 0x2A9D64, 0xABD770, -0xF87C63, 0x57B07A, 0xE71517, 0x5649C0, 0xD9D63B, 0x3884A7, -0xCB2324, 0x778AD6, 0x23545A, 0xB91F00, 0x1B0AF1, 0xDFCE19, -0xFF319F, 0x6A1E66, 0x615799, 0x47FBAC, 0xD87F7E, 0xB76522, -0x89E832, 0x60BFE6, 0xCDC4EF, 0x09366C, 0xD43F5D, 0xD7DE16, -0xDE3B58, 0x929BDE, 0x2822D2, 0xE88628, 0x4D58E2, 0x32CAC6, -0x16E308, 0xCB7DE0, 0x50C017, 0xA71DF3, 0x5BE018, 0x34132E, -0x621283, 0x014883, 0x5B8EF5, 0x7FB0AD, 0xF2E91E, 0x434A48, -0xD36710, 0xD8DDAA, 0x425FAE, 0xCE616A, 0xA4280A, 0xB499D3, -0xF2A606, 0x7F775C, 0x83C2A3, 0x883C61, 0x78738A, 0x5A8CAF, -0xBDD76F, 0x63A62D, 0xCBBFF4, 0xEF818D, 0x67C126, 0x45CA55, -0x36D9CA, 0xD2A828, 0x8D61C2, 0x77C912, 0x142604, 0x9B4612, -0xC459C4, 0x44C5C8, 0x91B24D, 0xF31700, 0xAD43D4, 0xE54929, -0x10D5FD, 0xFCBE00, 0xCC941E, 0xEECE70, 0xF53E13, 0x80F1EC, -0xC3E7B3, 0x28F8C7, 0x940593, 0x3E71C1, 0xB3092E, 0xF3450B, -0x9C1288, 0x7B20AB, 0x9FB52E, 0xC29247, 0x2F327B, 0x6D550C, -0x90A772, 0x1FE76B, 0x96CB31, 0x4A1679, 0xE27941, 0x89DFF4, -0x9794E8, 0x84E6E2, 0x973199, 0x6BED88, 0x365F5F, 0x0EFDBB, -0xB49A48, 0x6CA467, 0x427271, 0x325D8D, 0xB8159F, 0x09E5BC, -0x25318D, 0x3974F7, 0x1C0530, 0x010C0D, 0x68084B, 0x58EE2C, -0x90AA47, 0x02E774, 0x24D6BD, 0xA67DF7, 0x72486E, 0xEF169F, -0xA6948E, 0xF691B4, 0x5153D1, 0xF20ACF, 0x339820, 0x7E4BF5, -0x6863B2, 0x5F3EDD, 0x035D40, 0x7F8985, 0x295255, 0xC06437, -0x10D86D, 0x324832, 0x754C5B, 0xD4714E, 0x6E5445, 0xC1090B, -0x69F52A, 0xD56614, 0x9D0727, 0x50045D, 0xDB3BB4, 0xC576EA, -0x17F987, 0x7D6B49, 0xBA271D, 0x296996, 0xACCCC6, 0x5414AD, -0x6AE290, 0x89D988, 0x50722C, 0xBEA404, 0x940777, 0x7030F3, -0x27FC00, 0xA871EA, 0x49C266, 0x3DE064, 0x83DD97, 0x973FA3, -0xFD9443, 0x8C860D, 0xDE4131, 0x9D3992, 0x8C70DD, 0xE7B717, -0x3BDF08, 0x2B3715, 0xA0805C, 0x93805A, 0x921110, 0xD8E80F, -0xAF806C, 0x4BFFDB, 0x0F9038, 0x761859, 0x15A562, 0xBBCB61, -0xB989C7, 0xBD4010, 0x04F2D2, 0x277549, 0xF6B6EB, 0xBB22DB, -0xAA140A, 0x2F2689, 0x768364, 0x333B09, 0x1A940E, 0xAA3A51, -0xC2A31D, 0xAEEDAF, 0x12265C, 0x4DC26D, 0x9C7A2D, 0x9756C0, -0x833F03, 0xF6F009, 0x8C402B, 0x99316D, 0x07B439, 0x15200C, -0x5BC3D8, 0xC492F5, 0x4BADC6, 0xA5CA4E, 0xCD37A7, 0x36A9E6, -0x9492AB, 0x6842DD, 0xDE6319, 0xEF8C76, 0x528B68, 0x37DBFC, -0xABA1AE, 0x3115DF, 0xA1AE00, 0xDAFB0C, 0x664D64, 0xB705ED, -0x306529, 0xBF5657, 0x3AFF47, 0xB9F96A, 0xF3BE75, 0xDF9328, -0x3080AB, 0xF68C66, 0x15CB04, 0x0622FA, 0x1DE4D9, 0xA4B33D, -0x8F1B57, 0x09CD36, 0xE9424E, 0xA4BE13, 0xB52333, 0x1AAAF0, -0xA8654F, 0xA5C1D2, 0x0F3F0B, 0xCD785B, 0x76F923, 0x048B7B, -0x721789, 0x53A6C6, 0xE26E6F, 0x00EBEF, 0x584A9B, 0xB7DAC4, -0xBA66AA, 0xCFCF76, 0x1D02D1, 0x2DF1B1, 0xC1998C, 0x77ADC3, -0xDA4886, 0xA05DF7, 0xF480C6, 0x2FF0AC, 0x9AECDD, 0xBC5C3F, -0x6DDED0, 0x1FC790, 0xB6DB2A, 0x3A25A3, 0x9AAF00, 0x9353AD, -0x0457B6, 0xB42D29, 0x7E804B, 0xA707DA, 0x0EAA76, 0xA1597B, -0x2A1216, 0x2DB7DC, 0xFDE5FA, 0xFEDB89, 0xFDBE89, 0x6C76E4, -0xFCA906, 0x70803E, 0x156E85, 0xFF87FD, 0x073E28, 0x336761, -0x86182A, 0xEABD4D, 0xAFE7B3, 0x6E6D8F, 0x396795, 0x5BBF31, -0x48D784, 0x16DF30, 0x432DC7, 0x356125, 0xCE70C9, 0xB8CB30, -0xFD6CBF, 0xA200A4, 0xE46C05, 0xA0DD5A, 0x476F21, 0xD21262, -0x845CB9, 0x496170, 0xE0566B, 0x015299, 0x375550, 0xB7D51E, -0xC4F133, 0x5F6E13, 0xE4305D, 0xA92E85, 0xC3B21D, 0x3632A1, -0xA4B708, 0xD4B1EA, 0x21F716, 0xE4698F, 0x77FF27, 0x80030C, -0x2D408D, 0xA0CD4F, 0x99A520, 0xD3A2B3, 0x0A5D2F, 0x42F9B4, -0xCBDA11, 0xD0BE7D, 0xC1DB9B, 0xBD17AB, 0x81A2CA, 0x5C6A08, -0x17552E, 0x550027, 0xF0147F, 0x8607E1, 0x640B14, 0x8D4196, -0xDEBE87, 0x2AFDDA, 0xB6256B, 0x34897B, 0xFEF305, 0x9EBFB9, -0x4F6A68, 0xA82A4A, 0x5AC44F, 0xBCF82D, 0x985AD7, 0x95C7F4, -0x8D4D0D, 0xA63A20, 0x5F57A4, 0xB13F14, 0x953880, 0x0120CC, -0x86DD71, 0xB6DEC9, 0xF560BF, 0x11654D, 0x6B0701, 0xACB08C, -0xD0C0B2, 0x485551, 0x0EFB1E, 0xC37295, 0x3B06A3, 0x3540C0, -0x7BDC06, 0xCC45E0, 0xFA294E, 0xC8CAD6, 0x41F3E8, 0xDE647C, -0xD8649B, 0x31BED9, 0xC397A4, 0xD45877, 0xC5E369, 0x13DAF0, -0x3C3ABA, 0x461846, 0x5F7555, 0xF5BDD2, 0xC6926E, 0x5D2EAC, -0xED440E, 0x423E1C, 0x87C461, 0xE9FD29, 0xF3D6E7, 0xCA7C22, -0x35916F, 0xC5E008, 0x8DD7FF, 0xE26A6E, 0xC6FDB0, 0xC10893, -0x745D7C, 0xB2AD6B, 0x9D6ECD, 0x7B723E, 0x6A11C6, 0xA9CFF7, -0xDF7329, 0xBAC9B5, 0x5100B7, 0x0DB2E2, 0x24BA74, 0x607DE5, -0x8AD874, 0x2C150D, 0x0C1881, 0x94667E, 0x162901, 0x767A9F, -0xBEFDFD, 0xEF4556, 0x367ED9, 0x13D9EC, 0xB9BA8B, 0xFC97C4, -0x27A831, 0xC36EF1, 0x36C594, 0x56A8D8, 0xB5A8B4, 0x0ECCCF, -0x2D8912, 0x34576F, 0x89562C, 0xE3CE99, 0xB920D6, 0xAA5E6B, -0x9C2A3E, 0xCC5F11, 0x4A0BFD, 0xFBF4E1, 0x6D3B8E, 0x2C86E2, -0x84D4E9, 0xA9B4FC, 0xD1EEEF, 0xC9352E, 0x61392F, 0x442138, -0xC8D91B, 0x0AFC81, 0x6A4AFB, 0xD81C2F, 0x84B453, 0x8C994E, -0xCC2254, 0xDC552A, 0xD6C6C0, 0x96190B, 0xB8701A, 0x649569, -0x605A26, 0xEE523F, 0x0F117F, 0x11B5F4, 0xF5CBFC, 0x2DBC34, -0xEEBC34, 0xCC5DE8, 0x605EDD, 0x9B8E67, 0xEF3392, 0xB817C9, -0x9B5861, 0xBC57E1, 0xC68351, 0x103ED8, 0x4871DD, 0xDD1C2D, -0xA118AF, 0x462C21, 0xD7F359, 0x987AD9, 0xC0549E, 0xFA864F, -0xFC0656, 0xAE79E5, 0x362289, 0x22AD38, 0xDC9367, 0xAAE855, -0x382682, 0x9BE7CA, 0xA40D51, 0xB13399, 0x0ED7A9, 0x480569, -0xF0B265, 0xA7887F, 0x974C88, 0x36D1F9, 0xB39221, 0x4A827B, -0x21CF98, 0xDC9F40, 0x5547DC, 0x3A74E1, 0x42EB67, 0xDF9DFE, -0x5FD45E, 0xA4677B, 0x7AACBA, 0xA2F655, 0x23882B, 0x55BA41, -0x086E59, 0x862A21, 0x834739, 0xE6E389, 0xD49EE5, 0x40FB49, -0xE956FF, 0xCA0F1C, 0x8A59C5, 0x2BFA94, 0xC5C1D3, 0xCFC50F, -0xAE5ADB, 0x86C547, 0x624385, 0x3B8621, 0x94792C, 0x876110, -0x7B4C2A, 0x1A2C80, 0x12BF43, 0x902688, 0x893C78, 0xE4C4A8, -0x7BDBE5, 0xC23AC4, 0xEAF426, 0x8A67F7, 0xBF920D, 0x2BA365, -0xB1933D, 0x0B7CBD, 0xDC51A4, 0x63DD27, 0xDDE169, 0x19949A, -0x9529A8, 0x28CE68, 0xB4ED09, 0x209F44, 0xCA984E, 0x638270, -0x237C7E, 0x32B90F, 0x8EF5A7, 0xE75614, 0x08F121, 0x2A9DB5, -0x4D7E6F, 0x5119A5, 0xABF9B5, 0xD6DF82, 0x61DD96, 0x023616, -0x9F3AC4, 0xA1A283, 0x6DED72, 0x7A8D39, 0xA9B882, 0x5C326B, -0x5B2746, 0xED3400, 0x7700D2, 0x55F4FC, 0x4D5901, 0x8071E0, -#endif -}; - -static const double PIo2[] = { - 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ - 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ - 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ - 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ - 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ - 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ - 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ - 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ -}; - -int __rem_pio2_large(double *x, double *y, int e0, int nx, int prec) -{ - int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - double z,fw,f[20],fq[20],q[20]; - - /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/24; if(jv<0) jv=0; - q0 = e0-24*(jv+1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for (i=0; i<=m; i++,j++) - f[i] = j<0 ? 0.0 : (double)ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i=0; i<=jk; i++) { - for (j=0,fw=0.0; j<=jx; j++) - fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - - jz = jk; -recompute: - /* distill q[] into iq[] reversingly */ - for (i=0,j=jz,z=q[jz]; j>0; i++,j--) { - fw = (double)(int32_t)(0x1p-24*z); - iq[i] = (int32_t)(z - 0x1p24*fw); - z = q[j-1]+fw; - } - - /* compute n */ - z = scalbn(z,q0); /* actual value of z */ - z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ - n = (int32_t)z; - z -= (double)n; - ih = 0; - if (q0 > 0) { /* need iq[jz-1] to determine n */ - i = iq[jz-1]>>(24-q0); n += i; - iq[jz-1] -= i<<(24-q0); - ih = iq[jz-1]>>(23-q0); - } - else if (q0 == 0) ih = iq[jz-1]>>23; - else if (z >= 0.5) ih = 2; - - if (ih > 0) { /* q > 0.5 */ - n += 1; carry = 0; - for (i=0; i 0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7fffff; break; - case 2: - iq[jz-1] &= 0x3fffff; break; - } - } - if (ih == 2) { - z = 1.0 - z; - if (carry != 0) - z -= scalbn(1.0,q0); - } - } - - /* check if recomputation is needed */ - if (z == 0.0) { - j = 0; - for (i=jz-1; i>=jk; i--) j |= iq[i]; - if (j == 0) { /* need recomputation */ - for (k=1; iq[jk-k]==0; k++); /* k = no. of terms needed */ - - for (i=jz+1; i<=jz+k; i++) { /* add q[jz+1] to q[jz+k] */ - f[jx+i] = (double)ipio2[jv+i]; - for (j=0,fw=0.0; j<=jx; j++) - fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if (z == 0.0) { - jz -= 1; - q0 -= 24; - while (iq[jz] == 0) { - jz--; - q0 -= 24; - } - } else { /* break z into 24-bit if necessary */ - z = scalbn(z,-q0); - if (z >= 0x1p24) { - fw = (double)(int32_t)(0x1p-24*z); - iq[jz] = (int32_t)(z - 0x1p24*fw); - jz += 1; - q0 += 24; - iq[jz] = (int32_t)fw; - } else - iq[jz] = (int32_t)z; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = scalbn(1.0,q0); - for (i=jz; i>=0; i--) { - q[i] = fw*(double)iq[i]; - fw *= 0x1p-24; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz; i>=0; i--) { - for (fw=0.0,k=0; k<=jp && k<=jz-i; k++) - fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } - - /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz; i>=0; i--) - fw += fq[i]; - y[0] = ih==0 ? fw : -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz; i>=0; i--) - fw += fq[i]; - // TODO: drop excess precision here once double_t is used - fw = (double)fw; - y[0] = ih==0 ? fw : -fw; - fw = fq[0]-fw; - for (i=1; i<=jz; i++) - fw += fq[i]; - y[1] = ih==0 ? fw : -fw; - break; - case 3: /* painful */ - for (i=jz; i>0; i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz; i>1; i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz; i>=2; i--) - fw += fq[i]; - if (ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } - } - return n&7; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2f.c deleted file mode 100644 index e67656431..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2f.c +++ /dev/null @@ -1,86 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2f.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Debugged and optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* __rem_pio2f(x,y) - * - * return the remainder of x rem pi/2 in *y - * use double precision for everything except passing x - * use __rem_pio2_large() for large x - */ - -#include "libm.h" - -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif - -/* - * invpio2: 53 bits of 2/pi - * pio2_1: first 25 bits of pi/2 - * pio2_1t: pi/2 - pio2_1 - */ -static const double -toint = 1.5/EPS, -pio4 = 0x1.921fb6p-1, -invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ -pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */ -pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ - -int __rem_pio2f(float x, double *y) -{ - union {float f; uint32_t i;} u = {x}; - double tx[1],ty[1]; - double_t fn; - uint32_t ix; - int n, sign, e0; - - ix = u.i & 0x7fffffff; - /* 25+53 bit pi is good enough for medium size */ - if (ix < 0x4dc90fdb) { /* |x| ~< 2^28*(pi/2), medium size */ - /* Use a specialized rint() to get fn. */ - fn = (double_t)x*invpio2 + toint - toint; - n = (int32_t)fn; - *y = x - fn*pio2_1 - fn*pio2_1t; - /* Matters with directed rounding. */ - if (predict_false(*y < -pio4)) { - n--; - fn--; - *y = x - fn*pio2_1 - fn*pio2_1t; - } else if (predict_false(*y > pio4)) { - n++; - fn++; - *y = x - fn*pio2_1 - fn*pio2_1t; - } - return n; - } - if(ix>=0x7f800000) { /* x is inf or NaN */ - *y = x-x; - return 0; - } - /* scale x into [2^23, 2^24-1] */ - sign = u.i>>31; - e0 = (ix>>23) - (0x7f+23); /* e0 = ilogb(|x|)-23, positive */ - u.i = ix - (e0<<23); - tx[0] = u.f; - n = __rem_pio2_large(tx,ty,e0,1,0); - if (sign) { - *y = -ty[0]; - return -n; - } - *y = ty[0]; - return n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2l.c deleted file mode 100644 index 236b2def3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__rem_pio2l.c +++ /dev/null @@ -1,155 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/ld80/e_rem_pio2.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - * Optimized by Bruce D. Evans. - */ -#include "libm.h" -#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -/* ld80 and ld128 version of __rem_pio2(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] - * use __rem_pio2_large() for large x - */ - -static const long double toint = 1.5/LDBL_EPSILON; - -#if LDBL_MANT_DIG == 64 -/* u ~< 0x1p25*pi/2 */ -#define SMALL(u) (((u.i.se & 0x7fffU)<<16 | u.i.m>>48) < ((0x3fff + 25)<<16 | 0x921f>>1 | 0x8000)) -#define QUOBITS(x) ((uint32_t)(int32_t)x & 0x7fffffff) -#define ROUND1 22 -#define ROUND2 61 -#define NX 3 -#define NY 2 -/* - * invpio2: 64 bits of 2/pi - * pio2_1: first 39 bits of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 39 bits of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 39 bits of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ -static const double -pio2_1 = 1.57079632679597125389e+00, /* 0x3FF921FB, 0x54444000 */ -pio2_2 = -1.07463465549783099519e-12, /* -0x12e7b967674000.0p-92 */ -pio2_3 = 6.36831716351370313614e-25; /* 0x18a2e037074000.0p-133 */ -static const long double -pio4 = 0x1.921fb54442d1846ap-1L, -invpio2 = 6.36619772367581343076e-01L, /* 0xa2f9836e4e44152a.0p-64 */ -pio2_1t = -1.07463465549719416346e-12L, /* -0x973dcb3b399d747f.0p-103 */ -pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */ -pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ -#elif LDBL_MANT_DIG == 113 -/* u ~< 0x1p45*pi/2 */ -#define SMALL(u) (((u.i.se & 0x7fffU)<<16 | u.i.top) < ((0x3fff + 45)<<16 | 0x921f)) -#define QUOBITS(x) ((uint32_t)(int64_t)x & 0x7fffffff) -#define ROUND1 51 -#define ROUND2 119 -#define NX 5 -#define NY 3 -static const long double -pio4 = 0x1.921fb54442d18469898cc51701b8p-1L, -invpio2 = 6.3661977236758134307553505349005747e-01L, /* 0x145f306dc9c882a53f84eafa3ea6a.0p-113 */ -pio2_1 = 1.5707963267948966192292994253909555e+00L, /* 0x1921fb54442d18469800000000000.0p-112 */ -pio2_1t = 2.0222662487959507323996846200947577e-21L, /* 0x13198a2e03707344a4093822299f3.0p-181 */ -pio2_2 = 2.0222662487959507323994779168837751e-21L, /* 0x13198a2e03707344a400000000000.0p-181 */ -pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df531d89cd91.0p-254 */ -pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */ -pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */ -#endif - -int __rem_pio2l(long double x, long double *y) -{ - union ldshape u,uz; - long double z,w,t,r,fn; - double tx[NX],ty[NY]; - int ex,ey,n,i; - - u.f = x; - ex = u.i.se & 0x7fff; - if (SMALL(u)) { - /* rint(x/(pi/2)) */ - fn = x*invpio2 + toint - toint; - n = QUOBITS(fn); - r = x-fn*pio2_1; - w = fn*pio2_1t; /* 1st round good to 102/180 bits (ld80/ld128) */ - /* Matters with directed rounding. */ - if (predict_false(r - w < -pio4)) { - n--; - fn--; - r = x - fn*pio2_1; - w = fn*pio2_1t; - } else if (predict_false(r - w > pio4)) { - n++; - fn++; - r = x - fn*pio2_1; - w = fn*pio2_1t; - } - y[0] = r-w; - u.f = y[0]; - ey = u.i.se & 0x7fff; - if (ex - ey > ROUND1) { /* 2nd iteration needed, good to 141/248 (ld80/ld128) */ - t = r; - w = fn*pio2_2; - r = t-w; - w = fn*pio2_2t-((t-r)-w); - y[0] = r-w; - u.f = y[0]; - ey = u.i.se & 0x7fff; - if (ex - ey > ROUND2) { /* 3rd iteration, good to 180/316 bits */ - t = r; /* will cover all possible cases (not verified for ld128) */ - w = fn*pio2_3; - r = t-w; - w = fn*pio2_3t-((t-r)-w); - y[0] = r-w; - } - } - y[1] = (r - y[0]) - w; - return n; - } - /* - * all other (large) arguments - */ - if (ex == 0x7fff) { /* x is inf or NaN */ - y[0] = y[1] = x - x; - return 0; - } - /* set z = scalbn(|x|,-ilogb(x)+23) */ - uz.f = x; - uz.i.se = 0x3fff + 23; - z = uz.f; - for (i=0; i < NX - 1; i++) { - tx[i] = (double)(int32_t)z; - z = (z-tx[i])*0x1p24; - } - tx[i] = z; - while (tx[i] == 0) - i--; - n = __rem_pio2_large(tx, ty, ex-0x3fff-23, i+1, NY); - w = ty[1]; - if (NY == 3) - w += ty[2]; - r = ty[0] + w; - /* TODO: for ld128 this does not follow the recommendation of the - comments of __rem_pio2_large which seem wrong if |ty[0]| > |ty[1]+ty[2]| */ - w -= r - ty[0]; - if (u.i.se >> 15) { - y[0] = -r; - y[1] = -w; - return -n; - } - y[0] = r; - y[1] = w; - return n; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__signbit.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__signbit.c deleted file mode 100644 index e700b6b75..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__signbit.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "libm.h" - -// FIXME: macro in math.h -int __signbit(double x) -{ - union { - double d; - uint64_t i; - } y = { x }; - return y.i>>63; -} - - diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__signbitf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__signbitf.c deleted file mode 100644 index 40ad3cfd0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__signbitf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "libm.h" - -// FIXME: macro in math.h -int __signbitf(float x) -{ - union { - float f; - uint32_t i; - } y = { x }; - return y.i>>31; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__signbitl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__signbitl.c deleted file mode 100644 index 63b3dc5a0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__signbitl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "libm.h" - -#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -int __signbitl(long double x) -{ - union ldshape u = {x}; - return u.i.se >> 15; -} -#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -int __signbitl(long double x) -{ - return __signbit(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__sin.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__sin.c deleted file mode 100644 index 403094966..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__sin.c +++ /dev/null @@ -1,64 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_sin.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* __sin( x, y, iy) - * kernel sin function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). - * - * Algorithm - * 1. Since sin(-x) = -sin(x), we need only to consider positive x. - * 2. Callers must return sin(-0) = -0 without calling here since our - * odd polynomial is not evaluated in a way that preserves -0. - * Callers may do the optimization sin(x) ~ x for tiny x. - * 3. sin(x) is approximated by a polynomial of degree 13 on - * [0,pi/4] - * 3 13 - * sin(x) ~ x + S1*x + ... + S6*x - * where - * - * |sin(x) 2 4 6 8 10 12 | -58 - * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 - * | x | - * - * 4. sin(x+y) = sin(x) + sin'(x')*y - * ~ sin(x) + (1-x*x/2)*y - * For better accuracy, let - * 3 2 2 2 2 - * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) - * then 3 2 - * sin(x) = x + (S1*x + (x *(r-y/2)+y)) - */ - -#include "libm.h" - -static const double -S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ -S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ -S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ -S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ -S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ -S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ - -double __sin(double x, double y, int iy) -{ - double_t z,r,v,w; - - z = x*x; - w = z*z; - r = S2 + z*(S3 + z*S4) + z*w*(S5 + z*S6); - v = z*x; - if (iy == 0) - return x + v*(S1 + z*r); - else - return x - ((z*(0.5*y - v*r) - y) - v*S1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__sindf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__sindf.c deleted file mode 100644 index 8fec2a3f6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__sindf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_sinf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */ -static const double -S1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */ -S2 = 0x111110896efbb2.0p-59, /* 0.0083333293858894631756 */ -S3 = -0x1a00f9e2cae774.0p-65, /* -0.000198393348360966317347 */ -S4 = 0x16cd878c3b46a7.0p-71; /* 0.0000027183114939898219064 */ - -float __sindf(double x) -{ - double_t r, s, w, z; - - /* Try to optimize for parallel evaluation as in __tandf.c. */ - z = x*x; - w = z*z; - r = S3 + z*S4; - s = z*x; - return (x + s*(S1 + z*S2)) + s*w*r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__sinl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__sinl.c deleted file mode 100644 index 2525bbe86..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__sinl.c +++ /dev/null @@ -1,78 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/ld80/k_sinl.c */ -/* origin: FreeBSD /usr/src/lib/msun/ld128/k_sinl.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#if LDBL_MANT_DIG == 64 -/* - * ld80 version of __sin.c. See __sin.c for most comments. - */ -/* - * Domain [-0.7854, 0.7854], range ~[-1.89e-22, 1.915e-22] - * |sin(x)/x - s(x)| < 2**-72.1 - * - * See __cosl.c for more details about the polynomial. - */ -static const long double -S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ -static const double -S2 = 0.0083333333333333332, /* 0x11111111111111.0p-59 */ -S3 = -0.00019841269841269427, /* -0x1a01a01a019f81.0p-65 */ -S4 = 0.0000027557319223597490, /* 0x171de3a55560f7.0p-71 */ -S5 = -0.000000025052108218074604, /* -0x1ae64564f16cad.0p-78 */ -S6 = 1.6059006598854211e-10, /* 0x161242b90243b5.0p-85 */ -S7 = -7.6429779983024564e-13, /* -0x1ae42ebd1b2e00.0p-93 */ -S8 = 2.6174587166648325e-15; /* 0x179372ea0b3f64.0p-101 */ -#define POLY(z) (S2+z*(S3+z*(S4+z*(S5+z*(S6+z*(S7+z*S8)))))) -#elif LDBL_MANT_DIG == 113 -/* - * ld128 version of __sin.c. See __sin.c for most comments. - */ -/* - * Domain [-0.7854, 0.7854], range ~[-1.53e-37, 1.659e-37] - * |sin(x)/x - s(x)| < 2**-122.1 - * - * See __cosl.c for more details about the polynomial. - */ -static const long double -S1 = -0.16666666666666666666666666666666666606732416116558L, -S2 = 0.0083333333333333333333333333333331135404851288270047L, -S3 = -0.00019841269841269841269841269839935785325638310428717L, -S4 = 0.27557319223985890652557316053039946268333231205686e-5L, -S5 = -0.25052108385441718775048214826384312253862930064745e-7L, -S6 = 0.16059043836821614596571832194524392581082444805729e-9L, -S7 = -0.76471637318198151807063387954939213287488216303768e-12L, -S8 = 0.28114572543451292625024967174638477283187397621303e-14L; -static const double -S9 = -0.82206352458348947812512122163446202498005154296863e-17, -S10 = 0.19572940011906109418080609928334380560135358385256e-19, -S11 = -0.38680813379701966970673724299207480965452616911420e-22, -S12 = 0.64038150078671872796678569586315881020659912139412e-25; -#define POLY(z) (S2+z*(S3+z*(S4+z*(S5+z*(S6+z*(S7+z*(S8+ \ - z*(S9+z*(S10+z*(S11+z*S12)))))))))) -#endif - -long double __sinl(long double x, long double y, int iy) -{ - long double z,r,v; - - z = x*x; - v = z*x; - r = POLY(z); - if (iy == 0) - return x+v*(S1+z*r); - return x-((z*(0.5*y-v*r)-y)-v*S1); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__tan.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__tan.c deleted file mode 100644 index 8019844d3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__tan.c +++ /dev/null @@ -1,110 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_tan.c */ -/* - * ==================================================== - * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. - * - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* __tan( x, y, k ) - * kernel tan function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * Input odd indicates whether tan (if odd = 0) or -1/tan (if odd = 1) is returned. - * - * Algorithm - * 1. Since tan(-x) = -tan(x), we need only to consider positive x. - * 2. Callers must return tan(-0) = -0 without calling here since our - * odd polynomial is not evaluated in a way that preserves -0. - * Callers may do the optimization tan(x) ~ x for tiny x. - * 3. tan(x) is approximated by a odd polynomial of degree 27 on - * [0,0.67434] - * 3 27 - * tan(x) ~ x + T1*x + ... + T13*x - * where - * - * |tan(x) 2 4 26 | -59.2 - * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2 - * | x | - * - * Note: tan(x+y) = tan(x) + tan'(x)*y - * ~ tan(x) + (1+x*x)*y - * Therefore, for better accuracy in computing tan(x+y), let - * 3 2 2 2 2 - * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13)))) - * then - * 3 2 - * tan(x+y) = x + (T1*x + (x *(r+y)+y)) - * - * 4. For x in [0.67434,pi/4], let y = pi/4 - x, then - * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y)) - * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y))) - */ - -#include "libm.h" - -static const double T[] = { - 3.33333333333334091986e-01, /* 3FD55555, 55555563 */ - 1.33333333333201242699e-01, /* 3FC11111, 1110FE7A */ - 5.39682539762260521377e-02, /* 3FABA1BA, 1BB341FE */ - 2.18694882948595424599e-02, /* 3F9664F4, 8406D637 */ - 8.86323982359930005737e-03, /* 3F8226E3, E96E8493 */ - 3.59207910759131235356e-03, /* 3F6D6D22, C9560328 */ - 1.45620945432529025516e-03, /* 3F57DBC8, FEE08315 */ - 5.88041240820264096874e-04, /* 3F4344D8, F2F26501 */ - 2.46463134818469906812e-04, /* 3F3026F7, 1A8D1068 */ - 7.81794442939557092300e-05, /* 3F147E88, A03792A6 */ - 7.14072491382608190305e-05, /* 3F12B80F, 32F0A7E9 */ - -1.85586374855275456654e-05, /* BEF375CB, DB605373 */ - 2.59073051863633712884e-05, /* 3EFB2A70, 74BF7AD4 */ -}, -pio4 = 7.85398163397448278999e-01, /* 3FE921FB, 54442D18 */ -pio4lo = 3.06161699786838301793e-17; /* 3C81A626, 33145C07 */ - -double __tan(double x, double y, int odd) -{ - double_t z, r, v, w, s, a; - double w0, a0; - uint32_t hx; - int big, sign; - - GET_HIGH_WORD(hx,x); - big = (hx&0x7fffffff) >= 0x3FE59428; /* |x| >= 0.6744 */ - if (big) { - sign = hx>>31; - if (sign) { - x = -x; - y = -y; - } - x = (pio4 - x) + (pio4lo - y); - y = 0.0; - } - z = x * x; - w = z * z; - /* - * Break x^5*(T[1]+x^2*T[2]+...) into - * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + - * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) - */ - r = T[1] + w*(T[3] + w*(T[5] + w*(T[7] + w*(T[9] + w*T[11])))); - v = z*(T[2] + w*(T[4] + w*(T[6] + w*(T[8] + w*(T[10] + w*T[12]))))); - s = z * x; - r = y + z*(s*(r + v) + y) + s*T[0]; - w = x + r; - if (big) { - s = 1 - 2*odd; - v = s - 2.0 * (x + (r - w*w/(w + s))); - return sign ? -v : v; - } - if (!odd) - return w; - /* -1.0/(x+r) has up to 2ulp error, so compute it accurately */ - w0 = w; - SET_LOW_WORD(w0, 0); - v = r - (w0 - x); /* w0+v = r+x */ - a0 = a = -1.0 / w; - SET_LOW_WORD(a0, 0); - return a0 + a*(1.0 + a0*w0 + a0*v); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__tandf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__tandf.c deleted file mode 100644 index 25047eeee..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__tandf.c +++ /dev/null @@ -1,54 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/k_tanf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. - * - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -/* |tan(x)/x - t(x)| < 2**-25.5 (~[-2e-08, 2e-08]). */ -static const double T[] = { - 0x15554d3418c99f.0p-54, /* 0.333331395030791399758 */ - 0x1112fd38999f72.0p-55, /* 0.133392002712976742718 */ - 0x1b54c91d865afe.0p-57, /* 0.0533812378445670393523 */ - 0x191df3908c33ce.0p-58, /* 0.0245283181166547278873 */ - 0x185dadfcecf44e.0p-61, /* 0.00297435743359967304927 */ - 0x1362b9bf971bcd.0p-59, /* 0.00946564784943673166728 */ -}; - -float __tandf(double x, int odd) -{ - double_t z,r,w,s,t,u; - - z = x*x; - /* - * Split up the polynomial into small independent terms to give - * opportunities for parallel evaluation. The chosen splitting is - * micro-optimized for Athlons (XP, X64). It costs 2 multiplications - * relative to Horner's method on sequential machines. - * - * We add the small terms from lowest degree up for efficiency on - * non-sequential machines (the lowest degree terms tend to be ready - * earlier). Apart from this, we don't care about order of - * operations, and don't need to to care since we have precision to - * spare. However, the chosen splitting is good for accuracy too, - * and would give results as accurate as Horner's method if the - * small terms were added from highest degree down. - */ - r = T[4] + z*T[5]; - t = T[2] + z*T[3]; - w = z*z; - s = z*x; - u = T[0] + z*T[1]; - r = (x + s*u) + (s*w)*(t + w*r); - return odd ? -1.0/r : r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/__tanl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/__tanl.c deleted file mode 100644 index 54abc3daf..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/__tanl.c +++ /dev/null @@ -1,143 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/ld80/k_tanl.c */ -/* origin: FreeBSD /usr/src/lib/msun/ld128/k_tanl.c */ -/* - * ==================================================== - * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. - * - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#if LDBL_MANT_DIG == 64 -/* - * ld80 version of __tan.c. See __tan.c for most comments. - */ -/* - * Domain [-0.67434, 0.67434], range ~[-2.25e-22, 1.921e-22] - * |tan(x)/x - t(x)| < 2**-71.9 - * - * See __cosl.c for more details about the polynomial. - */ -static const long double -T3 = 0.333333333333333333180L, /* 0xaaaaaaaaaaaaaaa5.0p-65 */ -T5 = 0.133333333333333372290L, /* 0x88888888888893c3.0p-66 */ -T7 = 0.0539682539682504975744L, /* 0xdd0dd0dd0dc13ba2.0p-68 */ -pio4 = 0.785398163397448309628L, /* 0xc90fdaa22168c235.0p-64 */ -pio4lo = -1.25413940316708300586e-20L; /* -0xece675d1fc8f8cbb.0p-130 */ -static const double -T9 = 0.021869488536312216, /* 0x1664f4882cc1c2.0p-58 */ -T11 = 0.0088632355256619590, /* 0x1226e355c17612.0p-59 */ -T13 = 0.0035921281113786528, /* 0x1d6d3d185d7ff8.0p-61 */ -T15 = 0.0014558334756312418, /* 0x17da354aa3f96b.0p-62 */ -T17 = 0.00059003538700862256, /* 0x13559358685b83.0p-63 */ -T19 = 0.00023907843576635544, /* 0x1f56242026b5be.0p-65 */ -T21 = 0.000097154625656538905, /* 0x1977efc26806f4.0p-66 */ -T23 = 0.000038440165747303162, /* 0x14275a09b3ceac.0p-67 */ -T25 = 0.000018082171885432524, /* 0x12f5e563e5487e.0p-68 */ -T27 = 0.0000024196006108814377, /* 0x144c0d80cc6896.0p-71 */ -T29 = 0.0000078293456938132840, /* 0x106b59141a6cb3.0p-69 */ -T31 = -0.0000032609076735050182, /* -0x1b5abef3ba4b59.0p-71 */ -T33 = 0.0000023261313142559411; /* 0x13835436c0c87f.0p-71 */ -#define RPOLY(w) (T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 + \ - w * (T25 + w * (T29 + w * T33))))))) -#define VPOLY(w) (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 + \ - w * (T27 + w * T31)))))) -#elif LDBL_MANT_DIG == 113 -/* - * ld128 version of __tan.c. See __tan.c for most comments. - */ -/* - * Domain [-0.67434, 0.67434], range ~[-3.37e-36, 1.982e-37] - * |tan(x)/x - t(x)| < 2**-117.8 (XXX should be ~1e-37) - * - * See __cosl.c for more details about the polynomial. - */ -static const long double -T3 = 0x1.5555555555555555555555555553p-2L, -T5 = 0x1.1111111111111111111111111eb5p-3L, -T7 = 0x1.ba1ba1ba1ba1ba1ba1ba1b694cd6p-5L, -T9 = 0x1.664f4882c10f9f32d6bbe09d8bcdp-6L, -T11 = 0x1.226e355e6c23c8f5b4f5762322eep-7L, -T13 = 0x1.d6d3d0e157ddfb5fed8e84e27b37p-9L, -T15 = 0x1.7da36452b75e2b5fce9ee7c2c92ep-10L, -T17 = 0x1.355824803674477dfcf726649efep-11L, -T19 = 0x1.f57d7734d1656e0aceb716f614c2p-13L, -T21 = 0x1.967e18afcb180ed942dfdc518d6cp-14L, -T23 = 0x1.497d8eea21e95bc7e2aa79b9f2cdp-15L, -T25 = 0x1.0b132d39f055c81be49eff7afd50p-16L, -T27 = 0x1.b0f72d33eff7bfa2fbc1059d90b6p-18L, -T29 = 0x1.5ef2daf21d1113df38d0fbc00267p-19L, -T31 = 0x1.1c77d6eac0234988cdaa04c96626p-20L, -T33 = 0x1.cd2a5a292b180e0bdd701057dfe3p-22L, -T35 = 0x1.75c7357d0298c01a31d0a6f7d518p-23L, -T37 = 0x1.2f3190f4718a9a520f98f50081fcp-24L, -pio4 = 0x1.921fb54442d18469898cc51701b8p-1L, -pio4lo = 0x1.cd129024e088a67cc74020bbea60p-116L; -static const double -T39 = 0.000000028443389121318352, /* 0x1e8a7592977938.0p-78 */ -T41 = 0.000000011981013102001973, /* 0x19baa1b1223219.0p-79 */ -T43 = 0.0000000038303578044958070, /* 0x107385dfb24529.0p-80 */ -T45 = 0.0000000034664378216909893, /* 0x1dc6c702a05262.0p-81 */ -T47 = -0.0000000015090641701997785, /* -0x19ecef3569ebb6.0p-82 */ -T49 = 0.0000000029449552300483952, /* 0x194c0668da786a.0p-81 */ -T51 = -0.0000000022006995706097711, /* -0x12e763b8845268.0p-81 */ -T53 = 0.0000000015468200913196612, /* 0x1a92fc98c29554.0p-82 */ -T55 = -0.00000000061311613386849674, /* -0x151106cbc779a9.0p-83 */ -T57 = 1.4912469681508012e-10; /* 0x147edbdba6f43a.0p-85 */ -#define RPOLY(w) (T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 + \ - w * (T25 + w * (T29 + w * (T33 + w * (T37 + w * (T41 + \ - w * (T45 + w * (T49 + w * (T53 + w * T57))))))))))))) -#define VPOLY(w) (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 + \ - w * (T27 + w * (T31 + w * (T35 + w * (T39 + w * (T43 + \ - w * (T47 + w * (T51 + w * T55)))))))))))) -#endif - -long double __tanl(long double x, long double y, int odd) { - long double z, r, v, w, s, a, t; - int big, sign; - - big = fabsl(x) >= 0.67434; - if (big) { - sign = 0; - if (x < 0) { - sign = 1; - x = -x; - y = -y; - } - x = (pio4 - x) + (pio4lo - y); - y = 0.0; - } - z = x * x; - w = z * z; - r = RPOLY(w); - v = z * VPOLY(w); - s = z * x; - r = y + z * (s * (r + v) + y) + T3 * s; - w = x + r; - if (big) { - s = 1 - 2*odd; - v = s - 2.0 * (x + (r - w * w / (w + s))); - return sign ? -v : v; - } - if (!odd) - return w; - /* - * if allow error up to 2 ulp, simply return - * -1.0 / (x+r) here - */ - /* compute -1.0 / (x+r) accurately */ - z = w; - z = z + 0x1p32 - 0x1p32; - v = r - (z - x); /* z+v = r+x */ - t = a = -1.0 / w; /* a = -1.0/w */ - t = t + 0x1p32 - 0x1p32; - s = 1.0 + t * z; - return t + a * (s + t * v); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/acos.c b/src/hyperlight_guest_bin/third_party/musl/src/math/acos.c deleted file mode 100644 index ea9c87bf0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/acos.c +++ /dev/null @@ -1,101 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_acos.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* acos(x) - * Method : - * acos(x) = pi/2 - asin(x) - * acos(-x) = pi/2 + asin(x) - * For |x|<=0.5 - * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) - * For x>0.5 - * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) - * = 2asin(sqrt((1-x)/2)) - * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) - * = 2f + (2c + 2s*z*R(z)) - * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term - * for f so that f+c ~ sqrt(z). - * For x<-0.5 - * acos(x) = pi - 2asin(sqrt((1-|x|)/2)) - * = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z) - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN with invalid signal. - * - * Function needed: sqrt - */ - -#include "libm.h" - -static const double -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ -pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ -pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ -pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ -pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ -pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ -pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ -qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ -qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ -qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ -qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ - -static double R(double z) -{ - double_t p, q; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - return p/q; -} - -double acos(double x) -{ - double z,w,s,c,df; - uint32_t hx,ix; - - GET_HIGH_WORD(hx, x); - ix = hx & 0x7fffffff; - /* |x| >= 1 or nan */ - if (ix >= 0x3ff00000) { - uint32_t lx; - - GET_LOW_WORD(lx,x); - if ((ix-0x3ff00000 | lx) == 0) { - /* acos(1)=0, acos(-1)=pi */ - if (hx >> 31) - return 2*pio2_hi + 0x1p-120f; - return 0; - } - return 0/(x-x); - } - /* |x| < 0.5 */ - if (ix < 0x3fe00000) { - if (ix <= 0x3c600000) /* |x| < 2**-57 */ - return pio2_hi + 0x1p-120f; - return pio2_hi - (x - (pio2_lo-x*R(x*x))); - } - /* x < -0.5 */ - if (hx >> 31) { - z = (1.0+x)*0.5; - s = sqrt(z); - w = R(z)*s-pio2_lo; - return 2*(pio2_hi - (s+w)); - } - /* x > 0.5 */ - z = (1.0-x)*0.5; - s = sqrt(z); - df = s; - SET_LOW_WORD(df,0); - c = (z-df*df)/(s+df); - w = R(z)*s+c; - return 2*(df+w); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/acosf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/acosf.c deleted file mode 100644 index 8ee1a71d0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/acosf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_acosf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -static const float -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ -pS0 = 1.6666586697e-01, -pS1 = -4.2743422091e-02, -pS2 = -8.6563630030e-03, -qS1 = -7.0662963390e-01; - -static float R(float z) -{ - float_t p, q; - p = z*(pS0+z*(pS1+z*pS2)); - q = 1.0f+z*qS1; - return p/q; -} - -float acosf(float x) -{ - float z,w,s,c,df; - uint32_t hx,ix; - - GET_FLOAT_WORD(hx, x); - ix = hx & 0x7fffffff; - /* |x| >= 1 or nan */ - if (ix >= 0x3f800000) { - if (ix == 0x3f800000) { - if (hx >> 31) - return 2*pio2_hi + 0x1p-120f; - return 0; - } - return 0/(x-x); - } - /* |x| < 0.5 */ - if (ix < 0x3f000000) { - if (ix <= 0x32800000) /* |x| < 2**-26 */ - return pio2_hi + 0x1p-120f; - return pio2_hi - (x - (pio2_lo-x*R(x*x))); - } - /* x < -0.5 */ - if (hx >> 31) { - z = (1+x)*0.5f; - s = sqrtf(z); - w = R(z)*s-pio2_lo; - return 2*(pio2_hi - (s+w)); - } - /* x > 0.5 */ - z = (1-x)*0.5f; - s = sqrtf(z); - GET_FLOAT_WORD(hx,s); - SET_FLOAT_WORD(df,hx&0xfffff000); - c = (z-df*df)/(s+df); - w = R(z)*s+c; - return 2*(df+w); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/acosh.c b/src/hyperlight_guest_bin/third_party/musl/src/math/acosh.c deleted file mode 100644 index badbf9081..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/acosh.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "libm.h" - -#if FLT_EVAL_METHOD==2 -#undef sqrt -#define sqrt sqrtl -#endif - -/* acosh(x) = log(x + sqrt(x*x-1)) */ -double acosh(double x) -{ - union {double f; uint64_t i;} u = {.f = x}; - unsigned e = u.i >> 52 & 0x7ff; - - /* x < 1 domain error is handled in the called functions */ - - if (e < 0x3ff + 1) - /* |x| < 2, up to 2ulp error in [1,1.125] */ - return log1p(x-1 + sqrt((x-1)*(x-1)+2*(x-1))); - if (e < 0x3ff + 26) - /* |x| < 0x1p26 */ - return log(2*x - 1/(x+sqrt(x*x-1))); - /* |x| >= 0x1p26 or nan */ - return log(x) + 0.693147180559945309417232121458176568; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/acoshf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/acoshf.c deleted file mode 100644 index b773d48e2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/acoshf.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "libm.h" - -#if FLT_EVAL_METHOD==2 -#undef sqrtf -#define sqrtf sqrtl -#elif FLT_EVAL_METHOD==1 -#undef sqrtf -#define sqrtf sqrt -#endif - -/* acosh(x) = log(x + sqrt(x*x-1)) */ -float acoshf(float x) -{ - union {float f; uint32_t i;} u = {x}; - uint32_t a = u.i & 0x7fffffff; - - if (a < 0x3f800000+(1<<23)) - /* |x| < 2, invalid if x < 1 */ - /* up to 2ulp error in [1,1.125] */ - return log1pf(x-1 + sqrtf((x-1)*(x-1)+2*(x-1))); - if (u.i < 0x3f800000+(12<<23)) - /* 2 <= x < 0x1p12 */ - return logf(2*x - 1/(x+sqrtf(x*x-1))); - /* x >= 0x1p12 or x <= -2 or nan */ - return logf(x) + 0.693147180559945309417232121458176568f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/acoshl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/acoshl.c deleted file mode 100644 index 943cec179..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/acoshl.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double acoshl(long double x) -{ - return acosh(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* acosh(x) = log(x + sqrt(x*x-1)) */ -long double acoshl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se; - - if (e < 0x3fff + 1) - /* 0 <= x < 2, invalid if x < 1 */ - return log1pl(x-1 + sqrtl((x-1)*(x-1)+2*(x-1))); - if (e < 0x3fff + 32) - /* 2 <= x < 0x1p32 */ - return logl(2*x - 1/(x+sqrtl(x*x-1))); - if (e & 0x8000) - /* x < 0 or x = -0, invalid */ - return (x - x) / (x - x); - /* 0x1p32 <= x or nan */ - return logl(x) + 0.693147180559945309417232121458176568L; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double acoshl(long double x) -{ - return acosh(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/acosl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/acosl.c deleted file mode 100644 index c03bdf023..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/acosl.c +++ /dev/null @@ -1,67 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_acosl.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * See comments in acos.c. - * Converted to long double by David Schultz . - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double acosl(long double x) -{ - return acos(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#include "__invtrigl.h" -#if LDBL_MANT_DIG == 64 -#define CLEARBOTTOM(u) (u.i.m &= -1ULL << 32) -#elif LDBL_MANT_DIG == 113 -#define CLEARBOTTOM(u) (u.i.lo = 0) -#endif - -long double acosl(long double x) -{ - union ldshape u = {x}; - long double z, s, c, f; - uint16_t e = u.i.se & 0x7fff; - - /* |x| >= 1 or nan */ - if (e >= 0x3fff) { - if (x == 1) - return 0; - if (x == -1) - return 2*pio2_hi + 0x1p-120f; - return 0/(x-x); - } - /* |x| < 0.5 */ - if (e < 0x3fff - 1) { - if (e < 0x3fff - LDBL_MANT_DIG - 1) - return pio2_hi + 0x1p-120f; - return pio2_hi - (__invtrigl_R(x*x)*x - pio2_lo + x); - } - /* x < -0.5 */ - if (u.i.se >> 15) { - z = (1 + x)*0.5; - s = sqrtl(z); - return 2*(pio2_hi - (__invtrigl_R(z)*s - pio2_lo + s)); - } - /* x > 0.5 */ - z = (1 - x)*0.5; - s = sqrtl(z); - u.f = s; - CLEARBOTTOM(u); - f = u.f; - c = (z - f*f)/(s + f); - return 2*(__invtrigl_R(z)*s + c + f); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/asin.c b/src/hyperlight_guest_bin/third_party/musl/src/math/asin.c deleted file mode 100644 index c926b1885..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/asin.c +++ /dev/null @@ -1,107 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_asin.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* asin(x) - * Method : - * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... - * we approximate asin(x) on [0,0.5] by - * asin(x) = x + x*x^2*R(x^2) - * where - * R(x^2) is a rational approximation of (asin(x)-x)/x^3 - * and its remez error is bounded by - * |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75) - * - * For x in [0.5,1] - * asin(x) = pi/2-2*asin(sqrt((1-x)/2)) - * Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2; - * then for x>0.98 - * asin(x) = pi/2 - 2*(s+s*z*R(z)) - * = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo) - * For x<=0.98, let pio4_hi = pio2_hi/2, then - * f = hi part of s; - * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z) - * and - * asin(x) = pi/2 - 2*(s+s*z*R(z)) - * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) - * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN with invalid signal. - * - */ - -#include "libm.h" - -static const double -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ -/* coefficients for R(x^2) */ -pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ -pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ -pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ -pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ -pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ -pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ -qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ -qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ -qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ -qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ - -static double R(double z) -{ - double_t p, q; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - return p/q; -} - -double asin(double x) -{ - double z,r,s; - uint32_t hx,ix; - - GET_HIGH_WORD(hx, x); - ix = hx & 0x7fffffff; - /* |x| >= 1 or nan */ - if (ix >= 0x3ff00000) { - uint32_t lx; - GET_LOW_WORD(lx, x); - if ((ix-0x3ff00000 | lx) == 0) - /* asin(1) = +-pi/2 with inexact */ - return x*pio2_hi + 0x1p-120f; - return 0/(x-x); - } - /* |x| < 0.5 */ - if (ix < 0x3fe00000) { - /* if 0x1p-1022 <= |x| < 0x1p-26, avoid raising underflow */ - if (ix < 0x3e500000 && ix >= 0x00100000) - return x; - return x + x*R(x*x); - } - /* 1 > |x| >= 0.5 */ - z = (1 - fabs(x))*0.5; - s = sqrt(z); - r = R(z); - if (ix >= 0x3fef3333) { /* if |x| > 0.975 */ - x = pio2_hi-(2*(s+s*r)-pio2_lo); - } else { - double f,c; - /* f+c = sqrt(z) */ - f = s; - SET_LOW_WORD(f,0); - c = (z-f*f)/(s+f); - x = 0.5*pio2_hi - (2*s*r - (pio2_lo-2*c) - (0.5*pio2_hi-2*f)); - } - if (hx >> 31) - return -x; - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/asinf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/asinf.c deleted file mode 100644 index bcd304a34..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/asinf.c +++ /dev/null @@ -1,61 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_asinf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -#include "libm.h" - -static const double -pio2 = 1.570796326794896558e+00; - -static const float -/* coefficients for R(x^2) */ -pS0 = 1.6666586697e-01, -pS1 = -4.2743422091e-02, -pS2 = -8.6563630030e-03, -qS1 = -7.0662963390e-01; - -static float R(float z) -{ - float_t p, q; - p = z*(pS0+z*(pS1+z*pS2)); - q = 1.0f+z*qS1; - return p/q; -} - -float asinf(float x) -{ - double s; - float z; - uint32_t hx,ix; - - GET_FLOAT_WORD(hx, x); - ix = hx & 0x7fffffff; - if (ix >= 0x3f800000) { /* |x| >= 1 */ - if (ix == 0x3f800000) /* |x| == 1 */ - return x*pio2 + 0x1p-120f; /* asin(+-1) = +-pi/2 with inexact */ - return 0/(x-x); /* asin(|x|>1) is NaN */ - } - if (ix < 0x3f000000) { /* |x| < 0.5 */ - /* if 0x1p-126 <= |x| < 0x1p-12, avoid raising underflow */ - if (ix < 0x39800000 && ix >= 0x00800000) - return x; - return x + x*R(x*x); - } - /* 1 > |x| >= 0.5 */ - z = (1 - fabsf(x))*0.5f; - s = sqrt(z); - x = pio2 - 2*(s+s*R(z)); - if (hx >> 31) - return -x; - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/asinh.c b/src/hyperlight_guest_bin/third_party/musl/src/math/asinh.c deleted file mode 100644 index 0829f228e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/asinh.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "libm.h" - -/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ -double asinh(double x) -{ - union {double f; uint64_t i;} u = {.f = x}; - unsigned e = u.i >> 52 & 0x7ff; - unsigned s = u.i >> 63; - - /* |x| */ - u.i &= (uint64_t)-1/2; - x = u.f; - - if (e >= 0x3ff + 26) { - /* |x| >= 0x1p26 or inf or nan */ - x = log(x) + 0.693147180559945309417232121458176568; - } else if (e >= 0x3ff + 1) { - /* |x| >= 2 */ - x = log(2*x + 1/(sqrt(x*x+1)+x)); - } else if (e >= 0x3ff - 26) { - /* |x| >= 0x1p-26, up to 1.6ulp error in [0.125,0.5] */ - x = log1p(x + x*x/(sqrt(x*x+1)+1)); - } else { - /* |x| < 0x1p-26, raise inexact if x != 0 */ - FORCE_EVAL(x + 0x1p120f); - } - return s ? -x : x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/asinhf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/asinhf.c deleted file mode 100644 index fc9f0911b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/asinhf.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "libm.h" - -/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ -float asinhf(float x) -{ - union {float f; uint32_t i;} u = {.f = x}; - uint32_t i = u.i & 0x7fffffff; - unsigned s = u.i >> 31; - - /* |x| */ - u.i = i; - x = u.f; - - if (i >= 0x3f800000 + (12<<23)) { - /* |x| >= 0x1p12 or inf or nan */ - x = logf(x) + 0.693147180559945309417232121458176568f; - } else if (i >= 0x3f800000 + (1<<23)) { - /* |x| >= 2 */ - x = logf(2*x + 1/(sqrtf(x*x+1)+x)); - } else if (i >= 0x3f800000 - (12<<23)) { - /* |x| >= 0x1p-12, up to 1.6ulp error in [0.125,0.5] */ - x = log1pf(x + x*x/(sqrtf(x*x+1)+1)); - } else { - /* |x| < 0x1p-12, raise inexact if x!=0 */ - FORCE_EVAL(x + 0x1p120f); - } - return s ? -x : x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/asinhl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/asinhl.c deleted file mode 100644 index 8635f52e8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/asinhl.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double asinhl(long double x) -{ - return asinh(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ -long double asinhl(long double x) -{ - union ldshape u = {x}; - unsigned e = u.i.se & 0x7fff; - unsigned s = u.i.se >> 15; - - /* |x| */ - u.i.se = e; - x = u.f; - - if (e >= 0x3fff + 32) { - /* |x| >= 0x1p32 or inf or nan */ - x = logl(x) + 0.693147180559945309417232121458176568L; - } else if (e >= 0x3fff + 1) { - /* |x| >= 2 */ - x = logl(2*x + 1/(sqrtl(x*x+1)+x)); - } else if (e >= 0x3fff - 32) { - /* |x| >= 0x1p-32 */ - x = log1pl(x + x*x/(sqrtl(x*x+1)+1)); - } else { - /* |x| < 0x1p-32, raise inexact if x!=0 */ - FORCE_EVAL(x + 0x1p120f); - } - return s ? -x : x; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double asinhl(long double x) -{ - return asinh(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/asinl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/asinl.c deleted file mode 100644 index 347c53568..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/asinl.c +++ /dev/null @@ -1,71 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_asinl.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * See comments in asin.c. - * Converted to long double by David Schultz . - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double asinl(long double x) -{ - return asin(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#include "__invtrigl.h" -#if LDBL_MANT_DIG == 64 -#define CLOSETO1(u) (u.i.m>>56 >= 0xf7) -#define CLEARBOTTOM(u) (u.i.m &= -1ULL << 32) -#elif LDBL_MANT_DIG == 113 -#define CLOSETO1(u) (u.i.top >= 0xee00) -#define CLEARBOTTOM(u) (u.i.lo = 0) -#endif - -long double asinl(long double x) -{ - union ldshape u = {x}; - long double z, r, s; - uint16_t e = u.i.se & 0x7fff; - int sign = u.i.se >> 15; - - if (e >= 0x3fff) { /* |x| >= 1 or nan */ - /* asin(+-1)=+-pi/2 with inexact */ - if (x == 1 || x == -1) - return x*pio2_hi + 0x1p-120f; - return 0/(x-x); - } - if (e < 0x3fff - 1) { /* |x| < 0.5 */ - if (e < 0x3fff - (LDBL_MANT_DIG+1)/2) { - /* return x with inexact if x!=0 */ - FORCE_EVAL(x + 0x1p120f); - return x; - } - return x + x*__invtrigl_R(x*x); - } - /* 1 > |x| >= 0.5 */ - z = (1.0 - fabsl(x))*0.5; - s = sqrtl(z); - r = __invtrigl_R(z); - if (CLOSETO1(u)) { - x = pio2_hi - (2*(s+s*r)-pio2_lo); - } else { - long double f, c; - u.f = s; - CLEARBOTTOM(u); - f = u.f; - c = (z - f*f)/(s + f); - x = 0.5*pio2_hi-(2*s*r - (pio2_lo-2*c) - (0.5*pio2_hi-2*f)); - } - return sign ? -x : x; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atan.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atan.c deleted file mode 100644 index 63b0ab25e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atan.c +++ /dev/null @@ -1,116 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_atan.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* atan(x) - * Method - * 1. Reduce x to positive by atan(x) = -atan(-x). - * 2. According to the integer k=4t+0.25 chopped, t=x, the argument - * is further reduced to one of the following intervals and the - * arctangent of t is evaluated by the corresponding formula: - * - * [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) - * [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) ) - * [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) ) - * [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) ) - * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - - -#include "libm.h" - -static const double atanhi[] = { - 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ - 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ - 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ - 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ -}; - -static const double atanlo[] = { - 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */ - 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */ - 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */ - 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */ -}; - -static const double aT[] = { - 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */ - -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */ - 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */ - -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */ - 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */ - -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */ - 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */ - -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */ - 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */ - -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */ - 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ -}; - -double atan(double x) -{ - double_t w,s1,s2,z; - uint32_t ix,sign; - int id; - - GET_HIGH_WORD(ix, x); - sign = ix >> 31; - ix &= 0x7fffffff; - if (ix >= 0x44100000) { /* if |x| >= 2^66 */ - if (isnan(x)) - return x; - z = atanhi[3] + 0x1p-120f; - return sign ? -z : z; - } - if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ - if (ix < 0x3e400000) { /* |x| < 2^-27 */ - if (ix < 0x00100000) - /* raise underflow for subnormal x */ - FORCE_EVAL((float)x); - return x; - } - id = -1; - } else { - x = fabs(x); - if (ix < 0x3ff30000) { /* |x| < 1.1875 */ - if (ix < 0x3fe60000) { /* 7/16 <= |x| < 11/16 */ - id = 0; - x = (2.0*x-1.0)/(2.0+x); - } else { /* 11/16 <= |x| < 19/16 */ - id = 1; - x = (x-1.0)/(x+1.0); - } - } else { - if (ix < 0x40038000) { /* |x| < 2.4375 */ - id = 2; - x = (x-1.5)/(1.0+1.5*x); - } else { /* 2.4375 <= |x| < 2^66 */ - id = 3; - x = -1.0/x; - } - } - } - /* end of argument reduction */ - z = x*x; - w = z*z; - /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ - s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); - s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); - if (id < 0) - return x - x*(s1+s2); - z = atanhi[id] - (x*(s1+s2) - atanlo[id] - x); - return sign ? -z : z; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atan2.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atan2.c deleted file mode 100644 index 5a1903c62..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atan2.c +++ /dev/null @@ -1,107 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - */ -/* atan2(y,x) - * Method : - * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). - * 2. Reduce x to positive by (if x and y are unexceptional): - * ARG (x+iy) = arctan(y/x) ... if x > 0, - * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, - * - * Special cases: - * - * ATAN2((anything), NaN ) is NaN; - * ATAN2(NAN , (anything) ) is NaN; - * ATAN2(+-0, +(anything but NaN)) is +-0 ; - * ATAN2(+-0, -(anything but NaN)) is +-pi ; - * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; - * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; - * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; - * ATAN2(+-INF,+INF ) is +-pi/4 ; - * ATAN2(+-INF,-INF ) is +-3pi/4; - * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "libm.h" - -static const double -pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ -pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ - -double atan2(double y, double x) -{ - double z; - uint32_t m,lx,ly,ix,iy; - - if (isnan(x) || isnan(y)) - return x+y; - EXTRACT_WORDS(ix, lx, x); - EXTRACT_WORDS(iy, ly, y); - if ((ix-0x3ff00000 | lx) == 0) /* x = 1.0 */ - return atan(y); - m = ((iy>>31)&1) | ((ix>>30)&2); /* 2*sign(x)+sign(y) */ - ix = ix & 0x7fffffff; - iy = iy & 0x7fffffff; - - /* when y = 0 */ - if ((iy|ly) == 0) { - switch(m) { - case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ - case 2: return pi; /* atan(+0,-anything) = pi */ - case 3: return -pi; /* atan(-0,-anything) =-pi */ - } - } - /* when x = 0 */ - if ((ix|lx) == 0) - return m&1 ? -pi/2 : pi/2; - /* when x is INF */ - if (ix == 0x7ff00000) { - if (iy == 0x7ff00000) { - switch(m) { - case 0: return pi/4; /* atan(+INF,+INF) */ - case 1: return -pi/4; /* atan(-INF,+INF) */ - case 2: return 3*pi/4; /* atan(+INF,-INF) */ - case 3: return -3*pi/4; /* atan(-INF,-INF) */ - } - } else { - switch(m) { - case 0: return 0.0; /* atan(+...,+INF) */ - case 1: return -0.0; /* atan(-...,+INF) */ - case 2: return pi; /* atan(+...,-INF) */ - case 3: return -pi; /* atan(-...,-INF) */ - } - } - } - /* |y/x| > 0x1p64 */ - if (ix+(64<<20) < iy || iy == 0x7ff00000) - return m&1 ? -pi/2 : pi/2; - - /* z = atan(|y/x|) without spurious underflow */ - if ((m&2) && iy+(64<<20) < ix) /* |y/x| < 0x1p-64, x<0 */ - z = 0; - else - z = atan(fabs(y/x)); - switch (m) { - case 0: return z; /* atan(+,+) */ - case 1: return -z; /* atan(-,+) */ - case 2: return pi - (z-pi_lo); /* atan(+,-) */ - default: /* case 3 */ - return (z-pi_lo) - pi; /* atan(-,-) */ - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atan2f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atan2f.c deleted file mode 100644 index c634d00fc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atan2f.c +++ /dev/null @@ -1,83 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2f.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -static const float -pi = 3.1415927410e+00, /* 0x40490fdb */ -pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ - -float atan2f(float y, float x) -{ - float z; - uint32_t m,ix,iy; - - if (isnan(x) || isnan(y)) - return x+y; - GET_FLOAT_WORD(ix, x); - GET_FLOAT_WORD(iy, y); - if (ix == 0x3f800000) /* x=1.0 */ - return atanf(y); - m = ((iy>>31)&1) | ((ix>>30)&2); /* 2*sign(x)+sign(y) */ - ix &= 0x7fffffff; - iy &= 0x7fffffff; - - /* when y = 0 */ - if (iy == 0) { - switch (m) { - case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ - case 2: return pi; /* atan(+0,-anything) = pi */ - case 3: return -pi; /* atan(-0,-anything) =-pi */ - } - } - /* when x = 0 */ - if (ix == 0) - return m&1 ? -pi/2 : pi/2; - /* when x is INF */ - if (ix == 0x7f800000) { - if (iy == 0x7f800000) { - switch (m) { - case 0: return pi/4; /* atan(+INF,+INF) */ - case 1: return -pi/4; /* atan(-INF,+INF) */ - case 2: return 3*pi/4; /*atan(+INF,-INF)*/ - case 3: return -3*pi/4; /*atan(-INF,-INF)*/ - } - } else { - switch (m) { - case 0: return 0.0f; /* atan(+...,+INF) */ - case 1: return -0.0f; /* atan(-...,+INF) */ - case 2: return pi; /* atan(+...,-INF) */ - case 3: return -pi; /* atan(-...,-INF) */ - } - } - } - /* |y/x| > 0x1p26 */ - if (ix+(26<<23) < iy || iy == 0x7f800000) - return m&1 ? -pi/2 : pi/2; - - /* z = atan(|y/x|) with correct underflow */ - if ((m&2) && iy+(26<<23) < ix) /*|y/x| < 0x1p-26, x < 0 */ - z = 0.0; - else - z = atanf(fabsf(y/x)); - switch (m) { - case 0: return z; /* atan(+,+) */ - case 1: return -z; /* atan(-,+) */ - case 2: return pi - (z-pi_lo); /* atan(+,-) */ - default: /* case 3 */ - return (z-pi_lo) - pi; /* atan(-,-) */ - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atan2l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atan2l.c deleted file mode 100644 index f0937a979..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atan2l.c +++ /dev/null @@ -1,85 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2l.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - */ -/* - * See comments in atan2.c. - * Converted to long double by David Schultz . - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double atan2l(long double y, long double x) -{ - return atan2(y, x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#include "__invtrigl.h" - -long double atan2l(long double y, long double x) -{ - union ldshape ux, uy; - long double z; - int m, ex, ey; - - if (isnan(x) || isnan(y)) - return x+y; - if (x == 1) - return atanl(y); - ux.f = x; - uy.f = y; - ex = ux.i.se & 0x7fff; - ey = uy.i.se & 0x7fff; - m = 2*(ux.i.se>>15) | uy.i.se>>15; - if (y == 0) { - switch(m) { - case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ - case 2: return 2*pio2_hi; /* atan(+0,-anything) = pi */ - case 3: return -2*pio2_hi; /* atan(-0,-anything) =-pi */ - } - } - if (x == 0) - return m&1 ? -pio2_hi : pio2_hi; - if (ex == 0x7fff) { - if (ey == 0x7fff) { - switch(m) { - case 0: return pio2_hi/2; /* atan(+INF,+INF) */ - case 1: return -pio2_hi/2; /* atan(-INF,+INF) */ - case 2: return 1.5*pio2_hi; /* atan(+INF,-INF) */ - case 3: return -1.5*pio2_hi; /* atan(-INF,-INF) */ - } - } else { - switch(m) { - case 0: return 0.0; /* atan(+...,+INF) */ - case 1: return -0.0; /* atan(-...,+INF) */ - case 2: return 2*pio2_hi; /* atan(+...,-INF) */ - case 3: return -2*pio2_hi; /* atan(-...,-INF) */ - } - } - } - if (ex+120 < ey || ey == 0x7fff) - return m&1 ? -pio2_hi : pio2_hi; - /* z = atan(|y/x|) without spurious underflow */ - if ((m&2) && ey+120 < ex) /* |y/x| < 0x1p-120, x<0 */ - z = 0.0; - else - z = atanl(fabsl(y/x)); - switch (m) { - case 0: return z; /* atan(+,+) */ - case 1: return -z; /* atan(-,+) */ - case 2: return 2*pio2_hi-(z-2*pio2_lo); /* atan(+,-) */ - default: /* case 3 */ - return (z-2*pio2_lo)-2*pio2_hi; /* atan(-,-) */ - } -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atanf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atanf.c deleted file mode 100644 index 178341b67..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atanf.c +++ /dev/null @@ -1,94 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_atanf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - - -#include "libm.h" - -static const float atanhi[] = { - 4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */ - 7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */ - 9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */ - 1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */ -}; - -static const float atanlo[] = { - 5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */ - 3.7748947079e-08, /* atan(1.0)lo 0x33222168 */ - 3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */ - 7.5497894159e-08, /* atan(inf)lo 0x33a22168 */ -}; - -static const float aT[] = { - 3.3333328366e-01, - -1.9999158382e-01, - 1.4253635705e-01, - -1.0648017377e-01, - 6.1687607318e-02, -}; - -float atanf(float x) -{ - float_t w,s1,s2,z; - uint32_t ix,sign; - int id; - - GET_FLOAT_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x4c800000) { /* if |x| >= 2**26 */ - if (isnan(x)) - return x; - z = atanhi[3] + 0x1p-120f; - return sign ? -z : z; - } - if (ix < 0x3ee00000) { /* |x| < 0.4375 */ - if (ix < 0x39800000) { /* |x| < 2**-12 */ - if (ix < 0x00800000) - /* raise underflow for subnormal x */ - FORCE_EVAL(x*x); - return x; - } - id = -1; - } else { - x = fabsf(x); - if (ix < 0x3f980000) { /* |x| < 1.1875 */ - if (ix < 0x3f300000) { /* 7/16 <= |x| < 11/16 */ - id = 0; - x = (2.0f*x - 1.0f)/(2.0f + x); - } else { /* 11/16 <= |x| < 19/16 */ - id = 1; - x = (x - 1.0f)/(x + 1.0f); - } - } else { - if (ix < 0x401c0000) { /* |x| < 2.4375 */ - id = 2; - x = (x - 1.5f)/(1.0f + 1.5f*x); - } else { /* 2.4375 <= |x| < 2**26 */ - id = 3; - x = -1.0f/x; - } - } - } - /* end of argument reduction */ - z = x*x; - w = z*z; - /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ - s1 = z*(aT[0]+w*(aT[2]+w*aT[4])); - s2 = w*(aT[1]+w*aT[3]); - if (id < 0) - return x - x*(s1+s2); - z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); - return sign ? -z : z; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atanh.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atanh.c deleted file mode 100644 index 63a035d70..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atanh.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "libm.h" - -/* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ -double atanh(double x) -{ - union {double f; uint64_t i;} u = {.f = x}; - unsigned e = u.i >> 52 & 0x7ff; - unsigned s = u.i >> 63; - double_t y; - - /* |x| */ - u.i &= (uint64_t)-1/2; - y = u.f; - - if (e < 0x3ff - 1) { - if (e < 0x3ff - 32) { - /* handle underflow */ - if (e == 0) - FORCE_EVAL((float)y); - } else { - /* |x| < 0.5, up to 1.7ulp error */ - y = 0.5*log1p(2*y + 2*y*y/(1-y)); - } - } else { - /* avoid overflow */ - y = 0.5*log1p(2*(y/(1-y))); - } - return s ? -y : y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atanhf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atanhf.c deleted file mode 100644 index 65f07c0f4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atanhf.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "libm.h" - -/* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ -float atanhf(float x) -{ - union {float f; uint32_t i;} u = {.f = x}; - unsigned s = u.i >> 31; - float_t y; - - /* |x| */ - u.i &= 0x7fffffff; - y = u.f; - - if (u.i < 0x3f800000 - (1<<23)) { - if (u.i < 0x3f800000 - (32<<23)) { - /* handle underflow */ - if (u.i < (1<<23)) - FORCE_EVAL((float)(y*y)); - } else { - /* |x| < 0.5, up to 1.7ulp error */ - y = 0.5f*log1pf(2*y + 2*y*y/(1-y)); - } - } else { - /* avoid overflow */ - y = 0.5f*log1pf(2*(y/(1-y))); - } - return s ? -y : y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atanhl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atanhl.c deleted file mode 100644 index 87cd1cdb5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atanhl.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double atanhl(long double x) -{ - return atanh(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -/* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ -long double atanhl(long double x) -{ - union ldshape u = {x}; - unsigned e = u.i.se & 0x7fff; - unsigned s = u.i.se >> 15; - - /* |x| */ - u.i.se = e; - x = u.f; - - if (e < 0x3ff - 1) { - if (e < 0x3ff - LDBL_MANT_DIG/2) { - /* handle underflow */ - if (e == 0) - FORCE_EVAL((float)x); - } else { - /* |x| < 0.5, up to 1.7ulp error */ - x = 0.5*log1pl(2*x + 2*x*x/(1-x)); - } - } else { - /* avoid overflow */ - x = 0.5*log1pl(2*(x/(1-x))); - } - return s ? -x : x; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/atanl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/atanl.c deleted file mode 100644 index c3b0c9268..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/atanl.c +++ /dev/null @@ -1,184 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_atanl.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * See comments in atan.c. - * Converted to long double by David Schultz . - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double atanl(long double x) -{ - return atan(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -#if LDBL_MANT_DIG == 64 -#define EXPMAN(u) ((u.i.se & 0x7fff)<<8 | (u.i.m>>55 & 0xff)) - -static const long double atanhi[] = { - 4.63647609000806116202e-01L, - 7.85398163397448309628e-01L, - 9.82793723247329067960e-01L, - 1.57079632679489661926e+00L, -}; - -static const long double atanlo[] = { - 1.18469937025062860669e-20L, - -1.25413940316708300586e-20L, - 2.55232234165405176172e-20L, - -2.50827880633416601173e-20L, -}; - -static const long double aT[] = { - 3.33333333333333333017e-01L, - -1.99999999999999632011e-01L, - 1.42857142857046531280e-01L, - -1.11111111100562372733e-01L, - 9.09090902935647302252e-02L, - -7.69230552476207730353e-02L, - 6.66661718042406260546e-02L, - -5.88158892835030888692e-02L, - 5.25499891539726639379e-02L, - -4.70119845393155721494e-02L, - 4.03539201366454414072e-02L, - -2.91303858419364158725e-02L, - 1.24822046299269234080e-02L, -}; - -static long double T_even(long double x) -{ - return aT[0] + x * (aT[2] + x * (aT[4] + x * (aT[6] + - x * (aT[8] + x * (aT[10] + x * aT[12]))))); -} - -static long double T_odd(long double x) -{ - return aT[1] + x * (aT[3] + x * (aT[5] + x * (aT[7] + - x * (aT[9] + x * aT[11])))); -} -#elif LDBL_MANT_DIG == 113 -#define EXPMAN(u) ((u.i.se & 0x7fff)<<8 | u.i.top>>8) - -static const long double atanhi[] = { - 4.63647609000806116214256231461214397e-01L, - 7.85398163397448309615660845819875699e-01L, - 9.82793723247329067985710611014666038e-01L, - 1.57079632679489661923132169163975140e+00L, -}; - -static const long double atanlo[] = { - 4.89509642257333492668618435220297706e-36L, - 2.16795253253094525619926100651083806e-35L, - -2.31288434538183565909319952098066272e-35L, - 4.33590506506189051239852201302167613e-35L, -}; - -static const long double aT[] = { - 3.33333333333333333333333333333333125e-01L, - -1.99999999999999999999999999999180430e-01L, - 1.42857142857142857142857142125269827e-01L, - -1.11111111111111111111110834490810169e-01L, - 9.09090909090909090908522355708623681e-02L, - -7.69230769230769230696553844935357021e-02L, - 6.66666666666666660390096773046256096e-02L, - -5.88235294117646671706582985209643694e-02L, - 5.26315789473666478515847092020327506e-02L, - -4.76190476189855517021024424991436144e-02L, - 4.34782608678695085948531993458097026e-02L, - -3.99999999632663469330634215991142368e-02L, - 3.70370363987423702891250829918659723e-02L, - -3.44827496515048090726669907612335954e-02L, - 3.22579620681420149871973710852268528e-02L, - -3.03020767654269261041647570626778067e-02L, - 2.85641979882534783223403715930946138e-02L, - -2.69824879726738568189929461383741323e-02L, - 2.54194698498808542954187110873675769e-02L, - -2.35083879708189059926183138130183215e-02L, - 2.04832358998165364349957325067131428e-02L, - -1.54489555488544397858507248612362957e-02L, - 8.64492360989278761493037861575248038e-03L, - -2.58521121597609872727919154569765469e-03L, -}; - -static long double T_even(long double x) -{ - return (aT[0] + x * (aT[2] + x * (aT[4] + x * (aT[6] + x * (aT[8] + - x * (aT[10] + x * (aT[12] + x * (aT[14] + x * (aT[16] + - x * (aT[18] + x * (aT[20] + x * aT[22]))))))))))); -} - -static long double T_odd(long double x) -{ - return (aT[1] + x * (aT[3] + x * (aT[5] + x * (aT[7] + x * (aT[9] + - x * (aT[11] + x * (aT[13] + x * (aT[15] + x * (aT[17] + - x * (aT[19] + x * (aT[21] + x * aT[23]))))))))))); -} -#endif - -long double atanl(long double x) -{ - union ldshape u = {x}; - long double w, s1, s2, z; - int id; - unsigned e = u.i.se & 0x7fff; - unsigned sign = u.i.se >> 15; - unsigned expman; - - if (e >= 0x3fff + LDBL_MANT_DIG + 1) { /* if |x| is large, atan(x)~=pi/2 */ - if (isnan(x)) - return x; - return sign ? -atanhi[3] : atanhi[3]; - } - /* Extract the exponent and the first few bits of the mantissa. */ - expman = EXPMAN(u); - if (expman < ((0x3fff - 2) << 8) + 0xc0) { /* |x| < 0.4375 */ - if (e < 0x3fff - (LDBL_MANT_DIG+1)/2) { /* if |x| is small, atanl(x)~=x */ - /* raise underflow if subnormal */ - if (e == 0) - FORCE_EVAL((float)x); - return x; - } - id = -1; - } else { - x = fabsl(x); - if (expman < (0x3fff << 8) + 0x30) { /* |x| < 1.1875 */ - if (expman < ((0x3fff - 1) << 8) + 0x60) { /* 7/16 <= |x| < 11/16 */ - id = 0; - x = (2.0*x-1.0)/(2.0+x); - } else { /* 11/16 <= |x| < 19/16 */ - id = 1; - x = (x-1.0)/(x+1.0); - } - } else { - if (expman < ((0x3fff + 1) << 8) + 0x38) { /* |x| < 2.4375 */ - id = 2; - x = (x-1.5)/(1.0+1.5*x); - } else { /* 2.4375 <= |x| */ - id = 3; - x = -1.0/x; - } - } - } - /* end of argument reduction */ - z = x*x; - w = z*z; - /* break sum aT[i]z**(i+1) into odd and even poly */ - s1 = z*T_even(w); - s2 = w*T_odd(w); - if (id < 0) - return x - x*(s1+s2); - z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); - return sign ? -z : z; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cbrt.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cbrt.c deleted file mode 100644 index 7599d3e37..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cbrt.c +++ /dev/null @@ -1,103 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrt.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - * Optimized by Bruce D. Evans. - */ -/* cbrt(x) - * Return cube root of x - */ - -#include -#include - -static const uint32_t -B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20 */ -B2 = 696219795; /* B2 = (1023-1023/3-54/3-0.03306235651)*2**20 */ - -/* |1/cbrt(x) - p(x)| < 2**-23.5 (~[-7.93e-8, 7.929e-8]). */ -static const double -P0 = 1.87595182427177009643, /* 0x3ffe03e6, 0x0f61e692 */ -P1 = -1.88497979543377169875, /* 0xbffe28e0, 0x92f02420 */ -P2 = 1.621429720105354466140, /* 0x3ff9f160, 0x4a49d6c2 */ -P3 = -0.758397934778766047437, /* 0xbfe844cb, 0xbee751d9 */ -P4 = 0.145996192886612446982; /* 0x3fc2b000, 0xd4e4edd7 */ - -double cbrt(double x) -{ - union {double f; uint64_t i;} u = {x}; - double_t r,s,t,w; - uint32_t hx = u.i>>32 & 0x7fffffff; - - if (hx >= 0x7ff00000) /* cbrt(NaN,INF) is itself */ - return x+x; - - /* - * Rough cbrt to 5 bits: - * cbrt(2**e*(1+m) ~= 2**(e/3)*(1+(e%3+m)/3) - * where e is integral and >= 0, m is real and in [0, 1), and "/" and - * "%" are integer division and modulus with rounding towards minus - * infinity. The RHS is always >= the LHS and has a maximum relative - * error of about 1 in 16. Adding a bias of -0.03306235651 to the - * (e%3+m)/3 term reduces the error to about 1 in 32. With the IEEE - * floating point representation, for finite positive normal values, - * ordinary integer divison of the value in bits magically gives - * almost exactly the RHS of the above provided we first subtract the - * exponent bias (1023 for doubles) and later add it back. We do the - * subtraction virtually to keep e >= 0 so that ordinary integer - * division rounds towards minus infinity; this is also efficient. - */ - if (hx < 0x00100000) { /* zero or subnormal? */ - u.f = x*0x1p54; - hx = u.i>>32 & 0x7fffffff; - if (hx == 0) - return x; /* cbrt(0) is itself */ - hx = hx/3 + B2; - } else - hx = hx/3 + B1; - u.i &= 1ULL<<63; - u.i |= (uint64_t)hx << 32; - t = u.f; - - /* - * New cbrt to 23 bits: - * cbrt(x) = t*cbrt(x/t**3) ~= t*P(t**3/x) - * where P(r) is a polynomial of degree 4 that approximates 1/cbrt(r) - * to within 2**-23.5 when |r - 1| < 1/10. The rough approximation - * has produced t such than |t/cbrt(x) - 1| ~< 1/32, and cubing this - * gives us bounds for r = t**3/x. - * - * Try to optimize for parallel evaluation as in __tanf.c. - */ - r = (t*t)*(t/x); - t = t*((P0+r*(P1+r*P2))+((r*r)*r)*(P3+r*P4)); - - /* - * Round t away from zero to 23 bits (sloppily except for ensuring that - * the result is larger in magnitude than cbrt(x) but not much more than - * 2 23-bit ulps larger). With rounding towards zero, the error bound - * would be ~5/6 instead of ~4/6. With a maximum error of 2 23-bit ulps - * in the rounded t, the infinite-precision error in the Newton - * approximation barely affects third digit in the final error - * 0.667; the error in the rounded t can be up to about 3 23-bit ulps - * before the final error is larger than 0.667 ulps. - */ - u.f = t; - u.i = (u.i + 0x80000000) & 0xffffffffc0000000ULL; - t = u.f; - - /* one step Newton iteration to 53 bits with error < 0.667 ulps */ - s = t*t; /* t*t is exact */ - r = x/s; /* error <= 0.5 ulps; |r| < |t| */ - w = t+t; /* t+t is exact */ - r = (r-t)/(w+r); /* r-t is exact; w+r ~= 3*t */ - t = t+t*r; /* error <= 0.5 + 0.5/3 + epsilon */ - return t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cbrtf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cbrtf.c deleted file mode 100644 index 89c2c8655..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cbrtf.c +++ /dev/null @@ -1,66 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrtf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Debugged and optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* cbrtf(x) - * Return cube root of x - */ - -#include -#include - -static const unsigned -B1 = 709958130, /* B1 = (127-127.0/3-0.03306235651)*2**23 */ -B2 = 642849266; /* B2 = (127-127.0/3-24/3-0.03306235651)*2**23 */ - -float cbrtf(float x) -{ - double_t r,T; - union {float f; uint32_t i;} u = {x}; - uint32_t hx = u.i & 0x7fffffff; - - if (hx >= 0x7f800000) /* cbrt(NaN,INF) is itself */ - return x + x; - - /* rough cbrt to 5 bits */ - if (hx < 0x00800000) { /* zero or subnormal? */ - if (hx == 0) - return x; /* cbrt(+-0) is itself */ - u.f = x*0x1p24f; - hx = u.i & 0x7fffffff; - hx = hx/3 + B2; - } else - hx = hx/3 + B1; - u.i &= 0x80000000; - u.i |= hx; - - /* - * First step Newton iteration (solving t*t-x/t == 0) to 16 bits. In - * double precision so that its terms can be arranged for efficiency - * without causing overflow or underflow. - */ - T = u.f; - r = T*T*T; - T = T*((double_t)x+x+r)/(x+r+r); - - /* - * Second step Newton iteration to 47 bits. In double precision for - * efficiency and accuracy. - */ - r = T*T*T; - T = T*((double_t)x+x+r)/(x+r+r); - - /* rounding to 24 bits is perfect in round-to-nearest mode */ - return T; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cbrtl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cbrtl.c deleted file mode 100644 index ceff9136e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cbrtl.c +++ /dev/null @@ -1,124 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrtl.c */ -/*- - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2009-2011, Bruce D. Evans, Steven G. Kargl, David Schultz. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - * The argument reduction and testing for exceptional cases was - * written by Steven G. Kargl with input from Bruce D. Evans - * and David A. Schultz. - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double cbrtl(long double x) -{ - return cbrt(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -static const unsigned B1 = 709958130; /* B1 = (127-127.0/3-0.03306235651)*2**23 */ - -long double cbrtl(long double x) -{ - union ldshape u = {x}, v; - union {float f; uint32_t i;} uft; - long double r, s, t, w; - double_t dr, dt, dx; - float_t ft; - int e = u.i.se & 0x7fff; - int sign = u.i.se & 0x8000; - - /* - * If x = +-Inf, then cbrt(x) = +-Inf. - * If x = NaN, then cbrt(x) = NaN. - */ - if (e == 0x7fff) - return x + x; - if (e == 0) { - /* Adjust subnormal numbers. */ - u.f *= 0x1p120; - e = u.i.se & 0x7fff; - /* If x = +-0, then cbrt(x) = +-0. */ - if (e == 0) - return x; - e -= 120; - } - e -= 0x3fff; - u.i.se = 0x3fff; - x = u.f; - switch (e % 3) { - case 1: - case -2: - x *= 2; - e--; - break; - case 2: - case -1: - x *= 4; - e -= 2; - break; - } - v.f = 1.0; - v.i.se = sign | (0x3fff + e/3); - - /* - * The following is the guts of s_cbrtf, with the handling of - * special values removed and extra care for accuracy not taken, - * but with most of the extra accuracy not discarded. - */ - - /* ~5-bit estimate: */ - uft.f = x; - uft.i = (uft.i & 0x7fffffff)/3 + B1; - ft = uft.f; - - /* ~16-bit estimate: */ - dx = x; - dt = ft; - dr = dt * dt * dt; - dt = dt * (dx + dx + dr) / (dx + dr + dr); - - /* ~47-bit estimate: */ - dr = dt * dt * dt; - dt = dt * (dx + dx + dr) / (dx + dr + dr); - -#if LDBL_MANT_DIG == 64 - /* - * dt is cbrtl(x) to ~47 bits (after x has been reduced to 1 <= x < 8). - * Round it away from zero to 32 bits (32 so that t*t is exact, and - * away from zero for technical reasons). - */ - t = dt + (0x1.0p32L + 0x1.0p-31L) - 0x1.0p32; -#elif LDBL_MANT_DIG == 113 - /* - * Round dt away from zero to 47 bits. Since we don't trust the 47, - * add 2 47-bit ulps instead of 1 to round up. Rounding is slow and - * might be avoidable in this case, since on most machines dt will - * have been evaluated in 53-bit precision and the technical reasons - * for rounding up might not apply to either case in cbrtl() since - * dt is much more accurate than needed. - */ - t = dt + 0x2.0p-46 + 0x1.0p60L - 0x1.0p60; -#endif - - /* - * Final step Newton iteration to 64 or 113 bits with - * error < 0.667 ulps - */ - s = t*t; /* t*t is exact */ - r = x/s; /* error <= 0.5 ulps; |r| < |t| */ - w = t+t; /* t+t is exact */ - r = (r-t)/(w+r); /* r-t is exact; w+r ~= 3*t */ - t = t+t*r; /* error <= 0.5 + 0.5/3 + epsilon */ - - t *= v.f; - return t; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ceil.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ceil.c deleted file mode 100644 index b13e6f2d6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ceil.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "libm.h" - -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -static const double_t toint = 1/EPS; - -double ceil(double x) -{ - union {double f; uint64_t i;} u = {x}; - int e = u.i >> 52 & 0x7ff; - double_t y; - - if (e >= 0x3ff+52 || x == 0) - return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i >> 63) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3ff-1) { - FORCE_EVAL(y); - return u.i >> 63 ? -0.0 : 1; - } - if (y < 0) - return x + y + 1; - return x + y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ceilf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ceilf.c deleted file mode 100644 index 869835f39..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ceilf.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "libm.h" - -float ceilf(float x) -{ - union {float f; uint32_t i;} u = {x}; - int e = (int)(u.i >> 23 & 0xff) - 0x7f; - uint32_t m; - - if (e >= 23) - return x; - if (e >= 0) { - m = 0x007fffff >> e; - if ((u.i & m) == 0) - return x; - FORCE_EVAL(x + 0x1p120f); - if (u.i >> 31 == 0) - u.i += m; - u.i &= ~m; - } else { - FORCE_EVAL(x + 0x1p120f); - if (u.i >> 31) - u.f = -0.0; - else if (u.i << 1) - u.f = 1.0; - } - return u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ceill.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ceill.c deleted file mode 100644 index 60a83020d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ceill.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double ceill(long double x) -{ - return ceil(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -static const long double toint = 1/LDBL_EPSILON; - -long double ceill(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - long double y; - - if (e >= 0x3fff+LDBL_MANT_DIG-1 || x == 0) - return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i.se >> 15) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3fff-1) { - FORCE_EVAL(y); - return u.i.se >> 15 ? -0.0 : 1; - } - if (y < 0) - return x + y + 1; - return x + y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/copysign.c b/src/hyperlight_guest_bin/third_party/musl/src/math/copysign.c deleted file mode 100644 index b09331b68..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/copysign.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "libm.h" - -double copysign(double x, double y) { - union {double f; uint64_t i;} ux={x}, uy={y}; - ux.i &= -1ULL/2; - ux.i |= uy.i & 1ULL<<63; - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/copysignf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/copysignf.c deleted file mode 100644 index 0af6ae9b2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/copysignf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -float copysignf(float x, float y) -{ - union {float f; uint32_t i;} ux={x}, uy={y}; - ux.i &= 0x7fffffff; - ux.i |= uy.i & 0x80000000; - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/copysignl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/copysignl.c deleted file mode 100644 index 9dd933cfa..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/copysignl.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double copysignl(long double x, long double y) -{ - return copysign(x, y); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double copysignl(long double x, long double y) -{ - union ldshape ux = {x}, uy = {y}; - ux.i.se &= 0x7fff; - ux.i.se |= uy.i.se & 0x8000; - return ux.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cos.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cos.c deleted file mode 100644 index ee97f68bb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cos.c +++ /dev/null @@ -1,77 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cos.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* cos(x) - * Return cosine function of x. - * - * kernel function: - * __sin ... sine function on [-pi/4,pi/4] - * __cos ... cosine function on [-pi/4,pi/4] - * __rem_pio2 ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "libm.h" - -double cos(double x) -{ - double y[2]; - uint32_t ix; - unsigned n; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - - /* |x| ~< pi/4 */ - if (ix <= 0x3fe921fb) { - if (ix < 0x3e46a09e) { /* |x| < 2**-27 * sqrt(2) */ - /* raise inexact if x!=0 */ - FORCE_EVAL(x + 0x1p120f); - return 1.0; - } - return __cos(x, 0); - } - - /* cos(Inf or NaN) is NaN */ - if (ix >= 0x7ff00000) - return x-x; - - /* argument reduction */ - n = __rem_pio2(x, y); - switch (n&3) { - case 0: return __cos(y[0], y[1]); - case 1: return -__sin(y[0], y[1], 1); - case 2: return -__cos(y[0], y[1]); - default: - return __sin(y[0], y[1], 1); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cosf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cosf.c deleted file mode 100644 index 23f3e5bf6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cosf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_cosf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -/* Small multiples of pi/2 rounded to double precision. */ -static const double -c1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */ -c2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */ -c3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ -c4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ - -float cosf(float x) -{ - double y; - uint32_t ix; - unsigned n, sign; - - GET_FLOAT_WORD(ix, x); - sign = ix >> 31; - ix &= 0x7fffffff; - - if (ix <= 0x3f490fda) { /* |x| ~<= pi/4 */ - if (ix < 0x39800000) { /* |x| < 2**-12 */ - /* raise inexact if x != 0 */ - FORCE_EVAL(x + 0x1p120f); - return 1.0f; - } - return __cosdf(x); - } - if (ix <= 0x407b53d1) { /* |x| ~<= 5*pi/4 */ - if (ix > 0x4016cbe3) /* |x| ~> 3*pi/4 */ - return -__cosdf(sign ? x+c2pio2 : x-c2pio2); - else { - if (sign) - return __sindf(x + c1pio2); - else - return __sindf(c1pio2 - x); - } - } - if (ix <= 0x40e231d5) { /* |x| ~<= 9*pi/4 */ - if (ix > 0x40afeddf) /* |x| ~> 7*pi/4 */ - return __cosdf(sign ? x+c4pio2 : x-c4pio2); - else { - if (sign) - return __sindf(-x - c3pio2); - else - return __sindf(x - c3pio2); - } - } - - /* cos(Inf or NaN) is NaN */ - if (ix >= 0x7f800000) - return x-x; - - /* general argument reduction needed */ - n = __rem_pio2f(x,&y); - switch (n&3) { - case 0: return __cosdf(y); - case 1: return __sindf(-y); - case 2: return -__cosdf(y); - default: - return __sindf(y); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cosh.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cosh.c deleted file mode 100644 index 490c15fb1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cosh.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "libm.h" - -/* cosh(x) = (exp(x) + 1/exp(x))/2 - * = 1 + 0.5*(exp(x)-1)*(exp(x)-1)/exp(x) - * = 1 + x*x/2 + o(x^4) - */ -double cosh(double x) -{ - union {double f; uint64_t i;} u = {.f = x}; - uint32_t w; - double t; - - /* |x| */ - u.i &= (uint64_t)-1/2; - x = u.f; - w = u.i >> 32; - - /* |x| < log(2) */ - if (w < 0x3fe62e42) { - if (w < 0x3ff00000 - (26<<20)) { - /* raise inexact if x!=0 */ - FORCE_EVAL(x + 0x1p120f); - return 1; - } - t = expm1(x); - return 1 + t*t/(2*(1+t)); - } - - /* |x| < log(DBL_MAX) */ - if (w < 0x40862e42) { - t = exp(x); - /* note: if x>log(0x1p26) then the 1/t is not needed */ - return 0.5*(t + 1/t); - } - - /* |x| > log(DBL_MAX) or nan */ - /* note: the result is stored to handle overflow */ - t = __expo2(x, 1.0); - return t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/coshf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/coshf.c deleted file mode 100644 index e739cff93..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/coshf.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "libm.h" - -float coshf(float x) -{ - union {float f; uint32_t i;} u = {.f = x}; - uint32_t w; - float t; - - /* |x| */ - u.i &= 0x7fffffff; - x = u.f; - w = u.i; - - /* |x| < log(2) */ - if (w < 0x3f317217) { - if (w < 0x3f800000 - (12<<23)) { - FORCE_EVAL(x + 0x1p120f); - return 1; - } - t = expm1f(x); - return 1 + t*t/(2*(1+t)); - } - - /* |x| < log(FLT_MAX) */ - if (w < 0x42b17217) { - t = expf(x); - return 0.5f*(t + 1/t); - } - - /* |x| > log(FLT_MAX) or nan */ - t = __expo2f(x, 1.0f); - return t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/coshl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/coshl.c deleted file mode 100644 index 06a56fe3b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/coshl.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double coshl(long double x) -{ - return cosh(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -long double coshl(long double x) -{ - union ldshape u = {x}; - unsigned ex = u.i.se & 0x7fff; - uint32_t w; - long double t; - - /* |x| */ - u.i.se = ex; - x = u.f; - w = u.i.m >> 32; - - /* |x| < log(2) */ - if (ex < 0x3fff-1 || (ex == 0x3fff-1 && w < 0xb17217f7)) { - if (ex < 0x3fff-32) { - FORCE_EVAL(x + 0x1p120f); - return 1; - } - t = expm1l(x); - return 1 + t*t/(2*(1+t)); - } - - /* |x| < log(LDBL_MAX) */ - if (ex < 0x3fff+13 || (ex == 0x3fff+13 && w < 0xb17217f7)) { - t = expl(x); - return 0.5*(t + 1/t); - } - - /* |x| > log(LDBL_MAX) or nan */ - t = expl(0.5*x); - return 0.5*t*t; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double coshl(long double x) -{ - return cosh(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/cosl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/cosl.c deleted file mode 100644 index 79c41c77f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/cosl.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double cosl(long double x) { - return cos(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double cosl(long double x) -{ - union ldshape u = {x}; - unsigned n; - long double y[2], hi, lo; - - u.i.se &= 0x7fff; - if (u.i.se == 0x7fff) - return x - x; - x = u.f; - if (x < M_PI_4) { - if (u.i.se < 0x3fff - LDBL_MANT_DIG) - /* raise inexact if x!=0 */ - return 1.0 + x; - return __cosl(x, 0); - } - n = __rem_pio2l(x, y); - hi = y[0]; - lo = y[1]; - switch (n & 3) { - case 0: - return __cosl(hi, lo); - case 1: - return -__sinl(hi, lo, 1); - case 2: - return -__cosl(hi, lo); - case 3: - default: - return __sinl(hi, lo, 1); - } -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/erf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/erf.c deleted file mode 100644 index 2f30a298f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/erf.c +++ /dev/null @@ -1,273 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_erf.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* double erf(double x) - * double erfc(double x) - * x - * 2 |\ - * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| - * 0 - * - * erfc(x) = 1-erf(x) - * Note that - * erf(-x) = -erf(x) - * erfc(-x) = 2 - erfc(x) - * - * Method: - * 1. For |x| in [0, 0.84375] - * erf(x) = x + x*R(x^2) - * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] - * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] - * where R = P/Q where P is an odd poly of degree 8 and - * Q is an odd poly of degree 10. - * -57.90 - * | R - (erf(x)-x)/x | <= 2 - * - * - * Remark. The formula is derived by noting - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) - * and that - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 - * is close to one. The interval is chosen because the fix - * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is - * near 0.6174), and by some experiment, 0.84375 is chosen to - * guarantee the error is less than one ulp for erf. - * - * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and - * c = 0.84506291151 rounded to single (24 bits) - * erf(x) = sign(x) * (c + P1(s)/Q1(s)) - * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 - * 1+(c+P1(s)/Q1(s)) if x < 0 - * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 - * Remark: here we use the taylor series expansion at x=1. - * erf(1+s) = erf(1) + s*Poly(s) - * = 0.845.. + P1(s)/Q1(s) - * That is, we use rational approximation to approximate - * erf(1+s) - (c = (single)0.84506291151) - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where - * P1(s) = degree 6 poly in s - * Q1(s) = degree 6 poly in s - * - * 3. For x in [1.25,1/0.35(~2.857143)], - * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) - * erf(x) = 1 - erfc(x) - * where - * R1(z) = degree 7 poly in z, (z=1/x^2) - * S1(z) = degree 8 poly in z - * - * 4. For x in [1/0.35,28] - * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 - * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 - * erf(x) = sign(x) *(1 - tiny) (raise inexact) - * erfc(x) = tiny*tiny (raise underflow) if x > 0 - * = 2 - tiny if x<0 - * - * 7. Special case: - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, - * erfc/erf(NaN) is NaN - */ - -#include "libm.h" - -static const double -erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx8 = 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ -pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ -pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ -pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ -pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ -pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */ -qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ -qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ -qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ -qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ -qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ -pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ -pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ -pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ -pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ -pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ -pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */ -qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ -qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ -qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ -qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ -qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ -qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ -ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ -ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ -ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ -ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ -ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ -ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ -ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */ -sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ -sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ -sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ -sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ -sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ -sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ -sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ -sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ -rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ -rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ -rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ -rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ -rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ -rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */ -sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ -sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ -sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ -sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ -sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ -sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ -sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ - -static double erfc1(double x) -{ - double_t s,P,Q; - - s = fabs(x) - 1; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = 1+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - return 1 - erx - P/Q; -} - -static double erfc2(uint32_t ix, double x) -{ - double_t s,R,S; - double z; - - if (ix < 0x3ff40000) /* |x| < 1.25 */ - return erfc1(x); - - x = fabs(x); - s = 1/(x*x); - if (ix < 0x4006db6d) { /* |x| < 1/.35 ~ 2.85714 */ - R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S = 1.0+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| > 1/.35 */ - R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S = 1.0+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - SET_LOW_WORD(z,0); - return exp(-z*z-0.5625)*exp((z-x)*(z+x)+R/S)/x; -} - -double erf(double x) -{ - double r,s,z,y; - uint32_t ix; - int sign; - - GET_HIGH_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x7ff00000) { - /* erf(nan)=nan, erf(+-inf)=+-1 */ - return 1-2*sign + 1/x; - } - if (ix < 0x3feb0000) { /* |x| < 0.84375 */ - if (ix < 0x3e300000) { /* |x| < 2**-28 */ - /* avoid underflow */ - return 0.125*(8*x + efx8*x); - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = 1.0+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if (ix < 0x40180000) /* 0.84375 <= |x| < 6 */ - y = 1 - erfc2(ix,x); - else - y = 1 - 0x1p-1022; - return sign ? -y : y; -} - -double erfc(double x) -{ - double r,s,z,y; - uint32_t ix; - int sign; - - GET_HIGH_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x7ff00000) { - /* erfc(nan)=nan, erfc(+-inf)=0,2 */ - return 2*sign + 1/x; - } - if (ix < 0x3feb0000) { /* |x| < 0.84375 */ - if (ix < 0x3c700000) /* |x| < 2**-56 */ - return 1.0 - x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = 1.0+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if (sign || ix < 0x3fd00000) { /* x < 1/4 */ - return 1.0 - (x+x*y); - } - return 0.5 - (x - 0.5 + x*y); - } - if (ix < 0x403c0000) { /* 0.84375 <= |x| < 28 */ - return sign ? 2 - erfc2(ix,x) : erfc2(ix,x); - } - return sign ? 2 - 0x1p-1022 : 0x1p-1022*0x1p-1022; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/erff.c b/src/hyperlight_guest_bin/third_party/musl/src/math/erff.c deleted file mode 100644 index ed5f39757..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/erff.c +++ /dev/null @@ -1,183 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_erff.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -static const float -erx = 8.4506291151e-01, /* 0x3f58560b */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx8 = 1.0270333290e+00, /* 0x3f8375d4 */ -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ -pp1 = -3.2504209876e-01, /* 0xbea66beb */ -pp2 = -2.8481749818e-02, /* 0xbce9528f */ -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ -qq2 = 6.5022252500e-02, /* 0x3d852a63 */ -qq3 = 5.0813062117e-03, /* 0x3ba68116 */ -qq4 = 1.3249473704e-04, /* 0x390aee49 */ -qq5 = -3.9602282413e-06, /* 0xb684e21a */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ -pa1 = 4.1485610604e-01, /* 0x3ed46805 */ -pa2 = -3.7220788002e-01, /* 0xbebe9208 */ -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ -qa4 = 1.2617121637e-01, /* 0x3e013307 */ -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.8649440333e-03, /* 0xbc21a093 */ -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ -ra2 = -1.0558626175e+01, /* 0xc128f022 */ -ra3 = -6.2375331879e+01, /* 0xc2798057 */ -ra4 = -1.6239666748e+02, /* 0xc322658c */ -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ -ra6 = -8.1287437439e+01, /* 0xc2a2932b */ -ra7 = -9.8143291473e+00, /* 0xc11d077e */ -sa1 = 1.9651271820e+01, /* 0x419d35ce */ -sa2 = 1.3765776062e+02, /* 0x4309a863 */ -sa3 = 4.3456588745e+02, /* 0x43d9486f */ -sa4 = 6.4538726807e+02, /* 0x442158c9 */ -sa5 = 4.2900814819e+02, /* 0x43d6810b */ -sa6 = 1.0863500214e+02, /* 0x42d9451f */ -sa7 = 6.5702495575e+00, /* 0x40d23f7c */ -sa8 = -6.0424413532e-02, /* 0xbd777f97 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.8649431020e-03, /* 0xbc21a092 */ -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ -rb2 = -1.7757955551e+01, /* 0xc18e104b */ -rb3 = -1.6063638306e+02, /* 0xc320a2ea */ -rb4 = -6.3756646729e+02, /* 0xc41f6441 */ -rb5 = -1.0250950928e+03, /* 0xc480230b */ -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ -sb1 = 3.0338060379e+01, /* 0x41f2b459 */ -sb2 = 3.2579251099e+02, /* 0x43a2e571 */ -sb3 = 1.5367296143e+03, /* 0x44c01759 */ -sb4 = 3.1998581543e+03, /* 0x4547fdbb */ -sb5 = 2.5530502930e+03, /* 0x451f90ce */ -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ -sb7 = -2.2440952301e+01; /* 0xc1b38712 */ - -static float erfc1(float x) -{ - float_t s,P,Q; - - s = fabsf(x) - 1; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = 1+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - return 1 - erx - P/Q; -} - -static float erfc2(uint32_t ix, float x) -{ - float_t s,R,S; - float z; - - if (ix < 0x3fa00000) /* |x| < 1.25 */ - return erfc1(x); - - x = fabsf(x); - s = 1/(x*x); - if (ix < 0x4036db6d) { /* |x| < 1/0.35 */ - R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S = 1.0f+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S = 1.0f+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - GET_FLOAT_WORD(ix, x); - SET_FLOAT_WORD(z, ix&0xffffe000); - return expf(-z*z - 0.5625f) * expf((z-x)*(z+x) + R/S)/x; -} - -float erff(float x) -{ - float r,s,z,y; - uint32_t ix; - int sign; - - GET_FLOAT_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x7f800000) { - /* erf(nan)=nan, erf(+-inf)=+-1 */ - return 1-2*sign + 1/x; - } - if (ix < 0x3f580000) { /* |x| < 0.84375 */ - if (ix < 0x31800000) { /* |x| < 2**-28 */ - /*avoid underflow */ - return 0.125f*(8*x + efx8*x); - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = 1+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if (ix < 0x40c00000) /* |x| < 6 */ - y = 1 - erfc2(ix,x); - else - y = 1 - 0x1p-120f; - return sign ? -y : y; -} - -float erfcf(float x) -{ - float r,s,z,y; - uint32_t ix; - int sign; - - GET_FLOAT_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x7f800000) { - /* erfc(nan)=nan, erfc(+-inf)=0,2 */ - return 2*sign + 1/x; - } - - if (ix < 0x3f580000) { /* |x| < 0.84375 */ - if (ix < 0x23800000) /* |x| < 2**-56 */ - return 1.0f - x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = 1.0f+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if (sign || ix < 0x3e800000) /* x < 1/4 */ - return 1.0f - (x+x*y); - return 0.5f - (x - 0.5f + x*y); - } - if (ix < 0x41e00000) { /* |x| < 28 */ - return sign ? 2 - erfc2(ix,x) : erfc2(ix,x); - } - return sign ? 2 - 0x1p-120f : 0x1p-120f*0x1p-120f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/erfl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/erfl.c deleted file mode 100644 index e267c2310..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/erfl.c +++ /dev/null @@ -1,353 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_erfl.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* double erf(double x) - * double erfc(double x) - * x - * 2 |\ - * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| - * 0 - * - * erfc(x) = 1-erf(x) - * Note that - * erf(-x) = -erf(x) - * erfc(-x) = 2 - erfc(x) - * - * Method: - * 1. For |x| in [0, 0.84375] - * erf(x) = x + x*R(x^2) - * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] - * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] - * Remark. The formula is derived by noting - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) - * and that - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 - * is close to one. The interval is chosen because the fix - * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is - * near 0.6174), and by some experiment, 0.84375 is chosen to - * guarantee the error is less than one ulp for erf. - * - * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and - * c = 0.84506291151 rounded to single (24 bits) - * erf(x) = sign(x) * (c + P1(s)/Q1(s)) - * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 - * 1+(c+P1(s)/Q1(s)) if x < 0 - * Remark: here we use the taylor series expansion at x=1. - * erf(1+s) = erf(1) + s*Poly(s) - * = 0.845.. + P1(s)/Q1(s) - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * - * 3. For x in [1.25,1/0.35(~2.857143)], - * erfc(x) = (1/x)*exp(-x*x-0.5625+R1(z)/S1(z)) - * z=1/x^2 - * erf(x) = 1 - erfc(x) - * - * 4. For x in [1/0.35,107] - * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 - * = 2.0 - (1/x)*exp(-x*x-0.5625+R2(z)/S2(z)) - * if -6.666 x >= 107 - * erf(x) = sign(x) *(1 - tiny) (raise inexact) - * erfc(x) = tiny*tiny (raise underflow) if x > 0 - * = 2 - tiny if x<0 - * - * 7. Special case: - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, - * erfc/erf(NaN) is NaN - */ - - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double erfl(long double x) -{ - return erf(x); -} -long double erfcl(long double x) -{ - return erfc(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -static const long double -erx = 0.845062911510467529296875L, - -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -/* 8 * (2/sqrt(pi) - 1) */ -efx8 = 1.0270333367641005911692712249723613735048E0L, -pp[6] = { - 1.122751350964552113068262337278335028553E6L, - -2.808533301997696164408397079650699163276E6L, - -3.314325479115357458197119660818768924100E5L, - -6.848684465326256109712135497895525446398E4L, - -2.657817695110739185591505062971929859314E3L, - -1.655310302737837556654146291646499062882E2L, -}, -qq[6] = { - 8.745588372054466262548908189000448124232E6L, - 3.746038264792471129367533128637019611485E6L, - 7.066358783162407559861156173539693900031E5L, - 7.448928604824620999413120955705448117056E4L, - 4.511583986730994111992253980546131408924E3L, - 1.368902937933296323345610240009071254014E2L, - /* 1.000000000000000000000000000000000000000E0 */ -}, - -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -/* erf(x+1) = 0.845062911510467529296875 + pa(x)/qa(x) - -0.15625 <= x <= +.25 - Peak relative error 8.5e-22 */ -pa[8] = { - -1.076952146179812072156734957705102256059E0L, - 1.884814957770385593365179835059971587220E2L, - -5.339153975012804282890066622962070115606E1L, - 4.435910679869176625928504532109635632618E1L, - 1.683219516032328828278557309642929135179E1L, - -2.360236618396952560064259585299045804293E0L, - 1.852230047861891953244413872297940938041E0L, - 9.394994446747752308256773044667843200719E-2L, -}, -qa[7] = { - 4.559263722294508998149925774781887811255E2L, - 3.289248982200800575749795055149780689738E2L, - 2.846070965875643009598627918383314457912E2L, - 1.398715859064535039433275722017479994465E2L, - 6.060190733759793706299079050985358190726E1L, - 2.078695677795422351040502569964299664233E1L, - 4.641271134150895940966798357442234498546E0L, - /* 1.000000000000000000000000000000000000000E0 */ -}, - -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -/* erfc(1/x) = x exp (-1/x^2 - 0.5625 + ra(x^2)/sa(x^2)) - 1/2.85711669921875 < 1/x < 1/1.25 - Peak relative error 3.1e-21 */ -ra[] = { - 1.363566591833846324191000679620738857234E-1L, - 1.018203167219873573808450274314658434507E1L, - 1.862359362334248675526472871224778045594E2L, - 1.411622588180721285284945138667933330348E3L, - 5.088538459741511988784440103218342840478E3L, - 8.928251553922176506858267311750789273656E3L, - 7.264436000148052545243018622742770549982E3L, - 2.387492459664548651671894725748959751119E3L, - 2.220916652813908085449221282808458466556E2L, -}, -sa[] = { - -1.382234625202480685182526402169222331847E1L, - -3.315638835627950255832519203687435946482E2L, - -2.949124863912936259747237164260785326692E3L, - -1.246622099070875940506391433635999693661E4L, - -2.673079795851665428695842853070996219632E4L, - -2.880269786660559337358397106518918220991E4L, - -1.450600228493968044773354186390390823713E4L, - -2.874539731125893533960680525192064277816E3L, - -1.402241261419067750237395034116942296027E2L, - /* 1.000000000000000000000000000000000000000E0 */ -}, - -/* - * Coefficients for approximation to erfc in [1/.35,107] - */ -/* erfc(1/x) = x exp (-1/x^2 - 0.5625 + rb(x^2)/sb(x^2)) - 1/6.6666259765625 < 1/x < 1/2.85711669921875 - Peak relative error 4.2e-22 */ -rb[] = { - -4.869587348270494309550558460786501252369E-5L, - -4.030199390527997378549161722412466959403E-3L, - -9.434425866377037610206443566288917589122E-2L, - -9.319032754357658601200655161585539404155E-1L, - -4.273788174307459947350256581445442062291E0L, - -8.842289940696150508373541814064198259278E0L, - -7.069215249419887403187988144752613025255E0L, - -1.401228723639514787920274427443330704764E0L, -}, -sb[] = { - 4.936254964107175160157544545879293019085E-3L, - 1.583457624037795744377163924895349412015E-1L, - 1.850647991850328356622940552450636420484E0L, - 9.927611557279019463768050710008450625415E0L, - 2.531667257649436709617165336779212114570E1L, - 2.869752886406743386458304052862814690045E1L, - 1.182059497870819562441683560749192539345E1L, - /* 1.000000000000000000000000000000000000000E0 */ -}, -/* erfc(1/x) = x exp (-1/x^2 - 0.5625 + rc(x^2)/sc(x^2)) - 1/107 <= 1/x <= 1/6.6666259765625 - Peak relative error 1.1e-21 */ -rc[] = { - -8.299617545269701963973537248996670806850E-5L, - -6.243845685115818513578933902532056244108E-3L, - -1.141667210620380223113693474478394397230E-1L, - -7.521343797212024245375240432734425789409E-1L, - -1.765321928311155824664963633786967602934E0L, - -1.029403473103215800456761180695263439188E0L, -}, -sc[] = { - 8.413244363014929493035952542677768808601E-3L, - 2.065114333816877479753334599639158060979E-1L, - 1.639064941530797583766364412782135680148E0L, - 4.936788463787115555582319302981666347450E0L, - 5.005177727208955487404729933261347679090E0L, - /* 1.000000000000000000000000000000000000000E0 */ -}; - -static long double erfc1(long double x) -{ - long double s,P,Q; - - s = fabsl(x) - 1; - P = pa[0] + s * (pa[1] + s * (pa[2] + - s * (pa[3] + s * (pa[4] + s * (pa[5] + s * (pa[6] + s * pa[7])))))); - Q = qa[0] + s * (qa[1] + s * (qa[2] + - s * (qa[3] + s * (qa[4] + s * (qa[5] + s * (qa[6] + s)))))); - return 1 - erx - P / Q; -} - -static long double erfc2(uint32_t ix, long double x) -{ - union ldshape u; - long double s,z,R,S; - - if (ix < 0x3fffa000) /* 0.84375 <= |x| < 1.25 */ - return erfc1(x); - - x = fabsl(x); - s = 1 / (x * x); - if (ix < 0x4000b6db) { /* 1.25 <= |x| < 2.857 ~ 1/.35 */ - R = ra[0] + s * (ra[1] + s * (ra[2] + s * (ra[3] + s * (ra[4] + - s * (ra[5] + s * (ra[6] + s * (ra[7] + s * ra[8]))))))); - S = sa[0] + s * (sa[1] + s * (sa[2] + s * (sa[3] + s * (sa[4] + - s * (sa[5] + s * (sa[6] + s * (sa[7] + s * (sa[8] + s)))))))); - } else if (ix < 0x4001d555) { /* 2.857 <= |x| < 6.6666259765625 */ - R = rb[0] + s * (rb[1] + s * (rb[2] + s * (rb[3] + s * (rb[4] + - s * (rb[5] + s * (rb[6] + s * rb[7])))))); - S = sb[0] + s * (sb[1] + s * (sb[2] + s * (sb[3] + s * (sb[4] + - s * (sb[5] + s * (sb[6] + s)))))); - } else { /* 6.666 <= |x| < 107 (erfc only) */ - R = rc[0] + s * (rc[1] + s * (rc[2] + s * (rc[3] + - s * (rc[4] + s * rc[5])))); - S = sc[0] + s * (sc[1] + s * (sc[2] + s * (sc[3] + - s * (sc[4] + s)))); - } - u.f = x; - u.i.m &= -1ULL << 40; - z = u.f; - return expl(-z*z - 0.5625) * expl((z - x) * (z + x) + R / S) / x; -} - -long double erfl(long double x) -{ - long double r, s, z, y; - union ldshape u = {x}; - uint32_t ix = (u.i.se & 0x7fffU)<<16 | u.i.m>>48; - int sign = u.i.se >> 15; - - if (ix >= 0x7fff0000) - /* erf(nan)=nan, erf(+-inf)=+-1 */ - return 1 - 2*sign + 1/x; - if (ix < 0x3ffed800) { /* |x| < 0.84375 */ - if (ix < 0x3fde8000) { /* |x| < 2**-33 */ - return 0.125 * (8 * x + efx8 * x); /* avoid underflow */ - } - z = x * x; - r = pp[0] + z * (pp[1] + - z * (pp[2] + z * (pp[3] + z * (pp[4] + z * pp[5])))); - s = qq[0] + z * (qq[1] + - z * (qq[2] + z * (qq[3] + z * (qq[4] + z * (qq[5] + z))))); - y = r / s; - return x + x * y; - } - if (ix < 0x4001d555) /* |x| < 6.6666259765625 */ - y = 1 - erfc2(ix,x); - else - y = 1 - 0x1p-16382L; - return sign ? -y : y; -} - -long double erfcl(long double x) -{ - long double r, s, z, y; - union ldshape u = {x}; - uint32_t ix = (u.i.se & 0x7fffU)<<16 | u.i.m>>48; - int sign = u.i.se >> 15; - - if (ix >= 0x7fff0000) - /* erfc(nan) = nan, erfc(+-inf) = 0,2 */ - return 2*sign + 1/x; - if (ix < 0x3ffed800) { /* |x| < 0.84375 */ - if (ix < 0x3fbe0000) /* |x| < 2**-65 */ - return 1.0 - x; - z = x * x; - r = pp[0] + z * (pp[1] + - z * (pp[2] + z * (pp[3] + z * (pp[4] + z * pp[5])))); - s = qq[0] + z * (qq[1] + - z * (qq[2] + z * (qq[3] + z * (qq[4] + z * (qq[5] + z))))); - y = r / s; - if (ix < 0x3ffd8000) /* x < 1/4 */ - return 1.0 - (x + x * y); - return 0.5 - (x - 0.5 + x * y); - } - if (ix < 0x4005d600) /* |x| < 107 */ - return sign ? 2 - erfc2(ix,x) : erfc2(ix,x); - y = 0x1p-16382L; - return sign ? 2 - y : y*y; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double erfl(long double x) -{ - return erf(x); -} -long double erfcl(long double x) -{ - return erfc(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp.c deleted file mode 100644 index b764d73cf..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Double-precision e^x function. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "exp_data.h" - -#define N (1 << EXP_TABLE_BITS) -#define InvLn2N __exp_data.invln2N -#define NegLn2hiN __exp_data.negln2hiN -#define NegLn2loN __exp_data.negln2loN -#define Shift __exp_data.shift -#define T __exp_data.tab -#define C2 __exp_data.poly[5 - EXP_POLY_ORDER] -#define C3 __exp_data.poly[6 - EXP_POLY_ORDER] -#define C4 __exp_data.poly[7 - EXP_POLY_ORDER] -#define C5 __exp_data.poly[8 - EXP_POLY_ORDER] - -/* Handle cases that may overflow or underflow when computing the result that - is scale*(1+TMP) without intermediate rounding. The bit representation of - scale is in SBITS, however it has a computed exponent that may have - overflown into the sign bit so that needs to be adjusted before using it as - a double. (int32_t)KI is the k used in the argument reduction and exponent - adjustment of scale, positive k here means the result may overflow and - negative k means the result may underflow. */ -static inline double specialcase(double_t tmp, uint64_t sbits, uint64_t ki) -{ - double_t scale, y; - - if ((ki & 0x80000000) == 0) { - /* k > 0, the exponent of scale might have overflowed by <= 460. */ - sbits -= 1009ull << 52; - scale = asdouble(sbits); - y = 0x1p1009 * (scale + scale * tmp); - return eval_as_double(y); - } - /* k < 0, need special care in the subnormal range. */ - sbits += 1022ull << 52; - scale = asdouble(sbits); - y = scale + scale * tmp; - if (y < 1.0) { - /* Round y to the right precision before scaling it into the subnormal - range to avoid double rounding that can cause 0.5+E/2 ulp error where - E is the worst-case ulp error outside the subnormal range. So this - is only useful if the goal is better than 1 ulp worst-case error. */ - double_t hi, lo; - lo = scale - y + scale * tmp; - hi = 1.0 + y; - lo = 1.0 - hi + y + lo; - y = eval_as_double(hi + lo) - 1.0; - /* Avoid -0.0 with downward rounding. */ - if (WANT_ROUNDING && y == 0.0) - y = 0.0; - /* The underflow exception needs to be signaled explicitly. */ - fp_force_eval(fp_barrier(0x1p-1022) * 0x1p-1022); - } - y = 0x1p-1022 * y; - return eval_as_double(y); -} - -/* Top 12 bits of a double (sign and exponent bits). */ -static inline uint32_t top12(double x) -{ - return asuint64(x) >> 52; -} - -double exp(double x) -{ - uint32_t abstop; - uint64_t ki, idx, top, sbits; - double_t kd, z, r, r2, scale, tail, tmp; - - abstop = top12(x) & 0x7ff; - if (predict_false(abstop - top12(0x1p-54) >= top12(512.0) - top12(0x1p-54))) { - if (abstop - top12(0x1p-54) >= 0x80000000) - /* Avoid spurious underflow for tiny x. */ - /* Note: 0 is common input. */ - return WANT_ROUNDING ? 1.0 + x : 1.0; - if (abstop >= top12(1024.0)) { - if (asuint64(x) == asuint64(-INFINITY)) - return 0.0; - if (abstop >= top12(INFINITY)) - return 1.0 + x; - if (asuint64(x) >> 63) - return __math_uflow(0); - else - return __math_oflow(0); - } - /* Large x is special cased below. */ - abstop = 0; - } - - /* exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]. */ - /* x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]. */ - z = InvLn2N * x; -#if TOINT_INTRINSICS - kd = roundtoint(z); - ki = converttoint(z); -#elif EXP_USE_TOINT_NARROW - /* z - kd is in [-0.5-2^-16, 0.5] in all rounding modes. */ - kd = eval_as_double(z + Shift); - ki = asuint64(kd) >> 16; - kd = (double_t)(int32_t)ki; -#else - /* z - kd is in [-1, 1] in non-nearest rounding modes. */ - kd = eval_as_double(z + Shift); - ki = asuint64(kd); - kd -= Shift; -#endif - r = x + kd * NegLn2hiN + kd * NegLn2loN; - /* 2^(k/N) ~= scale * (1 + tail). */ - idx = 2 * (ki % N); - top = ki << (52 - EXP_TABLE_BITS); - tail = asdouble(T[idx]); - /* This is only a valid scale when -1023*N < k < 1024*N. */ - sbits = T[idx + 1] + top; - /* exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1). */ - /* Evaluation is optimized assuming superscalar pipelined execution. */ - r2 = r * r; - /* Without fma the worst case error is 0.25/N ulp larger. */ - /* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */ - tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5); - if (predict_false(abstop == 0)) - return specialcase(tmp, sbits, ki); - scale = asdouble(sbits); - /* Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there - is no spurious underflow here even without fma. */ - return eval_as_double(scale + scale * tmp); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp10.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp10.c deleted file mode 100644 index 26899ebac..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp10.c +++ /dev/null @@ -1,24 +0,0 @@ -#define _GNU_SOURCE -#include -#include - -double exp10(double x) -{ - static const double p10[] = { - 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, - 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, - 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15 - }; - double n, y = modf(x, &n); - union {double f; uint64_t i;} u = {n}; - /* fabs(n) < 16 without raising invalid on nan */ - if ((u.i>>52 & 0x7ff) < 0x3ff+4) { - if (!y) return p10[(int)n+15]; - y = exp2(3.32192809488736234787031942948939 * y); - return y * p10[(int)n+15]; - } - return pow(10.0, x); -} - -weak_alias(exp10, pow10); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp10f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp10f.c deleted file mode 100644 index d009f0a84..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp10f.c +++ /dev/null @@ -1,22 +0,0 @@ -#define _GNU_SOURCE -#include -#include - -float exp10f(float x) -{ - static const float p10[] = { - 1e-7f, 1e-6f, 1e-5f, 1e-4f, 1e-3f, 1e-2f, 1e-1f, - 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7 - }; - float n, y = modff(x, &n); - union {float f; uint32_t i;} u = {n}; - /* fabsf(n) < 8 without raising invalid on nan */ - if ((u.i>>23 & 0xff) < 0x7f+3) { - if (!y) return p10[(int)n+7]; - y = exp2f(3.32192809488736234787031942948939f * y); - return y * p10[(int)n+7]; - } - return exp2(3.32192809488736234787031942948939 * x); -} - -weak_alias(exp10f, pow10f); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp10l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp10l.c deleted file mode 100644 index f3da1a082..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp10l.c +++ /dev/null @@ -1,32 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double exp10l(long double x) -{ - return exp10(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double exp10l(long double x) -{ - static const long double p10[] = { - 1e-15L, 1e-14L, 1e-13L, 1e-12L, 1e-11L, 1e-10L, - 1e-9L, 1e-8L, 1e-7L, 1e-6L, 1e-5L, 1e-4L, 1e-3L, 1e-2L, 1e-1L, - 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15 - }; - long double n, y = modfl(x, &n); - union ldshape u = {n}; - /* fabsl(n) < 16 without raising invalid on nan */ - if ((u.i.se & 0x7fff) < 0x3fff+4) { - if (!y) return p10[(int)n+15]; - y = exp2l(3.32192809488736234787031942948939L * y); - return y * p10[(int)n+15]; - } - return powl(10.0, x); -} -#endif - -weak_alias(exp10l, pow10l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp2.c deleted file mode 100644 index e0ff54bd8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Double-precision 2^x function. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "exp_data.h" - -#define N (1 << EXP_TABLE_BITS) -#define Shift __exp_data.exp2_shift -#define T __exp_data.tab -#define C1 __exp_data.exp2_poly[0] -#define C2 __exp_data.exp2_poly[1] -#define C3 __exp_data.exp2_poly[2] -#define C4 __exp_data.exp2_poly[3] -#define C5 __exp_data.exp2_poly[4] - -/* Handle cases that may overflow or underflow when computing the result that - is scale*(1+TMP) without intermediate rounding. The bit representation of - scale is in SBITS, however it has a computed exponent that may have - overflown into the sign bit so that needs to be adjusted before using it as - a double. (int32_t)KI is the k used in the argument reduction and exponent - adjustment of scale, positive k here means the result may overflow and - negative k means the result may underflow. */ -static inline double specialcase(double_t tmp, uint64_t sbits, uint64_t ki) -{ - double_t scale, y; - - if ((ki & 0x80000000) == 0) { - /* k > 0, the exponent of scale might have overflowed by 1. */ - sbits -= 1ull << 52; - scale = asdouble(sbits); - y = 2 * (scale + scale * tmp); - return eval_as_double(y); - } - /* k < 0, need special care in the subnormal range. */ - sbits += 1022ull << 52; - scale = asdouble(sbits); - y = scale + scale * tmp; - if (y < 1.0) { - /* Round y to the right precision before scaling it into the subnormal - range to avoid double rounding that can cause 0.5+E/2 ulp error where - E is the worst-case ulp error outside the subnormal range. So this - is only useful if the goal is better than 1 ulp worst-case error. */ - double_t hi, lo; - lo = scale - y + scale * tmp; - hi = 1.0 + y; - lo = 1.0 - hi + y + lo; - y = eval_as_double(hi + lo) - 1.0; - /* Avoid -0.0 with downward rounding. */ - if (WANT_ROUNDING && y == 0.0) - y = 0.0; - /* The underflow exception needs to be signaled explicitly. */ - fp_force_eval(fp_barrier(0x1p-1022) * 0x1p-1022); - } - y = 0x1p-1022 * y; - return eval_as_double(y); -} - -/* Top 12 bits of a double (sign and exponent bits). */ -static inline uint32_t top12(double x) -{ - return asuint64(x) >> 52; -} - -double exp2(double x) -{ - uint32_t abstop; - uint64_t ki, idx, top, sbits; - double_t kd, r, r2, scale, tail, tmp; - - abstop = top12(x) & 0x7ff; - if (predict_false(abstop - top12(0x1p-54) >= top12(512.0) - top12(0x1p-54))) { - if (abstop - top12(0x1p-54) >= 0x80000000) - /* Avoid spurious underflow for tiny x. */ - /* Note: 0 is common input. */ - return WANT_ROUNDING ? 1.0 + x : 1.0; - if (abstop >= top12(1024.0)) { - if (asuint64(x) == asuint64(-INFINITY)) - return 0.0; - if (abstop >= top12(INFINITY)) - return 1.0 + x; - if (!(asuint64(x) >> 63)) - return __math_oflow(0); - else if (asuint64(x) >= asuint64(-1075.0)) - return __math_uflow(0); - } - if (2 * asuint64(x) > 2 * asuint64(928.0)) - /* Large x is special cased below. */ - abstop = 0; - } - - /* exp2(x) = 2^(k/N) * 2^r, with 2^r in [2^(-1/2N),2^(1/2N)]. */ - /* x = k/N + r, with int k and r in [-1/2N, 1/2N]. */ - kd = eval_as_double(x + Shift); - ki = asuint64(kd); /* k. */ - kd -= Shift; /* k/N for int k. */ - r = x - kd; - /* 2^(k/N) ~= scale * (1 + tail). */ - idx = 2 * (ki % N); - top = ki << (52 - EXP_TABLE_BITS); - tail = asdouble(T[idx]); - /* This is only a valid scale when -1023*N < k < 1024*N. */ - sbits = T[idx + 1] + top; - /* exp2(x) = 2^(k/N) * 2^r ~= scale + scale * (tail + 2^r - 1). */ - /* Evaluation is optimized assuming superscalar pipelined execution. */ - r2 = r * r; - /* Without fma the worst case error is 0.5/N ulp larger. */ - /* Worst case error is less than 0.5+0.86/N+(abs poly error * 2^53) ulp. */ - tmp = tail + r * C1 + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5); - if (predict_false(abstop == 0)) - return specialcase(tmp, sbits, ki); - scale = asdouble(sbits); - /* Note: tmp == 0 or |tmp| > 2^-65 and scale > 2^-928, so there - is no spurious underflow here even without fma. */ - return eval_as_double(scale + scale * tmp); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f.c deleted file mode 100644 index 0360482ca..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Single-precision 2^x function. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "exp2f_data.h" - -/* -EXP2F_TABLE_BITS = 5 -EXP2F_POLY_ORDER = 3 - -ULP error: 0.502 (nearest rounding.) -Relative error: 1.69 * 2^-34 in [-1/64, 1/64] (before rounding.) -Wrong count: 168353 (all nearest rounding wrong results with fma.) -Non-nearest ULP error: 1 (rounded ULP error) -*/ - -#define N (1 << EXP2F_TABLE_BITS) -#define T __exp2f_data.tab -#define C __exp2f_data.poly -#define SHIFT __exp2f_data.shift_scaled - -static inline uint32_t top12(float x) -{ - return asuint(x) >> 20; -} - -float exp2f(float x) -{ - uint32_t abstop; - uint64_t ki, t; - double_t kd, xd, z, r, r2, y, s; - - xd = (double_t)x; - abstop = top12(x) & 0x7ff; - if (predict_false(abstop >= top12(128.0f))) { - /* |x| >= 128 or x is nan. */ - if (asuint(x) == asuint(-INFINITY)) - return 0.0f; - if (abstop >= top12(INFINITY)) - return x + x; - if (x > 0.0f) - return __math_oflowf(0); - if (x <= -150.0f) - return __math_uflowf(0); - } - - /* x = k/N + r with r in [-1/(2N), 1/(2N)] and int k. */ - kd = eval_as_double(xd + SHIFT); - ki = asuint64(kd); - kd -= SHIFT; /* k/N for int k. */ - r = xd - kd; - - /* exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ - t = T[ki % N]; - t += ki << (52 - EXP2F_TABLE_BITS); - s = asdouble(t); - z = C[0] * r + C[1]; - r2 = r * r; - y = C[2] * r + 1; - y = z * r2 + y; - y = y * s; - return eval_as_float(y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.c deleted file mode 100644 index be324727f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Shared data between expf, exp2f and powf. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "exp2f_data.h" - -#define N (1 << EXP2F_TABLE_BITS) - -const struct exp2f_data __exp2f_data = { - /* tab[i] = uint(2^(i/N)) - (i << 52-BITS) - used for computing 2^(k/N) for an int |k| < 150 N as - double(tab[k%N] + (k << 52-BITS)) */ - .tab = { -0x3ff0000000000000, 0x3fefd9b0d3158574, 0x3fefb5586cf9890f, 0x3fef9301d0125b51, -0x3fef72b83c7d517b, 0x3fef54873168b9aa, 0x3fef387a6e756238, 0x3fef1e9df51fdee1, -0x3fef06fe0a31b715, 0x3feef1a7373aa9cb, 0x3feedea64c123422, 0x3feece086061892d, -0x3feebfdad5362a27, 0x3feeb42b569d4f82, 0x3feeab07dd485429, 0x3feea47eb03a5585, -0x3feea09e667f3bcd, 0x3fee9f75e8ec5f74, 0x3feea11473eb0187, 0x3feea589994cce13, -0x3feeace5422aa0db, 0x3feeb737b0cdc5e5, 0x3feec49182a3f090, 0x3feed503b23e255d, -0x3feee89f995ad3ad, 0x3feeff76f2fb5e47, 0x3fef199bdd85529c, 0x3fef3720dcef9069, -0x3fef5818dcfba487, 0x3fef7c97337b9b5f, 0x3fefa4afa2a490da, 0x3fefd0765b6e4540, - }, - .shift_scaled = 0x1.8p+52 / N, - .poly = { - 0x1.c6af84b912394p-5, 0x1.ebfce50fac4f3p-3, 0x1.62e42ff0c52d6p-1, - }, - .shift = 0x1.8p+52, - .invln2_scaled = 0x1.71547652b82fep+0 * N, - .poly_scaled = { - 0x1.c6af84b912394p-5/N/N/N, 0x1.ebfce50fac4f3p-3/N/N, 0x1.62e42ff0c52d6p-1/N, - }, -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.h deleted file mode 100644 index fe744f15b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _EXP2F_DATA_H -#define _EXP2F_DATA_H - -#include -#include - -/* Shared between expf, exp2f and powf. */ -#define EXP2F_TABLE_BITS 5 -#define EXP2F_POLY_ORDER 3 -extern hidden const struct exp2f_data { - uint64_t tab[1 << EXP2F_TABLE_BITS]; - double shift_scaled; - double poly[EXP2F_POLY_ORDER]; - double shift; - double invln2_scaled; - double poly_scaled[EXP2F_POLY_ORDER]; -} __exp2f_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp2l.c deleted file mode 100644 index 3565c1e67..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp2l.c +++ /dev/null @@ -1,619 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/ld80/s_exp2l.c and /usr/src/lib/msun/ld128/s_exp2l.c */ -/*- - * Copyright (c) 2005-2008 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double exp2l(long double x) -{ - return exp2(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -#define TBLBITS 7 -#define TBLSIZE (1 << TBLBITS) - -static const double -redux = 0x1.8p63 / TBLSIZE, -P1 = 0x1.62e42fefa39efp-1, -P2 = 0x1.ebfbdff82c58fp-3, -P3 = 0x1.c6b08d7049fap-5, -P4 = 0x1.3b2ab6fba4da5p-7, -P5 = 0x1.5d8804780a736p-10, -P6 = 0x1.430918835e33dp-13; - -static const double tbl[TBLSIZE * 2] = { - 0x1.6a09e667f3bcdp-1, -0x1.bdd3413b2648p-55, - 0x1.6c012750bdabfp-1, -0x1.2895667ff0cp-57, - 0x1.6dfb23c651a2fp-1, -0x1.bbe3a683c88p-58, - 0x1.6ff7df9519484p-1, -0x1.83c0f25860fp-56, - 0x1.71f75e8ec5f74p-1, -0x1.16e4786887bp-56, - 0x1.73f9a48a58174p-1, -0x1.0a8d96c65d5p-55, - 0x1.75feb564267c9p-1, -0x1.0245957316ep-55, - 0x1.780694fde5d3fp-1, 0x1.866b80a0216p-55, - 0x1.7a11473eb0187p-1, -0x1.41577ee0499p-56, - 0x1.7c1ed0130c132p-1, 0x1.f124cd1164ep-55, - 0x1.7e2f336cf4e62p-1, 0x1.05d02ba157ap-57, - 0x1.80427543e1a12p-1, -0x1.27c86626d97p-55, - 0x1.82589994cce13p-1, -0x1.d4c1dd41533p-55, - 0x1.8471a4623c7adp-1, -0x1.8d684a341cep-56, - 0x1.868d99b4492edp-1, -0x1.fc6f89bd4f68p-55, - 0x1.88ac7d98a6699p-1, 0x1.994c2f37cb5p-55, - 0x1.8ace5422aa0dbp-1, 0x1.6e9f156864bp-55, - 0x1.8cf3216b5448cp-1, -0x1.0d55e32e9e4p-57, - 0x1.8f1ae99157736p-1, 0x1.5cc13a2e397p-56, - 0x1.9145b0b91ffc6p-1, -0x1.dd6792e5825p-55, - 0x1.93737b0cdc5e5p-1, -0x1.75fc781b58p-58, - 0x1.95a44cbc8520fp-1, -0x1.64b7c96a5fp-57, - 0x1.97d829fde4e5p-1, -0x1.d185b7c1b86p-55, - 0x1.9a0f170ca07bap-1, -0x1.173bd91cee6p-55, - 0x1.9c49182a3f09p-1, 0x1.c7c46b071f2p-57, - 0x1.9e86319e32323p-1, 0x1.824ca78e64cp-57, - 0x1.a0c667b5de565p-1, -0x1.359495d1cd5p-55, - 0x1.a309bec4a2d33p-1, 0x1.6305c7ddc368p-55, - 0x1.a5503b23e255dp-1, -0x1.d2f6edb8d42p-55, - 0x1.a799e1330b358p-1, 0x1.bcb7ecac564p-55, - 0x1.a9e6b5579fdbfp-1, 0x1.0fac90ef7fdp-55, - 0x1.ac36bbfd3f37ap-1, -0x1.f9234cae76dp-56, - 0x1.ae89f995ad3adp-1, 0x1.7a1cd345dcc8p-55, - 0x1.b0e07298db666p-1, -0x1.bdef54c80e4p-55, - 0x1.b33a2b84f15fbp-1, -0x1.2805e3084d8p-58, - 0x1.b59728de5593ap-1, -0x1.c71dfbbba6ep-55, - 0x1.b7f76f2fb5e47p-1, -0x1.5584f7e54acp-57, - 0x1.ba5b030a1064ap-1, -0x1.efcd30e5429p-55, - 0x1.bcc1e904bc1d2p-1, 0x1.23dd07a2d9fp-56, - 0x1.bf2c25bd71e09p-1, -0x1.efdca3f6b9c8p-55, - 0x1.c199bdd85529cp-1, 0x1.11065895049p-56, - 0x1.c40ab5fffd07ap-1, 0x1.b4537e083c6p-55, - 0x1.c67f12e57d14bp-1, 0x1.2884dff483c8p-55, - 0x1.c8f6d9406e7b5p-1, 0x1.1acbc48805cp-57, - 0x1.cb720dcef9069p-1, 0x1.503cbd1e94ap-57, - 0x1.cdf0b555dc3fap-1, -0x1.dd83b53829dp-56, - 0x1.d072d4a07897cp-1, -0x1.cbc3743797a8p-55, - 0x1.d2f87080d89f2p-1, -0x1.d487b719d858p-55, - 0x1.d5818dcfba487p-1, 0x1.2ed02d75b37p-56, - 0x1.d80e316c98398p-1, -0x1.11ec18bedep-55, - 0x1.da9e603db3285p-1, 0x1.c2300696db5p-55, - 0x1.dd321f301b46p-1, 0x1.2da5778f019p-55, - 0x1.dfc97337b9b5fp-1, -0x1.1a5cd4f184b8p-55, - 0x1.e264614f5a129p-1, -0x1.7b627817a148p-55, - 0x1.e502ee78b3ff6p-1, 0x1.39e8980a9cdp-56, - 0x1.e7a51fbc74c83p-1, 0x1.2d522ca0c8ep-55, - 0x1.ea4afa2a490dap-1, -0x1.e9c23179c288p-55, - 0x1.ecf482d8e67f1p-1, -0x1.c93f3b411ad8p-55, - 0x1.efa1bee615a27p-1, 0x1.dc7f486a4b68p-55, - 0x1.f252b376bba97p-1, 0x1.3a1a5bf0d8e8p-55, - 0x1.f50765b6e454p-1, 0x1.9d3e12dd8a18p-55, - 0x1.f7bfdad9cbe14p-1, -0x1.dbb12d00635p-55, - 0x1.fa7c1819e90d8p-1, 0x1.74853f3a593p-56, - 0x1.fd3c22b8f71f1p-1, 0x1.2eb74966578p-58, - 0x1p+0, 0x0p+0, - 0x1.0163da9fb3335p+0, 0x1.b61299ab8cd8p-54, - 0x1.02c9a3e778061p+0, -0x1.19083535b08p-56, - 0x1.04315e86e7f85p+0, -0x1.0a31c1977c98p-54, - 0x1.059b0d3158574p+0, 0x1.d73e2a475b4p-55, - 0x1.0706b29ddf6dep+0, -0x1.c91dfe2b13cp-55, - 0x1.0874518759bc8p+0, 0x1.186be4bb284p-57, - 0x1.09e3ecac6f383p+0, 0x1.14878183161p-54, - 0x1.0b5586cf9890fp+0, 0x1.8a62e4adc61p-54, - 0x1.0cc922b7247f7p+0, 0x1.01edc16e24f8p-54, - 0x1.0e3ec32d3d1a2p+0, 0x1.03a1727c58p-59, - 0x1.0fb66affed31bp+0, -0x1.b9bedc44ebcp-57, - 0x1.11301d0125b51p+0, -0x1.6c51039449bp-54, - 0x1.12abdc06c31ccp+0, -0x1.1b514b36ca8p-58, - 0x1.1429aaea92dep+0, -0x1.32fbf9af1368p-54, - 0x1.15a98c8a58e51p+0, 0x1.2406ab9eeabp-55, - 0x1.172b83c7d517bp+0, -0x1.19041b9d78ap-55, - 0x1.18af9388c8deap+0, -0x1.11023d1970f8p-54, - 0x1.1a35beb6fcb75p+0, 0x1.e5b4c7b4969p-55, - 0x1.1bbe084045cd4p+0, -0x1.95386352ef6p-54, - 0x1.1d4873168b9aap+0, 0x1.e016e00a264p-54, - 0x1.1ed5022fcd91dp+0, -0x1.1df98027bb78p-54, - 0x1.2063b88628cd6p+0, 0x1.dc775814a85p-55, - 0x1.21f49917ddc96p+0, 0x1.2a97e9494a6p-55, - 0x1.2387a6e756238p+0, 0x1.9b07eb6c7058p-54, - 0x1.251ce4fb2a63fp+0, 0x1.ac155bef4f5p-55, - 0x1.26b4565e27cddp+0, 0x1.2bd339940eap-55, - 0x1.284dfe1f56381p+0, -0x1.a4c3a8c3f0d8p-54, - 0x1.29e9df51fdee1p+0, 0x1.612e8afad12p-55, - 0x1.2b87fd0dad99p+0, -0x1.10adcd6382p-59, - 0x1.2d285a6e4030bp+0, 0x1.0024754db42p-54, - 0x1.2ecafa93e2f56p+0, 0x1.1ca0f45d524p-56, - 0x1.306fe0a31b715p+0, 0x1.6f46ad23183p-55, - 0x1.32170fc4cd831p+0, 0x1.a9ce78e1804p-55, - 0x1.33c08b26416ffp+0, 0x1.327218436598p-54, - 0x1.356c55f929ff1p+0, -0x1.b5cee5c4e46p-55, - 0x1.371a7373aa9cbp+0, -0x1.63aeabf42ebp-54, - 0x1.38cae6d05d866p+0, -0x1.e958d3c99048p-54, - 0x1.3a7db34e59ff7p+0, -0x1.5e436d661f6p-56, - 0x1.3c32dc313a8e5p+0, -0x1.efff8375d2ap-54, - 0x1.3dea64c123422p+0, 0x1.ada0911f09fp-55, - 0x1.3fa4504ac801cp+0, -0x1.7d023f956fap-54, - 0x1.4160a21f72e2ap+0, -0x1.ef3691c309p-58, - 0x1.431f5d950a897p+0, -0x1.1c7dde35f7ap-55, - 0x1.44e086061892dp+0, 0x1.89b7a04ef8p-59, - 0x1.46a41ed1d0057p+0, 0x1.c944bd1648a8p-54, - 0x1.486a2b5c13cdp+0, 0x1.3c1a3b69062p-56, - 0x1.4a32af0d7d3dep+0, 0x1.9cb62f3d1be8p-54, - 0x1.4bfdad5362a27p+0, 0x1.d4397afec42p-56, - 0x1.4dcb299fddd0dp+0, 0x1.8ecdbbc6a78p-54, - 0x1.4f9b2769d2ca7p+0, -0x1.4b309d25958p-54, - 0x1.516daa2cf6642p+0, -0x1.f768569bd94p-55, - 0x1.5342b569d4f82p+0, -0x1.07abe1db13dp-55, - 0x1.551a4ca5d920fp+0, -0x1.d689cefede6p-55, - 0x1.56f4736b527dap+0, 0x1.9bb2c011d938p-54, - 0x1.58d12d497c7fdp+0, 0x1.295e15b9a1ep-55, - 0x1.5ab07dd485429p+0, 0x1.6324c0546478p-54, - 0x1.5c9268a5946b7p+0, 0x1.c4b1b81698p-60, - 0x1.5e76f15ad2148p+0, 0x1.ba6f93080e68p-54, - 0x1.605e1b976dc09p+0, -0x1.3e2429b56de8p-54, - 0x1.6247eb03a5585p+0, -0x1.383c17e40b48p-54, - 0x1.6434634ccc32p+0, -0x1.c483c759d89p-55, - 0x1.6623882552225p+0, -0x1.bb60987591cp-54, - 0x1.68155d44ca973p+0, 0x1.038ae44f74p-57, -}; - -/* - * exp2l(x): compute the base 2 exponential of x - * - * Accuracy: Peak error < 0.511 ulp. - * - * Method: (equally-spaced tables) - * - * Reduce x: - * x = 2**k + y, for integer k and |y| <= 1/2. - * Thus we have exp2l(x) = 2**k * exp2(y). - * - * Reduce y: - * y = i/TBLSIZE + z for integer i near y * TBLSIZE. - * Thus we have exp2(y) = exp2(i/TBLSIZE) * exp2(z), - * with |z| <= 2**-(TBLBITS+1). - * - * We compute exp2(i/TBLSIZE) via table lookup and exp2(z) via a - * degree-6 minimax polynomial with maximum error under 2**-69. - * The table entries each have 104 bits of accuracy, encoded as - * a pair of double precision values. - */ -long double exp2l(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - long double r, z; - uint32_t i0; - union {uint32_t u; int32_t i;} k; - - /* Filter out exceptional cases. */ - if (e >= 0x3fff + 13) { /* |x| >= 8192 or x is NaN */ - if (u.i.se >= 0x3fff + 14 && u.i.se >> 15 == 0) - /* overflow */ - return x * 0x1p16383L; - if (e == 0x7fff) /* -inf or -nan */ - return -1/x; - if (x < -16382) { - if (x <= -16446 || x - 0x1p63 + 0x1p63 != x) - /* underflow */ - FORCE_EVAL((float)(-0x1p-149/x)); - if (x <= -16446) - return 0; - } - } else if (e < 0x3fff - 64) { - return 1 + x; - } - - /* - * Reduce x, computing z, i0, and k. The low bits of x + redux - * contain the 16-bit integer part of the exponent (k) followed by - * TBLBITS fractional bits (i0). We use bit tricks to extract these - * as integers, then set z to the remainder. - * - * Example: Suppose x is 0xabc.123456p0 and TBLBITS is 8. - * Then the low-order word of x + redux is 0x000abc12, - * We split this into k = 0xabc and i0 = 0x12 (adjusted to - * index into the table), then we compute z = 0x0.003456p0. - */ - u.f = x + redux; - i0 = u.i.m + TBLSIZE / 2; - k.u = i0 / TBLSIZE * TBLSIZE; - k.i /= TBLSIZE; - i0 %= TBLSIZE; - u.f -= redux; - z = x - u.f; - - /* Compute r = exp2l(y) = exp2lt[i0] * p(z). */ - long double t_hi = tbl[2*i0]; - long double t_lo = tbl[2*i0 + 1]; - /* XXX This gives > 1 ulp errors outside of FE_TONEAREST mode */ - r = t_lo + (t_hi + t_lo) * z * (P1 + z * (P2 + z * (P3 + z * (P4 - + z * (P5 + z * P6))))) + t_hi; - - return scalbnl(r, k.i); -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -#define TBLBITS 7 -#define TBLSIZE (1 << TBLBITS) - -static const long double - P1 = 0x1.62e42fefa39ef35793c7673007e6p-1L, - P2 = 0x1.ebfbdff82c58ea86f16b06ec9736p-3L, - P3 = 0x1.c6b08d704a0bf8b33a762bad3459p-5L, - P4 = 0x1.3b2ab6fba4e7729ccbbe0b4f3fc2p-7L, - P5 = 0x1.5d87fe78a67311071dee13fd11d9p-10L, - P6 = 0x1.430912f86c7876f4b663b23c5fe5p-13L; - -static const double - P7 = 0x1.ffcbfc588b041p-17, - P8 = 0x1.62c0223a5c7c7p-20, - P9 = 0x1.b52541ff59713p-24, - P10 = 0x1.e4cf56a391e22p-28, - redux = 0x1.8p112 / TBLSIZE; - -static const long double tbl[TBLSIZE] = { - 0x1.6a09e667f3bcc908b2fb1366dfeap-1L, - 0x1.6c012750bdabeed76a99800f4edep-1L, - 0x1.6dfb23c651a2ef220e2cbe1bc0d4p-1L, - 0x1.6ff7df9519483cf87e1b4f3e1e98p-1L, - 0x1.71f75e8ec5f73dd2370f2ef0b148p-1L, - 0x1.73f9a48a58173bd5c9a4e68ab074p-1L, - 0x1.75feb564267c8bf6e9aa33a489a8p-1L, - 0x1.780694fde5d3f619ae02808592a4p-1L, - 0x1.7a11473eb0186d7d51023f6ccb1ap-1L, - 0x1.7c1ed0130c1327c49334459378dep-1L, - 0x1.7e2f336cf4e62105d02ba1579756p-1L, - 0x1.80427543e1a11b60de67649a3842p-1L, - 0x1.82589994cce128acf88afab34928p-1L, - 0x1.8471a4623c7acce52f6b97c6444cp-1L, - 0x1.868d99b4492ec80e41d90ac2556ap-1L, - 0x1.88ac7d98a669966530bcdf2d4cc0p-1L, - 0x1.8ace5422aa0db5ba7c55a192c648p-1L, - 0x1.8cf3216b5448bef2aa1cd161c57ap-1L, - 0x1.8f1ae991577362b982745c72eddap-1L, - 0x1.9145b0b91ffc588a61b469f6b6a0p-1L, - 0x1.93737b0cdc5e4f4501c3f2540ae8p-1L, - 0x1.95a44cbc8520ee9b483695a0e7fep-1L, - 0x1.97d829fde4e4f8b9e920f91e8eb6p-1L, - 0x1.9a0f170ca07b9ba3109b8c467844p-1L, - 0x1.9c49182a3f0901c7c46b071f28dep-1L, - 0x1.9e86319e323231824ca78e64c462p-1L, - 0x1.a0c667b5de564b29ada8b8cabbacp-1L, - 0x1.a309bec4a2d3358c171f770db1f4p-1L, - 0x1.a5503b23e255c8b424491caf88ccp-1L, - 0x1.a799e1330b3586f2dfb2b158f31ep-1L, - 0x1.a9e6b5579fdbf43eb243bdff53a2p-1L, - 0x1.ac36bbfd3f379c0db966a3126988p-1L, - 0x1.ae89f995ad3ad5e8734d17731c80p-1L, - 0x1.b0e07298db66590842acdfc6fb4ep-1L, - 0x1.b33a2b84f15faf6bfd0e7bd941b0p-1L, - 0x1.b59728de559398e3881111648738p-1L, - 0x1.b7f76f2fb5e46eaa7b081ab53ff6p-1L, - 0x1.ba5b030a10649840cb3c6af5b74cp-1L, - 0x1.bcc1e904bc1d2247ba0f45b3d06cp-1L, - 0x1.bf2c25bd71e088408d7025190cd0p-1L, - 0x1.c199bdd85529c2220cb12a0916bap-1L, - 0x1.c40ab5fffd07a6d14df820f17deap-1L, - 0x1.c67f12e57d14b4a2137fd20f2a26p-1L, - 0x1.c8f6d9406e7b511acbc48805c3f6p-1L, - 0x1.cb720dcef90691503cbd1e949d0ap-1L, - 0x1.cdf0b555dc3f9c44f8958fac4f12p-1L, - 0x1.d072d4a07897b8d0f22f21a13792p-1L, - 0x1.d2f87080d89f18ade123989ea50ep-1L, - 0x1.d5818dcfba48725da05aeb66dff8p-1L, - 0x1.d80e316c98397bb84f9d048807a0p-1L, - 0x1.da9e603db3285708c01a5b6d480cp-1L, - 0x1.dd321f301b4604b695de3c0630c0p-1L, - 0x1.dfc97337b9b5eb968cac39ed284cp-1L, - 0x1.e264614f5a128a12761fa17adc74p-1L, - 0x1.e502ee78b3ff6273d130153992d0p-1L, - 0x1.e7a51fbc74c834b548b2832378a4p-1L, - 0x1.ea4afa2a490d9858f73a18f5dab4p-1L, - 0x1.ecf482d8e67f08db0312fb949d50p-1L, - 0x1.efa1bee615a27771fd21a92dabb6p-1L, - 0x1.f252b376bba974e8696fc3638f24p-1L, - 0x1.f50765b6e4540674f84b762861a6p-1L, - 0x1.f7bfdad9cbe138913b4bfe72bd78p-1L, - 0x1.fa7c1819e90d82e90a7e74b26360p-1L, - 0x1.fd3c22b8f71f10975ba4b32bd006p-1L, - 0x1.0000000000000000000000000000p+0L, - 0x1.0163da9fb33356d84a66ae336e98p+0L, - 0x1.02c9a3e778060ee6f7caca4f7a18p+0L, - 0x1.04315e86e7f84bd738f9a20da442p+0L, - 0x1.059b0d31585743ae7c548eb68c6ap+0L, - 0x1.0706b29ddf6ddc6dc403a9d87b1ep+0L, - 0x1.0874518759bc808c35f25d942856p+0L, - 0x1.09e3ecac6f3834521e060c584d5cp+0L, - 0x1.0b5586cf9890f6298b92b7184200p+0L, - 0x1.0cc922b7247f7407b705b893dbdep+0L, - 0x1.0e3ec32d3d1a2020742e4f8af794p+0L, - 0x1.0fb66affed31af232091dd8a169ep+0L, - 0x1.11301d0125b50a4ebbf1aed9321cp+0L, - 0x1.12abdc06c31cbfb92bad324d6f84p+0L, - 0x1.1429aaea92ddfb34101943b2588ep+0L, - 0x1.15a98c8a58e512480d573dd562aep+0L, - 0x1.172b83c7d517adcdf7c8c50eb162p+0L, - 0x1.18af9388c8de9bbbf70b9a3c269cp+0L, - 0x1.1a35beb6fcb753cb698f692d2038p+0L, - 0x1.1bbe084045cd39ab1e72b442810ep+0L, - 0x1.1d4873168b9aa7805b8028990be8p+0L, - 0x1.1ed5022fcd91cb8819ff61121fbep+0L, - 0x1.2063b88628cd63b8eeb0295093f6p+0L, - 0x1.21f49917ddc962552fd29294bc20p+0L, - 0x1.2387a6e75623866c1fadb1c159c0p+0L, - 0x1.251ce4fb2a63f3582ab7de9e9562p+0L, - 0x1.26b4565e27cdd257a673281d3068p+0L, - 0x1.284dfe1f5638096cf15cf03c9fa0p+0L, - 0x1.29e9df51fdee12c25d15f5a25022p+0L, - 0x1.2b87fd0dad98ffddea46538fca24p+0L, - 0x1.2d285a6e4030b40091d536d0733ep+0L, - 0x1.2ecafa93e2f5611ca0f45d5239a4p+0L, - 0x1.306fe0a31b7152de8d5a463063bep+0L, - 0x1.32170fc4cd8313539cf1c3009330p+0L, - 0x1.33c08b26416ff4c9c8610d96680ep+0L, - 0x1.356c55f929ff0c94623476373be4p+0L, - 0x1.371a7373aa9caa7145502f45452ap+0L, - 0x1.38cae6d05d86585a9cb0d9bed530p+0L, - 0x1.3a7db34e59ff6ea1bc9299e0a1fep+0L, - 0x1.3c32dc313a8e484001f228b58cf0p+0L, - 0x1.3dea64c12342235b41223e13d7eep+0L, - 0x1.3fa4504ac801ba0bf701aa417b9cp+0L, - 0x1.4160a21f72e29f84325b8f3dbacap+0L, - 0x1.431f5d950a896dc704439410b628p+0L, - 0x1.44e086061892d03136f409df0724p+0L, - 0x1.46a41ed1d005772512f459229f0ap+0L, - 0x1.486a2b5c13cd013c1a3b69062f26p+0L, - 0x1.4a32af0d7d3de672d8bcf46f99b4p+0L, - 0x1.4bfdad5362a271d4397afec42e36p+0L, - 0x1.4dcb299fddd0d63b36ef1a9e19dep+0L, - 0x1.4f9b2769d2ca6ad33d8b69aa0b8cp+0L, - 0x1.516daa2cf6641c112f52c84d6066p+0L, - 0x1.5342b569d4f81df0a83c49d86bf4p+0L, - 0x1.551a4ca5d920ec52ec620243540cp+0L, - 0x1.56f4736b527da66ecb004764e61ep+0L, - 0x1.58d12d497c7fd252bc2b7343d554p+0L, - 0x1.5ab07dd48542958c93015191e9a8p+0L, - 0x1.5c9268a5946b701c4b1b81697ed4p+0L, - 0x1.5e76f15ad21486e9be4c20399d12p+0L, - 0x1.605e1b976dc08b076f592a487066p+0L, - 0x1.6247eb03a5584b1f0fa06fd2d9eap+0L, - 0x1.6434634ccc31fc76f8714c4ee122p+0L, - 0x1.66238825522249127d9e29b92ea2p+0L, - 0x1.68155d44ca973081c57227b9f69ep+0L, -}; - -static const float eps[TBLSIZE] = { - -0x1.5c50p-101, - -0x1.5d00p-106, - 0x1.8e90p-102, - -0x1.5340p-103, - 0x1.1bd0p-102, - -0x1.4600p-105, - -0x1.7a40p-104, - 0x1.d590p-102, - -0x1.d590p-101, - 0x1.b100p-103, - -0x1.0d80p-105, - 0x1.6b00p-103, - -0x1.9f00p-105, - 0x1.c400p-103, - 0x1.e120p-103, - -0x1.c100p-104, - -0x1.9d20p-103, - 0x1.a800p-108, - 0x1.4c00p-106, - -0x1.9500p-106, - 0x1.6900p-105, - -0x1.29d0p-100, - 0x1.4c60p-103, - 0x1.13a0p-102, - -0x1.5b60p-103, - -0x1.1c40p-103, - 0x1.db80p-102, - 0x1.91a0p-102, - 0x1.dc00p-105, - 0x1.44c0p-104, - 0x1.9710p-102, - 0x1.8760p-103, - -0x1.a720p-103, - 0x1.ed20p-103, - -0x1.49c0p-102, - -0x1.e000p-111, - 0x1.86a0p-103, - 0x1.2b40p-103, - -0x1.b400p-108, - 0x1.1280p-99, - -0x1.02d8p-102, - -0x1.e3d0p-103, - -0x1.b080p-105, - -0x1.f100p-107, - -0x1.16c0p-105, - -0x1.1190p-103, - -0x1.a7d2p-100, - 0x1.3450p-103, - -0x1.67c0p-105, - 0x1.4b80p-104, - -0x1.c4e0p-103, - 0x1.6000p-108, - -0x1.3f60p-105, - 0x1.93f0p-104, - 0x1.5fe0p-105, - 0x1.6f80p-107, - -0x1.7600p-106, - 0x1.21e0p-106, - -0x1.3a40p-106, - -0x1.40c0p-104, - -0x1.9860p-105, - -0x1.5d40p-108, - -0x1.1d70p-106, - 0x1.2760p-105, - 0x0.0000p+0, - 0x1.21e2p-104, - -0x1.9520p-108, - -0x1.5720p-106, - -0x1.4810p-106, - -0x1.be00p-109, - 0x1.0080p-105, - -0x1.5780p-108, - -0x1.d460p-105, - -0x1.6140p-105, - 0x1.4630p-104, - 0x1.ad50p-103, - 0x1.82e0p-105, - 0x1.1d3cp-101, - 0x1.6100p-107, - 0x1.ec30p-104, - 0x1.f200p-108, - 0x1.0b40p-103, - 0x1.3660p-102, - 0x1.d9d0p-103, - -0x1.02d0p-102, - 0x1.b070p-103, - 0x1.b9c0p-104, - -0x1.01c0p-103, - -0x1.dfe0p-103, - 0x1.1b60p-104, - -0x1.ae94p-101, - -0x1.3340p-104, - 0x1.b3d8p-102, - -0x1.6e40p-105, - -0x1.3670p-103, - 0x1.c140p-104, - 0x1.1840p-101, - 0x1.1ab0p-102, - -0x1.a400p-104, - 0x1.1f00p-104, - -0x1.7180p-103, - 0x1.4ce0p-102, - 0x1.9200p-107, - -0x1.54c0p-103, - 0x1.1b80p-105, - -0x1.1828p-101, - 0x1.5720p-102, - -0x1.a060p-100, - 0x1.9160p-102, - 0x1.a280p-104, - 0x1.3400p-107, - 0x1.2b20p-102, - 0x1.7800p-108, - 0x1.cfd0p-101, - 0x1.2ef0p-102, - -0x1.2760p-99, - 0x1.b380p-104, - 0x1.0048p-101, - -0x1.60b0p-102, - 0x1.a1ccp-100, - -0x1.a640p-104, - -0x1.08a0p-101, - 0x1.7e60p-102, - 0x1.22c0p-103, - -0x1.7200p-106, - 0x1.f0f0p-102, - 0x1.eb4ep-99, - 0x1.c6e0p-103, -}; - -/* - * exp2l(x): compute the base 2 exponential of x - * - * Accuracy: Peak error < 0.502 ulp. - * - * Method: (accurate tables) - * - * Reduce x: - * x = 2**k + y, for integer k and |y| <= 1/2. - * Thus we have exp2(x) = 2**k * exp2(y). - * - * Reduce y: - * y = i/TBLSIZE + z - eps[i] for integer i near y * TBLSIZE. - * Thus we have exp2(y) = exp2(i/TBLSIZE) * exp2(z - eps[i]), - * with |z - eps[i]| <= 2**-8 + 2**-98 for the table used. - * - * We compute exp2(i/TBLSIZE) via table lookup and exp2(z - eps[i]) via - * a degree-10 minimax polynomial with maximum error under 2**-120. - * The values in exp2t[] and eps[] are chosen such that - * exp2t[i] = exp2(i/TBLSIZE + eps[i]), and eps[i] is a small offset such - * that exp2t[i] is accurate to 2**-122. - * - * Note that the range of i is +-TBLSIZE/2, so we actually index the tables - * by i0 = i + TBLSIZE/2. - * - * This method is due to Gal, with many details due to Gal and Bachelis: - * - * Gal, S. and Bachelis, B. An Accurate Elementary Mathematical Library - * for the IEEE Floating Point Standard. TOMS 17(1), 26-46 (1991). - */ -long double -exp2l(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - long double r, z, t; - uint32_t i0; - union {uint32_t u; int32_t i;} k; - - /* Filter out exceptional cases. */ - if (e >= 0x3fff + 14) { /* |x| >= 16384 or x is NaN */ - if (u.i.se >= 0x3fff + 15 && u.i.se >> 15 == 0) - /* overflow */ - return x * 0x1p16383L; - if (e == 0x7fff) /* -inf or -nan */ - return -1/x; - if (x < -16382) { - if (x <= -16495 || x - 0x1p112 + 0x1p112 != x) - /* underflow */ - FORCE_EVAL((float)(-0x1p-149/x)); - if (x <= -16446) - return 0; - } - } else if (e < 0x3fff - 114) { - return 1 + x; - } - - /* - * Reduce x, computing z, i0, and k. The low bits of x + redux - * contain the 16-bit integer part of the exponent (k) followed by - * TBLBITS fractional bits (i0). We use bit tricks to extract these - * as integers, then set z to the remainder. - * - * Example: Suppose x is 0xabc.123456p0 and TBLBITS is 8. - * Then the low-order word of x + redux is 0x000abc12, - * We split this into k = 0xabc and i0 = 0x12 (adjusted to - * index into the table), then we compute z = 0x0.003456p0. - */ - u.f = x + redux; - i0 = u.i2.lo + TBLSIZE / 2; - k.u = i0 / TBLSIZE * TBLSIZE; - k.i /= TBLSIZE; - i0 %= TBLSIZE; - u.f -= redux; - z = x - u.f; - - /* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */ - t = tbl[i0]; - z -= eps[i0]; - r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * (P5 + z * (P6 - + z * (P7 + z * (P8 + z * (P9 + z * P10))))))))); - - return scalbnl(r, k.i); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.c deleted file mode 100644 index 21be0146a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Shared data between exp, exp2 and pow. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "exp_data.h" - -#define N (1 << EXP_TABLE_BITS) - -const struct exp_data __exp_data = { -// N/ln2 -.invln2N = 0x1.71547652b82fep0 * N, -// -ln2/N -.negln2hiN = -0x1.62e42fefa0000p-8, -.negln2loN = -0x1.cf79abc9e3b3ap-47, -// Used for rounding when !TOINT_INTRINSICS -#if EXP_USE_TOINT_NARROW -.shift = 0x1800000000.8p0, -#else -.shift = 0x1.8p52, -#endif -// exp polynomial coefficients. -.poly = { -// abs error: 1.555*2^-66 -// ulp error: 0.509 (0.511 without fma) -// if |x| < ln2/256+eps -// abs error if |x| < ln2/256+0x1p-15: 1.09*2^-65 -// abs error if |x| < ln2/128: 1.7145*2^-56 -0x1.ffffffffffdbdp-2, -0x1.555555555543cp-3, -0x1.55555cf172b91p-5, -0x1.1111167a4d017p-7, -}, -.exp2_shift = 0x1.8p52 / N, -// exp2 polynomial coefficients. -.exp2_poly = { -// abs error: 1.2195*2^-65 -// ulp error: 0.507 (0.511 without fma) -// if |x| < 1/256 -// abs error if |x| < 1/128: 1.9941*2^-56 -0x1.62e42fefa39efp-1, -0x1.ebfbdff82c424p-3, -0x1.c6b08d70cf4b5p-5, -0x1.3b2abd24650ccp-7, -0x1.5d7e09b4e3a84p-10, -}, -// 2^(k/N) ~= H[k]*(1 + T[k]) for int k in [0,N) -// tab[2*k] = asuint64(T[k]) -// tab[2*k+1] = asuint64(H[k]) - (k << 52)/N -.tab = { -0x0, 0x3ff0000000000000, -0x3c9b3b4f1a88bf6e, 0x3feff63da9fb3335, -0xbc7160139cd8dc5d, 0x3fefec9a3e778061, -0xbc905e7a108766d1, 0x3fefe315e86e7f85, -0x3c8cd2523567f613, 0x3fefd9b0d3158574, -0xbc8bce8023f98efa, 0x3fefd06b29ddf6de, -0x3c60f74e61e6c861, 0x3fefc74518759bc8, -0x3c90a3e45b33d399, 0x3fefbe3ecac6f383, -0x3c979aa65d837b6d, 0x3fefb5586cf9890f, -0x3c8eb51a92fdeffc, 0x3fefac922b7247f7, -0x3c3ebe3d702f9cd1, 0x3fefa3ec32d3d1a2, -0xbc6a033489906e0b, 0x3fef9b66affed31b, -0xbc9556522a2fbd0e, 0x3fef9301d0125b51, -0xbc5080ef8c4eea55, 0x3fef8abdc06c31cc, -0xbc91c923b9d5f416, 0x3fef829aaea92de0, -0x3c80d3e3e95c55af, 0x3fef7a98c8a58e51, -0xbc801b15eaa59348, 0x3fef72b83c7d517b, -0xbc8f1ff055de323d, 0x3fef6af9388c8dea, -0x3c8b898c3f1353bf, 0x3fef635beb6fcb75, -0xbc96d99c7611eb26, 0x3fef5be084045cd4, -0x3c9aecf73e3a2f60, 0x3fef54873168b9aa, -0xbc8fe782cb86389d, 0x3fef4d5022fcd91d, -0x3c8a6f4144a6c38d, 0x3fef463b88628cd6, -0x3c807a05b0e4047d, 0x3fef3f49917ddc96, -0x3c968efde3a8a894, 0x3fef387a6e756238, -0x3c875e18f274487d, 0x3fef31ce4fb2a63f, -0x3c80472b981fe7f2, 0x3fef2b4565e27cdd, -0xbc96b87b3f71085e, 0x3fef24dfe1f56381, -0x3c82f7e16d09ab31, 0x3fef1e9df51fdee1, -0xbc3d219b1a6fbffa, 0x3fef187fd0dad990, -0x3c8b3782720c0ab4, 0x3fef1285a6e4030b, -0x3c6e149289cecb8f, 0x3fef0cafa93e2f56, -0x3c834d754db0abb6, 0x3fef06fe0a31b715, -0x3c864201e2ac744c, 0x3fef0170fc4cd831, -0x3c8fdd395dd3f84a, 0x3feefc08b26416ff, -0xbc86a3803b8e5b04, 0x3feef6c55f929ff1, -0xbc924aedcc4b5068, 0x3feef1a7373aa9cb, -0xbc9907f81b512d8e, 0x3feeecae6d05d866, -0xbc71d1e83e9436d2, 0x3feee7db34e59ff7, -0xbc991919b3ce1b15, 0x3feee32dc313a8e5, -0x3c859f48a72a4c6d, 0x3feedea64c123422, -0xbc9312607a28698a, 0x3feeda4504ac801c, -0xbc58a78f4817895b, 0x3feed60a21f72e2a, -0xbc7c2c9b67499a1b, 0x3feed1f5d950a897, -0x3c4363ed60c2ac11, 0x3feece086061892d, -0x3c9666093b0664ef, 0x3feeca41ed1d0057, -0x3c6ecce1daa10379, 0x3feec6a2b5c13cd0, -0x3c93ff8e3f0f1230, 0x3feec32af0d7d3de, -0x3c7690cebb7aafb0, 0x3feebfdad5362a27, -0x3c931dbdeb54e077, 0x3feebcb299fddd0d, -0xbc8f94340071a38e, 0x3feeb9b2769d2ca7, -0xbc87deccdc93a349, 0x3feeb6daa2cf6642, -0xbc78dec6bd0f385f, 0x3feeb42b569d4f82, -0xbc861246ec7b5cf6, 0x3feeb1a4ca5d920f, -0x3c93350518fdd78e, 0x3feeaf4736b527da, -0x3c7b98b72f8a9b05, 0x3feead12d497c7fd, -0x3c9063e1e21c5409, 0x3feeab07dd485429, -0x3c34c7855019c6ea, 0x3feea9268a5946b7, -0x3c9432e62b64c035, 0x3feea76f15ad2148, -0xbc8ce44a6199769f, 0x3feea5e1b976dc09, -0xbc8c33c53bef4da8, 0x3feea47eb03a5585, -0xbc845378892be9ae, 0x3feea34634ccc320, -0xbc93cedd78565858, 0x3feea23882552225, -0x3c5710aa807e1964, 0x3feea155d44ca973, -0xbc93b3efbf5e2228, 0x3feea09e667f3bcd, -0xbc6a12ad8734b982, 0x3feea012750bdabf, -0xbc6367efb86da9ee, 0x3fee9fb23c651a2f, -0xbc80dc3d54e08851, 0x3fee9f7df9519484, -0xbc781f647e5a3ecf, 0x3fee9f75e8ec5f74, -0xbc86ee4ac08b7db0, 0x3fee9f9a48a58174, -0xbc8619321e55e68a, 0x3fee9feb564267c9, -0x3c909ccb5e09d4d3, 0x3feea0694fde5d3f, -0xbc7b32dcb94da51d, 0x3feea11473eb0187, -0x3c94ecfd5467c06b, 0x3feea1ed0130c132, -0x3c65ebe1abd66c55, 0x3feea2f336cf4e62, -0xbc88a1c52fb3cf42, 0x3feea427543e1a12, -0xbc9369b6f13b3734, 0x3feea589994cce13, -0xbc805e843a19ff1e, 0x3feea71a4623c7ad, -0xbc94d450d872576e, 0x3feea8d99b4492ed, -0x3c90ad675b0e8a00, 0x3feeaac7d98a6699, -0x3c8db72fc1f0eab4, 0x3feeace5422aa0db, -0xbc65b6609cc5e7ff, 0x3feeaf3216b5448c, -0x3c7bf68359f35f44, 0x3feeb1ae99157736, -0xbc93091fa71e3d83, 0x3feeb45b0b91ffc6, -0xbc5da9b88b6c1e29, 0x3feeb737b0cdc5e5, -0xbc6c23f97c90b959, 0x3feeba44cbc8520f, -0xbc92434322f4f9aa, 0x3feebd829fde4e50, -0xbc85ca6cd7668e4b, 0x3feec0f170ca07ba, -0x3c71affc2b91ce27, 0x3feec49182a3f090, -0x3c6dd235e10a73bb, 0x3feec86319e32323, -0xbc87c50422622263, 0x3feecc667b5de565, -0x3c8b1c86e3e231d5, 0x3feed09bec4a2d33, -0xbc91bbd1d3bcbb15, 0x3feed503b23e255d, -0x3c90cc319cee31d2, 0x3feed99e1330b358, -0x3c8469846e735ab3, 0x3feede6b5579fdbf, -0xbc82dfcd978e9db4, 0x3feee36bbfd3f37a, -0x3c8c1a7792cb3387, 0x3feee89f995ad3ad, -0xbc907b8f4ad1d9fa, 0x3feeee07298db666, -0xbc55c3d956dcaeba, 0x3feef3a2b84f15fb, -0xbc90a40e3da6f640, 0x3feef9728de5593a, -0xbc68d6f438ad9334, 0x3feeff76f2fb5e47, -0xbc91eee26b588a35, 0x3fef05b030a1064a, -0x3c74ffd70a5fddcd, 0x3fef0c1e904bc1d2, -0xbc91bdfbfa9298ac, 0x3fef12c25bd71e09, -0x3c736eae30af0cb3, 0x3fef199bdd85529c, -0x3c8ee3325c9ffd94, 0x3fef20ab5fffd07a, -0x3c84e08fd10959ac, 0x3fef27f12e57d14b, -0x3c63cdaf384e1a67, 0x3fef2f6d9406e7b5, -0x3c676b2c6c921968, 0x3fef3720dcef9069, -0xbc808a1883ccb5d2, 0x3fef3f0b555dc3fa, -0xbc8fad5d3ffffa6f, 0x3fef472d4a07897c, -0xbc900dae3875a949, 0x3fef4f87080d89f2, -0x3c74a385a63d07a7, 0x3fef5818dcfba487, -0xbc82919e2040220f, 0x3fef60e316c98398, -0x3c8e5a50d5c192ac, 0x3fef69e603db3285, -0x3c843a59ac016b4b, 0x3fef7321f301b460, -0xbc82d52107b43e1f, 0x3fef7c97337b9b5f, -0xbc892ab93b470dc9, 0x3fef864614f5a129, -0x3c74b604603a88d3, 0x3fef902ee78b3ff6, -0x3c83c5ec519d7271, 0x3fef9a51fbc74c83, -0xbc8ff7128fd391f0, 0x3fefa4afa2a490da, -0xbc8dae98e223747d, 0x3fefaf482d8e67f1, -0x3c8ec3bc41aa2008, 0x3fefba1bee615a27, -0x3c842b94c3a9eb32, 0x3fefc52b376bba97, -0x3c8a64a931d185ee, 0x3fefd0765b6e4540, -0xbc8e37bae43be3ed, 0x3fefdbfdad9cbe14, -0x3c77893b4d91cd9d, 0x3fefe7c1819e90d8, -0x3c5305c14160cc89, 0x3feff3c22b8f71f1, -}, -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.h deleted file mode 100644 index 3e24bac57..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _EXP_DATA_H -#define _EXP_DATA_H - -#include -#include - -#define EXP_TABLE_BITS 7 -#define EXP_POLY_ORDER 5 -#define EXP_USE_TOINT_NARROW 0 -#define EXP2_POLY_ORDER 5 -extern hidden const struct exp_data { - double invln2N; - double shift; - double negln2hiN; - double negln2loN; - double poly[4]; /* Last four coefficients. */ - double exp2_shift; - double exp2_poly[EXP2_POLY_ORDER]; - uint64_t tab[2*(1 << EXP_TABLE_BITS)]; -} __exp_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/expf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/expf.c deleted file mode 100644 index f9fbf8e72..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/expf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Single-precision e^x function. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "exp2f_data.h" - -/* -EXP2F_TABLE_BITS = 5 -EXP2F_POLY_ORDER = 3 - -ULP error: 0.502 (nearest rounding.) -Relative error: 1.69 * 2^-34 in [-ln2/64, ln2/64] (before rounding.) -Wrong count: 170635 (all nearest rounding wrong results with fma.) -Non-nearest ULP error: 1 (rounded ULP error) -*/ - -#define N (1 << EXP2F_TABLE_BITS) -#define InvLn2N __exp2f_data.invln2_scaled -#define T __exp2f_data.tab -#define C __exp2f_data.poly_scaled - -static inline uint32_t top12(float x) -{ - return asuint(x) >> 20; -} - -float expf(float x) -{ - uint32_t abstop; - uint64_t ki, t; - double_t kd, xd, z, r, r2, y, s; - - xd = (double_t)x; - abstop = top12(x) & 0x7ff; - if (predict_false(abstop >= top12(88.0f))) { - /* |x| >= 88 or x is nan. */ - if (asuint(x) == asuint(-INFINITY)) - return 0.0f; - if (abstop >= top12(INFINITY)) - return x + x; - if (x > 0x1.62e42ep6f) /* x > log(0x1p128) ~= 88.72 */ - return __math_oflowf(0); - if (x < -0x1.9fe368p6f) /* x < log(0x1p-150) ~= -103.97 */ - return __math_uflowf(0); - } - - /* x*N/Ln2 = k + r with r in [-1/2, 1/2] and int k. */ - z = InvLn2N * xd; - - /* Round and convert z to int, the result is in [-150*N, 128*N] and - ideally ties-to-even rule is used, otherwise the magnitude of r - can be bigger which gives larger approximation error. */ -#if TOINT_INTRINSICS - kd = roundtoint(z); - ki = converttoint(z); -#else -# define SHIFT __exp2f_data.shift - kd = eval_as_double(z + SHIFT); - ki = asuint64(kd); - kd -= SHIFT; -#endif - r = z - kd; - - /* exp(x) = 2^(k/N) * 2^(r/N) ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ - t = T[ki % N]; - t += ki << (52 - EXP2F_TABLE_BITS); - s = asdouble(t); - z = C[0] * r + C[1]; - r2 = r * r; - y = C[2] * r + 1; - y = z * r2 + y; - y = y * s; - return eval_as_float(y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/expl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/expl.c deleted file mode 100644 index 0a7f44f68..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/expl.c +++ /dev/null @@ -1,128 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_expl.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Exponential function, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, expl(); - * - * y = expl( x ); - * - * - * DESCRIPTION: - * - * Returns e (2.71828...) raised to the x power. - * - * Range reduction is accomplished by separating the argument - * into an integer k and fraction f such that - * - * x k f - * e = 2 e. - * - * A Pade' form of degree 5/6 is used to approximate exp(f) - 1 - * in the basic range [-0.5 ln 2, 0.5 ln 2]. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE +-10000 50000 1.12e-19 2.81e-20 - * - * - * Error amplification in the exponential function can be - * a serious matter. The error propagation involves - * exp( X(1+delta) ) = exp(X) ( 1 + X*delta + ... ), - * which shows that a 1 lsb error in representing X produces - * a relative error of X times 1 lsb in the function. - * While the routine gives an accurate result for arguments - * that are exactly represented by a long double precision - * computer number, the result contains amplified roundoff - * error for large arguments not exactly represented. - * - * - * ERROR MESSAGES: - * - * message condition value returned - * exp underflow x < MINLOG 0.0 - * exp overflow x > MAXLOG MAXNUM - * - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double expl(long double x) -{ - return exp(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 - -static const long double P[3] = { - 1.2617719307481059087798E-4L, - 3.0299440770744196129956E-2L, - 9.9999999999999999991025E-1L, -}; -static const long double Q[4] = { - 3.0019850513866445504159E-6L, - 2.5244834034968410419224E-3L, - 2.2726554820815502876593E-1L, - 2.0000000000000000000897E0L, -}; -static const long double -LN2HI = 6.9314575195312500000000E-1L, -LN2LO = 1.4286068203094172321215E-6L, -LOG2E = 1.4426950408889634073599E0L; - -long double expl(long double x) -{ - long double px, xx; - int k; - - if (isnan(x)) - return x; - if (x > 11356.5234062941439488L) /* x > ln(2^16384 - 0.5) */ - return x * 0x1p16383L; - if (x < -11399.4985314888605581L) /* x < ln(2^-16446) */ - return -0x1p-16445L/x; - - /* Express e**x = e**f 2**k - * = e**(f + k ln(2)) - */ - px = floorl(LOG2E * x + 0.5); - k = px; - x -= px * LN2HI; - x -= px * LN2LO; - - /* rational approximation of the fractional part: - * e**x = 1 + 2x P(x**2)/(Q(x**2) - x P(x**2)) - */ - xx = x * x; - px = x * __polevll(xx, P, 2); - x = px/(__polevll(xx, Q, 3) - px); - x = 1.0 + 2.0 * x; - return scalbnl(x, k); -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double expl(long double x) -{ - return exp(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/expm1.c b/src/hyperlight_guest_bin/third_party/musl/src/math/expm1.c deleted file mode 100644 index ac1e61e4f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/expm1.c +++ /dev/null @@ -1,201 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* expm1(x) - * Returns exp(x)-1, the exponential of x minus 1. - * - * Method - * 1. Argument reduction: - * Given x, find r and integer k such that - * - * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 - * - * Here a correction term c will be computed to compensate - * the error in r when rounded to a floating-point number. - * - * 2. Approximating expm1(r) by a special rational function on - * the interval [0,0.34658]: - * Since - * r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ... - * we define R1(r*r) by - * r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r) - * That is, - * R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r) - * = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r)) - * = 1 - r^2/60 + r^4/2520 - r^6/100800 + ... - * We use a special Remez algorithm on [0,0.347] to generate - * a polynomial of degree 5 in r*r to approximate R1. The - * maximum error of this polynomial approximation is bounded - * by 2**-61. In other words, - * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 - * where Q1 = -1.6666666666666567384E-2, - * Q2 = 3.9682539681370365873E-4, - * Q3 = -9.9206344733435987357E-6, - * Q4 = 2.5051361420808517002E-7, - * Q5 = -6.2843505682382617102E-9; - * z = r*r, - * with error bounded by - * | 5 | -61 - * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 - * | | - * - * expm1(r) = exp(r)-1 is then computed by the following - * specific way which minimize the accumulation rounding error: - * 2 3 - * r r [ 3 - (R1 + R1*r/2) ] - * expm1(r) = r + --- + --- * [--------------------] - * 2 2 [ 6 - r*(3 - R1*r/2) ] - * - * To compensate the error in the argument reduction, we use - * expm1(r+c) = expm1(r) + c + expm1(r)*c - * ~ expm1(r) + c + r*c - * Thus c+r*c will be added in as the correction terms for - * expm1(r+c). Now rearrange the term to avoid optimization - * screw up: - * ( 2 2 ) - * ({ ( r [ R1 - (3 - R1*r/2) ] ) } r ) - * expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- ) - * ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 ) - * ( ) - * - * = r - E - * 3. Scale back to obtain expm1(x): - * From step 1, we have - * expm1(x) = either 2^k*[expm1(r)+1] - 1 - * = or 2^k*[expm1(r) + (1-2^-k)] - * 4. Implementation notes: - * (A). To save one multiplication, we scale the coefficient Qi - * to Qi*2^i, and replace z by (x^2)/2. - * (B). To achieve maximum accuracy, we compute expm1(x) by - * (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf) - * (ii) if k=0, return r-E - * (iii) if k=-1, return 0.5*(r-E)-0.5 - * (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E) - * else return 1.0+2.0*(r-E); - * (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) - * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else - * (vii) return 2^k(1-((E+2^-k)-r)) - * - * Special cases: - * expm1(INF) is INF, expm1(NaN) is NaN; - * expm1(-INF) is -1, and - * for finite argument, only expm1(0)=0 is exact. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Misc. info. - * For IEEE double - * if x > 7.09782712893383973096e+02 then expm1(x) overflow - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "libm.h" - -static const double -o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ -ln2_hi = 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */ -ln2_lo = 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */ -invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */ -/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs = x*x/2: */ -Q1 = -3.33333333333331316428e-02, /* BFA11111 111110F4 */ -Q2 = 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ -Q3 = -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ -Q4 = 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ -Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ - -double expm1(double x) -{ - double_t y,hi,lo,c,t,e,hxs,hfx,r1,twopk; - union {double f; uint64_t i;} u = {x}; - uint32_t hx = u.i>>32 & 0x7fffffff; - int k, sign = u.i>>63; - - /* filter out huge and non-finite argument */ - if (hx >= 0x4043687A) { /* if |x|>=56*ln2 */ - if (isnan(x)) - return x; - if (sign) - return -1; - if (x > o_threshold) { - x *= 0x1p1023; - return x; - } - } - - /* argument reduction */ - if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ - if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ - if (!sign) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = invln2*x + (sign ? -0.5 : 0.5); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi-lo; - c = (hi-x)-lo; - } else if (hx < 0x3c900000) { /* |x| < 2**-54, return x */ - if (hx < 0x00100000) - FORCE_EVAL((float)x); - return x; - } else - k = 0; - - /* x is now in primary range */ - hfx = 0.5*x; - hxs = x*hfx; - r1 = 1.0+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); - t = 3.0-r1*hfx; - e = hxs*((r1-t)/(6.0 - x*t)); - if (k == 0) /* c is 0 */ - return x - (x*e-hxs); - e = x*(e-c) - c; - e -= hxs; - /* exp(x) ~ 2^k (x_reduced - e + 1) */ - if (k == -1) - return 0.5*(x-e) - 0.5; - if (k == 1) { - if (x < -0.25) - return -2.0*(e-(x+0.5)); - return 1.0+2.0*(x-e); - } - u.i = (uint64_t)(0x3ff + k)<<52; /* 2^k */ - twopk = u.f; - if (k < 0 || k > 56) { /* suffice to return exp(x)-1 */ - y = x - e + 1.0; - if (k == 1024) - y = y*2.0*0x1p1023; - else - y = y*twopk; - return y - 1.0; - } - u.i = (uint64_t)(0x3ff - k)<<52; /* 2^-k */ - if (k < 20) - y = (x-e+(1-u.f))*twopk; - else - y = (x-(e+u.f)+1)*twopk; - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/expm1f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/expm1f.c deleted file mode 100644 index 09a41afe7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/expm1f.c +++ /dev/null @@ -1,110 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1f.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -static const float -ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ -ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ -invln2 = 1.4426950216e+00, /* 0x3fb8aa3b */ -/* - * Domain [-0.34568, 0.34568], range ~[-6.694e-10, 6.696e-10]: - * |6 / x * (1 + 2 * (1 / (exp(x) - 1) - 1 / x)) - q(x)| < 2**-30.04 - * Scaled coefficients: Qn_here = 2**n * Qn_for_q (see s_expm1.c): - */ -Q1 = -3.3333212137e-2, /* -0x888868.0p-28 */ -Q2 = 1.5807170421e-3; /* 0xcf3010.0p-33 */ - -float expm1f(float x) -{ - float_t y,hi,lo,c,t,e,hxs,hfx,r1,twopk; - union {float f; uint32_t i;} u = {x}; - uint32_t hx = u.i & 0x7fffffff; - int k, sign = u.i >> 31; - - /* filter out huge and non-finite argument */ - if (hx >= 0x4195b844) { /* if |x|>=27*ln2 */ - if (hx > 0x7f800000) /* NaN */ - return x; - if (sign) - return -1; - if (hx > 0x42b17217) { /* x > log(FLT_MAX) */ - x *= 0x1p127f; - return x; - } - } - - /* argument reduction */ - if (hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ - if (hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ - if (!sign) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = invln2*x + (sign ? -0.5f : 0.5f); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi-lo; - c = (hi-x)-lo; - } else if (hx < 0x33000000) { /* when |x|<2**-25, return x */ - if (hx < 0x00800000) - FORCE_EVAL(x*x); - return x; - } else - k = 0; - - /* x is now in primary range */ - hfx = 0.5f*x; - hxs = x*hfx; - r1 = 1.0f+hxs*(Q1+hxs*Q2); - t = 3.0f - r1*hfx; - e = hxs*((r1-t)/(6.0f - x*t)); - if (k == 0) /* c is 0 */ - return x - (x*e-hxs); - e = x*(e-c) - c; - e -= hxs; - /* exp(x) ~ 2^k (x_reduced - e + 1) */ - if (k == -1) - return 0.5f*(x-e) - 0.5f; - if (k == 1) { - if (x < -0.25f) - return -2.0f*(e-(x+0.5f)); - return 1.0f + 2.0f*(x-e); - } - u.i = (0x7f+k)<<23; /* 2^k */ - twopk = u.f; - if (k < 0 || k > 56) { /* suffice to return exp(x)-1 */ - y = x - e + 1.0f; - if (k == 128) - y = y*2.0f*0x1p127f; - else - y = y*twopk; - return y - 1.0f; - } - u.i = (0x7f-k)<<23; /* 2^-k */ - if (k < 23) - y = (x-e+(1-u.f))*twopk; - else - y = (x-(e+u.f)+1)*twopk; - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/expm1l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/expm1l.c deleted file mode 100644 index d17150785..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/expm1l.c +++ /dev/null @@ -1,123 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_expm1l.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Exponential function, minus 1 - * Long double precision - * - * - * SYNOPSIS: - * - * long double x, y, expm1l(); - * - * y = expm1l( x ); - * - * - * DESCRIPTION: - * - * Returns e (2.71828...) raised to the x power, minus 1. - * - * Range reduction is accomplished by separating the argument - * into an integer k and fraction f such that - * - * x k f - * e = 2 e. - * - * An expansion x + .5 x^2 + x^3 R(x) approximates exp(f) - 1 - * in the basic range [-0.5 ln 2, 0.5 ln 2]. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -45,+maxarg 200,000 1.2e-19 2.5e-20 - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double expm1l(long double x) -{ - return expm1(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 - -/* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x) - -.5 ln 2 < x < .5 ln 2 - Theoretical peak relative error = 3.4e-22 */ -static const long double -P0 = -1.586135578666346600772998894928250240826E4L, -P1 = 2.642771505685952966904660652518429479531E3L, -P2 = -3.423199068835684263987132888286791620673E2L, -P3 = 1.800826371455042224581246202420972737840E1L, -P4 = -5.238523121205561042771939008061958820811E-1L, -Q0 = -9.516813471998079611319047060563358064497E4L, -Q1 = 3.964866271411091674556850458227710004570E4L, -Q2 = -7.207678383830091850230366618190187434796E3L, -Q3 = 7.206038318724600171970199625081491823079E2L, -Q4 = -4.002027679107076077238836622982900945173E1L, -/* Q5 = 1.000000000000000000000000000000000000000E0 */ -/* C1 + C2 = ln 2 */ -C1 = 6.93145751953125E-1L, -C2 = 1.428606820309417232121458176568075500134E-6L, -/* ln 2^-65 */ -minarg = -4.5054566736396445112120088E1L, -/* ln 2^16384 */ -maxarg = 1.1356523406294143949492E4L; - -long double expm1l(long double x) -{ - long double px, qx, xx; - int k; - - if (isnan(x)) - return x; - if (x > maxarg) - return x*0x1p16383L; /* overflow, unless x==inf */ - if (x == 0.0) - return x; - if (x < minarg) - return -1.0; - - xx = C1 + C2; - /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */ - px = floorl(0.5 + x / xx); - k = px; - /* remainder times ln 2 */ - x -= px * C1; - x -= px * C2; - - /* Approximate exp(remainder ln 2).*/ - px = (((( P4 * x + P3) * x + P2) * x + P1) * x + P0) * x; - qx = (((( x + Q4) * x + Q3) * x + Q2) * x + Q1) * x + Q0; - xx = x * x; - qx = x + (0.5 * xx + xx * px / qx); - - /* exp(x) = exp(k ln 2) exp(remainder ln 2) = 2^k exp(remainder ln 2). - We have qx = exp(remainder ln 2) - 1, so - exp(x) - 1 = 2^k (qx + 1) - 1 = 2^k qx + 2^k - 1. */ - px = scalbnl(1.0, k); - x = px * qx + (px - 1.0); - return x; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double expm1l(long double x) -{ - return expm1(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fabs.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fabs.c deleted file mode 100644 index e8258cfdb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fabs.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -double fabs(double x) -{ - union {double f; uint64_t i;} u = {x}; - u.i &= -1ULL/2; - return u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fabsf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fabsf.c deleted file mode 100644 index 4efc8d686..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fabsf.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -float fabsf(float x) -{ - union {float f; uint32_t i;} u = {x}; - u.i &= 0x7fffffff; - return u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fabsl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fabsl.c deleted file mode 100644 index c4f36ec28..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fabsl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libm.h" -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double fabsl(long double x) -{ - return fabs(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double fabsl(long double x) -{ - union ldshape u = {x}; - - u.i.se &= 0x7fff; - return u.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fdim.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fdim.c deleted file mode 100644 index 958546064..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fdim.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -double fdim(double x, double y) -{ - if (isnan(x)) - return x; - if (isnan(y)) - return y; - return x > y ? x - y : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fdimf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fdimf.c deleted file mode 100644 index 543c3648e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fdimf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -float fdimf(float x, float y) -{ - if (isnan(x)) - return x; - if (isnan(y)) - return y; - return x > y ? x - y : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fdiml.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fdiml.c deleted file mode 100644 index 62e29b7df..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fdiml.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double fdiml(long double x, long double y) -{ - return fdim(x, y); -} -#else -long double fdiml(long double x, long double y) -{ - if (isnan(x)) - return x; - if (isnan(y)) - return y; - return x > y ? x - y : 0; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/finite.c b/src/hyperlight_guest_bin/third_party/musl/src/math/finite.c deleted file mode 100644 index 25a0575fb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/finite.c +++ /dev/null @@ -1,7 +0,0 @@ -#define _GNU_SOURCE -#include - -int finite(double x) -{ - return isfinite(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/finitef.c b/src/hyperlight_guest_bin/third_party/musl/src/math/finitef.c deleted file mode 100644 index 2c4c77146..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/finitef.c +++ /dev/null @@ -1,7 +0,0 @@ -#define _GNU_SOURCE -#include - -int finitef(float x) -{ - return isfinite(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/floor.c b/src/hyperlight_guest_bin/third_party/musl/src/math/floor.c deleted file mode 100644 index 14a31cd8c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/floor.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "libm.h" - -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -static const double_t toint = 1/EPS; - -double floor(double x) -{ - union {double f; uint64_t i;} u = {x}; - int e = u.i >> 52 & 0x7ff; - double_t y; - - if (e >= 0x3ff+52 || x == 0) - return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i >> 63) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3ff-1) { - FORCE_EVAL(y); - return u.i >> 63 ? -1 : 0; - } - if (y > 0) - return x + y - 1; - return x + y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/floorf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/floorf.c deleted file mode 100644 index dceec739d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/floorf.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "libm.h" - -float floorf(float x) -{ - union {float f; uint32_t i;} u = {x}; - int e = (int)(u.i >> 23 & 0xff) - 0x7f; - uint32_t m; - - if (e >= 23) - return x; - if (e >= 0) { - m = 0x007fffff >> e; - if ((u.i & m) == 0) - return x; - FORCE_EVAL(x + 0x1p120f); - if (u.i >> 31) - u.i += m; - u.i &= ~m; - } else { - FORCE_EVAL(x + 0x1p120f); - if (u.i >> 31 == 0) - u.i = 0; - else if (u.i << 1) - u.f = -1.0; - } - return u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/floorl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/floorl.c deleted file mode 100644 index 16aaec48e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/floorl.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double floorl(long double x) -{ - return floor(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -static const long double toint = 1/LDBL_EPSILON; - -long double floorl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - long double y; - - if (e >= 0x3fff+LDBL_MANT_DIG-1 || x == 0) - return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i.se >> 15) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3fff-1) { - FORCE_EVAL(y); - return u.i.se >> 15 ? -1 : 0; - } - if (y > 0) - return x + y - 1; - return x + y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fma.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fma.c deleted file mode 100644 index 0c6f90c9c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fma.c +++ /dev/null @@ -1,183 +0,0 @@ -#include -#include -#include -#include "atomic.h" - -#define ASUINT64(x) ((union {double f; uint64_t i;}){x}).i -#define ZEROINFNAN (0x7ff-0x3ff-52-1) - -struct num { uint64_t m; int e; int sign; }; - -static struct num normalize(double x) -{ - uint64_t ix = ASUINT64(x); - int e = ix>>52; - int sign = e & 0x800; - e &= 0x7ff; - if (!e) { - ix = ASUINT64(x*0x1p63); - e = ix>>52 & 0x7ff; - e = e ? e-63 : 0x800; - } - ix &= (1ull<<52)-1; - ix |= 1ull<<52; - ix <<= 1; - e -= 0x3ff + 52 + 1; - return (struct num){ix,e,sign}; -} - -static void mul(uint64_t *hi, uint64_t *lo, uint64_t x, uint64_t y) -{ - uint64_t t1,t2,t3; - uint64_t xlo = (uint32_t)x, xhi = x>>32; - uint64_t ylo = (uint32_t)y, yhi = y>>32; - - t1 = xlo*ylo; - t2 = xlo*yhi + xhi*ylo; - t3 = xhi*yhi; - *lo = t1 + (t2<<32); - *hi = t3 + (t2>>32) + (t1 > *lo); -} - -double fma(double x, double y, double z) -{ - #pragma STDC FENV_ACCESS ON - - /* normalize so top 10bits and last bit are 0 */ - struct num nx, ny, nz; - nx = normalize(x); - ny = normalize(y); - nz = normalize(z); - - if (nx.e >= ZEROINFNAN || ny.e >= ZEROINFNAN) - return x*y + z; - if (nz.e >= ZEROINFNAN) { - if (nz.e > ZEROINFNAN) /* z==0 */ - return x*y + z; - return z; - } - - /* mul: r = x*y */ - uint64_t rhi, rlo, zhi, zlo; - mul(&rhi, &rlo, nx.m, ny.m); - /* either top 20 or 21 bits of rhi and last 2 bits of rlo are 0 */ - - /* align exponents */ - int e = nx.e + ny.e; - int d = nz.e - e; - /* shift bits z<<=kz, r>>=kr, so kz+kr == d, set e = e+kr (== ez-kz) */ - if (d > 0) { - if (d < 64) { - zlo = nz.m<>64-d; - } else { - zlo = 0; - zhi = nz.m; - e = nz.e - 64; - d -= 64; - if (d == 0) { - } else if (d < 64) { - rlo = rhi<<64-d | rlo>>d | !!(rlo<<64-d); - rhi = rhi>>d; - } else { - rlo = 1; - rhi = 0; - } - } - } else { - zhi = 0; - d = -d; - if (d == 0) { - zlo = nz.m; - } else if (d < 64) { - zlo = nz.m>>d | !!(nz.m<<64-d); - } else { - zlo = 1; - } - } - - /* add */ - int sign = nx.sign^ny.sign; - int samesign = !(sign^nz.sign); - int nonzero = 1; - if (samesign) { - /* r += z */ - rlo += zlo; - rhi += zhi + (rlo < zlo); - } else { - /* r -= z */ - uint64_t t = rlo; - rlo -= zlo; - rhi = rhi - zhi - (t < rlo); - if (rhi>>63) { - rlo = -rlo; - rhi = -rhi-!!rlo; - sign = !sign; - } - nonzero = !!rhi; - } - - /* set rhi to top 63bit of the result (last bit is sticky) */ - if (nonzero) { - e += 64; - d = a_clz_64(rhi)-1; - /* note: d > 0 */ - rhi = rhi<>64-d | !!(rlo<>1 | (rlo&1); - else - rhi = rlo<>1 | (rhi&1) | 1ull<<62; - if (sign) - i = -i; - r = i; - r = 2*r - c; /* remove top bit */ - - /* raise underflow portably, such that it - cannot be optimized away */ - { - double_t tiny = DBL_MIN/FLT_MIN * r; - r += (double)(tiny*tiny) * (r-r); - } - } - } else { - /* only round once when scaled */ - d = 10; - i = ( rhi>>d | !!(rhi<<64-d) ) << d; - if (sign) - i = -i; - r = i; - } - } - return scalbn(r, e); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmaf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmaf.c deleted file mode 100644 index 7c65acf1f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmaf.c +++ /dev/null @@ -1,92 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_fmaf.c */ -/*- - * Copyright (c) 2005-2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include - -/* - * Fused multiply-add: Compute x * y + z with a single rounding error. - * - * A double has more than twice as much precision than a float, so - * direct double-precision arithmetic suffices, except where double - * rounding occurs. - */ -float fmaf(float x, float y, float z) -{ - #pragma STDC FENV_ACCESS ON - double xy, result; - union {double f; uint64_t i;} u; - int e; - - xy = (double)x * y; - result = xy + z; - u.f = result; - e = u.i>>52 & 0x7ff; - /* Common case: The double precision result is fine. */ - if ((u.i & 0x1fffffff) != 0x10000000 || /* not a halfway case */ - e == 0x7ff || /* NaN */ - (result - xy == z && result - z == xy) || /* exact */ - fegetround() != FE_TONEAREST) /* not round-to-nearest */ - { - /* - underflow may not be raised correctly, example: - fmaf(0x1p-120f, 0x1p-120f, 0x1p-149f) - */ -#if defined(FE_INEXACT) && defined(FE_UNDERFLOW) - if (e < 0x3ff-126 && e >= 0x3ff-149 && fetestexcept(FE_INEXACT)) { - feclearexcept(FE_INEXACT); - /* TODO: gcc and clang bug workaround */ - volatile float vz = z; - result = xy + vz; - if (fetestexcept(FE_INEXACT)) - feraiseexcept(FE_UNDERFLOW); - else - feraiseexcept(FE_INEXACT); - } -#endif - z = result; - return z; - } - - /* - * If result is inexact, and exactly halfway between two float values, - * we need to adjust the low-order bit in the direction of the error. - */ - double err; - int neg = u.i >> 63; - if (neg == (z > xy)) - err = xy - result + z; - else - err = z - result + xy; - if (neg == (err < 0)) - u.i++; - else - u.i--; - z = u.f; - return z; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmal.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmal.c deleted file mode 100644 index 4506aac6f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmal.c +++ /dev/null @@ -1,293 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_fmal.c */ -/*- - * Copyright (c) 2005-2011 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - - -#include "libm.h" -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double fmal(long double x, long double y, long double z) -{ - return fma(x, y, z); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#include -#if LDBL_MANT_DIG == 64 -#define LASTBIT(u) (u.i.m & 1) -#define SPLIT (0x1p32L + 1) -#elif LDBL_MANT_DIG == 113 -#define LASTBIT(u) (u.i.lo & 1) -#define SPLIT (0x1p57L + 1) -#endif - -/* - * A struct dd represents a floating-point number with twice the precision - * of a long double. We maintain the invariant that "hi" stores the high-order - * bits of the result. - */ -struct dd { - long double hi; - long double lo; -}; - -/* - * Compute a+b exactly, returning the exact result in a struct dd. We assume - * that both a and b are finite, but make no assumptions about their relative - * magnitudes. - */ -static inline struct dd dd_add(long double a, long double b) -{ - struct dd ret; - long double s; - - ret.hi = a + b; - s = ret.hi - a; - ret.lo = (a - (ret.hi - s)) + (b - s); - return (ret); -} - -/* - * Compute a+b, with a small tweak: The least significant bit of the - * result is adjusted into a sticky bit summarizing all the bits that - * were lost to rounding. This adjustment negates the effects of double - * rounding when the result is added to another number with a higher - * exponent. For an explanation of round and sticky bits, see any reference - * on FPU design, e.g., - * - * J. Coonen. An Implementation Guide to a Proposed Standard for - * Floating-Point Arithmetic. Computer, vol. 13, no. 1, Jan 1980. - */ -static inline long double add_adjusted(long double a, long double b) -{ - struct dd sum; - union ldshape u; - - sum = dd_add(a, b); - if (sum.lo != 0) { - u.f = sum.hi; - if (!LASTBIT(u)) - sum.hi = nextafterl(sum.hi, INFINITY * sum.lo); - } - return (sum.hi); -} - -/* - * Compute ldexp(a+b, scale) with a single rounding error. It is assumed - * that the result will be subnormal, and care is taken to ensure that - * double rounding does not occur. - */ -static inline long double add_and_denormalize(long double a, long double b, int scale) -{ - struct dd sum; - int bits_lost; - union ldshape u; - - sum = dd_add(a, b); - - /* - * If we are losing at least two bits of accuracy to denormalization, - * then the first lost bit becomes a round bit, and we adjust the - * lowest bit of sum.hi to make it a sticky bit summarizing all the - * bits in sum.lo. With the sticky bit adjusted, the hardware will - * break any ties in the correct direction. - * - * If we are losing only one bit to denormalization, however, we must - * break the ties manually. - */ - if (sum.lo != 0) { - u.f = sum.hi; - bits_lost = -u.i.se - scale + 1; - if ((bits_lost != 1) ^ LASTBIT(u)) - sum.hi = nextafterl(sum.hi, INFINITY * sum.lo); - } - return scalbnl(sum.hi, scale); -} - -/* - * Compute a*b exactly, returning the exact result in a struct dd. We assume - * that both a and b are normalized, so no underflow or overflow will occur. - * The current rounding mode must be round-to-nearest. - */ -static inline struct dd dd_mul(long double a, long double b) -{ - struct dd ret; - long double ha, hb, la, lb, p, q; - - p = a * SPLIT; - ha = a - p; - ha += p; - la = a - ha; - - p = b * SPLIT; - hb = b - p; - hb += p; - lb = b - hb; - - p = ha * hb; - q = ha * lb + la * hb; - - ret.hi = p + q; - ret.lo = p - ret.hi + q + la * lb; - return (ret); -} - -/* - * Fused multiply-add: Compute x * y + z with a single rounding error. - * - * We use scaling to avoid overflow/underflow, along with the - * canonical precision-doubling technique adapted from: - * - * Dekker, T. A Floating-Point Technique for Extending the - * Available Precision. Numer. Math. 18, 224-242 (1971). - */ -long double fmal(long double x, long double y, long double z) -{ - #pragma STDC FENV_ACCESS ON - long double xs, ys, zs, adj; - struct dd xy, r; - int oround; - int ex, ey, ez; - int spread; - - /* - * Handle special cases. The order of operations and the particular - * return values here are crucial in handling special cases involving - * infinities, NaNs, overflows, and signed zeroes correctly. - */ - if (!isfinite(x) || !isfinite(y)) - return (x * y + z); - if (!isfinite(z)) - return (z); - if (x == 0.0 || y == 0.0) - return (x * y + z); - if (z == 0.0) - return (x * y); - - xs = frexpl(x, &ex); - ys = frexpl(y, &ey); - zs = frexpl(z, &ez); - oround = fegetround(); - spread = ex + ey - ez; - - /* - * If x * y and z are many orders of magnitude apart, the scaling - * will overflow, so we handle these cases specially. Rounding - * modes other than FE_TONEAREST are painful. - */ - if (spread < -LDBL_MANT_DIG) { -#ifdef FE_INEXACT - feraiseexcept(FE_INEXACT); -#endif -#ifdef FE_UNDERFLOW - if (!isnormal(z)) - feraiseexcept(FE_UNDERFLOW); -#endif - switch (oround) { - default: /* FE_TONEAREST */ - return (z); -#ifdef FE_TOWARDZERO - case FE_TOWARDZERO: - if (x > 0.0 ^ y < 0.0 ^ z < 0.0) - return (z); - else - return (nextafterl(z, 0)); -#endif -#ifdef FE_DOWNWARD - case FE_DOWNWARD: - if (x > 0.0 ^ y < 0.0) - return (z); - else - return (nextafterl(z, -INFINITY)); -#endif -#ifdef FE_UPWARD - case FE_UPWARD: - if (x > 0.0 ^ y < 0.0) - return (nextafterl(z, INFINITY)); - else - return (z); -#endif - } - } - if (spread <= LDBL_MANT_DIG * 2) - zs = scalbnl(zs, -spread); - else - zs = copysignl(LDBL_MIN, zs); - - fesetround(FE_TONEAREST); - - /* - * Basic approach for round-to-nearest: - * - * (xy.hi, xy.lo) = x * y (exact) - * (r.hi, r.lo) = xy.hi + z (exact) - * adj = xy.lo + r.lo (inexact; low bit is sticky) - * result = r.hi + adj (correctly rounded) - */ - xy = dd_mul(xs, ys); - r = dd_add(xy.hi, zs); - - spread = ex + ey; - - if (r.hi == 0.0) { - /* - * When the addends cancel to 0, ensure that the result has - * the correct sign. - */ - fesetround(oround); - volatile long double vzs = zs; /* XXX gcc CSE bug workaround */ - return xy.hi + vzs + scalbnl(xy.lo, spread); - } - - if (oround != FE_TONEAREST) { - /* - * There is no need to worry about double rounding in directed - * rounding modes. - * But underflow may not be raised correctly, example in downward rounding: - * fmal(0x1.0000000001p-16000L, 0x1.0000000001p-400L, -0x1p-16440L) - */ - long double ret; -#if defined(FE_INEXACT) && defined(FE_UNDERFLOW) - int e = fetestexcept(FE_INEXACT); - feclearexcept(FE_INEXACT); -#endif - fesetround(oround); - adj = r.lo + xy.lo; - ret = scalbnl(r.hi + adj, spread); -#if defined(FE_INEXACT) && defined(FE_UNDERFLOW) - if (ilogbl(ret) < -16382 && fetestexcept(FE_INEXACT)) - feraiseexcept(FE_UNDERFLOW); - else if (e) - feraiseexcept(FE_INEXACT); -#endif - return ret; - } - - adj = add_adjusted(r.lo, xy.lo); - if (spread + ilogbl(r.hi) > -16383) - return scalbnl(r.hi + adj, spread); - else - return add_and_denormalize(r.hi, adj, spread); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmax.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmax.c deleted file mode 100644 index 94f0caa17..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmax.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -double fmax(double x, double y) -{ - if (isnan(x)) - return y; - if (isnan(y)) - return x; - /* handle signed zeros, see C99 Annex F.9.9.2 */ - if (signbit(x) != signbit(y)) - return signbit(x) ? y : x; - return x < y ? y : x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmaxf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmaxf.c deleted file mode 100644 index 695d8179c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmaxf.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -float fmaxf(float x, float y) -{ - if (isnan(x)) - return y; - if (isnan(y)) - return x; - /* handle signed zeroes, see C99 Annex F.9.9.2 */ - if (signbit(x) != signbit(y)) - return signbit(x) ? y : x; - return x < y ? y : x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmaxl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmaxl.c deleted file mode 100644 index 4b03158e0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmaxl.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double fmaxl(long double x, long double y) -{ - return fmax(x, y); -} -#else -long double fmaxl(long double x, long double y) -{ - if (isnan(x)) - return y; - if (isnan(y)) - return x; - /* handle signed zeros, see C99 Annex F.9.9.2 */ - if (signbit(x) != signbit(y)) - return signbit(x) ? y : x; - return x < y ? y : x; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmin.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmin.c deleted file mode 100644 index 08a8fd17f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmin.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -double fmin(double x, double y) -{ - if (isnan(x)) - return y; - if (isnan(y)) - return x; - /* handle signed zeros, see C99 Annex F.9.9.2 */ - if (signbit(x) != signbit(y)) - return signbit(x) ? x : y; - return x < y ? x : y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fminf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fminf.c deleted file mode 100644 index 3573c7de7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fminf.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -float fminf(float x, float y) -{ - if (isnan(x)) - return y; - if (isnan(y)) - return x; - /* handle signed zeros, see C99 Annex F.9.9.2 */ - if (signbit(x) != signbit(y)) - return signbit(x) ? x : y; - return x < y ? x : y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fminl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fminl.c deleted file mode 100644 index 69bc24a79..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fminl.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double fminl(long double x, long double y) -{ - return fmin(x, y); -} -#else -long double fminl(long double x, long double y) -{ - if (isnan(x)) - return y; - if (isnan(y)) - return x; - /* handle signed zeros, see C99 Annex F.9.9.2 */ - if (signbit(x) != signbit(y)) - return signbit(x) ? x : y; - return x < y ? x : y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmod.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmod.c deleted file mode 100644 index 6849722ba..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmod.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include - -double fmod(double x, double y) -{ - union {double f; uint64_t i;} ux = {x}, uy = {y}; - int ex = ux.i>>52 & 0x7ff; - int ey = uy.i>>52 & 0x7ff; - int sx = ux.i>>63; - uint64_t i; - - /* in the followings uxi should be ux.i, but then gcc wrongly adds */ - /* float load/store to inner loops ruining performance and code size */ - uint64_t uxi = ux.i; - - if (uy.i<<1 == 0 || isnan(y) || ex == 0x7ff) - return (x*y)/(x*y); - if (uxi<<1 <= uy.i<<1) { - if (uxi<<1 == uy.i<<1) - return 0*x; - return x; - } - - /* normalize x and y */ - if (!ex) { - for (i = uxi<<12; i>>63 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1ULL >> 12; - uxi |= 1ULL << 52; - } - if (!ey) { - for (i = uy.i<<12; i>>63 == 0; ey--, i <<= 1); - uy.i <<= -ey + 1; - } else { - uy.i &= -1ULL >> 12; - uy.i |= 1ULL << 52; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uy.i; - if (i >> 63 == 0) { - if (i == 0) - return 0*x; - uxi = i; - } - uxi <<= 1; - } - i = uxi - uy.i; - if (i >> 63 == 0) { - if (i == 0) - return 0*x; - uxi = i; - } - for (; uxi>>52 == 0; uxi <<= 1, ex--); - - /* scale result */ - if (ex > 0) { - uxi -= 1ULL << 52; - uxi |= (uint64_t)ex << 52; - } else { - uxi >>= -ex + 1; - } - uxi |= (uint64_t)sx << 63; - ux.i = uxi; - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmodf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmodf.c deleted file mode 100644 index ff58f9336..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmodf.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include - -float fmodf(float x, float y) -{ - union {float f; uint32_t i;} ux = {x}, uy = {y}; - int ex = ux.i>>23 & 0xff; - int ey = uy.i>>23 & 0xff; - uint32_t sx = ux.i & 0x80000000; - uint32_t i; - uint32_t uxi = ux.i; - - if (uy.i<<1 == 0 || isnan(y) || ex == 0xff) - return (x*y)/(x*y); - if (uxi<<1 <= uy.i<<1) { - if (uxi<<1 == uy.i<<1) - return 0*x; - return x; - } - - /* normalize x and y */ - if (!ex) { - for (i = uxi<<9; i>>31 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1U >> 9; - uxi |= 1U << 23; - } - if (!ey) { - for (i = uy.i<<9; i>>31 == 0; ey--, i <<= 1); - uy.i <<= -ey + 1; - } else { - uy.i &= -1U >> 9; - uy.i |= 1U << 23; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uy.i; - if (i >> 31 == 0) { - if (i == 0) - return 0*x; - uxi = i; - } - uxi <<= 1; - } - i = uxi - uy.i; - if (i >> 31 == 0) { - if (i == 0) - return 0*x; - uxi = i; - } - for (; uxi>>23 == 0; uxi <<= 1, ex--); - - /* scale result up */ - if (ex > 0) { - uxi -= 1U << 23; - uxi |= (uint32_t)ex << 23; - } else { - uxi >>= -ex + 1; - } - uxi |= sx; - ux.i = uxi; - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/fmodl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/fmodl.c deleted file mode 100644 index 9f5b87393..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/fmodl.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double fmodl(long double x, long double y) -{ - return fmod(x, y); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double fmodl(long double x, long double y) -{ - union ldshape ux = {x}, uy = {y}; - int ex = ux.i.se & 0x7fff; - int ey = uy.i.se & 0x7fff; - int sx = ux.i.se & 0x8000; - - if (y == 0 || isnan(y) || ex == 0x7fff) - return (x*y)/(x*y); - ux.i.se = ex; - uy.i.se = ey; - if (ux.f <= uy.f) { - if (ux.f == uy.f) - return 0*x; - return x; - } - - /* normalize x and y */ - if (!ex) { - ux.f *= 0x1p120f; - ex = ux.i.se - 120; - } - if (!ey) { - uy.f *= 0x1p120f; - ey = uy.i.se - 120; - } - - /* x mod y */ -#if LDBL_MANT_DIG == 64 - uint64_t i, mx, my; - mx = ux.i.m; - my = uy.i.m; - for (; ex > ey; ex--) { - i = mx - my; - if (mx >= my) { - if (i == 0) - return 0*x; - mx = 2*i; - } else if (2*mx < mx) { - mx = 2*mx - my; - } else { - mx = 2*mx; - } - } - i = mx - my; - if (mx >= my) { - if (i == 0) - return 0*x; - mx = i; - } - for (; mx >> 63 == 0; mx *= 2, ex--); - ux.i.m = mx; -#elif LDBL_MANT_DIG == 113 - uint64_t hi, lo, xhi, xlo, yhi, ylo; - xhi = (ux.i2.hi & -1ULL>>16) | 1ULL<<48; - yhi = (uy.i2.hi & -1ULL>>16) | 1ULL<<48; - xlo = ux.i2.lo; - ylo = uy.i2.lo; - for (; ex > ey; ex--) { - hi = xhi - yhi; - lo = xlo - ylo; - if (xlo < ylo) - hi -= 1; - if (hi >> 63 == 0) { - if ((hi|lo) == 0) - return 0*x; - xhi = 2*hi + (lo>>63); - xlo = 2*lo; - } else { - xhi = 2*xhi + (xlo>>63); - xlo = 2*xlo; - } - } - hi = xhi - yhi; - lo = xlo - ylo; - if (xlo < ylo) - hi -= 1; - if (hi >> 63 == 0) { - if ((hi|lo) == 0) - return 0*x; - xhi = hi; - xlo = lo; - } - for (; xhi >> 48 == 0; xhi = 2*xhi + (xlo>>63), xlo = 2*xlo, ex--); - ux.i2.hi = xhi; - ux.i2.lo = xlo; -#endif - - /* scale result */ - if (ex <= 0) { - ux.i.se = (ex+120)|sx; - ux.f *= 0x1p-120f; - } else - ux.i.se = ex|sx; - return ux.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/frexp.c b/src/hyperlight_guest_bin/third_party/musl/src/math/frexp.c deleted file mode 100644 index 27b6266ed..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/frexp.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -double frexp(double x, int *e) -{ - union { double d; uint64_t i; } y = { x }; - int ee = y.i>>52 & 0x7ff; - - if (!ee) { - if (x) { - x = frexp(x*0x1p64, e); - *e -= 64; - } else *e = 0; - return x; - } else if (ee == 0x7ff) { - return x; - } - - *e = ee - 0x3fe; - y.i &= 0x800fffffffffffffull; - y.i |= 0x3fe0000000000000ull; - return y.d; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/frexpf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/frexpf.c deleted file mode 100644 index 078709752..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/frexpf.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -float frexpf(float x, int *e) -{ - union { float f; uint32_t i; } y = { x }; - int ee = y.i>>23 & 0xff; - - if (!ee) { - if (x) { - x = frexpf(x*0x1p64, e); - *e -= 64; - } else *e = 0; - return x; - } else if (ee == 0xff) { - return x; - } - - *e = ee - 0x7e; - y.i &= 0x807ffffful; - y.i |= 0x3f000000ul; - return y.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/frexpl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/frexpl.c deleted file mode 100644 index 3c1b55374..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/frexpl.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double frexpl(long double x, int *e) -{ - return frexp(x, e); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double frexpl(long double x, int *e) -{ - union ldshape u = {x}; - int ee = u.i.se & 0x7fff; - - if (!ee) { - if (x) { - x = frexpl(x*0x1p120, e); - *e -= 120; - } else *e = 0; - return x; - } else if (ee == 0x7fff) { - return x; - } - - *e = ee - 0x3ffe; - u.i.se &= 0x8000; - u.i.se |= 0x3ffe; - return u.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/hypot.c b/src/hyperlight_guest_bin/third_party/musl/src/math/hypot.c deleted file mode 100644 index 6071bf1e2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/hypot.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include - -#if FLT_EVAL_METHOD > 1U && LDBL_MANT_DIG == 64 -#define SPLIT (0x1p32 + 1) -#else -#define SPLIT (0x1p27 + 1) -#endif - -static void sq(double_t *hi, double_t *lo, double x) -{ - double_t xh, xl, xc; - - xc = (double_t)x*SPLIT; - xh = x - xc + xc; - xl = x - xh; - *hi = (double_t)x*x; - *lo = xh*xh - *hi + 2*xh*xl + xl*xl; -} - -double hypot(double x, double y) -{ - union {double f; uint64_t i;} ux = {x}, uy = {y}, ut; - int ex, ey; - double_t hx, lx, hy, ly, z; - - /* arrange |x| >= |y| */ - ux.i &= -1ULL>>1; - uy.i &= -1ULL>>1; - if (ux.i < uy.i) { - ut = ux; - ux = uy; - uy = ut; - } - - /* special cases */ - ex = ux.i>>52; - ey = uy.i>>52; - x = ux.f; - y = uy.f; - /* note: hypot(inf,nan) == inf */ - if (ey == 0x7ff) - return y; - if (ex == 0x7ff || uy.i == 0) - return x; - /* note: hypot(x,y) ~= x + y*y/x/2 with inexact for small y/x */ - /* 64 difference is enough for ld80 double_t */ - if (ex - ey > 64) - return x + y; - - /* precise sqrt argument in nearest rounding mode without overflow */ - /* xh*xh must not overflow and xl*xl must not underflow in sq */ - z = 1; - if (ex > 0x3ff+510) { - z = 0x1p700; - x *= 0x1p-700; - y *= 0x1p-700; - } else if (ey < 0x3ff-450) { - z = 0x1p-700; - x *= 0x1p700; - y *= 0x1p700; - } - sq(&hx, &lx, x); - sq(&hy, &ly, y); - return z*sqrt(ly+lx+hy+hx); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/hypotf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/hypotf.c deleted file mode 100644 index 2fc214b72..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/hypotf.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include - -float hypotf(float x, float y) -{ - union {float f; uint32_t i;} ux = {x}, uy = {y}, ut; - float_t z; - - ux.i &= -1U>>1; - uy.i &= -1U>>1; - if (ux.i < uy.i) { - ut = ux; - ux = uy; - uy = ut; - } - - x = ux.f; - y = uy.f; - if (uy.i == 0xff<<23) - return y; - if (ux.i >= 0xff<<23 || uy.i == 0 || ux.i - uy.i >= 25<<23) - return x + y; - - z = 1; - if (ux.i >= (0x7f+60)<<23) { - z = 0x1p90f; - x *= 0x1p-90f; - y *= 0x1p-90f; - } else if (uy.i < (0x7f-60)<<23) { - z = 0x1p-90f; - x *= 0x1p90f; - y *= 0x1p90f; - } - return z*sqrtf((double)x*x + (double)y*y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/hypotl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/hypotl.c deleted file mode 100644 index 479aa92c3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/hypotl.c +++ /dev/null @@ -1,66 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double hypotl(long double x, long double y) -{ - return hypot(x, y); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -#if LDBL_MANT_DIG == 64 -#define SPLIT (0x1p32L+1) -#elif LDBL_MANT_DIG == 113 -#define SPLIT (0x1p57L+1) -#endif - -static void sq(long double *hi, long double *lo, long double x) -{ - long double xh, xl, xc; - xc = x*SPLIT; - xh = x - xc + xc; - xl = x - xh; - *hi = x*x; - *lo = xh*xh - *hi + 2*xh*xl + xl*xl; -} - -long double hypotl(long double x, long double y) -{ - union ldshape ux = {x}, uy = {y}; - int ex, ey; - long double hx, lx, hy, ly, z; - - ux.i.se &= 0x7fff; - uy.i.se &= 0x7fff; - if (ux.i.se < uy.i.se) { - ex = uy.i.se; - ey = ux.i.se; - x = uy.f; - y = ux.f; - } else { - ex = ux.i.se; - ey = uy.i.se; - x = ux.f; - y = uy.f; - } - - if (ex == 0x7fff && isinf(y)) - return y; - if (ex == 0x7fff || y == 0) - return x; - if (ex - ey > LDBL_MANT_DIG) - return x + y; - - z = 1; - if (ex > 0x3fff+8000) { - z = 0x1p10000L; - x *= 0x1p-10000L; - y *= 0x1p-10000L; - } else if (ey < 0x3fff-8000) { - z = 0x1p-10000L; - x *= 0x1p10000L; - y *= 0x1p10000L; - } - sq(&hx, &lx, x); - sq(&hy, &ly, y); - return z*sqrtl(ly+lx+hy+hx); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ilogb.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ilogb.c deleted file mode 100644 index 64d40154d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ilogb.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include "libm.h" - -int ilogb(double x) -{ - #pragma STDC FENV_ACCESS ON - union {double f; uint64_t i;} u = {x}; - uint64_t i = u.i; - int e = i>>52 & 0x7ff; - - if (!e) { - i <<= 12; - if (i == 0) { - FORCE_EVAL(0/0.0f); - return FP_ILOGB0; - } - /* subnormal x */ - for (e = -0x3ff; i>>63 == 0; e--, i<<=1); - return e; - } - if (e == 0x7ff) { - FORCE_EVAL(0/0.0f); - return i<<12 ? FP_ILOGBNAN : INT_MAX; - } - return e - 0x3ff; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ilogbf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ilogbf.c deleted file mode 100644 index e23ba209e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ilogbf.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include "libm.h" - -int ilogbf(float x) -{ - #pragma STDC FENV_ACCESS ON - union {float f; uint32_t i;} u = {x}; - uint32_t i = u.i; - int e = i>>23 & 0xff; - - if (!e) { - i <<= 9; - if (i == 0) { - FORCE_EVAL(0/0.0f); - return FP_ILOGB0; - } - /* subnormal x */ - for (e = -0x7f; i>>31 == 0; e--, i<<=1); - return e; - } - if (e == 0xff) { - FORCE_EVAL(0/0.0f); - return i<<9 ? FP_ILOGBNAN : INT_MAX; - } - return e - 0x7f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ilogbl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ilogbl.c deleted file mode 100644 index 7b1a9cf8d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ilogbl.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -int ilogbl(long double x) -{ - return ilogb(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -int ilogbl(long double x) -{ - #pragma STDC FENV_ACCESS ON - union ldshape u = {x}; - uint64_t m = u.i.m; - int e = u.i.se & 0x7fff; - - if (!e) { - if (m == 0) { - FORCE_EVAL(0/0.0f); - return FP_ILOGB0; - } - /* subnormal x */ - for (e = -0x3fff+1; m>>63 == 0; e--, m<<=1); - return e; - } - if (e == 0x7fff) { - FORCE_EVAL(0/0.0f); - return m<<1 ? FP_ILOGBNAN : INT_MAX; - } - return e - 0x3fff; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -int ilogbl(long double x) -{ - #pragma STDC FENV_ACCESS ON - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - - if (!e) { - if (x == 0) { - FORCE_EVAL(0/0.0f); - return FP_ILOGB0; - } - /* subnormal x */ - x *= 0x1p120; - return ilogbl(x) - 120; - } - if (e == 0x7fff) { - FORCE_EVAL(0/0.0f); - u.i.se = 0; - return u.f ? FP_ILOGBNAN : INT_MAX; - } - return e - 0x3fff; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/j0.c b/src/hyperlight_guest_bin/third_party/musl/src/math/j0.c deleted file mode 100644 index d722d9428..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/j0.c +++ /dev/null @@ -1,375 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_j0.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* j0(x), y0(x) - * Bessel function of the first and second kinds of order zero. - * Method -- j0(x): - * 1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ... - * 2. Reduce x to |x| since j0(x)=j0(-x), and - * for x in (0,2) - * j0(x) = 1-z/4+ z^2*R0/S0, where z = x*x; - * (precision: |j0-1+z/4-z^2R0/S0 |<2**-63.67 ) - * for x in (2,inf) - * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0)) - * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) - * as follow: - * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) - * = 1/sqrt(2) * (cos(x) + sin(x)) - * sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4) - * = 1/sqrt(2) * (sin(x) - cos(x)) - * (To avoid cancellation, use - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) - * - * 3 Special cases - * j0(nan)= nan - * j0(0) = 1 - * j0(inf) = 0 - * - * Method -- y0(x): - * 1. For x<2. - * Since - * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) - * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. - * We use the following function to approximate y0, - * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 - * where - * U(z) = u00 + u01*z + ... + u06*z^6 - * V(z) = 1 + v01*z + ... + v04*z^4 - * with absolute approximation error bounded by 2**-72. - * Note: For tiny x, U/V = u0 and j0(x)~1, hence - * y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27) - * 2. For x>=2. - * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0)) - * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) - * by the method mentioned above. - * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. - */ - -#include "libm.h" - -static double pzero(double), qzero(double); - -static const double -invsqrtpi = 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ -tpi = 6.36619772367581382433e-01; /* 0x3FE45F30, 0x6DC9C883 */ - -/* common method when |x|>=2 */ -static double common(uint32_t ix, double x, int y0) -{ - double s,c,ss,cc,z; - - /* - * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x-pi/4)-q0(x)*sin(x-pi/4)) - * y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x-pi/4)+q0(x)*cos(x-pi/4)) - * - * sin(x-pi/4) = (sin(x) - cos(x))/sqrt(2) - * cos(x-pi/4) = (sin(x) + cos(x))/sqrt(2) - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - */ - s = sin(x); - c = cos(x); - if (y0) - c = -c; - cc = s+c; - /* avoid overflow in 2*x, big ulp error when x>=0x1p1023 */ - if (ix < 0x7fe00000) { - ss = s-c; - z = -cos(2*x); - if (s*c < 0) - cc = z/ss; - else - ss = z/cc; - if (ix < 0x48000000) { - if (y0) - ss = -ss; - cc = pzero(x)*cc-qzero(x)*ss; - } - } - return invsqrtpi*cc/sqrt(x); -} - -/* R0/S0 on [0, 2.00] */ -static const double -R02 = 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */ -R03 = -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */ -R04 = 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */ -R05 = -4.61832688532103189199e-09, /* 0xBE33D5E7, 0x73D63FCE */ -S01 = 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */ -S02 = 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */ -S03 = 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */ -S04 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */ - -double j0(double x) -{ - double z,r,s; - uint32_t ix; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - - /* j0(+-inf)=0, j0(nan)=nan */ - if (ix >= 0x7ff00000) - return 1/(x*x); - x = fabs(x); - - if (ix >= 0x40000000) { /* |x| >= 2 */ - /* large ulp error near zeros: 2.4, 5.52, 8.6537,.. */ - return common(ix,x,0); - } - - /* 1 - x*x/4 + x*x*R(x^2)/S(x^2) */ - if (ix >= 0x3f200000) { /* |x| >= 2**-13 */ - /* up to 4ulp error close to 2 */ - z = x*x; - r = z*(R02+z*(R03+z*(R04+z*R05))); - s = 1+z*(S01+z*(S02+z*(S03+z*S04))); - return (1+x/2)*(1-x/2) + z*(r/s); - } - - /* 1 - x*x/4 */ - /* prevent underflow */ - /* inexact should be raised when x!=0, this is not done correctly */ - if (ix >= 0x38000000) /* |x| >= 2**-127 */ - x = 0.25*x*x; - return 1 - x; -} - -static const double -u00 = -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */ -u01 = 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */ -u02 = -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */ -u03 = 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */ -u04 = -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */ -u05 = 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */ -u06 = -3.98205194132103398453e-11, /* 0xBDC5E43D, 0x693FB3C8 */ -v01 = 1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ -v02 = 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */ -v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ -v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ - -double y0(double x) -{ - double z,u,v; - uint32_t ix,lx; - - EXTRACT_WORDS(ix, lx, x); - - /* y0(nan)=nan, y0(<0)=nan, y0(0)=-inf, y0(inf)=0 */ - if ((ix<<1 | lx) == 0) - return -1/0.0; - if (ix>>31) - return 0/0.0; - if (ix >= 0x7ff00000) - return 1/x; - - if (ix >= 0x40000000) { /* x >= 2 */ - /* large ulp errors near zeros: 3.958, 7.086,.. */ - return common(ix,x,1); - } - - /* U(x^2)/V(x^2) + (2/pi)*j0(x)*log(x) */ - if (ix >= 0x3e400000) { /* x >= 2**-27 */ - /* large ulp error near the first zero, x ~= 0.89 */ - z = x*x; - u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); - v = 1.0+z*(v01+z*(v02+z*(v03+z*v04))); - return u/v + tpi*(j0(x)*log(x)); - } - return u00 + tpi*log(x); -} - -/* The asymptotic expansions of pzero is - * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. - * For x >= 2, We approximate pzero by - * pzero(x) = 1 + (R/S) - * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10 - * S = 1 + pS0*s^2 + ... + pS4*s^10 - * and - * | pzero(x)-1-R/S | <= 2 ** ( -60.26) - */ -static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */ - -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */ - -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */ - -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */ - -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */ -}; -static const double pS8[5] = { - 1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */ - 3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */ - 4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */ - 1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */ - 4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */ -}; - -static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */ - -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */ - -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */ - -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */ - -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */ - -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */ -}; -static const double pS5[5] = { - 6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */ - 1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */ - 5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */ - 9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */ - 2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */ -}; - -static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ - -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */ - -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */ - -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */ - -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */ - -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */ - -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */ -}; -static const double pS3[5] = { - 3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */ - 3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */ - 1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */ - 1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */ - 1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */ -}; - -static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */ - -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */ - -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */ - -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */ - -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */ - -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */ -}; -static const double pS2[5] = { - 2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */ - 1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */ - 2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */ - 1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */ - 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ -}; - -static double pzero(double x) -{ - const double *p,*q; - double_t z,r,s; - uint32_t ix; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x40200000){p = pR8; q = pS8;} - else if (ix >= 0x40122E8B){p = pR5; q = pS5;} - else if (ix >= 0x4006DB6D){p = pR3; q = pS3;} - else /*ix >= 0x40000000*/ {p = pR2; q = pS2;} - z = 1.0/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); - return 1.0 + r/s; -} - - -/* For x >= 8, the asymptotic expansions of qzero is - * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. - * We approximate pzero by - * qzero(x) = s*(-1.25 + (R/S)) - * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 - * S = 1 + qS0*s^2 + ... + qS5*s^12 - * and - * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22) - */ -static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - 7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */ - 1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */ - 5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */ - 8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */ - 3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */ -}; -static const double qS8[6] = { - 1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */ - 8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */ - 1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */ - 8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */ - 8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */ - -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */ -}; - -static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - 1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */ - 7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */ - 5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */ - 1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */ - 1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */ - 1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */ -}; -static const double qS5[6] = { - 8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */ - 2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */ - 1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */ - 5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */ - 3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */ - -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */ -}; - -static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ - 4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */ - 7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */ - 3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */ - 4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */ - 1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */ - 1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */ -}; -static const double qS3[6] = { - 4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */ - 7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */ - 3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */ - 6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */ - 2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */ - -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */ -}; - -static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - 1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */ - 7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */ - 1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */ - 1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */ - 3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */ - 1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */ -}; -static const double qS2[6] = { - 3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */ - 2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */ - 8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */ - 8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */ - 2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */ - -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ -}; - -static double qzero(double x) -{ - const double *p,*q; - double_t s,r,z; - uint32_t ix; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x40200000){p = qR8; q = qS8;} - else if (ix >= 0x40122E8B){p = qR5; q = qS5;} - else if (ix >= 0x4006DB6D){p = qR3; q = qS3;} - else /*ix >= 0x40000000*/ {p = qR2; q = qS2;} - z = 1.0/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); - return (-.125 + r/s)/x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/j0f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/j0f.c deleted file mode 100644 index fab554a31..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/j0f.c +++ /dev/null @@ -1,314 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_j0f.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#define _GNU_SOURCE -#include "libm.h" - -static float pzerof(float), qzerof(float); - -static const float -invsqrtpi = 5.6418961287e-01, /* 0x3f106ebb */ -tpi = 6.3661974669e-01; /* 0x3f22f983 */ - -static float common(uint32_t ix, float x, int y0) -{ - float z,s,c,ss,cc; - /* - * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) - * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) - */ - s = sinf(x); - c = cosf(x); - if (y0) - c = -c; - cc = s+c; - if (ix < 0x7f000000) { - ss = s-c; - z = -cosf(2*x); - if (s*c < 0) - cc = z/ss; - else - ss = z/cc; - if (ix < 0x58800000) { - if (y0) - ss = -ss; - cc = pzerof(x)*cc-qzerof(x)*ss; - } - } - return invsqrtpi*cc/sqrtf(x); -} - -/* R0/S0 on [0, 2.00] */ -static const float -R02 = 1.5625000000e-02, /* 0x3c800000 */ -R03 = -1.8997929874e-04, /* 0xb947352e */ -R04 = 1.8295404516e-06, /* 0x35f58e88 */ -R05 = -4.6183270541e-09, /* 0xb19eaf3c */ -S01 = 1.5619102865e-02, /* 0x3c7fe744 */ -S02 = 1.1692678527e-04, /* 0x38f53697 */ -S03 = 5.1354652442e-07, /* 0x3509daa6 */ -S04 = 1.1661400734e-09; /* 0x30a045e8 */ - -float j0f(float x) -{ - float z,r,s; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x7f800000) - return 1/(x*x); - x = fabsf(x); - - if (ix >= 0x40000000) { /* |x| >= 2 */ - /* large ulp error near zeros */ - return common(ix, x, 0); - } - if (ix >= 0x3a000000) { /* |x| >= 2**-11 */ - /* up to 4ulp error near 2 */ - z = x*x; - r = z*(R02+z*(R03+z*(R04+z*R05))); - s = 1+z*(S01+z*(S02+z*(S03+z*S04))); - return (1+x/2)*(1-x/2) + z*(r/s); - } - if (ix >= 0x21800000) /* |x| >= 2**-60 */ - x = 0.25f*x*x; - return 1 - x; -} - -static const float -u00 = -7.3804296553e-02, /* 0xbd9726b5 */ -u01 = 1.7666645348e-01, /* 0x3e34e80d */ -u02 = -1.3818567619e-02, /* 0xbc626746 */ -u03 = 3.4745343146e-04, /* 0x39b62a69 */ -u04 = -3.8140706238e-06, /* 0xb67ff53c */ -u05 = 1.9559013964e-08, /* 0x32a802ba */ -u06 = -3.9820518410e-11, /* 0xae2f21eb */ -v01 = 1.2730483897e-02, /* 0x3c509385 */ -v02 = 7.6006865129e-05, /* 0x389f65e0 */ -v03 = 2.5915085189e-07, /* 0x348b216c */ -v04 = 4.4111031494e-10; /* 0x2ff280c2 */ - -float y0f(float x) -{ - float z,u,v; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - if ((ix & 0x7fffffff) == 0) - return -1/0.0f; - if (ix>>31) - return 0/0.0f; - if (ix >= 0x7f800000) - return 1/x; - if (ix >= 0x40000000) { /* |x| >= 2.0 */ - /* large ulp error near zeros */ - return common(ix,x,1); - } - if (ix >= 0x39000000) { /* x >= 2**-13 */ - /* large ulp error at x ~= 0.89 */ - z = x*x; - u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); - v = 1+z*(v01+z*(v02+z*(v03+z*v04))); - return u/v + tpi*(j0f(x)*logf(x)); - } - return u00 + tpi*logf(x); -} - -/* The asymptotic expansions of pzero is - * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. - * For x >= 2, We approximate pzero by - * pzero(x) = 1 + (R/S) - * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10 - * S = 1 + pS0*s^2 + ... + pS4*s^10 - * and - * | pzero(x)-1-R/S | <= 2 ** ( -60.26) - */ -static const float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.0000000000e+00, /* 0x00000000 */ - -7.0312500000e-02, /* 0xbd900000 */ - -8.0816707611e+00, /* 0xc1014e86 */ - -2.5706311035e+02, /* 0xc3808814 */ - -2.4852163086e+03, /* 0xc51b5376 */ - -5.2530439453e+03, /* 0xc5a4285a */ -}; -static const float pS8[5] = { - 1.1653436279e+02, /* 0x42e91198 */ - 3.8337448730e+03, /* 0x456f9beb */ - 4.0597855469e+04, /* 0x471e95db */ - 1.1675296875e+05, /* 0x47e4087c */ - 4.7627726562e+04, /* 0x473a0bba */ -}; -static const float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - -1.1412546255e-11, /* 0xad48c58a */ - -7.0312492549e-02, /* 0xbd8fffff */ - -4.1596107483e+00, /* 0xc0851b88 */ - -6.7674766541e+01, /* 0xc287597b */ - -3.3123129272e+02, /* 0xc3a59d9b */ - -3.4643338013e+02, /* 0xc3ad3779 */ -}; -static const float pS5[5] = { - 6.0753936768e+01, /* 0x42730408 */ - 1.0512523193e+03, /* 0x44836813 */ - 5.9789707031e+03, /* 0x45bad7c4 */ - 9.6254453125e+03, /* 0x461665c8 */ - 2.4060581055e+03, /* 0x451660ee */ -}; - -static const float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ - -2.5470459075e-09, /* 0xb12f081b */ - -7.0311963558e-02, /* 0xbd8fffb8 */ - -2.4090321064e+00, /* 0xc01a2d95 */ - -2.1965976715e+01, /* 0xc1afba52 */ - -5.8079170227e+01, /* 0xc2685112 */ - -3.1447946548e+01, /* 0xc1fb9565 */ -}; -static const float pS3[5] = { - 3.5856033325e+01, /* 0x420f6c94 */ - 3.6151397705e+02, /* 0x43b4c1ca */ - 1.1936077881e+03, /* 0x44953373 */ - 1.1279968262e+03, /* 0x448cffe6 */ - 1.7358093262e+02, /* 0x432d94b8 */ -}; - -static const float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - -8.8753431271e-08, /* 0xb3be98b7 */ - -7.0303097367e-02, /* 0xbd8ffb12 */ - -1.4507384300e+00, /* 0xbfb9b1cc */ - -7.6356959343e+00, /* 0xc0f4579f */ - -1.1193166733e+01, /* 0xc1331736 */ - -3.2336456776e+00, /* 0xc04ef40d */ -}; -static const float pS2[5] = { - 2.2220300674e+01, /* 0x41b1c32d */ - 1.3620678711e+02, /* 0x430834f0 */ - 2.7047027588e+02, /* 0x43873c32 */ - 1.5387539673e+02, /* 0x4319e01a */ - 1.4657617569e+01, /* 0x416a859a */ -}; - -static float pzerof(float x) -{ - const float *p,*q; - float_t z,r,s; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x41000000){p = pR8; q = pS8;} - else if (ix >= 0x409173eb){p = pR5; q = pS5;} - else if (ix >= 0x4036d917){p = pR3; q = pS3;} - else /*ix >= 0x40000000*/ {p = pR2; q = pS2;} - z = 1.0f/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0f+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); - return 1.0f + r/s; -} - - -/* For x >= 8, the asymptotic expansions of qzero is - * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. - * We approximate pzero by - * qzero(x) = s*(-1.25 + (R/S)) - * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 - * S = 1 + qS0*s^2 + ... + qS5*s^12 - * and - * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22) - */ -static const float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.0000000000e+00, /* 0x00000000 */ - 7.3242187500e-02, /* 0x3d960000 */ - 1.1768206596e+01, /* 0x413c4a93 */ - 5.5767340088e+02, /* 0x440b6b19 */ - 8.8591972656e+03, /* 0x460a6cca */ - 3.7014625000e+04, /* 0x471096a0 */ -}; -static const float qS8[6] = { - 1.6377603149e+02, /* 0x4323c6aa */ - 8.0983447266e+03, /* 0x45fd12c2 */ - 1.4253829688e+05, /* 0x480b3293 */ - 8.0330925000e+05, /* 0x49441ed4 */ - 8.4050156250e+05, /* 0x494d3359 */ - -3.4389928125e+05, /* 0xc8a7eb69 */ -}; - -static const float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - 1.8408595828e-11, /* 0x2da1ec79 */ - 7.3242180049e-02, /* 0x3d95ffff */ - 5.8356351852e+00, /* 0x40babd86 */ - 1.3511157227e+02, /* 0x43071c90 */ - 1.0272437744e+03, /* 0x448067cd */ - 1.9899779053e+03, /* 0x44f8bf4b */ -}; -static const float qS5[6] = { - 8.2776611328e+01, /* 0x42a58da0 */ - 2.0778142090e+03, /* 0x4501dd07 */ - 1.8847289062e+04, /* 0x46933e94 */ - 5.6751113281e+04, /* 0x475daf1d */ - 3.5976753906e+04, /* 0x470c88c1 */ - -5.3543427734e+03, /* 0xc5a752be */ -}; - -static const float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ - 4.3774099900e-09, /* 0x3196681b */ - 7.3241114616e-02, /* 0x3d95ff70 */ - 3.3442313671e+00, /* 0x405607e3 */ - 4.2621845245e+01, /* 0x422a7cc5 */ - 1.7080809021e+02, /* 0x432acedf */ - 1.6673394775e+02, /* 0x4326bbe4 */ -}; -static const float qS3[6] = { - 4.8758872986e+01, /* 0x42430916 */ - 7.0968920898e+02, /* 0x44316c1c */ - 3.7041481934e+03, /* 0x4567825f */ - 6.4604252930e+03, /* 0x45c9e367 */ - 2.5163337402e+03, /* 0x451d4557 */ - -1.4924745178e+02, /* 0xc3153f59 */ -}; - -static const float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - 1.5044444979e-07, /* 0x342189db */ - 7.3223426938e-02, /* 0x3d95f62a */ - 1.9981917143e+00, /* 0x3fffc4bf */ - 1.4495602608e+01, /* 0x4167edfd */ - 3.1666231155e+01, /* 0x41fd5471 */ - 1.6252708435e+01, /* 0x4182058c */ -}; -static const float qS2[6] = { - 3.0365585327e+01, /* 0x41f2ecb8 */ - 2.6934811401e+02, /* 0x4386ac8f */ - 8.4478375244e+02, /* 0x44533229 */ - 8.8293585205e+02, /* 0x445cbbe5 */ - 2.1266638184e+02, /* 0x4354aa98 */ - -5.3109550476e+00, /* 0xc0a9f358 */ -}; - -static float qzerof(float x) -{ - const float *p,*q; - float_t s,r,z; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x41000000){p = qR8; q = qS8;} - else if (ix >= 0x409173eb){p = qR5; q = qS5;} - else if (ix >= 0x4036d917){p = qR3; q = qS3;} - else /*ix >= 0x40000000*/ {p = qR2; q = qS2;} - z = 1.0f/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0f+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); - return (-.125f + r/s)/x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/j1.c b/src/hyperlight_guest_bin/third_party/musl/src/math/j1.c deleted file mode 100644 index df724d172..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/j1.c +++ /dev/null @@ -1,362 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_j1.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* j1(x), y1(x) - * Bessel function of the first and second kinds of order zero. - * Method -- j1(x): - * 1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ... - * 2. Reduce x to |x| since j1(x)=-j1(-x), and - * for x in (0,2) - * j1(x) = x/2 + x*z*R0/S0, where z = x*x; - * (precision: |j1/x - 1/2 - R0/S0 |<2**-61.51 ) - * for x in (2,inf) - * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) - * as follow: - * cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) - * = 1/sqrt(2) * (sin(x) - cos(x)) - * sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) - * = -1/sqrt(2) * (sin(x) + cos(x)) - * (To avoid cancellation, use - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) - * - * 3 Special cases - * j1(nan)= nan - * j1(0) = 0 - * j1(inf) = 0 - * - * Method -- y1(x): - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN - * 2. For x<2. - * Since - * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) - * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. - * We use the following function to approximate y1, - * y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2 - * where for x in [0,2] (abs err less than 2**-65.89) - * U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4 - * V(z) = 1 + v0[0]*z + ... + v0[4]*z^5 - * Note: For tiny x, 1/x dominate y1 and hence - * y1(tiny) = -2/pi/tiny, (choose tiny<2**-54) - * 3. For x>=2. - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) - * by method mentioned above. - */ - -#include "libm.h" - -static double pone(double), qone(double); - -static const double -invsqrtpi = 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ -tpi = 6.36619772367581382433e-01; /* 0x3FE45F30, 0x6DC9C883 */ - -static double common(uint32_t ix, double x, int y1, int sign) -{ - double z,s,c,ss,cc; - - /* - * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x-3pi/4)-q1(x)*sin(x-3pi/4)) - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x-3pi/4)+q1(x)*cos(x-3pi/4)) - * - * sin(x-3pi/4) = -(sin(x) + cos(x))/sqrt(2) - * cos(x-3pi/4) = (sin(x) - cos(x))/sqrt(2) - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - */ - s = sin(x); - if (y1) - s = -s; - c = cos(x); - cc = s-c; - if (ix < 0x7fe00000) { - /* avoid overflow in 2*x */ - ss = -s-c; - z = cos(2*x); - if (s*c > 0) - cc = z/ss; - else - ss = z/cc; - if (ix < 0x48000000) { - if (y1) - ss = -ss; - cc = pone(x)*cc-qone(x)*ss; - } - } - if (sign) - cc = -cc; - return invsqrtpi*cc/sqrt(x); -} - -/* R0/S0 on [0,2] */ -static const double -r00 = -6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */ -r01 = 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */ -r02 = -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */ -r03 = 4.96727999609584448412e-08, /* 0x3E6AAAFA, 0x46CA0BD9 */ -s01 = 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */ -s02 = 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */ -s03 = 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */ -s04 = 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */ -s05 = 1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */ - -double j1(double x) -{ - double z,r,s; - uint32_t ix; - int sign; - - GET_HIGH_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x7ff00000) - return 1/(x*x); - if (ix >= 0x40000000) /* |x| >= 2 */ - return common(ix, fabs(x), 0, sign); - if (ix >= 0x38000000) { /* |x| >= 2**-127 */ - z = x*x; - r = z*(r00+z*(r01+z*(r02+z*r03))); - s = 1+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); - z = r/s; - } else - /* avoid underflow, raise inexact if x!=0 */ - z = x; - return (0.5 + z)*x; -} - -static const double U0[5] = { - -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */ - 5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */ - -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */ - 2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */ - -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */ -}; -static const double V0[5] = { - 1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */ - 2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */ - 1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */ - 6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */ - 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ -}; - -double y1(double x) -{ - double z,u,v; - uint32_t ix,lx; - - EXTRACT_WORDS(ix, lx, x); - /* y1(nan)=nan, y1(<0)=nan, y1(0)=-inf, y1(inf)=0 */ - if ((ix<<1 | lx) == 0) - return -1/0.0; - if (ix>>31) - return 0/0.0; - if (ix >= 0x7ff00000) - return 1/x; - - if (ix >= 0x40000000) /* x >= 2 */ - return common(ix, x, 1, 0); - if (ix < 0x3c900000) /* x < 2**-54 */ - return -tpi/x; - z = x*x; - u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); - v = 1+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); - return x*(u/v) + tpi*(j1(x)*log(x)-1/x); -} - -/* For x >= 8, the asymptotic expansions of pone is - * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. - * We approximate pone by - * pone(x) = 1 + (R/S) - * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10 - * S = 1 + ps0*s^2 + ... + ps4*s^10 - * and - * | pone(x)-1-R/S | <= 2 ** ( -60.06) - */ - -static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - 1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */ - 1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */ - 4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */ - 3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */ - 7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */ -}; -static const double ps8[5] = { - 1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */ - 3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */ - 3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */ - 9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */ - 3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */ -}; - -static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - 1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */ - 1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */ - 6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */ - 1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */ - 5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */ - 5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */ -}; -static const double ps5[5] = { - 5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */ - 9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */ - 5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */ - 7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */ - 1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */ -}; - -static const double pr3[6] = { - 3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */ - 1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */ - 3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */ - 3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */ - 9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */ - 4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */ -}; -static const double ps3[5] = { - 3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */ - 3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */ - 1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */ - 8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */ - 1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */ -}; - -static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - 1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */ - 1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */ - 2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */ - 1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */ - 1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */ - 5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */ -}; -static const double ps2[5] = { - 2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */ - 1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */ - 2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */ - 1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */ - 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */ -}; - -static double pone(double x) -{ - const double *p,*q; - double_t z,r,s; - uint32_t ix; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x40200000){p = pr8; q = ps8;} - else if (ix >= 0x40122E8B){p = pr5; q = ps5;} - else if (ix >= 0x4006DB6D){p = pr3; q = ps3;} - else /*ix >= 0x40000000*/ {p = pr2; q = ps2;} - z = 1.0/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); - return 1.0+ r/s; -} - -/* For x >= 8, the asymptotic expansions of qone is - * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. - * We approximate pone by - * qone(x) = s*(0.375 + (R/S)) - * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 - * S = 1 + qs1*s^2 + ... + qs6*s^12 - * and - * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13) - */ - -static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */ - -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */ - -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */ - -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */ - -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */ -}; -static const double qs8[6] = { - 1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */ - 7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */ - 1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */ - 7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */ - 6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */ - -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */ -}; - -static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */ - -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */ - -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */ - -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */ - -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */ - -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */ -}; -static const double qs5[6] = { - 8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */ - 1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */ - 1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */ - 4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */ - 2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */ - -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */ -}; - -static const double qr3[6] = { - -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */ - -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */ - -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */ - -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */ - -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */ - -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */ -}; -static const double qs3[6] = { - 4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */ - 6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */ - 3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */ - 5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */ - 1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */ - -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */ -}; - -static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */ - -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */ - -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */ - -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */ - -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */ - -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */ -}; -static const double qs2[6] = { - 2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */ - 2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */ - 7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */ - 7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */ - 1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */ - -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */ -}; - -static double qone(double x) -{ - const double *p,*q; - double_t s,r,z; - uint32_t ix; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x40200000){p = qr8; q = qs8;} - else if (ix >= 0x40122E8B){p = qr5; q = qs5;} - else if (ix >= 0x4006DB6D){p = qr3; q = qs3;} - else /*ix >= 0x40000000*/ {p = qr2; q = qs2;} - z = 1.0/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); - return (.375 + r/s)/x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/j1f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/j1f.c deleted file mode 100644 index 3434c53dc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/j1f.c +++ /dev/null @@ -1,310 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_j1f.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#define _GNU_SOURCE -#include "libm.h" - -static float ponef(float), qonef(float); - -static const float -invsqrtpi = 5.6418961287e-01, /* 0x3f106ebb */ -tpi = 6.3661974669e-01; /* 0x3f22f983 */ - -static float common(uint32_t ix, float x, int y1, int sign) -{ - double z,s,c,ss,cc; - - s = sinf(x); - if (y1) - s = -s; - c = cosf(x); - cc = s-c; - if (ix < 0x7f000000) { - ss = -s-c; - z = cosf(2*x); - if (s*c > 0) - cc = z/ss; - else - ss = z/cc; - if (ix < 0x58800000) { - if (y1) - ss = -ss; - cc = ponef(x)*cc-qonef(x)*ss; - } - } - if (sign) - cc = -cc; - return invsqrtpi*cc/sqrtf(x); -} - -/* R0/S0 on [0,2] */ -static const float -r00 = -6.2500000000e-02, /* 0xbd800000 */ -r01 = 1.4070566976e-03, /* 0x3ab86cfd */ -r02 = -1.5995563444e-05, /* 0xb7862e36 */ -r03 = 4.9672799207e-08, /* 0x335557d2 */ -s01 = 1.9153760746e-02, /* 0x3c9ce859 */ -s02 = 1.8594678841e-04, /* 0x3942fab6 */ -s03 = 1.1771846857e-06, /* 0x359dffc2 */ -s04 = 5.0463624390e-09, /* 0x31ad6446 */ -s05 = 1.2354227016e-11; /* 0x2d59567e */ - -float j1f(float x) -{ - float z,r,s; - uint32_t ix; - int sign; - - GET_FLOAT_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix >= 0x7f800000) - return 1/(x*x); - if (ix >= 0x40000000) /* |x| >= 2 */ - return common(ix, fabsf(x), 0, sign); - if (ix >= 0x39000000) { /* |x| >= 2**-13 */ - z = x*x; - r = z*(r00+z*(r01+z*(r02+z*r03))); - s = 1+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); - z = 0.5f + r/s; - } else - z = 0.5f; - return z*x; -} - -static const float U0[5] = { - -1.9605709612e-01, /* 0xbe48c331 */ - 5.0443872809e-02, /* 0x3d4e9e3c */ - -1.9125689287e-03, /* 0xbafaaf2a */ - 2.3525259166e-05, /* 0x37c5581c */ - -9.1909917899e-08, /* 0xb3c56003 */ -}; -static const float V0[5] = { - 1.9916731864e-02, /* 0x3ca3286a */ - 2.0255257550e-04, /* 0x3954644b */ - 1.3560879779e-06, /* 0x35b602d4 */ - 6.2274145840e-09, /* 0x31d5f8eb */ - 1.6655924903e-11, /* 0x2d9281cf */ -}; - -float y1f(float x) -{ - float z,u,v; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - if ((ix & 0x7fffffff) == 0) - return -1/0.0f; - if (ix>>31) - return 0/0.0f; - if (ix >= 0x7f800000) - return 1/x; - if (ix >= 0x40000000) /* |x| >= 2.0 */ - return common(ix,x,1,0); - if (ix < 0x33000000) /* x < 2**-25 */ - return -tpi/x; - z = x*x; - u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); - v = 1.0f+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); - return x*(u/v) + tpi*(j1f(x)*logf(x)-1.0f/x); -} - -/* For x >= 8, the asymptotic expansions of pone is - * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. - * We approximate pone by - * pone(x) = 1 + (R/S) - * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10 - * S = 1 + ps0*s^2 + ... + ps4*s^10 - * and - * | pone(x)-1-R/S | <= 2 ** ( -60.06) - */ - -static const float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.0000000000e+00, /* 0x00000000 */ - 1.1718750000e-01, /* 0x3df00000 */ - 1.3239480972e+01, /* 0x4153d4ea */ - 4.1205184937e+02, /* 0x43ce06a3 */ - 3.8747453613e+03, /* 0x45722bed */ - 7.9144794922e+03, /* 0x45f753d6 */ -}; -static const float ps8[5] = { - 1.1420736694e+02, /* 0x42e46a2c */ - 3.6509309082e+03, /* 0x45642ee5 */ - 3.6956207031e+04, /* 0x47105c35 */ - 9.7602796875e+04, /* 0x47bea166 */ - 3.0804271484e+04, /* 0x46f0a88b */ -}; - -static const float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - 1.3199052094e-11, /* 0x2d68333f */ - 1.1718749255e-01, /* 0x3defffff */ - 6.8027510643e+00, /* 0x40d9b023 */ - 1.0830818176e+02, /* 0x42d89dca */ - 5.1763616943e+02, /* 0x440168b7 */ - 5.2871520996e+02, /* 0x44042dc6 */ -}; -static const float ps5[5] = { - 5.9280597687e+01, /* 0x426d1f55 */ - 9.9140142822e+02, /* 0x4477d9b1 */ - 5.3532670898e+03, /* 0x45a74a23 */ - 7.8446904297e+03, /* 0x45f52586 */ - 1.5040468750e+03, /* 0x44bc0180 */ -}; - -static const float pr3[6] = { - 3.0250391081e-09, /* 0x314fe10d */ - 1.1718686670e-01, /* 0x3defffab */ - 3.9329774380e+00, /* 0x407bb5e7 */ - 3.5119403839e+01, /* 0x420c7a45 */ - 9.1055007935e+01, /* 0x42b61c2a */ - 4.8559066772e+01, /* 0x42423c7c */ -}; -static const float ps3[5] = { - 3.4791309357e+01, /* 0x420b2a4d */ - 3.3676245117e+02, /* 0x43a86198 */ - 1.0468714600e+03, /* 0x4482dbe3 */ - 8.9081134033e+02, /* 0x445eb3ed */ - 1.0378793335e+02, /* 0x42cf936c */ -}; - -static const float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - 1.0771083225e-07, /* 0x33e74ea8 */ - 1.1717621982e-01, /* 0x3deffa16 */ - 2.3685150146e+00, /* 0x401795c0 */ - 1.2242610931e+01, /* 0x4143e1bc */ - 1.7693971634e+01, /* 0x418d8d41 */ - 5.0735230446e+00, /* 0x40a25a4d */ -}; -static const float ps2[5] = { - 2.1436485291e+01, /* 0x41ab7dec */ - 1.2529022980e+02, /* 0x42fa9499 */ - 2.3227647400e+02, /* 0x436846c7 */ - 1.1767937469e+02, /* 0x42eb5bd7 */ - 8.3646392822e+00, /* 0x4105d590 */ -}; - -static float ponef(float x) -{ - const float *p,*q; - float_t z,r,s; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x41000000){p = pr8; q = ps8;} - else if (ix >= 0x409173eb){p = pr5; q = ps5;} - else if (ix >= 0x4036d917){p = pr3; q = ps3;} - else /*ix >= 0x40000000*/ {p = pr2; q = ps2;} - z = 1.0f/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0f+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); - return 1.0f + r/s; -} - -/* For x >= 8, the asymptotic expansions of qone is - * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. - * We approximate pone by - * qone(x) = s*(0.375 + (R/S)) - * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 - * S = 1 + qs1*s^2 + ... + qs6*s^12 - * and - * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13) - */ - -static const float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ - 0.0000000000e+00, /* 0x00000000 */ - -1.0253906250e-01, /* 0xbdd20000 */ - -1.6271753311e+01, /* 0xc1822c8d */ - -7.5960174561e+02, /* 0xc43de683 */ - -1.1849806641e+04, /* 0xc639273a */ - -4.8438511719e+04, /* 0xc73d3683 */ -}; -static const float qs8[6] = { - 1.6139537048e+02, /* 0x43216537 */ - 7.8253862305e+03, /* 0x45f48b17 */ - 1.3387534375e+05, /* 0x4802bcd6 */ - 7.1965775000e+05, /* 0x492fb29c */ - 6.6660125000e+05, /* 0x4922be94 */ - -2.9449025000e+05, /* 0xc88fcb48 */ -}; - -static const float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ - -2.0897993405e-11, /* 0xadb7d219 */ - -1.0253904760e-01, /* 0xbdd1fffe */ - -8.0564479828e+00, /* 0xc100e736 */ - -1.8366960144e+02, /* 0xc337ab6b */ - -1.3731937256e+03, /* 0xc4aba633 */ - -2.6124443359e+03, /* 0xc523471c */ -}; -static const float qs5[6] = { - 8.1276550293e+01, /* 0x42a28d98 */ - 1.9917987061e+03, /* 0x44f8f98f */ - 1.7468484375e+04, /* 0x468878f8 */ - 4.9851425781e+04, /* 0x4742bb6d */ - 2.7948074219e+04, /* 0x46da5826 */ - -4.7191835938e+03, /* 0xc5937978 */ -}; - -static const float qr3[6] = { - -5.0783124372e-09, /* 0xb1ae7d4f */ - -1.0253783315e-01, /* 0xbdd1ff5b */ - -4.6101160049e+00, /* 0xc0938612 */ - -5.7847221375e+01, /* 0xc267638e */ - -2.2824453735e+02, /* 0xc3643e9a */ - -2.1921012878e+02, /* 0xc35b35cb */ -}; -static const float qs3[6] = { - 4.7665153503e+01, /* 0x423ea91e */ - 6.7386511230e+02, /* 0x4428775e */ - 3.3801528320e+03, /* 0x45534272 */ - 5.5477290039e+03, /* 0x45ad5dd5 */ - 1.9031191406e+03, /* 0x44ede3d0 */ - -1.3520118713e+02, /* 0xc3073381 */ -}; - -static const float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ - -1.7838172539e-07, /* 0xb43f8932 */ - -1.0251704603e-01, /* 0xbdd1f475 */ - -2.7522056103e+00, /* 0xc0302423 */ - -1.9663616180e+01, /* 0xc19d4f16 */ - -4.2325313568e+01, /* 0xc2294d1f */ - -2.1371921539e+01, /* 0xc1aaf9b2 */ -}; -static const float qs2[6] = { - 2.9533363342e+01, /* 0x41ec4454 */ - 2.5298155212e+02, /* 0x437cfb47 */ - 7.5750280762e+02, /* 0x443d602e */ - 7.3939318848e+02, /* 0x4438d92a */ - 1.5594900513e+02, /* 0x431bf2f2 */ - -4.9594988823e+00, /* 0xc09eb437 */ -}; - -static float qonef(float x) -{ - const float *p,*q; - float_t s,r,z; - uint32_t ix; - - GET_FLOAT_WORD(ix, x); - ix &= 0x7fffffff; - if (ix >= 0x41000000){p = qr8; q = qs8;} - else if (ix >= 0x409173eb){p = qr5; q = qs5;} - else if (ix >= 0x4036d917){p = qr3; q = qs3;} - else /*ix >= 0x40000000*/ {p = qr2; q = qs2;} - z = 1.0f/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = 1.0f+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); - return (.375f + r/s)/x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/jn.c b/src/hyperlight_guest_bin/third_party/musl/src/math/jn.c deleted file mode 100644 index 4878a54fe..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/jn.c +++ /dev/null @@ -1,280 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_jn.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * jn(n, x), yn(n, x) - * floating point Bessel's function of the 1st and 2nd kind - * of order n - * - * Special cases: - * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; - * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. - * Note 2. About jn(n,x), yn(n,x) - * For n=0, j0(x) is called, - * for n=1, j1(x) is called, - * for n<=x, forward recursion is used starting - * from values of j0(x) and j1(x). - * for n>x, a continued fraction approximation to - * j(n,x)/j(n-1,x) is evaluated and then backward - * recursion is used starting from a supposed value - * for j(n,x). The resulting value of j(0,x) is - * compared with the actual value to correct the - * supposed value of j(n,x). - * - * yn(n,x) is similar in all respects, except - * that forward recursion is used for all - * values of n>1. - */ - -#include "libm.h" - -static const double invsqrtpi = 5.64189583547756279280e-01; /* 0x3FE20DD7, 0x50429B6D */ - -double jn(int n, double x) -{ - uint32_t ix, lx; - int nm1, i, sign; - double a, b, temp; - - EXTRACT_WORDS(ix, lx, x); - sign = ix>>31; - ix &= 0x7fffffff; - - if ((ix | (lx|-lx)>>31) > 0x7ff00000) /* nan */ - return x; - - /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) - * Thus, J(-n,x) = J(n,-x) - */ - /* nm1 = |n|-1 is used instead of |n| to handle n==INT_MIN */ - if (n == 0) - return j0(x); - if (n < 0) { - nm1 = -(n+1); - x = -x; - sign ^= 1; - } else - nm1 = n-1; - if (nm1 == 0) - return j1(x); - - sign &= n; /* even n: 0, odd n: signbit(x) */ - x = fabs(x); - if ((ix|lx) == 0 || ix == 0x7ff00000) /* if x is 0 or inf */ - b = 0.0; - else if (nm1 < x) { - /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ - if (ix >= 0x52d00000) { /* x > 2**302 */ - /* (x >> n**2) - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then - * - * n sin(xn)*sqt2 cos(xn)*sqt2 - * ---------------------------------- - * 0 s-c c+s - * 1 -s-c -c+s - * 2 -s+c -c-s - * 3 s+c c-s - */ - switch(nm1&3) { - case 0: temp = -cos(x)+sin(x); break; - case 1: temp = -cos(x)-sin(x); break; - case 2: temp = cos(x)-sin(x); break; - default: - case 3: temp = cos(x)+sin(x); break; - } - b = invsqrtpi*temp/sqrt(x); - } else { - a = j0(x); - b = j1(x); - for (i=0; i 32) /* underflow */ - b = 0.0; - else { - temp = x*0.5; - b = temp; - a = 1.0; - for (i=2; i<=nm1+1; i++) { - a *= (double)i; /* a = n! */ - b *= temp; /* b = (x/2)^n */ - } - b = b/a; - } - } else { - /* use backward recurrence */ - /* x x^2 x^2 - * J(n,x)/J(n-1,x) = ---- ------ ------ ..... - * 2n - 2(n+1) - 2(n+2) - * - * 1 1 1 - * (for large x) = ---- ------ ------ ..... - * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - - * x x x - * - * Let w = 2n/x and h=2/x, then the above quotient - * is equal to the continued fraction: - * 1 - * = ----------------------- - * 1 - * w - ----------------- - * 1 - * w+h - --------- - * w+2h - ... - * - * To determine how many terms needed, let - * Q(0) = w, Q(1) = w(w+h) - 1, - * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple - */ - /* determine k */ - double t,q0,q1,w,h,z,tmp,nf; - int k; - - nf = nm1 + 1.0; - w = 2*nf/x; - h = 2/x; - z = w+h; - q0 = w; - q1 = w*z - 1.0; - k = 1; - while (q1 < 1.0e9) { - k += 1; - z += h; - tmp = z*q1 - q0; - q0 = q1; - q1 = tmp; - } - for (t=0.0, i=k; i>=0; i--) - t = 1/(2*(i+nf)/x - t); - a = t; - b = 1.0; - /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) - * Hence, if n*(log(2n/x)) > ... - * single 8.8722839355e+01 - * double 7.09782712893383973096e+02 - * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is - * likely underflow to zero - */ - tmp = nf*log(fabs(w)); - if (tmp < 7.09782712893383973096e+02) { - for (i=nm1; i>0; i--) { - temp = b; - b = b*(2.0*i)/x - a; - a = temp; - } - } else { - for (i=nm1; i>0; i--) { - temp = b; - b = b*(2.0*i)/x - a; - a = temp; - /* scale b to avoid spurious overflow */ - if (b > 0x1p500) { - a /= b; - t /= b; - b = 1.0; - } - } - } - z = j0(x); - w = j1(x); - if (fabs(z) >= fabs(w)) - b = t*z/b; - else - b = t*w/a; - } - } - return sign ? -b : b; -} - - -double yn(int n, double x) -{ - uint32_t ix, lx, ib; - int nm1, sign, i; - double a, b, temp; - - EXTRACT_WORDS(ix, lx, x); - sign = ix>>31; - ix &= 0x7fffffff; - - if ((ix | (lx|-lx)>>31) > 0x7ff00000) /* nan */ - return x; - if (sign && (ix|lx)!=0) /* x < 0 */ - return 0/0.0; - if (ix == 0x7ff00000) - return 0.0; - - if (n == 0) - return y0(x); - if (n < 0) { - nm1 = -(n+1); - sign = n&1; - } else { - nm1 = n-1; - sign = 0; - } - if (nm1 == 0) - return sign ? -y1(x) : y1(x); - - if (ix >= 0x52d00000) { /* x > 2**302 */ - /* (x >> n**2) - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then - * - * n sin(xn)*sqt2 cos(xn)*sqt2 - * ---------------------------------- - * 0 s-c c+s - * 1 -s-c -c+s - * 2 -s+c -c-s - * 3 s+c c-s - */ - switch(nm1&3) { - case 0: temp = -sin(x)-cos(x); break; - case 1: temp = -sin(x)+cos(x); break; - case 2: temp = sin(x)+cos(x); break; - default: - case 3: temp = sin(x)-cos(x); break; - } - b = invsqrtpi*temp/sqrt(x); - } else { - a = y0(x); - b = y1(x); - /* quit if b is -inf */ - GET_HIGH_WORD(ib, b); - for (i=0; i>31; - ix &= 0x7fffffff; - if (ix > 0x7f800000) /* nan */ - return x; - - /* J(-n,x) = J(n,-x), use |n|-1 to avoid overflow in -n */ - if (n == 0) - return j0f(x); - if (n < 0) { - nm1 = -(n+1); - x = -x; - sign ^= 1; - } else - nm1 = n-1; - if (nm1 == 0) - return j1f(x); - - sign &= n; /* even n: 0, odd n: signbit(x) */ - x = fabsf(x); - if (ix == 0 || ix == 0x7f800000) /* if x is 0 or inf */ - b = 0.0f; - else if (nm1 < x) { - /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ - a = j0f(x); - b = j1f(x); - for (i=0; i 8) /* underflow */ - nm1 = 8; - temp = 0.5f * x; - b = temp; - a = 1.0f; - for (i=2; i<=nm1+1; i++) { - a *= (float)i; /* a = n! */ - b *= temp; /* b = (x/2)^n */ - } - b = b/a; - } else { - /* use backward recurrence */ - /* x x^2 x^2 - * J(n,x)/J(n-1,x) = ---- ------ ------ ..... - * 2n - 2(n+1) - 2(n+2) - * - * 1 1 1 - * (for large x) = ---- ------ ------ ..... - * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - - * x x x - * - * Let w = 2n/x and h=2/x, then the above quotient - * is equal to the continued fraction: - * 1 - * = ----------------------- - * 1 - * w - ----------------- - * 1 - * w+h - --------- - * w+2h - ... - * - * To determine how many terms needed, let - * Q(0) = w, Q(1) = w(w+h) - 1, - * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple - */ - /* determine k */ - float t,q0,q1,w,h,z,tmp,nf; - int k; - - nf = nm1+1.0f; - w = 2*nf/x; - h = 2/x; - z = w+h; - q0 = w; - q1 = w*z - 1.0f; - k = 1; - while (q1 < 1.0e4f) { - k += 1; - z += h; - tmp = z*q1 - q0; - q0 = q1; - q1 = tmp; - } - for (t=0.0f, i=k; i>=0; i--) - t = 1.0f/(2*(i+nf)/x-t); - a = t; - b = 1.0f; - /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) - * Hence, if n*(log(2n/x)) > ... - * single 8.8722839355e+01 - * double 7.09782712893383973096e+02 - * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is - * likely underflow to zero - */ - tmp = nf*logf(fabsf(w)); - if (tmp < 88.721679688f) { - for (i=nm1; i>0; i--) { - temp = b; - b = 2.0f*i*b/x - a; - a = temp; - } - } else { - for (i=nm1; i>0; i--){ - temp = b; - b = 2.0f*i*b/x - a; - a = temp; - /* scale b to avoid spurious overflow */ - if (b > 0x1p60f) { - a /= b; - t /= b; - b = 1.0f; - } - } - } - z = j0f(x); - w = j1f(x); - if (fabsf(z) >= fabsf(w)) - b = t*z/b; - else - b = t*w/a; - } - } - return sign ? -b : b; -} - -float ynf(int n, float x) -{ - uint32_t ix, ib; - int nm1, sign, i; - float a, b, temp; - - GET_FLOAT_WORD(ix, x); - sign = ix>>31; - ix &= 0x7fffffff; - if (ix > 0x7f800000) /* nan */ - return x; - if (sign && ix != 0) /* x < 0 */ - return 0/0.0f; - if (ix == 0x7f800000) - return 0.0f; - - if (n == 0) - return y0f(x); - if (n < 0) { - nm1 = -(n+1); - sign = n&1; - } else { - nm1 = n-1; - sign = 0; - } - if (nm1 == 0) - return sign ? -y1f(x) : y1f(x); - - a = y0f(x); - b = y1f(x); - /* quit if b is -inf */ - GET_FLOAT_WORD(ib,b); - for (i = 0; i < nm1 && ib != 0xff800000; ) { - i++; - temp = b; - b = (2.0f*i/x)*b - a; - GET_FLOAT_WORD(ib, b); - a = temp; - } - return sign ? -b : b; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ldexp.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ldexp.c deleted file mode 100644 index f4d1cd6af..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ldexp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -double ldexp(double x, int n) -{ - return scalbn(x, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ldexpf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ldexpf.c deleted file mode 100644 index 3bad5f393..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ldexpf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -float ldexpf(float x, int n) -{ - return scalbnf(x, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/ldexpl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/ldexpl.c deleted file mode 100644 index fd145ccc5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/ldexpl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long double ldexpl(long double x, int n) -{ - return scalbnl(x, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lgamma.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lgamma.c deleted file mode 100644 index 2fc9b478e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lgamma.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "libm.h" - -double lgamma(double x) -{ - return __lgamma_r(x, &__signgam); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lgamma_r.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lgamma_r.c deleted file mode 100644 index f9984cd0c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lgamma_r.c +++ /dev/null @@ -1,283 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_lgamma_r.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - */ -/* lgamma_r(x, signgamp) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). - * - * Method: - * 1. Argument Reduction for 0 < x <= 8 - * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may - * reduce x to a number in [1.5,2.5] by - * lgamma(1+s) = log(s) + lgamma(s) - * for example, - * lgamma(7.3) = log(6.3) + lgamma(6.3) - * = log(6.3*5.3) + lgamma(5.3) - * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) - * 2. Polynomial approximation of lgamma around its - * minimun ymin=1.461632144968362245 to maintain monotonicity. - * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use - * Let z = x-ymin; - * lgamma(x) = -1.214862905358496078218 + z^2*poly(z) - * where - * poly(z) is a 14 degree polynomial. - * 2. Rational approximation in the primary interval [2,3] - * We use the following approximation: - * s = x-2.0; - * lgamma(x) = 0.5*s + s*P(s)/Q(s) - * with accuracy - * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71 - * Our algorithms are based on the following observation - * - * zeta(2)-1 2 zeta(3)-1 3 - * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... - * 2 3 - * - * where Euler = 0.5771... is the Euler constant, which is very - * close to 0.5. - * - * 3. For x>=8, we have - * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... - * (better formula: - * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) - * Let z = 1/x, then we approximation - * f(z) = lgamma(x) - (x-0.5)(log(x)-1) - * by - * 3 5 11 - * w = w0 + w1*z + w2*z + w3*z + ... + w6*z - * where - * |w - f(z)| < 2**-58.74 - * - * 4. For negative x, since (G is gamma function) - * -x*G(-x)*G(x) = pi/sin(pi*x), - * we have - * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) - * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 - * Hence, for x<0, signgam = sign(sin(pi*x)) and - * lgamma(x) = log(|Gamma(x)|) - * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); - * Note: one should avoid compute pi*(-x) directly in the - * computation of sin(pi*(-x)). - * - * 5. Special Cases - * lgamma(2+s) ~ s*(1-Euler) for tiny s - * lgamma(1) = lgamma(2) = 0 - * lgamma(x) ~ -log(|x|) for tiny x - * lgamma(0) = lgamma(neg.integer) = inf and raise divide-by-zero - * lgamma(inf) = inf - * lgamma(-inf) = inf (bug for bug compatible with C99!?) - * - */ - -#include "libm.h" - -static const double -pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ -a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */ -a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */ -a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */ -a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */ -a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */ -a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */ -a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */ -a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */ -a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */ -a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */ -a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */ -a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */ -tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */ -tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */ -/* tt = -(tail of tf) */ -tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */ -t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */ -t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */ -t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */ -t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */ -t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */ -t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */ -t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */ -t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */ -t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */ -t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */ -t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */ -t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */ -t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */ -t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */ -t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */ -u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ -u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */ -u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */ -u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */ -u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */ -u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */ -v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */ -v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */ -v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */ -v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */ -v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */ -s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ -s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */ -s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */ -s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */ -s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ -s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ -s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ -r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ -r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */ -r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */ -r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */ -r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */ -r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */ -w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */ -w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */ -w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */ -w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */ -w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */ -w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */ -w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */ - -/* sin(pi*x) assuming x > 2^-100, if sin(pi*x)==0 the sign is arbitrary */ -static double sin_pi(double x) -{ - int n; - - /* spurious inexact if odd int */ - x = 2.0*(x*0.5 - floor(x*0.5)); /* x mod 2.0 */ - - n = (int)(x*4.0); - n = (n+1)/2; - x -= n*0.5f; - x *= pi; - - switch (n) { - default: /* case 4: */ - case 0: return __sin(x, 0.0, 0); - case 1: return __cos(x, 0.0); - case 2: return __sin(-x, 0.0, 0); - case 3: return -__cos(x, 0.0); - } -} - -double __lgamma_r(double x, int *signgamp) -{ - union {double f; uint64_t i;} u = {x}; - double_t t,y,z,nadj,p,p1,p2,p3,q,r,w; - uint32_t ix; - int sign,i; - - /* purge off +-inf, NaN, +-0, tiny and negative arguments */ - *signgamp = 1; - sign = u.i>>63; - ix = u.i>>32 & 0x7fffffff; - if (ix >= 0x7ff00000) - return x*x; - if (ix < (0x3ff-70)<<20) { /* |x|<2**-70, return -log(|x|) */ - if(sign) { - x = -x; - *signgamp = -1; - } - return -log(x); - } - if (sign) { - x = -x; - t = sin_pi(x); - if (t == 0.0) /* -integer */ - return 1.0/(x-x); - if (t > 0.0) - *signgamp = -1; - else - t = -t; - nadj = log(pi/(t*x)); - } - - /* purge off 1 and 2 */ - if ((ix == 0x3ff00000 || ix == 0x40000000) && (uint32_t)u.i == 0) - r = 0; - /* for x < 2.0 */ - else if (ix < 0x40000000) { - if (ix <= 0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */ - r = -log(x); - if (ix >= 0x3FE76944) { - y = 1.0 - x; - i = 0; - } else if (ix >= 0x3FCDA661) { - y = x - (tc-1.0); - i = 1; - } else { - y = x; - i = 2; - } - } else { - r = 0.0; - if (ix >= 0x3FFBB4C3) { /* [1.7316,2] */ - y = 2.0 - x; - i = 0; - } else if(ix >= 0x3FF3B4C4) { /* [1.23,1.73] */ - y = x - tc; - i = 1; - } else { - y = x - 1.0; - i = 2; - } - } - switch (i) { - case 0: - z = y*y; - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); - p = y*p1+p2; - r += (p-0.5*y); - break; - case 1: - z = y*y; - w = z*y; - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); - p = z*p1-(tt-w*(p2+y*p3)); - r += tf + p; - break; - case 2: - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); - p2 = 1.0+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += -0.5*y + p1/p2; - } - } else if (ix < 0x40200000) { /* x < 8.0 */ - i = (int)x; - y = x - (double)i; - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); - q = 1.0+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = 0.5*y+p/q; - z = 1.0; /* lgamma(1+s) = log(s) + lgamma(s) */ - switch (i) { - case 7: z *= y + 6.0; /* FALLTHRU */ - case 6: z *= y + 5.0; /* FALLTHRU */ - case 5: z *= y + 4.0; /* FALLTHRU */ - case 4: z *= y + 3.0; /* FALLTHRU */ - case 3: z *= y + 2.0; /* FALLTHRU */ - r += log(z); - break; - } - } else if (ix < 0x43900000) { /* 8.0 <= x < 2**58 */ - t = log(x); - z = 1.0/x; - y = z*z; - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); - r = (x-0.5)*(t-1.0)+w; - } else /* 2**58 <= x <= inf */ - r = x*(log(x)-1.0); - if (sign) - r = nadj - r; - return r; -} - -weak_alias(__lgamma_r, lgamma_r); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf.c deleted file mode 100644 index 2ae051d09..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "libm.h" - -float lgammaf(float x) -{ - return __lgammaf_r(x, &__signgam); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf_r.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf_r.c deleted file mode 100644 index 3f353f19b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf_r.c +++ /dev/null @@ -1,218 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_lgammaf_r.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -static const float -pi = 3.1415927410e+00, /* 0x40490fdb */ -a0 = 7.7215664089e-02, /* 0x3d9e233f */ -a1 = 3.2246702909e-01, /* 0x3ea51a66 */ -a2 = 6.7352302372e-02, /* 0x3d89f001 */ -a3 = 2.0580807701e-02, /* 0x3ca89915 */ -a4 = 7.3855509982e-03, /* 0x3bf2027e */ -a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */ -a6 = 1.1927076848e-03, /* 0x3a9c54a1 */ -a7 = 5.1006977446e-04, /* 0x3a05b634 */ -a8 = 2.2086278477e-04, /* 0x39679767 */ -a9 = 1.0801156895e-04, /* 0x38e28445 */ -a10 = 2.5214456400e-05, /* 0x37d383a2 */ -a11 = 4.4864096708e-05, /* 0x383c2c75 */ -tc = 1.4616321325e+00, /* 0x3fbb16c3 */ -tf = -1.2148628384e-01, /* 0xbdf8cdcd */ -/* tt = -(tail of tf) */ -tt = 6.6971006518e-09, /* 0x31e61c52 */ -t0 = 4.8383611441e-01, /* 0x3ef7b95e */ -t1 = -1.4758771658e-01, /* 0xbe17213c */ -t2 = 6.4624942839e-02, /* 0x3d845a15 */ -t3 = -3.2788541168e-02, /* 0xbd064d47 */ -t4 = 1.7970675603e-02, /* 0x3c93373d */ -t5 = -1.0314224288e-02, /* 0xbc28fcfe */ -t6 = 6.1005386524e-03, /* 0x3bc7e707 */ -t7 = -3.6845202558e-03, /* 0xbb7177fe */ -t8 = 2.2596477065e-03, /* 0x3b141699 */ -t9 = -1.4034647029e-03, /* 0xbab7f476 */ -t10 = 8.8108185446e-04, /* 0x3a66f867 */ -t11 = -5.3859531181e-04, /* 0xba0d3085 */ -t12 = 3.1563205994e-04, /* 0x39a57b6b */ -t13 = -3.1275415677e-04, /* 0xb9a3f927 */ -t14 = 3.3552918467e-04, /* 0x39afe9f7 */ -u0 = -7.7215664089e-02, /* 0xbd9e233f */ -u1 = 6.3282704353e-01, /* 0x3f2200f4 */ -u2 = 1.4549225569e+00, /* 0x3fba3ae7 */ -u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */ -u4 = 2.2896373272e-01, /* 0x3e6a7578 */ -u5 = 1.3381091878e-02, /* 0x3c5b3c5e */ -v1 = 2.4559779167e+00, /* 0x401d2ebe */ -v2 = 2.1284897327e+00, /* 0x4008392d */ -v3 = 7.6928514242e-01, /* 0x3f44efdf */ -v4 = 1.0422264785e-01, /* 0x3dd572af */ -v5 = 3.2170924824e-03, /* 0x3b52d5db */ -s0 = -7.7215664089e-02, /* 0xbd9e233f */ -s1 = 2.1498242021e-01, /* 0x3e5c245a */ -s2 = 3.2577878237e-01, /* 0x3ea6cc7a */ -s3 = 1.4635047317e-01, /* 0x3e15dce6 */ -s4 = 2.6642270386e-02, /* 0x3cda40e4 */ -s5 = 1.8402845599e-03, /* 0x3af135b4 */ -s6 = 3.1947532989e-05, /* 0x3805ff67 */ -r1 = 1.3920053244e+00, /* 0x3fb22d3b */ -r2 = 7.2193557024e-01, /* 0x3f38d0c5 */ -r3 = 1.7193385959e-01, /* 0x3e300f6e */ -r4 = 1.8645919859e-02, /* 0x3c98bf54 */ -r5 = 7.7794247773e-04, /* 0x3a4beed6 */ -r6 = 7.3266842264e-06, /* 0x36f5d7bd */ -w0 = 4.1893854737e-01, /* 0x3ed67f1d */ -w1 = 8.3333335817e-02, /* 0x3daaaaab */ -w2 = -2.7777778450e-03, /* 0xbb360b61 */ -w3 = 7.9365057172e-04, /* 0x3a500cfd */ -w4 = -5.9518753551e-04, /* 0xba1c065c */ -w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */ -w6 = -1.6309292987e-03; /* 0xbad5c4e8 */ - -/* sin(pi*x) assuming x > 2^-100, if sin(pi*x)==0 the sign is arbitrary */ -static float sin_pi(float x) -{ - double_t y; - int n; - - /* spurious inexact if odd int */ - x = 2*(x*0.5f - floorf(x*0.5f)); /* x mod 2.0 */ - - n = (int)(x*4); - n = (n+1)/2; - y = x - n*0.5f; - y *= 3.14159265358979323846; - switch (n) { - default: /* case 4: */ - case 0: return __sindf(y); - case 1: return __cosdf(y); - case 2: return __sindf(-y); - case 3: return -__cosdf(y); - } -} - -float __lgammaf_r(float x, int *signgamp) -{ - union {float f; uint32_t i;} u = {x}; - float t,y,z,nadj,p,p1,p2,p3,q,r,w; - uint32_t ix; - int i,sign; - - /* purge off +-inf, NaN, +-0, tiny and negative arguments */ - *signgamp = 1; - sign = u.i>>31; - ix = u.i & 0x7fffffff; - if (ix >= 0x7f800000) - return x*x; - if (ix < 0x35000000) { /* |x| < 2**-21, return -log(|x|) */ - if (sign) { - *signgamp = -1; - x = -x; - } - return -logf(x); - } - if (sign) { - x = -x; - t = sin_pi(x); - if (t == 0.0f) /* -integer */ - return 1.0f/(x-x); - if (t > 0.0f) - *signgamp = -1; - else - t = -t; - nadj = logf(pi/(t*x)); - } - - /* purge off 1 and 2 */ - if (ix == 0x3f800000 || ix == 0x40000000) - r = 0; - /* for x < 2.0 */ - else if (ix < 0x40000000) { - if (ix <= 0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */ - r = -logf(x); - if (ix >= 0x3f3b4a20) { - y = 1.0f - x; - i = 0; - } else if (ix >= 0x3e6d3308) { - y = x - (tc-1.0f); - i = 1; - } else { - y = x; - i = 2; - } - } else { - r = 0.0f; - if (ix >= 0x3fdda618) { /* [1.7316,2] */ - y = 2.0f - x; - i = 0; - } else if (ix >= 0x3F9da620) { /* [1.23,1.73] */ - y = x - tc; - i = 1; - } else { - y = x - 1.0f; - i = 2; - } - } - switch(i) { - case 0: - z = y*y; - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); - p = y*p1+p2; - r += p - 0.5f*y; - break; - case 1: - z = y*y; - w = z*y; - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); - p = z*p1-(tt-w*(p2+y*p3)); - r += (tf + p); - break; - case 2: - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); - p2 = 1.0f+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += -0.5f*y + p1/p2; - } - } else if (ix < 0x41000000) { /* x < 8.0 */ - i = (int)x; - y = x - (float)i; - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); - q = 1.0f+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = 0.5f*y+p/q; - z = 1.0f; /* lgamma(1+s) = log(s) + lgamma(s) */ - switch (i) { - case 7: z *= y + 6.0f; /* FALLTHRU */ - case 6: z *= y + 5.0f; /* FALLTHRU */ - case 5: z *= y + 4.0f; /* FALLTHRU */ - case 4: z *= y + 3.0f; /* FALLTHRU */ - case 3: z *= y + 2.0f; /* FALLTHRU */ - r += logf(z); - break; - } - } else if (ix < 0x5c800000) { /* 8.0 <= x < 2**58 */ - t = logf(x); - z = 1.0f/x; - y = z*z; - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); - r = (x-0.5f)*(t-1.0f)+w; - } else /* 2**58 <= x <= inf */ - r = x*(logf(x)-1.0f); - if (sign) - r = nadj - r; - return r; -} - -weak_alias(__lgammaf_r, lgammaf_r); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lgammal.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lgammal.c deleted file mode 100644 index abbd4fc6f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lgammal.c +++ /dev/null @@ -1,353 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_lgammal.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* lgammal(x) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). - * - * Method: - * 1. Argument Reduction for 0 < x <= 8 - * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may - * reduce x to a number in [1.5,2.5] by - * lgamma(1+s) = log(s) + lgamma(s) - * for example, - * lgamma(7.3) = log(6.3) + lgamma(6.3) - * = log(6.3*5.3) + lgamma(5.3) - * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) - * 2. Polynomial approximation of lgamma around its - * minimun ymin=1.461632144968362245 to maintain monotonicity. - * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use - * Let z = x-ymin; - * lgamma(x) = -1.214862905358496078218 + z^2*poly(z) - * 2. Rational approximation in the primary interval [2,3] - * We use the following approximation: - * s = x-2.0; - * lgamma(x) = 0.5*s + s*P(s)/Q(s) - * Our algorithms are based on the following observation - * - * zeta(2)-1 2 zeta(3)-1 3 - * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... - * 2 3 - * - * where Euler = 0.5771... is the Euler constant, which is very - * close to 0.5. - * - * 3. For x>=8, we have - * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... - * (better formula: - * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) - * Let z = 1/x, then we approximation - * f(z) = lgamma(x) - (x-0.5)(log(x)-1) - * by - * 3 5 11 - * w = w0 + w1*z + w2*z + w3*z + ... + w6*z - * - * 4. For negative x, since (G is gamma function) - * -x*G(-x)*G(x) = pi/sin(pi*x), - * we have - * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) - * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 - * Hence, for x<0, signgam = sign(sin(pi*x)) and - * lgamma(x) = log(|Gamma(x)|) - * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); - * Note: one should avoid compute pi*(-x) directly in the - * computation of sin(pi*(-x)). - * - * 5. Special Cases - * lgamma(2+s) ~ s*(1-Euler) for tiny s - * lgamma(1)=lgamma(2)=0 - * lgamma(x) ~ -log(x) for tiny x - * lgamma(0) = lgamma(inf) = inf - * lgamma(-integer) = +-inf - * - */ - -#define _GNU_SOURCE -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double __lgammal_r(long double x, int *sg) -{ - return __lgamma_r(x, sg); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -static const long double -pi = 3.14159265358979323846264L, - -/* lgam(1+x) = 0.5 x + x a(x)/b(x) - -0.268402099609375 <= x <= 0 - peak relative error 6.6e-22 */ -a0 = -6.343246574721079391729402781192128239938E2L, -a1 = 1.856560238672465796768677717168371401378E3L, -a2 = 2.404733102163746263689288466865843408429E3L, -a3 = 8.804188795790383497379532868917517596322E2L, -a4 = 1.135361354097447729740103745999661157426E2L, -a5 = 3.766956539107615557608581581190400021285E0L, - -b0 = 8.214973713960928795704317259806842490498E3L, -b1 = 1.026343508841367384879065363925870888012E4L, -b2 = 4.553337477045763320522762343132210919277E3L, -b3 = 8.506975785032585797446253359230031874803E2L, -b4 = 6.042447899703295436820744186992189445813E1L, -/* b5 = 1.000000000000000000000000000000000000000E0 */ - - -tc = 1.4616321449683623412626595423257213284682E0L, -tf = -1.2148629053584961146050602565082954242826E-1, /* double precision */ -/* tt = (tail of tf), i.e. tf + tt has extended precision. */ -tt = 3.3649914684731379602768989080467587736363E-18L, -/* lgam ( 1.4616321449683623412626595423257213284682E0 ) = --1.2148629053584960809551455717769158215135617312999903886372437313313530E-1 */ - -/* lgam (x + tc) = tf + tt + x g(x)/h(x) - -0.230003726999612341262659542325721328468 <= x - <= 0.2699962730003876587373404576742786715318 - peak relative error 2.1e-21 */ -g0 = 3.645529916721223331888305293534095553827E-18L, -g1 = 5.126654642791082497002594216163574795690E3L, -g2 = 8.828603575854624811911631336122070070327E3L, -g3 = 5.464186426932117031234820886525701595203E3L, -g4 = 1.455427403530884193180776558102868592293E3L, -g5 = 1.541735456969245924860307497029155838446E2L, -g6 = 4.335498275274822298341872707453445815118E0L, - -h0 = 1.059584930106085509696730443974495979641E4L, -h1 = 2.147921653490043010629481226937850618860E4L, -h2 = 1.643014770044524804175197151958100656728E4L, -h3 = 5.869021995186925517228323497501767586078E3L, -h4 = 9.764244777714344488787381271643502742293E2L, -h5 = 6.442485441570592541741092969581997002349E1L, -/* h6 = 1.000000000000000000000000000000000000000E0 */ - - -/* lgam (x+1) = -0.5 x + x u(x)/v(x) - -0.100006103515625 <= x <= 0.231639862060546875 - peak relative error 1.3e-21 */ -u0 = -8.886217500092090678492242071879342025627E1L, -u1 = 6.840109978129177639438792958320783599310E2L, -u2 = 2.042626104514127267855588786511809932433E3L, -u3 = 1.911723903442667422201651063009856064275E3L, -u4 = 7.447065275665887457628865263491667767695E2L, -u5 = 1.132256494121790736268471016493103952637E2L, -u6 = 4.484398885516614191003094714505960972894E0L, - -v0 = 1.150830924194461522996462401210374632929E3L, -v1 = 3.399692260848747447377972081399737098610E3L, -v2 = 3.786631705644460255229513563657226008015E3L, -v3 = 1.966450123004478374557778781564114347876E3L, -v4 = 4.741359068914069299837355438370682773122E2L, -v5 = 4.508989649747184050907206782117647852364E1L, -/* v6 = 1.000000000000000000000000000000000000000E0 */ - - -/* lgam (x+2) = .5 x + x s(x)/r(x) - 0 <= x <= 1 - peak relative error 7.2e-22 */ -s0 = 1.454726263410661942989109455292824853344E6L, -s1 = -3.901428390086348447890408306153378922752E6L, -s2 = -6.573568698209374121847873064292963089438E6L, -s3 = -3.319055881485044417245964508099095984643E6L, -s4 = -7.094891568758439227560184618114707107977E5L, -s5 = -6.263426646464505837422314539808112478303E4L, -s6 = -1.684926520999477529949915657519454051529E3L, - -r0 = -1.883978160734303518163008696712983134698E7L, -r1 = -2.815206082812062064902202753264922306830E7L, -r2 = -1.600245495251915899081846093343626358398E7L, -r3 = -4.310526301881305003489257052083370058799E6L, -r4 = -5.563807682263923279438235987186184968542E5L, -r5 = -3.027734654434169996032905158145259713083E4L, -r6 = -4.501995652861105629217250715790764371267E2L, -/* r6 = 1.000000000000000000000000000000000000000E0 */ - - -/* lgam(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x w(1/x^2) - x >= 8 - Peak relative error 1.51e-21 -w0 = LS2PI - 0.5 */ -w0 = 4.189385332046727417803e-1L, -w1 = 8.333333333333331447505E-2L, -w2 = -2.777777777750349603440E-3L, -w3 = 7.936507795855070755671E-4L, -w4 = -5.952345851765688514613E-4L, -w5 = 8.412723297322498080632E-4L, -w6 = -1.880801938119376907179E-3L, -w7 = 4.885026142432270781165E-3L; - -/* sin(pi*x) assuming x > 2^-1000, if sin(pi*x)==0 the sign is arbitrary */ -static long double sin_pi(long double x) -{ - int n; - - /* spurious inexact if odd int */ - x *= 0.5; - x = 2.0*(x - floorl(x)); /* x mod 2.0 */ - - n = (int)(x*4.0); - n = (n+1)/2; - x -= n*0.5f; - x *= pi; - - switch (n) { - default: /* case 4: */ - case 0: return __sinl(x, 0.0, 0); - case 1: return __cosl(x, 0.0); - case 2: return __sinl(-x, 0.0, 0); - case 3: return -__cosl(x, 0.0); - } -} - -long double __lgammal_r(long double x, int *sg) { - long double t, y, z, nadj, p, p1, p2, q, r, w; - union ldshape u = {x}; - uint32_t ix = (u.i.se & 0x7fffU)<<16 | u.i.m>>48; - int sign = u.i.se >> 15; - int i; - - *sg = 1; - - /* purge off +-inf, NaN, +-0, tiny and negative arguments */ - if (ix >= 0x7fff0000) - return x * x; - if (ix < 0x3fc08000) { /* |x|<2**-63, return -log(|x|) */ - if (sign) { - *sg = -1; - x = -x; - } - return -logl(x); - } - if (sign) { - x = -x; - t = sin_pi(x); - if (t == 0.0) - return 1.0 / (x-x); /* -integer */ - if (t > 0.0) - *sg = -1; - else - t = -t; - nadj = logl(pi / (t * x)); - } - - /* purge off 1 and 2 (so the sign is ok with downward rounding) */ - if ((ix == 0x3fff8000 || ix == 0x40008000) && u.i.m == 0) { - r = 0; - } else if (ix < 0x40008000) { /* x < 2.0 */ - if (ix <= 0x3ffee666) { /* 8.99993896484375e-1 */ - /* lgamma(x) = lgamma(x+1) - log(x) */ - r = -logl(x); - if (ix >= 0x3ffebb4a) { /* 7.31597900390625e-1 */ - y = x - 1.0; - i = 0; - } else if (ix >= 0x3ffced33) { /* 2.31639862060546875e-1 */ - y = x - (tc - 1.0); - i = 1; - } else { /* x < 0.23 */ - y = x; - i = 2; - } - } else { - r = 0.0; - if (ix >= 0x3fffdda6) { /* 1.73162841796875 */ - /* [1.7316,2] */ - y = x - 2.0; - i = 0; - } else if (ix >= 0x3fff9da6) { /* 1.23162841796875 */ - /* [1.23,1.73] */ - y = x - tc; - i = 1; - } else { - /* [0.9, 1.23] */ - y = x - 1.0; - i = 2; - } - } - switch (i) { - case 0: - p1 = a0 + y * (a1 + y * (a2 + y * (a3 + y * (a4 + y * a5)))); - p2 = b0 + y * (b1 + y * (b2 + y * (b3 + y * (b4 + y)))); - r += 0.5 * y + y * p1/p2; - break; - case 1: - p1 = g0 + y * (g1 + y * (g2 + y * (g3 + y * (g4 + y * (g5 + y * g6))))); - p2 = h0 + y * (h1 + y * (h2 + y * (h3 + y * (h4 + y * (h5 + y))))); - p = tt + y * p1/p2; - r += (tf + p); - break; - case 2: - p1 = y * (u0 + y * (u1 + y * (u2 + y * (u3 + y * (u4 + y * (u5 + y * u6)))))); - p2 = v0 + y * (v1 + y * (v2 + y * (v3 + y * (v4 + y * (v5 + y))))); - r += (-0.5 * y + p1 / p2); - } - } else if (ix < 0x40028000) { /* 8.0 */ - /* x < 8.0 */ - i = (int)x; - y = x - (double)i; - p = y * (s0 + y * (s1 + y * (s2 + y * (s3 + y * (s4 + y * (s5 + y * s6)))))); - q = r0 + y * (r1 + y * (r2 + y * (r3 + y * (r4 + y * (r5 + y * (r6 + y)))))); - r = 0.5 * y + p / q; - z = 1.0; - /* lgamma(1+s) = log(s) + lgamma(s) */ - switch (i) { - case 7: - z *= (y + 6.0); /* FALLTHRU */ - case 6: - z *= (y + 5.0); /* FALLTHRU */ - case 5: - z *= (y + 4.0); /* FALLTHRU */ - case 4: - z *= (y + 3.0); /* FALLTHRU */ - case 3: - z *= (y + 2.0); /* FALLTHRU */ - r += logl(z); - break; - } - } else if (ix < 0x40418000) { /* 2^66 */ - /* 8.0 <= x < 2**66 */ - t = logl(x); - z = 1.0 / x; - y = z * z; - w = w0 + z * (w1 + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7)))))); - r = (x - 0.5) * (t - 1.0) + w; - } else /* 2**66 <= x <= inf */ - r = x * (logl(x) - 1.0); - if (sign) - r = nadj - r; - return r; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double __lgammal_r(long double x, int *sg) -{ - return __lgamma_r(x, sg); -} -#endif - -long double lgammal(long double x) -{ - return __lgammal_r(x, &__signgam); -} - -weak_alias(__lgammal_r, lgammal_r); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/llrint.c b/src/hyperlight_guest_bin/third_party/musl/src/math/llrint.c deleted file mode 100644 index 4f583ae55..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/llrint.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -/* uses LLONG_MAX > 2^53, see comments in lrint.c */ - -long long llrint(double x) -{ - return rint(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/llrintf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/llrintf.c deleted file mode 100644 index 96949a006..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/llrintf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -/* uses LLONG_MAX > 2^24, see comments in lrint.c */ - -long long llrintf(float x) -{ - return rintf(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/llrintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/llrintl.c deleted file mode 100644 index 3449f6f2b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/llrintl.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "libm.h" - - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long long llrintl(long double x) -{ - return llrint(x); -} -#elif defined(FE_INEXACT) -/* -see comments in lrint.c - -Note that if LLONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64 -then x == 2**63 - 0.5 is the only input that overflows and -raises inexact (with tonearest or upward rounding mode) -*/ -long long llrintl(long double x) -{ - #pragma STDC FENV_ACCESS ON - int e; - - e = fetestexcept(FE_INEXACT); - x = rintl(x); - if (!e && (x > LLONG_MAX || x < LLONG_MIN)) - feclearexcept(FE_INEXACT); - /* conversion */ - return x; -} -#else -long long llrintl(long double x) -{ - return rintl(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/llround.c b/src/hyperlight_guest_bin/third_party/musl/src/math/llround.c deleted file mode 100644 index 4d94787d6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/llround.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long long llround(double x) -{ - return round(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/llroundf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/llroundf.c deleted file mode 100644 index 19eb77ee3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/llroundf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long long llroundf(float x) -{ - return roundf(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/llroundl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/llroundl.c deleted file mode 100644 index 2c2ee5ecd..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/llroundl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long long llroundl(long double x) -{ - return roundl(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log.c deleted file mode 100644 index cc52585a9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Double-precision log(x) function. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "log_data.h" - -#define T __log_data.tab -#define T2 __log_data.tab2 -#define B __log_data.poly1 -#define A __log_data.poly -#define Ln2hi __log_data.ln2hi -#define Ln2lo __log_data.ln2lo -#define N (1 << LOG_TABLE_BITS) -#define OFF 0x3fe6000000000000 - -/* Top 16 bits of a double. */ -static inline uint32_t top16(double x) -{ - return asuint64(x) >> 48; -} - -double log(double x) -{ - double_t w, z, r, r2, r3, y, invc, logc, kd, hi, lo; - uint64_t ix, iz, tmp; - uint32_t top; - int k, i; - - ix = asuint64(x); - top = top16(x); -#define LO asuint64(1.0 - 0x1p-4) -#define HI asuint64(1.0 + 0x1.09p-4) - if (predict_false(ix - LO < HI - LO)) { - /* Handle close to 1.0 inputs separately. */ - /* Fix sign of zero with downward rounding when x==1. */ - if (WANT_ROUNDING && predict_false(ix == asuint64(1.0))) - return 0; - r = x - 1.0; - r2 = r * r; - r3 = r * r2; - y = r3 * - (B[1] + r * B[2] + r2 * B[3] + - r3 * (B[4] + r * B[5] + r2 * B[6] + - r3 * (B[7] + r * B[8] + r2 * B[9] + r3 * B[10]))); - /* Worst-case error is around 0.507 ULP. */ - w = r * 0x1p27; - double_t rhi = r + w - w; - double_t rlo = r - rhi; - w = rhi * rhi * B[0]; /* B[0] == -0.5. */ - hi = r + w; - lo = r - hi + w; - lo += B[0] * rlo * (rhi + r); - y += lo; - y += hi; - return eval_as_double(y); - } - if (predict_false(top - 0x0010 >= 0x7ff0 - 0x0010)) { - /* x < 0x1p-1022 or inf or nan. */ - if (ix * 2 == 0) - return __math_divzero(1); - if (ix == asuint64(INFINITY)) /* log(inf) == inf. */ - return x; - if ((top & 0x8000) || (top & 0x7ff0) == 0x7ff0) - return __math_invalid(x); - /* x is subnormal, normalize it. */ - ix = asuint64(x * 0x1p52); - ix -= 52ULL << 52; - } - - /* x = 2^k z; where z is in range [OFF,2*OFF) and exact. - The range is split into N subintervals. - The ith subinterval contains z and c is near its center. */ - tmp = ix - OFF; - i = (tmp >> (52 - LOG_TABLE_BITS)) % N; - k = (int64_t)tmp >> 52; /* arithmetic shift */ - iz = ix - (tmp & 0xfffULL << 52); - invc = T[i].invc; - logc = T[i].logc; - z = asdouble(iz); - - /* log(x) = log1p(z/c-1) + log(c) + k*Ln2. */ - /* r ~= z/c - 1, |r| < 1/(2*N). */ -#if __FP_FAST_FMA - /* rounding error: 0x1p-55/N. */ - r = __builtin_fma(z, invc, -1.0); -#else - /* rounding error: 0x1p-55/N + 0x1p-66. */ - r = (z - T2[i].chi - T2[i].clo) * invc; -#endif - kd = (double_t)k; - - /* hi + lo = r + log(c) + k*Ln2. */ - w = kd * Ln2hi + logc; - hi = w + r; - lo = w - hi + r + kd * Ln2lo; - - /* log(x) = lo + (log1p(r) - r) + hi. */ - r2 = r * r; /* rounding error: 0x1p-54/N^2. */ - /* Worst case error if |y| > 0x1p-5: - 0.5 + 4.13/N + abs-poly-error*2^57 ULP (+ 0.002 ULP without fma) - Worst case error if |y| > 0x1p-4: - 0.5 + 2.06/N + abs-poly-error*2^56 ULP (+ 0.001 ULP without fma). */ - y = lo + r2 * A[0] + - r * r2 * (A[1] + r * A[2] + r2 * (A[3] + r * A[4])) + hi; - return eval_as_double(y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log10.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log10.c deleted file mode 100644 index 81026876b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log10.c +++ /dev/null @@ -1,101 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_log10.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * Return the base 10 logarithm of x. See log.c for most comments. - * - * Reduce x to 2^k (1+f) and calculate r = log(1+f) - f + f*f/2 - * as in log.c, then combine and scale in extra precision: - * log10(x) = (f - f*f/2 + r)/log(10) + k*log10(2) - */ - -#include -#include - -static const double -ivln10hi = 4.34294481878168880939e-01, /* 0x3fdbcb7b, 0x15200000 */ -ivln10lo = 2.50829467116452752298e-11, /* 0x3dbb9438, 0xca9aadd5 */ -log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */ -log10_2lo = 3.69423907715893078616e-13, /* 0x3D59FEF3, 0x11F12B36 */ -Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ -Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ -Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ -Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ -Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ -Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ -Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ - -double log10(double x) -{ - union {double f; uint64_t i;} u = {x}; - double_t hfsq,f,s,z,R,w,t1,t2,dk,y,hi,lo,val_hi,val_lo; - uint32_t hx; - int k; - - hx = u.i>>32; - k = 0; - if (hx < 0x00100000 || hx>>31) { - if (u.i<<1 == 0) - return -1/(x*x); /* log(+-0)=-inf */ - if (hx>>31) - return (x-x)/0.0; /* log(-#) = NaN */ - /* subnormal number, scale x up */ - k -= 54; - x *= 0x1p54; - u.f = x; - hx = u.i>>32; - } else if (hx >= 0x7ff00000) { - return x; - } else if (hx == 0x3ff00000 && u.i<<32 == 0) - return 0; - - /* reduce x into [sqrt(2)/2, sqrt(2)] */ - hx += 0x3ff00000 - 0x3fe6a09e; - k += (int)(hx>>20) - 0x3ff; - hx = (hx&0x000fffff) + 0x3fe6a09e; - u.i = (uint64_t)hx<<32 | (u.i&0xffffffff); - x = u.f; - - f = x - 1.0; - hfsq = 0.5*f*f; - s = f/(2.0+f); - z = s*s; - w = z*z; - t1 = w*(Lg2+w*(Lg4+w*Lg6)); - t2 = z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - R = t2 + t1; - - /* See log2.c for details. */ - /* hi+lo = f - hfsq + s*(hfsq+R) ~ log(1+f) */ - hi = f - hfsq; - u.f = hi; - u.i &= (uint64_t)-1<<32; - hi = u.f; - lo = f - hi - hfsq + s*(hfsq+R); - - /* val_hi+val_lo ~ log10(1+f) + k*log10(2) */ - val_hi = hi*ivln10hi; - dk = k; - y = dk*log10_2hi; - val_lo = dk*log10_2lo + (lo+hi)*ivln10lo + lo*ivln10hi; - - /* - * Extra precision in for adding y is not strictly needed - * since there is no very large cancellation near x = sqrt(2) or - * x = 1/sqrt(2), but we do it anyway since it costs little on CPUs - * with some parallelism and it reduces the error for many args. - */ - w = y + val_hi; - val_lo += (y - w) + val_hi; - val_hi = w; - - return val_lo + val_hi; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log10f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log10f.c deleted file mode 100644 index 9ca2f017d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log10f.c +++ /dev/null @@ -1,77 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_log10f.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * See comments in log10.c. - */ - -#include -#include - -static const float -ivln10hi = 4.3432617188e-01, /* 0x3ede6000 */ -ivln10lo = -3.1689971365e-05, /* 0xb804ead9 */ -log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */ -log10_2lo = 7.9034151668e-07, /* 0x355427db */ -/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */ -Lg1 = 0xaaaaaa.0p-24, /* 0.66666662693 */ -Lg2 = 0xccce13.0p-25, /* 0.40000972152 */ -Lg3 = 0x91e9ee.0p-25, /* 0.28498786688 */ -Lg4 = 0xf89e26.0p-26; /* 0.24279078841 */ - -float log10f(float x) -{ - union {float f; uint32_t i;} u = {x}; - float_t hfsq,f,s,z,R,w,t1,t2,dk,hi,lo; - uint32_t ix; - int k; - - ix = u.i; - k = 0; - if (ix < 0x00800000 || ix>>31) { /* x < 2**-126 */ - if (ix<<1 == 0) - return -1/(x*x); /* log(+-0)=-inf */ - if (ix>>31) - return (x-x)/0.0f; /* log(-#) = NaN */ - /* subnormal number, scale up x */ - k -= 25; - x *= 0x1p25f; - u.f = x; - ix = u.i; - } else if (ix >= 0x7f800000) { - return x; - } else if (ix == 0x3f800000) - return 0; - - /* reduce x into [sqrt(2)/2, sqrt(2)] */ - ix += 0x3f800000 - 0x3f3504f3; - k += (int)(ix>>23) - 0x7f; - ix = (ix&0x007fffff) + 0x3f3504f3; - u.i = ix; - x = u.f; - - f = x - 1.0f; - s = f/(2.0f + f); - z = s*s; - w = z*z; - t1= w*(Lg2+w*Lg4); - t2= z*(Lg1+w*Lg3); - R = t2 + t1; - hfsq = 0.5f*f*f; - - hi = f - hfsq; - u.f = hi; - u.i &= 0xfffff000; - hi = u.f; - lo = f - hi - hfsq + s*(hfsq+R); - dk = k; - return dk*log10_2lo + (lo+hi)*ivln10lo + lo*ivln10hi + hi*ivln10hi + dk*log10_2hi; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log10l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log10l.c deleted file mode 100644 index 63dcc286d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log10l.c +++ /dev/null @@ -1,191 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_log10l.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Common logarithm, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, log10l(); - * - * y = log10l( x ); - * - * - * DESCRIPTION: - * - * Returns the base 10 logarithm of x. - * - * The argument is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the logarithm - * of the fraction is approximated by - * - * log(1+x) = x - 0.5 x**2 + x**3 P(x)/Q(x). - * - * Otherwise, setting z = 2(x-1)/x+1), - * - * log(x) = z + z**3 P(z)/Q(z). - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0.5, 2.0 30000 9.0e-20 2.6e-20 - * IEEE exp(+-10000) 30000 6.0e-20 2.3e-20 - * - * In the tests over the interval exp(+-10000), the logarithms - * of the random arguments were uniformly distributed over - * [-10000, +10000]. - * - * ERROR MESSAGES: - * - * log singularity: x = 0; returns MINLOG - * log domain: x < 0; returns MINLOG - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double log10l(long double x) -{ - return log10(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* Coefficients for log(1+x) = x - x**2/2 + x**3 P(x)/Q(x) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 6.2e-22 - */ -static const long double P[] = { - 4.9962495940332550844739E-1L, - 1.0767376367209449010438E1L, - 7.7671073698359539859595E1L, - 2.5620629828144409632571E2L, - 4.2401812743503691187826E2L, - 3.4258224542413922935104E2L, - 1.0747524399916215149070E2L, -}; -static const long double Q[] = { -/* 1.0000000000000000000000E0,*/ - 2.3479774160285863271658E1L, - 1.9444210022760132894510E2L, - 7.7952888181207260646090E2L, - 1.6911722418503949084863E3L, - 2.0307734695595183428202E3L, - 1.2695660352705325274404E3L, - 3.2242573199748645407652E2L, -}; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 6.16e-22 - */ -static const long double R[4] = { - 1.9757429581415468984296E-3L, --7.1990767473014147232598E-1L, - 1.0777257190312272158094E1L, --3.5717684488096787370998E1L, -}; -static const long double S[4] = { -/* 1.00000000000000000000E0L,*/ --2.6201045551331104417768E1L, - 1.9361891836232102174846E2L, --4.2861221385716144629696E2L, -}; -/* log10(2) */ -#define L102A 0.3125L -#define L102B -1.1470004336018804786261e-2L -/* log10(e) */ -#define L10EA 0.5L -#define L10EB -6.5705518096748172348871e-2L - -#define SQRTH 0.70710678118654752440L - -long double log10l(long double x) -{ - long double y, z; - int e; - - if (isnan(x)) - return x; - if(x <= 0.0) { - if(x == 0.0) - return -1.0 / (x*x); - return (x - x) / 0.0; - } - if (x == INFINITY) - return INFINITY; - /* separate mantissa from exponent */ - /* Note, frexp is used so that denormal numbers - * will be handled properly. - */ - x = frexpl(x, &e); - - /* logarithm using log(x) = z + z**3 P(z)/Q(z), - * where z = 2(x-1)/x+1) - */ - if (e > 2 || e < -2) { - if (x < SQRTH) { /* 2(2x-1)/(2x+1) */ - e -= 1; - z = x - 0.5; - y = 0.5 * z + 0.5; - } else { /* 2 (x-1)/(x+1) */ - z = x - 0.5; - z -= 0.5; - y = 0.5 * x + 0.5; - } - x = z / y; - z = x*x; - y = x * (z * __polevll(z, R, 3) / __p1evll(z, S, 3)); - goto done; - } - - /* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */ - if (x < SQRTH) { - e -= 1; - x = 2.0*x - 1.0; - } else { - x = x - 1.0; - } - z = x*x; - y = x * (z * __polevll(x, P, 6) / __p1evll(x, Q, 7)); - y = y - 0.5*z; - -done: - /* Multiply log of fraction by log10(e) - * and base 2 exponent by log10(2). - * - * ***CAUTION*** - * - * This sequence of operations is critical and it may - * be horribly defeated by some compiler optimizers. - */ - z = y * (L10EB); - z += x * (L10EB); - z += e * (L102B); - z += y * (L10EA); - z += x * (L10EA); - z += e * (L102A); - return z; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double log10l(long double x) -{ - return log10(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log1p.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log1p.c deleted file mode 100644 index 009713494..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log1p.c +++ /dev/null @@ -1,122 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_log1p.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* double log1p(double x) - * Return the natural logarithm of 1+x. - * - * Method : - * 1. Argument Reduction: find k and f such that - * 1+x = 2^k * (1+f), - * where sqrt(2)/2 < 1+f < sqrt(2) . - * - * Note. If k=0, then f=x is exact. However, if k!=0, then f - * may not be representable exactly. In that case, a correction - * term is need. Let u=1+x rounded. Let c = (1+x)-u, then - * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u), - * and add back the correction term c/u. - * (Note: when x > 2**53, one can simply return log(x)) - * - * 2. Approximation of log(1+f): See log.c - * - * 3. Finally, log1p(x) = k*ln2 + log(1+f) + c/u. See log.c - * - * Special cases: - * log1p(x) is NaN with signal if x < -1 (including -INF) ; - * log1p(+INF) is +INF; log1p(-1) is -INF with signal; - * log1p(NaN) is that NaN with no signal. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - * - * Note: Assuming log() return accurate answer, the following - * algorithm can be used to compute log1p(x) to within a few ULP: - * - * u = 1+x; - * if(u==1.0) return x ; else - * return log(u)*(x/(u-1.0)); - * - * See HP-15C Advanced Functions Handbook, p.193. - */ - -#include "libm.h" - -static const double -ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ -ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ -Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ -Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ -Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ -Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ -Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ -Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ -Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ - -double log1p(double x) -{ - union {double f; uint64_t i;} u = {x}; - double_t hfsq,f,c,s,z,R,w,t1,t2,dk; - uint32_t hx,hu; - int k; - - hx = u.i>>32; - k = 1; - if (hx < 0x3fda827a || hx>>31) { /* 1+x < sqrt(2)+ */ - if (hx >= 0xbff00000) { /* x <= -1.0 */ - if (x == -1) - return x/0.0; /* log1p(-1) = -inf */ - return (x-x)/0.0; /* log1p(x<-1) = NaN */ - } - if (hx<<1 < 0x3ca00000<<1) { /* |x| < 2**-53 */ - /* underflow if subnormal */ - if ((hx&0x7ff00000) == 0) - FORCE_EVAL((float)x); - return x; - } - if (hx <= 0xbfd2bec4) { /* sqrt(2)/2- <= 1+x < sqrt(2)+ */ - k = 0; - c = 0; - f = x; - } - } else if (hx >= 0x7ff00000) - return x; - if (k) { - u.f = 1 + x; - hu = u.i>>32; - hu += 0x3ff00000 - 0x3fe6a09e; - k = (int)(hu>>20) - 0x3ff; - /* correction term ~ log(1+x)-log(u), avoid underflow in c/u */ - if (k < 54) { - c = k >= 2 ? 1-(u.f-x) : x-(u.f-1); - c /= u.f; - } else - c = 0; - /* reduce u into [sqrt(2)/2, sqrt(2)] */ - hu = (hu&0x000fffff) + 0x3fe6a09e; - u.i = (uint64_t)hu<<32 | (u.i&0xffffffff); - f = u.f - 1; - } - hfsq = 0.5*f*f; - s = f/(2.0+f); - z = s*s; - w = z*z; - t1 = w*(Lg2+w*(Lg4+w*Lg6)); - t2 = z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - R = t2 + t1; - dk = k; - return s*(hfsq+R) + (dk*ln2_lo+c) - hfsq + f + dk*ln2_hi; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log1pf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log1pf.c deleted file mode 100644 index 23985c356..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log1pf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_log1pf.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -static const float -ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ -ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ -/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */ -Lg1 = 0xaaaaaa.0p-24, /* 0.66666662693 */ -Lg2 = 0xccce13.0p-25, /* 0.40000972152 */ -Lg3 = 0x91e9ee.0p-25, /* 0.28498786688 */ -Lg4 = 0xf89e26.0p-26; /* 0.24279078841 */ - -float log1pf(float x) -{ - union {float f; uint32_t i;} u = {x}; - float_t hfsq,f,c,s,z,R,w,t1,t2,dk; - uint32_t ix,iu; - int k; - - ix = u.i; - k = 1; - if (ix < 0x3ed413d0 || ix>>31) { /* 1+x < sqrt(2)+ */ - if (ix >= 0xbf800000) { /* x <= -1.0 */ - if (x == -1) - return x/0.0f; /* log1p(-1)=+inf */ - return (x-x)/0.0f; /* log1p(x<-1)=NaN */ - } - if (ix<<1 < 0x33800000<<1) { /* |x| < 2**-24 */ - /* underflow if subnormal */ - if ((ix&0x7f800000) == 0) - FORCE_EVAL(x*x); - return x; - } - if (ix <= 0xbe95f619) { /* sqrt(2)/2- <= 1+x < sqrt(2)+ */ - k = 0; - c = 0; - f = x; - } - } else if (ix >= 0x7f800000) - return x; - if (k) { - u.f = 1 + x; - iu = u.i; - iu += 0x3f800000 - 0x3f3504f3; - k = (int)(iu>>23) - 0x7f; - /* correction term ~ log(1+x)-log(u), avoid underflow in c/u */ - if (k < 25) { - c = k >= 2 ? 1-(u.f-x) : x-(u.f-1); - c /= u.f; - } else - c = 0; - /* reduce u into [sqrt(2)/2, sqrt(2)] */ - iu = (iu&0x007fffff) + 0x3f3504f3; - u.i = iu; - f = u.f - 1; - } - s = f/(2.0f + f); - z = s*s; - w = z*z; - t1= w*(Lg2+w*Lg4); - t2= z*(Lg1+w*Lg3); - R = t2 + t1; - hfsq = 0.5f*f*f; - dk = k; - return s*(hfsq+R) + (dk*ln2_lo+c) - hfsq + f + dk*ln2_hi; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log1pl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log1pl.c deleted file mode 100644 index 141b5f0b0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log1pl.c +++ /dev/null @@ -1,177 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/s_log1pl.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Relative error logarithm - * Natural logarithm of 1+x, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, log1pl(); - * - * y = log1pl( x ); - * - * - * DESCRIPTION: - * - * Returns the base e (2.718...) logarithm of 1+x. - * - * The argument 1+x is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the logarithm - * of the fraction is approximated by - * - * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x). - * - * Otherwise, setting z = 2(x-1)/x+1), - * - * log(x) = z + z^3 P(z)/Q(z). - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -1.0, 9.0 100000 8.2e-20 2.5e-20 - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double log1pl(long double x) -{ - return log1p(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* Coefficients for log(1+x) = x - x^2 / 2 + x^3 P(x)/Q(x) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 2.32e-20 - */ -static const long double P[] = { - 4.5270000862445199635215E-5L, - 4.9854102823193375972212E-1L, - 6.5787325942061044846969E0L, - 2.9911919328553073277375E1L, - 6.0949667980987787057556E1L, - 5.7112963590585538103336E1L, - 2.0039553499201281259648E1L, -}; -static const long double Q[] = { -/* 1.0000000000000000000000E0,*/ - 1.5062909083469192043167E1L, - 8.3047565967967209469434E1L, - 2.2176239823732856465394E2L, - 3.0909872225312059774938E2L, - 2.1642788614495947685003E2L, - 6.0118660497603843919306E1L, -}; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 6.16e-22 - */ -static const long double R[4] = { - 1.9757429581415468984296E-3L, --7.1990767473014147232598E-1L, - 1.0777257190312272158094E1L, --3.5717684488096787370998E1L, -}; -static const long double S[4] = { -/* 1.00000000000000000000E0L,*/ --2.6201045551331104417768E1L, - 1.9361891836232102174846E2L, --4.2861221385716144629696E2L, -}; -static const long double C1 = 6.9314575195312500000000E-1L; -static const long double C2 = 1.4286068203094172321215E-6L; - -#define SQRTH 0.70710678118654752440L - -long double log1pl(long double xm1) -{ - long double x, y, z; - int e; - - if (isnan(xm1)) - return xm1; - if (xm1 == INFINITY) - return xm1; - if (xm1 == 0.0) - return xm1; - - x = xm1 + 1.0; - - /* Test for domain errors. */ - if (x <= 0.0) { - if (x == 0.0) - return -1/(x*x); /* -inf with divbyzero */ - return 0/0.0f; /* nan with invalid */ - } - - /* Separate mantissa from exponent. - Use frexp so that denormal numbers will be handled properly. */ - x = frexpl(x, &e); - - /* logarithm using log(x) = z + z^3 P(z)/Q(z), - where z = 2(x-1)/x+1) */ - if (e > 2 || e < -2) { - if (x < SQRTH) { /* 2(2x-1)/(2x+1) */ - e -= 1; - z = x - 0.5; - y = 0.5 * z + 0.5; - } else { /* 2 (x-1)/(x+1) */ - z = x - 0.5; - z -= 0.5; - y = 0.5 * x + 0.5; - } - x = z / y; - z = x*x; - z = x * (z * __polevll(z, R, 3) / __p1evll(z, S, 3)); - z = z + e * C2; - z = z + x; - z = z + e * C1; - return z; - } - - /* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */ - if (x < SQRTH) { - e -= 1; - if (e != 0) - x = 2.0 * x - 1.0; - else - x = xm1; - } else { - if (e != 0) - x = x - 1.0; - else - x = xm1; - } - z = x*x; - y = x * (z * __polevll(x, P, 6) / __p1evll(x, Q, 6)); - y = y + e * C2; - z = y - 0.5 * z; - z = z + x; - z = z + e * C1; - return z; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double log1pl(long double x) -{ - return log1p(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log2.c deleted file mode 100644 index 1276ed4e3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Double-precision log2(x) function. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "log2_data.h" - -#define T __log2_data.tab -#define T2 __log2_data.tab2 -#define B __log2_data.poly1 -#define A __log2_data.poly -#define InvLn2hi __log2_data.invln2hi -#define InvLn2lo __log2_data.invln2lo -#define N (1 << LOG2_TABLE_BITS) -#define OFF 0x3fe6000000000000 - -/* Top 16 bits of a double. */ -static inline uint32_t top16(double x) -{ - return asuint64(x) >> 48; -} - -double log2(double x) -{ - double_t z, r, r2, r4, y, invc, logc, kd, hi, lo, t1, t2, t3, p; - uint64_t ix, iz, tmp; - uint32_t top; - int k, i; - - ix = asuint64(x); - top = top16(x); -#define LO asuint64(1.0 - 0x1.5b51p-5) -#define HI asuint64(1.0 + 0x1.6ab2p-5) - if (predict_false(ix - LO < HI - LO)) { - /* Handle close to 1.0 inputs separately. */ - /* Fix sign of zero with downward rounding when x==1. */ - if (WANT_ROUNDING && predict_false(ix == asuint64(1.0))) - return 0; - r = x - 1.0; -#if __FP_FAST_FMA - hi = r * InvLn2hi; - lo = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -hi); -#else - double_t rhi, rlo; - rhi = asdouble(asuint64(r) & -1ULL << 32); - rlo = r - rhi; - hi = rhi * InvLn2hi; - lo = rlo * InvLn2hi + r * InvLn2lo; -#endif - r2 = r * r; /* rounding error: 0x1p-62. */ - r4 = r2 * r2; - /* Worst-case error is less than 0.54 ULP (0.55 ULP without fma). */ - p = r2 * (B[0] + r * B[1]); - y = hi + p; - lo += hi - y + p; - lo += r4 * (B[2] + r * B[3] + r2 * (B[4] + r * B[5]) + - r4 * (B[6] + r * B[7] + r2 * (B[8] + r * B[9]))); - y += lo; - return eval_as_double(y); - } - if (predict_false(top - 0x0010 >= 0x7ff0 - 0x0010)) { - /* x < 0x1p-1022 or inf or nan. */ - if (ix * 2 == 0) - return __math_divzero(1); - if (ix == asuint64(INFINITY)) /* log(inf) == inf. */ - return x; - if ((top & 0x8000) || (top & 0x7ff0) == 0x7ff0) - return __math_invalid(x); - /* x is subnormal, normalize it. */ - ix = asuint64(x * 0x1p52); - ix -= 52ULL << 52; - } - - /* x = 2^k z; where z is in range [OFF,2*OFF) and exact. - The range is split into N subintervals. - The ith subinterval contains z and c is near its center. */ - tmp = ix - OFF; - i = (tmp >> (52 - LOG2_TABLE_BITS)) % N; - k = (int64_t)tmp >> 52; /* arithmetic shift */ - iz = ix - (tmp & 0xfffULL << 52); - invc = T[i].invc; - logc = T[i].logc; - z = asdouble(iz); - kd = (double_t)k; - - /* log2(x) = log2(z/c) + log2(c) + k. */ - /* r ~= z/c - 1, |r| < 1/(2*N). */ -#if __FP_FAST_FMA - /* rounding error: 0x1p-55/N. */ - r = __builtin_fma(z, invc, -1.0); - t1 = r * InvLn2hi; - t2 = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -t1); -#else - double_t rhi, rlo; - /* rounding error: 0x1p-55/N + 0x1p-65. */ - r = (z - T2[i].chi - T2[i].clo) * invc; - rhi = asdouble(asuint64(r) & -1ULL << 32); - rlo = r - rhi; - t1 = rhi * InvLn2hi; - t2 = rlo * InvLn2hi + r * InvLn2lo; -#endif - - /* hi + lo = r/ln2 + log2(c) + k. */ - t3 = kd + logc; - hi = t3 + t1; - lo = t3 - hi + t1 + t2; - - /* log2(r+1) = r/ln2 + r^2*poly(r). */ - /* Evaluation is optimized assuming superscalar pipelined execution. */ - r2 = r * r; /* rounding error: 0x1p-54/N^2. */ - r4 = r2 * r2; - /* Worst-case error if |y| > 0x1p-4: 0.547 ULP (0.550 ULP without fma). - ~ 0.5 + 2/N/ln2 + abs-poly-error*0x1p56 ULP (+ 0.003 ULP without fma). */ - p = A[0] + r * A[1] + r2 * (A[2] + r * A[3]) + r4 * (A[4] + r * A[5]); - y = lo + r2 * p + hi; - return eval_as_double(y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.c deleted file mode 100644 index 3dd1ca514..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Data for log2. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "log2_data.h" - -#define N (1 << LOG2_TABLE_BITS) - -const struct log2_data __log2_data = { -// First coefficient: 0x1.71547652b82fe1777d0ffda0d24p0 -.invln2hi = 0x1.7154765200000p+0, -.invln2lo = 0x1.705fc2eefa200p-33, -.poly1 = { -// relative error: 0x1.2fad8188p-63 -// in -0x1.5b51p-5 0x1.6ab2p-5 --0x1.71547652b82fep-1, -0x1.ec709dc3a03f7p-2, --0x1.71547652b7c3fp-2, -0x1.2776c50f05be4p-2, --0x1.ec709dd768fe5p-3, -0x1.a61761ec4e736p-3, --0x1.7153fbc64a79bp-3, -0x1.484d154f01b4ap-3, --0x1.289e4a72c383cp-3, -0x1.0b32f285aee66p-3, -}, -.poly = { -// relative error: 0x1.a72c2bf8p-58 -// abs error: 0x1.67a552c8p-66 -// in -0x1.f45p-8 0x1.f45p-8 --0x1.71547652b8339p-1, -0x1.ec709dc3a04bep-2, --0x1.7154764702ffbp-2, -0x1.2776c50034c48p-2, --0x1.ec7b328ea92bcp-3, -0x1.a6225e117f92ep-3, -}, -/* Algorithm: - - x = 2^k z - log2(x) = k + log2(c) + log2(z/c) - log2(z/c) = poly(z/c - 1) - -where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls -into the ith one, then table entries are computed as - - tab[i].invc = 1/c - tab[i].logc = (double)log2(c) - tab2[i].chi = (double)c - tab2[i].clo = (double)(c - (double)c) - -where c is near the center of the subinterval and is chosen by trying +-2^29 -floating point invc candidates around 1/center and selecting one for which - - 1) the rounding error in 0x1.8p10 + logc is 0, - 2) the rounding error in z - chi - clo is < 0x1p-64 and - 3) the rounding error in (double)log2(c) is minimized (< 0x1p-68). - -Note: 1) ensures that k + logc can be computed without rounding error, 2) -ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to a -single rounding error when there is no fast fma for z*invc - 1, 3) ensures -that logc + poly(z/c - 1) has small error, however near x == 1 when -|log2(x)| < 0x1p-4, this is not enough so that is special cased. */ -.tab = { -{0x1.724286bb1acf8p+0, -0x1.1095feecdb000p-1}, -{0x1.6e1f766d2cca1p+0, -0x1.08494bd76d000p-1}, -{0x1.6a13d0e30d48ap+0, -0x1.00143aee8f800p-1}, -{0x1.661ec32d06c85p+0, -0x1.efec5360b4000p-2}, -{0x1.623fa951198f8p+0, -0x1.dfdd91ab7e000p-2}, -{0x1.5e75ba4cf026cp+0, -0x1.cffae0cc79000p-2}, -{0x1.5ac055a214fb8p+0, -0x1.c043811fda000p-2}, -{0x1.571ed0f166e1ep+0, -0x1.b0b67323ae000p-2}, -{0x1.53909590bf835p+0, -0x1.a152f5a2db000p-2}, -{0x1.5014fed61adddp+0, -0x1.9217f5af86000p-2}, -{0x1.4cab88e487bd0p+0, -0x1.8304db0719000p-2}, -{0x1.49539b4334feep+0, -0x1.74189f9a9e000p-2}, -{0x1.460cbdfafd569p+0, -0x1.6552bb5199000p-2}, -{0x1.42d664ee4b953p+0, -0x1.56b23a29b1000p-2}, -{0x1.3fb01111dd8a6p+0, -0x1.483650f5fa000p-2}, -{0x1.3c995b70c5836p+0, -0x1.39de937f6a000p-2}, -{0x1.3991c4ab6fd4ap+0, -0x1.2baa1538d6000p-2}, -{0x1.3698e0ce099b5p+0, -0x1.1d98340ca4000p-2}, -{0x1.33ae48213e7b2p+0, -0x1.0fa853a40e000p-2}, -{0x1.30d191985bdb1p+0, -0x1.01d9c32e73000p-2}, -{0x1.2e025cab271d7p+0, -0x1.e857da2fa6000p-3}, -{0x1.2b404cf13cd82p+0, -0x1.cd3c8633d8000p-3}, -{0x1.288b02c7ccb50p+0, -0x1.b26034c14a000p-3}, -{0x1.25e2263944de5p+0, -0x1.97c1c2f4fe000p-3}, -{0x1.234563d8615b1p+0, -0x1.7d6023f800000p-3}, -{0x1.20b46e33eaf38p+0, -0x1.633a71a05e000p-3}, -{0x1.1e2eefdcda3ddp+0, -0x1.494f5e9570000p-3}, -{0x1.1bb4a580b3930p+0, -0x1.2f9e424e0a000p-3}, -{0x1.19453847f2200p+0, -0x1.162595afdc000p-3}, -{0x1.16e06c0d5d73cp+0, -0x1.f9c9a75bd8000p-4}, -{0x1.1485f47b7e4c2p+0, -0x1.c7b575bf9c000p-4}, -{0x1.12358ad0085d1p+0, -0x1.960c60ff48000p-4}, -{0x1.0fef00f532227p+0, -0x1.64ce247b60000p-4}, -{0x1.0db2077d03a8fp+0, -0x1.33f78b2014000p-4}, -{0x1.0b7e6d65980d9p+0, -0x1.0387d1a42c000p-4}, -{0x1.0953efe7b408dp+0, -0x1.a6f9208b50000p-5}, -{0x1.07325cac53b83p+0, -0x1.47a954f770000p-5}, -{0x1.05197e40d1b5cp+0, -0x1.d23a8c50c0000p-6}, -{0x1.03091c1208ea2p+0, -0x1.16a2629780000p-6}, -{0x1.0101025b37e21p+0, -0x1.720f8d8e80000p-8}, -{0x1.fc07ef9caa76bp-1, 0x1.6fe53b1500000p-7}, -{0x1.f4465d3f6f184p-1, 0x1.11ccce10f8000p-5}, -{0x1.ecc079f84107fp-1, 0x1.c4dfc8c8b8000p-5}, -{0x1.e573a99975ae8p-1, 0x1.3aa321e574000p-4}, -{0x1.de5d6f0bd3de6p-1, 0x1.918a0d08b8000p-4}, -{0x1.d77b681ff38b3p-1, 0x1.e72e9da044000p-4}, -{0x1.d0cb5724de943p-1, 0x1.1dcd2507f6000p-3}, -{0x1.ca4b2dc0e7563p-1, 0x1.476ab03dea000p-3}, -{0x1.c3f8ee8d6cb51p-1, 0x1.7074377e22000p-3}, -{0x1.bdd2b4f020c4cp-1, 0x1.98ede8ba94000p-3}, -{0x1.b7d6c006015cap-1, 0x1.c0db86ad2e000p-3}, -{0x1.b20366e2e338fp-1, 0x1.e840aafcee000p-3}, -{0x1.ac57026295039p-1, 0x1.0790ab4678000p-2}, -{0x1.a6d01bc2731ddp-1, 0x1.1ac056801c000p-2}, -{0x1.a16d3bc3ff18bp-1, 0x1.2db11d4fee000p-2}, -{0x1.9c2d14967feadp-1, 0x1.406464ec58000p-2}, -{0x1.970e4f47c9902p-1, 0x1.52dbe093af000p-2}, -{0x1.920fb3982bcf2p-1, 0x1.651902050d000p-2}, -{0x1.8d30187f759f1p-1, 0x1.771d2cdeaf000p-2}, -{0x1.886e5ebb9f66dp-1, 0x1.88e9c857d9000p-2}, -{0x1.83c97b658b994p-1, 0x1.9a80155e16000p-2}, -{0x1.7f405ffc61022p-1, 0x1.abe186ed3d000p-2}, -{0x1.7ad22181415cap-1, 0x1.bd0f2aea0e000p-2}, -{0x1.767dcf99eff8cp-1, 0x1.ce0a43dbf4000p-2}, -}, -#if !__FP_FAST_FMA -.tab2 = { -{0x1.6200012b90a8ep-1, 0x1.904ab0644b605p-55}, -{0x1.66000045734a6p-1, 0x1.1ff9bea62f7a9p-57}, -{0x1.69fffc325f2c5p-1, 0x1.27ecfcb3c90bap-55}, -{0x1.6e00038b95a04p-1, 0x1.8ff8856739326p-55}, -{0x1.71fffe09994e3p-1, 0x1.afd40275f82b1p-55}, -{0x1.7600015590e1p-1, -0x1.2fd75b4238341p-56}, -{0x1.7a00012655bd5p-1, 0x1.808e67c242b76p-56}, -{0x1.7e0003259e9a6p-1, -0x1.208e426f622b7p-57}, -{0x1.81fffedb4b2d2p-1, -0x1.402461ea5c92fp-55}, -{0x1.860002dfafcc3p-1, 0x1.df7f4a2f29a1fp-57}, -{0x1.89ffff78c6b5p-1, -0x1.e0453094995fdp-55}, -{0x1.8e00039671566p-1, -0x1.a04f3bec77b45p-55}, -{0x1.91fffe2bf1745p-1, -0x1.7fa34400e203cp-56}, -{0x1.95fffcc5c9fd1p-1, -0x1.6ff8005a0695dp-56}, -{0x1.9a0003bba4767p-1, 0x1.0f8c4c4ec7e03p-56}, -{0x1.9dfffe7b92da5p-1, 0x1.e7fd9478c4602p-55}, -{0x1.a1fffd72efdafp-1, -0x1.a0c554dcdae7ep-57}, -{0x1.a5fffde04ff95p-1, 0x1.67da98ce9b26bp-55}, -{0x1.a9fffca5e8d2bp-1, -0x1.284c9b54c13dep-55}, -{0x1.adfffddad03eap-1, 0x1.812c8ea602e3cp-58}, -{0x1.b1ffff10d3d4dp-1, -0x1.efaddad27789cp-55}, -{0x1.b5fffce21165ap-1, 0x1.3cb1719c61237p-58}, -{0x1.b9fffd950e674p-1, 0x1.3f7d94194cep-56}, -{0x1.be000139ca8afp-1, 0x1.50ac4215d9bcp-56}, -{0x1.c20005b46df99p-1, 0x1.beea653e9c1c9p-57}, -{0x1.c600040b9f7aep-1, -0x1.c079f274a70d6p-56}, -{0x1.ca0006255fd8ap-1, -0x1.a0b4076e84c1fp-56}, -{0x1.cdfffd94c095dp-1, 0x1.8f933f99ab5d7p-55}, -{0x1.d1ffff975d6cfp-1, -0x1.82c08665fe1bep-58}, -{0x1.d5fffa2561c93p-1, -0x1.b04289bd295f3p-56}, -{0x1.d9fff9d228b0cp-1, 0x1.70251340fa236p-55}, -{0x1.de00065bc7e16p-1, -0x1.5011e16a4d80cp-56}, -{0x1.e200002f64791p-1, 0x1.9802f09ef62ep-55}, -{0x1.e600057d7a6d8p-1, -0x1.e0b75580cf7fap-56}, -{0x1.ea00027edc00cp-1, -0x1.c848309459811p-55}, -{0x1.ee0006cf5cb7cp-1, -0x1.f8027951576f4p-55}, -{0x1.f2000782b7dccp-1, -0x1.f81d97274538fp-55}, -{0x1.f6000260c450ap-1, -0x1.071002727ffdcp-59}, -{0x1.f9fffe88cd533p-1, -0x1.81bdce1fda8bp-58}, -{0x1.fdfffd50f8689p-1, 0x1.7f91acb918e6ep-55}, -{0x1.0200004292367p+0, 0x1.b7ff365324681p-54}, -{0x1.05fffe3e3d668p+0, 0x1.6fa08ddae957bp-55}, -{0x1.0a0000a85a757p+0, -0x1.7e2de80d3fb91p-58}, -{0x1.0e0001a5f3fccp+0, -0x1.1823305c5f014p-54}, -{0x1.11ffff8afbaf5p+0, -0x1.bfabb6680bac2p-55}, -{0x1.15fffe54d91adp+0, -0x1.d7f121737e7efp-54}, -{0x1.1a00011ac36e1p+0, 0x1.c000a0516f5ffp-54}, -{0x1.1e00019c84248p+0, -0x1.082fbe4da5dap-54}, -{0x1.220000ffe5e6ep+0, -0x1.8fdd04c9cfb43p-55}, -{0x1.26000269fd891p+0, 0x1.cfe2a7994d182p-55}, -{0x1.2a00029a6e6dap+0, -0x1.00273715e8bc5p-56}, -{0x1.2dfffe0293e39p+0, 0x1.b7c39dab2a6f9p-54}, -{0x1.31ffff7dcf082p+0, 0x1.df1336edc5254p-56}, -{0x1.35ffff05a8b6p+0, -0x1.e03564ccd31ebp-54}, -{0x1.3a0002e0eaeccp+0, 0x1.5f0e74bd3a477p-56}, -{0x1.3e000043bb236p+0, 0x1.c7dcb149d8833p-54}, -{0x1.4200002d187ffp+0, 0x1.e08afcf2d3d28p-56}, -{0x1.460000d387cb1p+0, 0x1.20837856599a6p-55}, -{0x1.4a00004569f89p+0, -0x1.9fa5c904fbcd2p-55}, -{0x1.4e000043543f3p+0, -0x1.81125ed175329p-56}, -{0x1.51fffcc027f0fp+0, 0x1.883d8847754dcp-54}, -{0x1.55ffffd87b36fp+0, -0x1.709e731d02807p-55}, -{0x1.59ffff21df7bap+0, 0x1.7f79f68727b02p-55}, -{0x1.5dfffebfc3481p+0, -0x1.180902e30e93ep-54}, -}, -#endif -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.h deleted file mode 100644 index 276a786d1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _LOG2_DATA_H -#define _LOG2_DATA_H - -#include - -#define LOG2_TABLE_BITS 6 -#define LOG2_POLY_ORDER 7 -#define LOG2_POLY1_ORDER 11 -extern hidden const struct log2_data { - double invln2hi; - double invln2lo; - double poly[LOG2_POLY_ORDER - 1]; - double poly1[LOG2_POLY1_ORDER - 1]; - struct { - double invc, logc; - } tab[1 << LOG2_TABLE_BITS]; -#if !__FP_FAST_FMA - struct { - double chi, clo; - } tab2[1 << LOG2_TABLE_BITS]; -#endif -} __log2_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2f.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log2f.c deleted file mode 100644 index c368f88f3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2f.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Single-precision log2 function. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "log2f_data.h" - -/* -LOG2F_TABLE_BITS = 4 -LOG2F_POLY_ORDER = 4 - -ULP error: 0.752 (nearest rounding.) -Relative error: 1.9 * 2^-26 (before rounding.) -*/ - -#define N (1 << LOG2F_TABLE_BITS) -#define T __log2f_data.tab -#define A __log2f_data.poly -#define OFF 0x3f330000 - -float log2f(float x) -{ - double_t z, r, r2, p, y, y0, invc, logc; - uint32_t ix, iz, top, tmp; - int k, i; - - ix = asuint(x); - /* Fix sign of zero with downward rounding when x==1. */ - if (WANT_ROUNDING && predict_false(ix == 0x3f800000)) - return 0; - if (predict_false(ix - 0x00800000 >= 0x7f800000 - 0x00800000)) { - /* x < 0x1p-126 or inf or nan. */ - if (ix * 2 == 0) - return __math_divzerof(1); - if (ix == 0x7f800000) /* log2(inf) == inf. */ - return x; - if ((ix & 0x80000000) || ix * 2 >= 0xff000000) - return __math_invalidf(x); - /* x is subnormal, normalize it. */ - ix = asuint(x * 0x1p23f); - ix -= 23 << 23; - } - - /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. - The range is split into N subintervals. - The ith subinterval contains z and c is near its center. */ - tmp = ix - OFF; - i = (tmp >> (23 - LOG2F_TABLE_BITS)) % N; - top = tmp & 0xff800000; - iz = ix - top; - k = (int32_t)tmp >> 23; /* arithmetic shift */ - invc = T[i].invc; - logc = T[i].logc; - z = (double_t)asfloat(iz); - - /* log2(x) = log1p(z/c-1)/ln2 + log2(c) + k */ - r = z * invc - 1; - y0 = logc + (double_t)k; - - /* Pipelined polynomial evaluation to approximate log1p(r)/ln2. */ - r2 = r * r; - y = A[1] * r + A[2]; - y = A[0] * r2 + y; - p = A[3] * r + y0; - y = y * r2 + p; - return eval_as_float(y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.c deleted file mode 100644 index 24e450f1e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Data definition for log2f. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "log2f_data.h" - -const struct log2f_data __log2f_data = { - .tab = { - { 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2 }, - { 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2 }, - { 0x1.49539f0f010bp+0, -0x1.7418b0a1fb77bp-2 }, - { 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2 }, - { 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2 }, - { 0x1.25e227b0b8eap+0, -0x1.97c1d1b3b7afp-3 }, - { 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3 }, - { 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4 }, - { 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5 }, - { 0x1p+0, 0x0p+0 }, - { 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4 }, - { 0x1.ca4b31f026aap-1, 0x1.476a9543891bap-3 }, - { 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3 }, - { 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2 }, - { 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2 }, - { 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2 }, - }, - .poly = { - -0x1.712b6f70a7e4dp-2, 0x1.ecabf496832ep-2, -0x1.715479ffae3dep-1, - 0x1.715475f35c8b8p0, - } -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.h deleted file mode 100644 index 4fa489560..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _LOG2F_DATA_H -#define _LOG2F_DATA_H - -#include - -#define LOG2F_TABLE_BITS 4 -#define LOG2F_POLY_ORDER 4 -extern hidden const struct log2f_data { - struct { - double invc, logc; - } tab[1 << LOG2F_TABLE_BITS]; - double poly[LOG2F_POLY_ORDER]; -} __log2f_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log2l.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log2l.c deleted file mode 100644 index 722b451a0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log2l.c +++ /dev/null @@ -1,182 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_log2l.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Base 2 logarithm, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, log2l(); - * - * y = log2l( x ); - * - * - * DESCRIPTION: - * - * Returns the base 2 logarithm of x. - * - * The argument is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the (natural) - * logarithm of the fraction is approximated by - * - * log(1+x) = x - 0.5 x**2 + x**3 P(x)/Q(x). - * - * Otherwise, setting z = 2(x-1)/x+1), - * - * log(x) = z + z**3 P(z)/Q(z). - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0.5, 2.0 30000 9.8e-20 2.7e-20 - * IEEE exp(+-10000) 70000 5.4e-20 2.3e-20 - * - * In the tests over the interval exp(+-10000), the logarithms - * of the random arguments were uniformly distributed over - * [-10000, +10000]. - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double log2l(long double x) -{ - return log2(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 6.2e-22 - */ -static const long double P[] = { - 4.9962495940332550844739E-1L, - 1.0767376367209449010438E1L, - 7.7671073698359539859595E1L, - 2.5620629828144409632571E2L, - 4.2401812743503691187826E2L, - 3.4258224542413922935104E2L, - 1.0747524399916215149070E2L, -}; -static const long double Q[] = { -/* 1.0000000000000000000000E0,*/ - 2.3479774160285863271658E1L, - 1.9444210022760132894510E2L, - 7.7952888181207260646090E2L, - 1.6911722418503949084863E3L, - 2.0307734695595183428202E3L, - 1.2695660352705325274404E3L, - 3.2242573199748645407652E2L, -}; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 6.16e-22 - */ -static const long double R[4] = { - 1.9757429581415468984296E-3L, --7.1990767473014147232598E-1L, - 1.0777257190312272158094E1L, --3.5717684488096787370998E1L, -}; -static const long double S[4] = { -/* 1.00000000000000000000E0L,*/ --2.6201045551331104417768E1L, - 1.9361891836232102174846E2L, --4.2861221385716144629696E2L, -}; -/* log2(e) - 1 */ -#define LOG2EA 4.4269504088896340735992e-1L - -#define SQRTH 0.70710678118654752440L - -long double log2l(long double x) -{ - long double y, z; - int e; - - if (isnan(x)) - return x; - if (x == INFINITY) - return x; - if (x <= 0.0) { - if (x == 0.0) - return -1/(x*x); /* -inf with divbyzero */ - return 0/0.0f; /* nan with invalid */ - } - - /* separate mantissa from exponent */ - /* Note, frexp is used so that denormal numbers - * will be handled properly. - */ - x = frexpl(x, &e); - - /* logarithm using log(x) = z + z**3 P(z)/Q(z), - * where z = 2(x-1)/x+1) - */ - if (e > 2 || e < -2) { - if (x < SQRTH) { /* 2(2x-1)/(2x+1) */ - e -= 1; - z = x - 0.5; - y = 0.5 * z + 0.5; - } else { /* 2 (x-1)/(x+1) */ - z = x - 0.5; - z -= 0.5; - y = 0.5 * x + 0.5; - } - x = z / y; - z = x*x; - y = x * (z * __polevll(z, R, 3) / __p1evll(z, S, 3)); - goto done; - } - - /* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */ - if (x < SQRTH) { - e -= 1; - x = 2.0*x - 1.0; - } else { - x = x - 1.0; - } - z = x*x; - y = x * (z * __polevll(x, P, 6) / __p1evll(x, Q, 7)); - y = y - 0.5*z; - -done: - /* Multiply log of fraction by log2(e) - * and base 2 exponent by 1 - * - * ***CAUTION*** - * - * This sequence of operations is critical and it may - * be horribly defeated by some compiler optimizers. - */ - z = y * LOG2EA; - z += x * LOG2EA; - z += y; - z += x; - z += e; - return z; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double log2l(long double x) -{ - return log2(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/log_data.c deleted file mode 100644 index 1a6ec712a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log_data.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Data for log. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "log_data.h" - -#define N (1 << LOG_TABLE_BITS) - -const struct log_data __log_data = { -.ln2hi = 0x1.62e42fefa3800p-1, -.ln2lo = 0x1.ef35793c76730p-45, -.poly1 = { -// relative error: 0x1.c04d76cp-63 -// in -0x1p-4 0x1.09p-4 (|log(1+x)| > 0x1p-4 outside the interval) --0x1p-1, -0x1.5555555555577p-2, --0x1.ffffffffffdcbp-3, -0x1.999999995dd0cp-3, --0x1.55555556745a7p-3, -0x1.24924a344de3p-3, --0x1.fffffa4423d65p-4, -0x1.c7184282ad6cap-4, --0x1.999eb43b068ffp-4, -0x1.78182f7afd085p-4, --0x1.5521375d145cdp-4, -}, -.poly = { -// relative error: 0x1.926199e8p-56 -// abs error: 0x1.882ff33p-65 -// in -0x1.fp-9 0x1.fp-9 --0x1.0000000000001p-1, -0x1.555555551305bp-2, --0x1.fffffffeb459p-3, -0x1.999b324f10111p-3, --0x1.55575e506c89fp-3, -}, -/* Algorithm: - - x = 2^k z - log(x) = k ln2 + log(c) + log(z/c) - log(z/c) = poly(z/c - 1) - -where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls -into the ith one, then table entries are computed as - - tab[i].invc = 1/c - tab[i].logc = (double)log(c) - tab2[i].chi = (double)c - tab2[i].clo = (double)(c - (double)c) - -where c is near the center of the subinterval and is chosen by trying +-2^29 -floating point invc candidates around 1/center and selecting one for which - - 1) the rounding error in 0x1.8p9 + logc is 0, - 2) the rounding error in z - chi - clo is < 0x1p-66 and - 3) the rounding error in (double)log(c) is minimized (< 0x1p-66). - -Note: 1) ensures that k*ln2hi + logc can be computed without rounding error, -2) ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to -a single rounding error when there is no fast fma for z*invc - 1, 3) ensures -that logc + poly(z/c - 1) has small error, however near x == 1 when -|log(x)| < 0x1p-4, this is not enough so that is special cased. */ -.tab = { -{0x1.734f0c3e0de9fp+0, -0x1.7cc7f79e69000p-2}, -{0x1.713786a2ce91fp+0, -0x1.76feec20d0000p-2}, -{0x1.6f26008fab5a0p+0, -0x1.713e31351e000p-2}, -{0x1.6d1a61f138c7dp+0, -0x1.6b85b38287800p-2}, -{0x1.6b1490bc5b4d1p+0, -0x1.65d5590807800p-2}, -{0x1.69147332f0cbap+0, -0x1.602d076180000p-2}, -{0x1.6719f18224223p+0, -0x1.5a8ca86909000p-2}, -{0x1.6524f99a51ed9p+0, -0x1.54f4356035000p-2}, -{0x1.63356aa8f24c4p+0, -0x1.4f637c36b4000p-2}, -{0x1.614b36b9ddc14p+0, -0x1.49da7fda85000p-2}, -{0x1.5f66452c65c4cp+0, -0x1.445923989a800p-2}, -{0x1.5d867b5912c4fp+0, -0x1.3edf439b0b800p-2}, -{0x1.5babccb5b90dep+0, -0x1.396ce448f7000p-2}, -{0x1.59d61f2d91a78p+0, -0x1.3401e17bda000p-2}, -{0x1.5805612465687p+0, -0x1.2e9e2ef468000p-2}, -{0x1.56397cee76bd3p+0, -0x1.2941b3830e000p-2}, -{0x1.54725e2a77f93p+0, -0x1.23ec58cda8800p-2}, -{0x1.52aff42064583p+0, -0x1.1e9e129279000p-2}, -{0x1.50f22dbb2bddfp+0, -0x1.1956d2b48f800p-2}, -{0x1.4f38f4734ded7p+0, -0x1.141679ab9f800p-2}, -{0x1.4d843cfde2840p+0, -0x1.0edd094ef9800p-2}, -{0x1.4bd3ec078a3c8p+0, -0x1.09aa518db1000p-2}, -{0x1.4a27fc3e0258ap+0, -0x1.047e65263b800p-2}, -{0x1.4880524d48434p+0, -0x1.feb224586f000p-3}, -{0x1.46dce1b192d0bp+0, -0x1.f474a7517b000p-3}, -{0x1.453d9d3391854p+0, -0x1.ea4443d103000p-3}, -{0x1.43a2744b4845ap+0, -0x1.e020d44e9b000p-3}, -{0x1.420b54115f8fbp+0, -0x1.d60a22977f000p-3}, -{0x1.40782da3ef4b1p+0, -0x1.cc00104959000p-3}, -{0x1.3ee8f5d57fe8fp+0, -0x1.c202956891000p-3}, -{0x1.3d5d9a00b4ce9p+0, -0x1.b81178d811000p-3}, -{0x1.3bd60c010c12bp+0, -0x1.ae2c9ccd3d000p-3}, -{0x1.3a5242b75dab8p+0, -0x1.a45402e129000p-3}, -{0x1.38d22cd9fd002p+0, -0x1.9a877681df000p-3}, -{0x1.3755bc5847a1cp+0, -0x1.90c6d69483000p-3}, -{0x1.35dce49ad36e2p+0, -0x1.87120a645c000p-3}, -{0x1.34679984dd440p+0, -0x1.7d68fb4143000p-3}, -{0x1.32f5cceffcb24p+0, -0x1.73cb83c627000p-3}, -{0x1.3187775a10d49p+0, -0x1.6a39a9b376000p-3}, -{0x1.301c8373e3990p+0, -0x1.60b3154b7a000p-3}, -{0x1.2eb4ebb95f841p+0, -0x1.5737d76243000p-3}, -{0x1.2d50a0219a9d1p+0, -0x1.4dc7b8fc23000p-3}, -{0x1.2bef9a8b7fd2ap+0, -0x1.4462c51d20000p-3}, -{0x1.2a91c7a0c1babp+0, -0x1.3b08abc830000p-3}, -{0x1.293726014b530p+0, -0x1.31b996b490000p-3}, -{0x1.27dfa5757a1f5p+0, -0x1.2875490a44000p-3}, -{0x1.268b39b1d3bbfp+0, -0x1.1f3b9f879a000p-3}, -{0x1.2539d838ff5bdp+0, -0x1.160c8252ca000p-3}, -{0x1.23eb7aac9083bp+0, -0x1.0ce7f57f72000p-3}, -{0x1.22a012ba940b6p+0, -0x1.03cdc49fea000p-3}, -{0x1.2157996cc4132p+0, -0x1.f57bdbc4b8000p-4}, -{0x1.201201dd2fc9bp+0, -0x1.e370896404000p-4}, -{0x1.1ecf4494d480bp+0, -0x1.d17983ef94000p-4}, -{0x1.1d8f5528f6569p+0, -0x1.bf9674ed8a000p-4}, -{0x1.1c52311577e7cp+0, -0x1.adc79202f6000p-4}, -{0x1.1b17c74cb26e9p+0, -0x1.9c0c3e7288000p-4}, -{0x1.19e010c2c1ab6p+0, -0x1.8a646b372c000p-4}, -{0x1.18ab07bb670bdp+0, -0x1.78d01b3ac0000p-4}, -{0x1.1778a25efbcb6p+0, -0x1.674f145380000p-4}, -{0x1.1648d354c31dap+0, -0x1.55e0e6d878000p-4}, -{0x1.151b990275fddp+0, -0x1.4485cdea1e000p-4}, -{0x1.13f0ea432d24cp+0, -0x1.333d94d6aa000p-4}, -{0x1.12c8b7210f9dap+0, -0x1.22079f8c56000p-4}, -{0x1.11a3028ecb531p+0, -0x1.10e4698622000p-4}, -{0x1.107fbda8434afp+0, -0x1.ffa6c6ad20000p-5}, -{0x1.0f5ee0f4e6bb3p+0, -0x1.dda8d4a774000p-5}, -{0x1.0e4065d2a9fcep+0, -0x1.bbcece4850000p-5}, -{0x1.0d244632ca521p+0, -0x1.9a1894012c000p-5}, -{0x1.0c0a77ce2981ap+0, -0x1.788583302c000p-5}, -{0x1.0af2f83c636d1p+0, -0x1.5715e67d68000p-5}, -{0x1.09ddb98a01339p+0, -0x1.35c8a49658000p-5}, -{0x1.08cabaf52e7dfp+0, -0x1.149e364154000p-5}, -{0x1.07b9f2f4e28fbp+0, -0x1.e72c082eb8000p-6}, -{0x1.06ab58c358f19p+0, -0x1.a55f152528000p-6}, -{0x1.059eea5ecf92cp+0, -0x1.63d62cf818000p-6}, -{0x1.04949cdd12c90p+0, -0x1.228fb8caa0000p-6}, -{0x1.038c6c6f0ada9p+0, -0x1.c317b20f90000p-7}, -{0x1.02865137932a9p+0, -0x1.419355daa0000p-7}, -{0x1.0182427ea7348p+0, -0x1.81203c2ec0000p-8}, -{0x1.008040614b195p+0, -0x1.0040979240000p-9}, -{0x1.fe01ff726fa1ap-1, 0x1.feff384900000p-9}, -{0x1.fa11cc261ea74p-1, 0x1.7dc41353d0000p-7}, -{0x1.f6310b081992ep-1, 0x1.3cea3c4c28000p-6}, -{0x1.f25f63ceeadcdp-1, 0x1.b9fc114890000p-6}, -{0x1.ee9c8039113e7p-1, 0x1.1b0d8ce110000p-5}, -{0x1.eae8078cbb1abp-1, 0x1.58a5bd001c000p-5}, -{0x1.e741aa29d0c9bp-1, 0x1.95c8340d88000p-5}, -{0x1.e3a91830a99b5p-1, 0x1.d276aef578000p-5}, -{0x1.e01e009609a56p-1, 0x1.07598e598c000p-4}, -{0x1.dca01e577bb98p-1, 0x1.253f5e30d2000p-4}, -{0x1.d92f20b7c9103p-1, 0x1.42edd8b380000p-4}, -{0x1.d5cac66fb5ccep-1, 0x1.606598757c000p-4}, -{0x1.d272caa5ede9dp-1, 0x1.7da76356a0000p-4}, -{0x1.cf26e3e6b2ccdp-1, 0x1.9ab434e1c6000p-4}, -{0x1.cbe6da2a77902p-1, 0x1.b78c7bb0d6000p-4}, -{0x1.c8b266d37086dp-1, 0x1.d431332e72000p-4}, -{0x1.c5894bd5d5804p-1, 0x1.f0a3171de6000p-4}, -{0x1.c26b533bb9f8cp-1, 0x1.067152b914000p-3}, -{0x1.bf583eeece73fp-1, 0x1.147858292b000p-3}, -{0x1.bc4fd75db96c1p-1, 0x1.2266ecdca3000p-3}, -{0x1.b951e0c864a28p-1, 0x1.303d7a6c55000p-3}, -{0x1.b65e2c5ef3e2cp-1, 0x1.3dfc33c331000p-3}, -{0x1.b374867c9888bp-1, 0x1.4ba366b7a8000p-3}, -{0x1.b094b211d304ap-1, 0x1.5933928d1f000p-3}, -{0x1.adbe885f2ef7ep-1, 0x1.66acd2418f000p-3}, -{0x1.aaf1d31603da2p-1, 0x1.740f8ec669000p-3}, -{0x1.a82e63fd358a7p-1, 0x1.815c0f51af000p-3}, -{0x1.a5740ef09738bp-1, 0x1.8e92954f68000p-3}, -{0x1.a2c2a90ab4b27p-1, 0x1.9bb3602f84000p-3}, -{0x1.a01a01393f2d1p-1, 0x1.a8bed1c2c0000p-3}, -{0x1.9d79f24db3c1bp-1, 0x1.b5b515c01d000p-3}, -{0x1.9ae2505c7b190p-1, 0x1.c2967ccbcc000p-3}, -{0x1.9852ef297ce2fp-1, 0x1.cf635d5486000p-3}, -{0x1.95cbaeea44b75p-1, 0x1.dc1bd3446c000p-3}, -{0x1.934c69de74838p-1, 0x1.e8c01b8cfe000p-3}, -{0x1.90d4f2f6752e6p-1, 0x1.f5509c0179000p-3}, -{0x1.8e6528effd79dp-1, 0x1.00e6c121fb800p-2}, -{0x1.8bfce9fcc007cp-1, 0x1.071b80e93d000p-2}, -{0x1.899c0dabec30ep-1, 0x1.0d46b9e867000p-2}, -{0x1.87427aa2317fbp-1, 0x1.13687334bd000p-2}, -{0x1.84f00acb39a08p-1, 0x1.1980d67234800p-2}, -{0x1.82a49e8653e55p-1, 0x1.1f8ffe0cc8000p-2}, -{0x1.8060195f40260p-1, 0x1.2595fd7636800p-2}, -{0x1.7e22563e0a329p-1, 0x1.2b9300914a800p-2}, -{0x1.7beb377dcb5adp-1, 0x1.3187210436000p-2}, -{0x1.79baa679725c2p-1, 0x1.377266dec1800p-2}, -{0x1.77907f2170657p-1, 0x1.3d54ffbaf3000p-2}, -{0x1.756cadbd6130cp-1, 0x1.432eee32fe000p-2}, -}, -#if !__FP_FAST_FMA -.tab2 = { -{0x1.61000014fb66bp-1, 0x1.e026c91425b3cp-56}, -{0x1.63000034db495p-1, 0x1.dbfea48005d41p-55}, -{0x1.650000d94d478p-1, 0x1.e7fa786d6a5b7p-55}, -{0x1.67000074e6fadp-1, 0x1.1fcea6b54254cp-57}, -{0x1.68ffffedf0faep-1, -0x1.c7e274c590efdp-56}, -{0x1.6b0000763c5bcp-1, -0x1.ac16848dcda01p-55}, -{0x1.6d0001e5cc1f6p-1, 0x1.33f1c9d499311p-55}, -{0x1.6efffeb05f63ep-1, -0x1.e80041ae22d53p-56}, -{0x1.710000e86978p-1, 0x1.bff6671097952p-56}, -{0x1.72ffffc67e912p-1, 0x1.c00e226bd8724p-55}, -{0x1.74fffdf81116ap-1, -0x1.e02916ef101d2p-57}, -{0x1.770000f679c9p-1, -0x1.7fc71cd549c74p-57}, -{0x1.78ffffa7ec835p-1, 0x1.1bec19ef50483p-55}, -{0x1.7affffe20c2e6p-1, -0x1.07e1729cc6465p-56}, -{0x1.7cfffed3fc9p-1, -0x1.08072087b8b1cp-55}, -{0x1.7efffe9261a76p-1, 0x1.dc0286d9df9aep-55}, -{0x1.81000049ca3e8p-1, 0x1.97fd251e54c33p-55}, -{0x1.8300017932c8fp-1, -0x1.afee9b630f381p-55}, -{0x1.850000633739cp-1, 0x1.9bfbf6b6535bcp-55}, -{0x1.87000204289c6p-1, -0x1.bbf65f3117b75p-55}, -{0x1.88fffebf57904p-1, -0x1.9006ea23dcb57p-55}, -{0x1.8b00022bc04dfp-1, -0x1.d00df38e04b0ap-56}, -{0x1.8cfffe50c1b8ap-1, -0x1.8007146ff9f05p-55}, -{0x1.8effffc918e43p-1, 0x1.3817bd07a7038p-55}, -{0x1.910001efa5fc7p-1, 0x1.93e9176dfb403p-55}, -{0x1.9300013467bb9p-1, 0x1.f804e4b980276p-56}, -{0x1.94fffe6ee076fp-1, -0x1.f7ef0d9ff622ep-55}, -{0x1.96fffde3c12d1p-1, -0x1.082aa962638bap-56}, -{0x1.98ffff4458a0dp-1, -0x1.7801b9164a8efp-55}, -{0x1.9afffdd982e3ep-1, -0x1.740e08a5a9337p-55}, -{0x1.9cfffed49fb66p-1, 0x1.fce08c19bep-60}, -{0x1.9f00020f19c51p-1, -0x1.a3faa27885b0ap-55}, -{0x1.a10001145b006p-1, 0x1.4ff489958da56p-56}, -{0x1.a300007bbf6fap-1, 0x1.cbeab8a2b6d18p-55}, -{0x1.a500010971d79p-1, 0x1.8fecadd78793p-55}, -{0x1.a70001df52e48p-1, -0x1.f41763dd8abdbp-55}, -{0x1.a90001c593352p-1, -0x1.ebf0284c27612p-55}, -{0x1.ab0002a4f3e4bp-1, -0x1.9fd043cff3f5fp-57}, -{0x1.acfffd7ae1ed1p-1, -0x1.23ee7129070b4p-55}, -{0x1.aefffee510478p-1, 0x1.a063ee00edea3p-57}, -{0x1.b0fffdb650d5bp-1, 0x1.a06c8381f0ab9p-58}, -{0x1.b2ffffeaaca57p-1, -0x1.9011e74233c1dp-56}, -{0x1.b4fffd995badcp-1, -0x1.9ff1068862a9fp-56}, -{0x1.b7000249e659cp-1, 0x1.aff45d0864f3ep-55}, -{0x1.b8ffff987164p-1, 0x1.cfe7796c2c3f9p-56}, -{0x1.bafffd204cb4fp-1, -0x1.3ff27eef22bc4p-57}, -{0x1.bcfffd2415c45p-1, -0x1.cffb7ee3bea21p-57}, -{0x1.beffff86309dfp-1, -0x1.14103972e0b5cp-55}, -{0x1.c0fffe1b57653p-1, 0x1.bc16494b76a19p-55}, -{0x1.c2ffff1fa57e3p-1, -0x1.4feef8d30c6edp-57}, -{0x1.c4fffdcbfe424p-1, -0x1.43f68bcec4775p-55}, -{0x1.c6fffed54b9f7p-1, 0x1.47ea3f053e0ecp-55}, -{0x1.c8fffeb998fd5p-1, 0x1.383068df992f1p-56}, -{0x1.cb0002125219ap-1, -0x1.8fd8e64180e04p-57}, -{0x1.ccfffdd94469cp-1, 0x1.e7ebe1cc7ea72p-55}, -{0x1.cefffeafdc476p-1, 0x1.ebe39ad9f88fep-55}, -{0x1.d1000169af82bp-1, 0x1.57d91a8b95a71p-56}, -{0x1.d30000d0ff71dp-1, 0x1.9c1906970c7dap-55}, -{0x1.d4fffea790fc4p-1, -0x1.80e37c558fe0cp-58}, -{0x1.d70002edc87e5p-1, -0x1.f80d64dc10f44p-56}, -{0x1.d900021dc82aap-1, -0x1.47c8f94fd5c5cp-56}, -{0x1.dafffd86b0283p-1, 0x1.c7f1dc521617ep-55}, -{0x1.dd000296c4739p-1, 0x1.8019eb2ffb153p-55}, -{0x1.defffe54490f5p-1, 0x1.e00d2c652cc89p-57}, -{0x1.e0fffcdabf694p-1, -0x1.f8340202d69d2p-56}, -{0x1.e2fffdb52c8ddp-1, 0x1.b00c1ca1b0864p-56}, -{0x1.e4ffff24216efp-1, 0x1.2ffa8b094ab51p-56}, -{0x1.e6fffe88a5e11p-1, -0x1.7f673b1efbe59p-58}, -{0x1.e9000119eff0dp-1, -0x1.4808d5e0bc801p-55}, -{0x1.eafffdfa51744p-1, 0x1.80006d54320b5p-56}, -{0x1.ed0001a127fa1p-1, -0x1.002f860565c92p-58}, -{0x1.ef00007babcc4p-1, -0x1.540445d35e611p-55}, -{0x1.f0ffff57a8d02p-1, -0x1.ffb3139ef9105p-59}, -{0x1.f30001ee58ac7p-1, 0x1.a81acf2731155p-55}, -{0x1.f4ffff5823494p-1, 0x1.a3f41d4d7c743p-55}, -{0x1.f6ffffca94c6bp-1, -0x1.202f41c987875p-57}, -{0x1.f8fffe1f9c441p-1, 0x1.77dd1f477e74bp-56}, -{0x1.fafffd2e0e37ep-1, -0x1.f01199a7ca331p-57}, -{0x1.fd0001c77e49ep-1, 0x1.181ee4bceacb1p-56}, -{0x1.feffff7e0c331p-1, -0x1.e05370170875ap-57}, -{0x1.00ffff465606ep+0, -0x1.a7ead491c0adap-55}, -{0x1.02ffff3867a58p+0, -0x1.77f69c3fcb2ep-54}, -{0x1.04ffffdfc0d17p+0, 0x1.7bffe34cb945bp-54}, -{0x1.0700003cd4d82p+0, 0x1.20083c0e456cbp-55}, -{0x1.08ffff9f2cbe8p+0, -0x1.dffdfbe37751ap-57}, -{0x1.0b000010cda65p+0, -0x1.13f7faee626ebp-54}, -{0x1.0d00001a4d338p+0, 0x1.07dfa79489ff7p-55}, -{0x1.0effffadafdfdp+0, -0x1.7040570d66bcp-56}, -{0x1.110000bbafd96p+0, 0x1.e80d4846d0b62p-55}, -{0x1.12ffffae5f45dp+0, 0x1.dbffa64fd36efp-54}, -{0x1.150000dd59ad9p+0, 0x1.a0077701250aep-54}, -{0x1.170000f21559ap+0, 0x1.dfdf9e2e3deeep-55}, -{0x1.18ffffc275426p+0, 0x1.10030dc3b7273p-54}, -{0x1.1b000123d3c59p+0, 0x1.97f7980030188p-54}, -{0x1.1cffff8299eb7p+0, -0x1.5f932ab9f8c67p-57}, -{0x1.1effff48ad4p+0, 0x1.37fbf9da75bebp-54}, -{0x1.210000c8b86a4p+0, 0x1.f806b91fd5b22p-54}, -{0x1.2300003854303p+0, 0x1.3ffc2eb9fbf33p-54}, -{0x1.24fffffbcf684p+0, 0x1.601e77e2e2e72p-56}, -{0x1.26ffff52921d9p+0, 0x1.ffcbb767f0c61p-56}, -{0x1.2900014933a3cp+0, -0x1.202ca3c02412bp-56}, -{0x1.2b00014556313p+0, -0x1.2808233f21f02p-54}, -{0x1.2cfffebfe523bp+0, -0x1.8ff7e384fdcf2p-55}, -{0x1.2f0000bb8ad96p+0, -0x1.5ff51503041c5p-55}, -{0x1.30ffffb7ae2afp+0, -0x1.10071885e289dp-55}, -{0x1.32ffffeac5f7fp+0, -0x1.1ff5d3fb7b715p-54}, -{0x1.350000ca66756p+0, 0x1.57f82228b82bdp-54}, -{0x1.3700011fbf721p+0, 0x1.000bac40dd5ccp-55}, -{0x1.38ffff9592fb9p+0, -0x1.43f9d2db2a751p-54}, -{0x1.3b00004ddd242p+0, 0x1.57f6b707638e1p-55}, -{0x1.3cffff5b2c957p+0, 0x1.a023a10bf1231p-56}, -{0x1.3efffeab0b418p+0, 0x1.87f6d66b152bp-54}, -{0x1.410001532aff4p+0, 0x1.7f8375f198524p-57}, -{0x1.4300017478b29p+0, 0x1.301e672dc5143p-55}, -{0x1.44fffe795b463p+0, 0x1.9ff69b8b2895ap-55}, -{0x1.46fffe80475ep+0, -0x1.5c0b19bc2f254p-54}, -{0x1.48fffef6fc1e7p+0, 0x1.b4009f23a2a72p-54}, -{0x1.4afffe5bea704p+0, -0x1.4ffb7bf0d7d45p-54}, -{0x1.4d000171027dep+0, -0x1.9c06471dc6a3dp-54}, -{0x1.4f0000ff03ee2p+0, 0x1.77f890b85531cp-54}, -{0x1.5100012dc4bd1p+0, 0x1.004657166a436p-57}, -{0x1.530001605277ap+0, -0x1.6bfcece233209p-54}, -{0x1.54fffecdb704cp+0, -0x1.902720505a1d7p-55}, -{0x1.56fffef5f54a9p+0, 0x1.bbfe60ec96412p-54}, -{0x1.5900017e61012p+0, 0x1.87ec581afef9p-55}, -{0x1.5b00003c93e92p+0, -0x1.f41080abf0ccp-54}, -{0x1.5d0001d4919bcp+0, -0x1.8812afb254729p-54}, -{0x1.5efffe7b87a89p+0, -0x1.47eb780ed6904p-54}, -}, -#endif -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/log_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/log_data.h deleted file mode 100644 index 1be22ab24..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/log_data.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _LOG_DATA_H -#define _LOG_DATA_H - -#include - -#define LOG_TABLE_BITS 7 -#define LOG_POLY_ORDER 6 -#define LOG_POLY1_ORDER 12 -extern hidden const struct log_data { - double ln2hi; - double ln2lo; - double poly[LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ - double poly1[LOG_POLY1_ORDER - 1]; - struct { - double invc, logc; - } tab[1 << LOG_TABLE_BITS]; -#if !__FP_FAST_FMA - struct { - double chi, clo; - } tab2[1 << LOG_TABLE_BITS]; -#endif -} __log_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logb.c b/src/hyperlight_guest_bin/third_party/musl/src/math/logb.c deleted file mode 100644 index 7f8bdfae1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logb.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -/* -special cases: - logb(+-0) = -inf, and raise divbyzero - logb(+-inf) = +inf - logb(nan) = nan -*/ - -double logb(double x) -{ - if (!isfinite(x)) - return x * x; - if (x == 0) - return -1/(x*x); - return ilogb(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logbf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/logbf.c deleted file mode 100644 index a0a0b5ed5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logbf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -float logbf(float x) -{ - if (!isfinite(x)) - return x * x; - if (x == 0) - return -1/(x*x); - return ilogbf(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logbl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/logbl.c deleted file mode 100644 index 962973a7b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logbl.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double logbl(long double x) -{ - return logb(x); -} -#else -long double logbl(long double x) -{ - if (!isfinite(x)) - return x * x; - if (x == 0) - return -1/(x*x); - return ilogbl(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/logf.c deleted file mode 100644 index e4c2237ca..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Single-precision log function. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "logf_data.h" - -/* -LOGF_TABLE_BITS = 4 -LOGF_POLY_ORDER = 4 - -ULP error: 0.818 (nearest rounding.) -Relative error: 1.957 * 2^-26 (before rounding.) -*/ - -#define T __logf_data.tab -#define A __logf_data.poly -#define Ln2 __logf_data.ln2 -#define N (1 << LOGF_TABLE_BITS) -#define OFF 0x3f330000 - -float logf(float x) -{ - double_t z, r, r2, y, y0, invc, logc; - uint32_t ix, iz, tmp; - int k, i; - - ix = asuint(x); - /* Fix sign of zero with downward rounding when x==1. */ - if (WANT_ROUNDING && predict_false(ix == 0x3f800000)) - return 0; - if (predict_false(ix - 0x00800000 >= 0x7f800000 - 0x00800000)) { - /* x < 0x1p-126 or inf or nan. */ - if (ix * 2 == 0) - return __math_divzerof(1); - if (ix == 0x7f800000) /* log(inf) == inf. */ - return x; - if ((ix & 0x80000000) || ix * 2 >= 0xff000000) - return __math_invalidf(x); - /* x is subnormal, normalize it. */ - ix = asuint(x * 0x1p23f); - ix -= 23 << 23; - } - - /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. - The range is split into N subintervals. - The ith subinterval contains z and c is near its center. */ - tmp = ix - OFF; - i = (tmp >> (23 - LOGF_TABLE_BITS)) % N; - k = (int32_t)tmp >> 23; /* arithmetic shift */ - iz = ix - (tmp & 0xff800000); - invc = T[i].invc; - logc = T[i].logc; - z = (double_t)asfloat(iz); - - /* log(x) = log1p(z/c-1) + log(c) + k*Ln2 */ - r = z * invc - 1; - y0 = logc + (double_t)k * Ln2; - - /* Pipelined polynomial evaluation to approximate log1p(r). */ - r2 = r * r; - y = A[1] * r + A[2]; - y = A[0] * r2 + y; - y = y * r2 + (y0 + r); - return eval_as_float(y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.c deleted file mode 100644 index 857221f79..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Data definition for logf. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "logf_data.h" - -const struct logf_data __logf_data = { - .tab = { - { 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2 }, - { 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2 }, - { 0x1.49539f0f010bp+0, -0x1.01eae7f513a67p-2 }, - { 0x1.3c995b0b80385p+0, -0x1.b31d8a68224e9p-3 }, - { 0x1.30d190c8864a5p+0, -0x1.6574f0ac07758p-3 }, - { 0x1.25e227b0b8eap+0, -0x1.1aa2bc79c81p-3 }, - { 0x1.1bb4a4a1a343fp+0, -0x1.a4e76ce8c0e5ep-4 }, - { 0x1.12358f08ae5bap+0, -0x1.1973c5a611cccp-4 }, - { 0x1.0953f419900a7p+0, -0x1.252f438e10c1ep-5 }, - { 0x1p+0, 0x0p+0 }, - { 0x1.e608cfd9a47acp-1, 0x1.aa5aa5df25984p-5 }, - { 0x1.ca4b31f026aap-1, 0x1.c5e53aa362eb4p-4 }, - { 0x1.b2036576afce6p-1, 0x1.526e57720db08p-3 }, - { 0x1.9c2d163a1aa2dp-1, 0x1.bc2860d22477p-3 }, - { 0x1.886e6037841edp-1, 0x1.1058bc8a07ee1p-2 }, - { 0x1.767dcf5534862p-1, 0x1.4043057b6ee09p-2 }, - }, - .ln2 = 0x1.62e42fefa39efp-1, - .poly = { - -0x1.00ea348b88334p-2, 0x1.5575b0be00b6ap-2, -0x1.ffffef20a4123p-2, - } -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.h deleted file mode 100644 index 00cff6f81..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _LOGF_DATA_H -#define _LOGF_DATA_H - -#include - -#define LOGF_TABLE_BITS 4 -#define LOGF_POLY_ORDER 4 -extern hidden const struct logf_data { - struct { - double invc, logc; - } tab[1 << LOGF_TABLE_BITS]; - double ln2; - double poly[LOGF_POLY_ORDER - 1]; /* First order coefficient is 1. */ -} __logf_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/logl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/logl.c deleted file mode 100644 index 5d5365929..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/logl.c +++ /dev/null @@ -1,175 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_logl.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Natural logarithm, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, logl(); - * - * y = logl( x ); - * - * - * DESCRIPTION: - * - * Returns the base e (2.718...) logarithm of x. - * - * The argument is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the logarithm - * of the fraction is approximated by - * - * log(1+x) = x - 0.5 x**2 + x**3 P(x)/Q(x). - * - * Otherwise, setting z = 2(x-1)/(x+1), - * - * log(x) = log(1+z/2) - log(1-z/2) = z + z**3 P(z)/Q(z). - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0.5, 2.0 150000 8.71e-20 2.75e-20 - * IEEE exp(+-10000) 100000 5.39e-20 2.34e-20 - * - * In the tests over the interval exp(+-10000), the logarithms - * of the random arguments were uniformly distributed over - * [-10000, +10000]. - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double logl(long double x) -{ - return log(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* Coefficients for log(1+x) = x - x**2/2 + x**3 P(x)/Q(x) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 2.32e-20 - */ -static const long double P[] = { - 4.5270000862445199635215E-5L, - 4.9854102823193375972212E-1L, - 6.5787325942061044846969E0L, - 2.9911919328553073277375E1L, - 6.0949667980987787057556E1L, - 5.7112963590585538103336E1L, - 2.0039553499201281259648E1L, -}; -static const long double Q[] = { -/* 1.0000000000000000000000E0,*/ - 1.5062909083469192043167E1L, - 8.3047565967967209469434E1L, - 2.2176239823732856465394E2L, - 3.0909872225312059774938E2L, - 2.1642788614495947685003E2L, - 6.0118660497603843919306E1L, -}; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 6.16e-22 - */ -static const long double R[4] = { - 1.9757429581415468984296E-3L, --7.1990767473014147232598E-1L, - 1.0777257190312272158094E1L, --3.5717684488096787370998E1L, -}; -static const long double S[4] = { -/* 1.00000000000000000000E0L,*/ --2.6201045551331104417768E1L, - 1.9361891836232102174846E2L, --4.2861221385716144629696E2L, -}; -static const long double C1 = 6.9314575195312500000000E-1L; -static const long double C2 = 1.4286068203094172321215E-6L; - -#define SQRTH 0.70710678118654752440L - -long double logl(long double x) -{ - long double y, z; - int e; - - if (isnan(x)) - return x; - if (x == INFINITY) - return x; - if (x <= 0.0) { - if (x == 0.0) - return -1/(x*x); /* -inf with divbyzero */ - return 0/0.0f; /* nan with invalid */ - } - - /* separate mantissa from exponent */ - /* Note, frexp is used so that denormal numbers - * will be handled properly. - */ - x = frexpl(x, &e); - - /* logarithm using log(x) = z + z**3 P(z)/Q(z), - * where z = 2(x-1)/(x+1) - */ - if (e > 2 || e < -2) { - if (x < SQRTH) { /* 2(2x-1)/(2x+1) */ - e -= 1; - z = x - 0.5; - y = 0.5 * z + 0.5; - } else { /* 2 (x-1)/(x+1) */ - z = x - 0.5; - z -= 0.5; - y = 0.5 * x + 0.5; - } - x = z / y; - z = x*x; - z = x * (z * __polevll(z, R, 3) / __p1evll(z, S, 3)); - z = z + e * C2; - z = z + x; - z = z + e * C1; - return z; - } - - /* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */ - if (x < SQRTH) { - e -= 1; - x = 2.0*x - 1.0; - } else { - x = x - 1.0; - } - z = x*x; - y = x * (z * __polevll(x, P, 6) / __p1evll(x, Q, 6)); - y = y + e * C2; - z = y - 0.5*z; - /* Note, the sum of above terms does not exceed x/4, - * so it contributes at most about 1/4 lsb to the error. - */ - z = z + x; - z = z + e * C1; /* This sum has an error of 1/2 lsb. */ - return z; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double logl(long double x) -{ - return log(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lrint.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lrint.c deleted file mode 100644 index ddee7a0d9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lrint.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include "libm.h" - -/* -If the result cannot be represented (overflow, nan), then -lrint raises the invalid exception. - -Otherwise if the input was not an integer then the inexact -exception is raised. - -C99 is a bit vague about whether inexact exception is -allowed to be raised when invalid is raised. -(F.9 explicitly allows spurious inexact exceptions, F.9.6.5 -does not make it clear if that rule applies to lrint, but -IEEE 754r 7.8 seems to forbid spurious inexact exception in -the ineger conversion functions) - -So we try to make sure that no spurious inexact exception is -raised in case of an overflow. - -If the bit size of long > precision of double, then there -cannot be inexact rounding in case the result overflows, -otherwise LONG_MAX and LONG_MIN can be represented exactly -as a double. -*/ - -#if LONG_MAX < 1U<<53 && defined(FE_INEXACT) -#include -#include -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -#ifdef __GNUC__ -/* avoid stack frame in lrint */ -__attribute__((noinline)) -#endif -static long lrint_slow(double x) -{ - #pragma STDC FENV_ACCESS ON - int e; - - e = fetestexcept(FE_INEXACT); - x = rint(x); - if (!e && (x > LONG_MAX || x < LONG_MIN)) - feclearexcept(FE_INEXACT); - /* conversion */ - return x; -} - -long lrint(double x) -{ - uint32_t abstop = asuint64(x)>>32 & 0x7fffffff; - uint64_t sign = asuint64(x) & (1ULL << 63); - - if (abstop < 0x41dfffff) { - /* |x| < 0x7ffffc00, no overflow */ - double_t toint = asdouble(asuint64(1/EPS) | sign); - double_t y = x + toint - toint; - return (long)y; - } - return lrint_slow(x); -} -#else -long lrint(double x) -{ - return rint(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lrintf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lrintf.c deleted file mode 100644 index ca0b6a46a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lrintf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -/* uses LONG_MAX > 2^24, see comments in lrint.c */ - -long lrintf(float x) -{ - return rintf(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lrintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lrintl.c deleted file mode 100644 index b2a8106d7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lrintl.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "libm.h" - - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long lrintl(long double x) -{ - return lrint(x); -} -#elif defined(FE_INEXACT) -/* -see comments in lrint.c - -Note that if LONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64 -then x == 2**63 - 0.5 is the only input that overflows and -raises inexact (with tonearest or upward rounding mode) -*/ -long lrintl(long double x) -{ - #pragma STDC FENV_ACCESS ON - int e; - - e = fetestexcept(FE_INEXACT); - x = rintl(x); - if (!e && (x > LONG_MAX || x < LONG_MIN)) - feclearexcept(FE_INEXACT); - /* conversion */ - return x; -} -#else -long lrintl(long double x) -{ - return rintl(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lround.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lround.c deleted file mode 100644 index b8b795470..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lround.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long lround(double x) -{ - return round(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lroundf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lroundf.c deleted file mode 100644 index c4707e7db..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lroundf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long lroundf(float x) -{ - return roundf(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/lroundl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/lroundl.c deleted file mode 100644 index 094fdf648..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/lroundl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long lroundl(long double x) -{ - return roundl(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/modf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/modf.c deleted file mode 100644 index 1c8a1db90..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/modf.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "libm.h" - -double modf(double x, double *iptr) -{ - union {double f; uint64_t i;} u = {x}; - uint64_t mask; - int e = (int)(u.i>>52 & 0x7ff) - 0x3ff; - - /* no fractional part */ - if (e >= 52) { - *iptr = x; - if (e == 0x400 && u.i<<12 != 0) /* nan */ - return x; - u.i &= 1ULL<<63; - return u.f; - } - - /* no integral part*/ - if (e < 0) { - u.i &= 1ULL<<63; - *iptr = u.f; - return x; - } - - mask = -1ULL>>12>>e; - if ((u.i & mask) == 0) { - *iptr = x; - u.i &= 1ULL<<63; - return u.f; - } - u.i &= ~mask; - *iptr = u.f; - return x - u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/modff.c b/src/hyperlight_guest_bin/third_party/musl/src/math/modff.c deleted file mode 100644 index 639514eff..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/modff.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "libm.h" - -float modff(float x, float *iptr) -{ - union {float f; uint32_t i;} u = {x}; - uint32_t mask; - int e = (int)(u.i>>23 & 0xff) - 0x7f; - - /* no fractional part */ - if (e >= 23) { - *iptr = x; - if (e == 0x80 && u.i<<9 != 0) { /* nan */ - return x; - } - u.i &= 0x80000000; - return u.f; - } - /* no integral part */ - if (e < 0) { - u.i &= 0x80000000; - *iptr = u.f; - return x; - } - - mask = 0x007fffff>>e; - if ((u.i & mask) == 0) { - *iptr = x; - u.i &= 0x80000000; - return u.f; - } - u.i &= ~mask; - *iptr = u.f; - return x - u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/modfl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/modfl.c deleted file mode 100644 index a47b1924f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/modfl.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double modfl(long double x, long double *iptr) -{ - double d; - long double r; - - r = modf(x, &d); - *iptr = d; - return r; -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -static const long double toint = 1/LDBL_EPSILON; - -long double modfl(long double x, long double *iptr) -{ - union ldshape u = {x}; - int e = (u.i.se & 0x7fff) - 0x3fff; - int s = u.i.se >> 15; - long double absx; - long double y; - - /* no fractional part */ - if (e >= LDBL_MANT_DIG-1) { - *iptr = x; - if (isnan(x)) - return x; - return s ? -0.0 : 0.0; - } - - /* no integral part*/ - if (e < 0) { - *iptr = s ? -0.0 : 0.0; - return x; - } - - /* raises spurious inexact */ - absx = s ? -x : x; - y = absx + toint - toint - absx; - if (y == 0) { - *iptr = x; - return s ? -0.0 : 0.0; - } - if (y > 0) - y -= 1; - if (s) - y = -y; - *iptr = x + y; - return -y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nan.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nan.c deleted file mode 100644 index 9e0826c77..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nan.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -double nan(const char *s) -{ - return NAN; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nanf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nanf.c deleted file mode 100644 index 752ce5463..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nanf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -float nanf(const char *s) -{ - return NAN; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nanl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nanl.c deleted file mode 100644 index 969af5641..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nanl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long double nanl(const char *s) -{ - return NAN; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyint.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyint.c deleted file mode 100644 index f4e8aac4f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyint.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -/* nearbyint is the same as rint, but it must not raise the inexact exception */ - -double nearbyint(double x) -{ -#ifdef FE_INEXACT - #pragma STDC FENV_ACCESS ON - int e; - - e = fetestexcept(FE_INEXACT); -#endif - x = rint(x); -#ifdef FE_INEXACT - if (!e) - feclearexcept(FE_INEXACT); -#endif - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintf.c deleted file mode 100644 index 092e9ffae..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintf.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -float nearbyintf(float x) -{ -#ifdef FE_INEXACT - #pragma STDC FENV_ACCESS ON - int e; - - e = fetestexcept(FE_INEXACT); -#endif - x = rintf(x); -#ifdef FE_INEXACT - if (!e) - feclearexcept(FE_INEXACT); -#endif - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintl.c deleted file mode 100644 index 82852492f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintl.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double nearbyintl(long double x) -{ - return nearbyint(x); -} -#else -#include -long double nearbyintl(long double x) -{ -#ifdef FE_INEXACT - #pragma STDC FENV_ACCESS ON - int e; - - e = fetestexcept(FE_INEXACT); -#endif - x = rintl(x); -#ifdef FE_INEXACT - if (!e) - feclearexcept(FE_INEXACT); -#endif - return x; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nextafter.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nextafter.c deleted file mode 100644 index ab5795a47..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nextafter.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "libm.h" - -double nextafter(double x, double y) -{ - union {double f; uint64_t i;} ux={x}, uy={y}; - uint64_t ax, ay; - int e; - - if (isnan(x) || isnan(y)) - return x + y; - if (ux.i == uy.i) - return y; - ax = ux.i & -1ULL/2; - ay = uy.i & -1ULL/2; - if (ax == 0) { - if (ay == 0) - return y; - ux.i = (uy.i & 1ULL<<63) | 1; - } else if (ax > ay || ((ux.i ^ uy.i) & 1ULL<<63)) - ux.i--; - else - ux.i++; - e = ux.i >> 52 & 0x7ff; - /* raise overflow if ux.f is infinite and x is finite */ - if (e == 0x7ff) - FORCE_EVAL(x+x); - /* raise underflow if ux.f is subnormal or zero */ - if (e == 0) - FORCE_EVAL(x*x + ux.f*ux.f); - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nextafterf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nextafterf.c deleted file mode 100644 index 75a09f7d1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nextafterf.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "libm.h" - -float nextafterf(float x, float y) -{ - union {float f; uint32_t i;} ux={x}, uy={y}; - uint32_t ax, ay, e; - - if (isnan(x) || isnan(y)) - return x + y; - if (ux.i == uy.i) - return y; - ax = ux.i & 0x7fffffff; - ay = uy.i & 0x7fffffff; - if (ax == 0) { - if (ay == 0) - return y; - ux.i = (uy.i & 0x80000000) | 1; - } else if (ax > ay || ((ux.i ^ uy.i) & 0x80000000)) - ux.i--; - else - ux.i++; - e = ux.i & 0x7f800000; - /* raise overflow if ux.f is infinite and x is finite */ - if (e == 0x7f800000) - FORCE_EVAL(x+x); - /* raise underflow if ux.f is subnormal or zero */ - if (e == 0) - FORCE_EVAL(x*x + ux.f*ux.f); - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nextafterl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nextafterl.c deleted file mode 100644 index 37e858fb4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nextafterl.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double nextafterl(long double x, long double y) -{ - return nextafter(x, y); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -long double nextafterl(long double x, long double y) -{ - union ldshape ux, uy; - - if (isnan(x) || isnan(y)) - return x + y; - if (x == y) - return y; - ux.f = x; - if (x == 0) { - uy.f = y; - ux.i.m = 1; - ux.i.se = uy.i.se & 0x8000; - } else if ((x < y) == !(ux.i.se & 0x8000)) { - ux.i.m++; - if (ux.i.m << 1 == 0) { - ux.i.m = 1ULL << 63; - ux.i.se++; - } - } else { - if (ux.i.m << 1 == 0) { - ux.i.se--; - if (ux.i.se) - ux.i.m = 0; - } - ux.i.m--; - } - /* raise overflow if ux is infinite and x is finite */ - if ((ux.i.se & 0x7fff) == 0x7fff) - return x + x; - /* raise underflow if ux is subnormal or zero */ - if ((ux.i.se & 0x7fff) == 0) - FORCE_EVAL(x*x + ux.f*ux.f); - return ux.f; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -long double nextafterl(long double x, long double y) -{ - union ldshape ux, uy; - - if (isnan(x) || isnan(y)) - return x + y; - if (x == y) - return y; - ux.f = x; - if (x == 0) { - uy.f = y; - ux.i.lo = 1; - ux.i.se = uy.i.se & 0x8000; - } else if ((x < y) == !(ux.i.se & 0x8000)) { - ux.i2.lo++; - if (ux.i2.lo == 0) - ux.i2.hi++; - } else { - if (ux.i2.lo == 0) - ux.i2.hi--; - ux.i2.lo--; - } - /* raise overflow if ux is infinite and x is finite */ - if ((ux.i.se & 0x7fff) == 0x7fff) - return x + x; - /* raise underflow if ux is subnormal or zero */ - if ((ux.i.se & 0x7fff) == 0) - FORCE_EVAL(x*x + ux.f*ux.f); - return ux.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nexttoward.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nexttoward.c deleted file mode 100644 index 827ee5c3c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nexttoward.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -double nexttoward(double x, long double y) -{ - return nextafter(x, y); -} -#else -double nexttoward(double x, long double y) -{ - union {double f; uint64_t i;} ux = {x}; - int e; - - if (isnan(x) || isnan(y)) - return x + y; - if (x == y) - return y; - if (x == 0) { - ux.i = 1; - if (signbit(y)) - ux.i |= 1ULL<<63; - } else if (x < y) { - if (signbit(x)) - ux.i--; - else - ux.i++; - } else { - if (signbit(x)) - ux.i++; - else - ux.i--; - } - e = ux.i>>52 & 0x7ff; - /* raise overflow if ux.f is infinite and x is finite */ - if (e == 0x7ff) - FORCE_EVAL(x+x); - /* raise underflow if ux.f is subnormal or zero */ - if (e == 0) - FORCE_EVAL(x*x + ux.f*ux.f); - return ux.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardf.c deleted file mode 100644 index bbf172f9e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardf.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "libm.h" - -float nexttowardf(float x, long double y) -{ - union {float f; uint32_t i;} ux = {x}; - uint32_t e; - - if (isnan(x) || isnan(y)) - return x + y; - if (x == y) - return y; - if (x == 0) { - ux.i = 1; - if (signbit(y)) - ux.i |= 0x80000000; - } else if (x < y) { - if (signbit(x)) - ux.i--; - else - ux.i++; - } else { - if (signbit(x)) - ux.i++; - else - ux.i--; - } - e = ux.i & 0x7f800000; - /* raise overflow if ux.f is infinite and x is finite */ - if (e == 0x7f800000) - FORCE_EVAL(x+x); - /* raise underflow if ux.f is subnormal or zero */ - if (e == 0) - FORCE_EVAL(x*x + ux.f*ux.f); - return ux.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardl.c deleted file mode 100644 index 67a634039..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long double nexttowardl(long double x, long double y) -{ - return nextafterl(x, y); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/pow.c b/src/hyperlight_guest_bin/third_party/musl/src/math/pow.c deleted file mode 100644 index 694c2ef64..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/pow.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Double-precision x^y function. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "exp_data.h" -#include "pow_data.h" - -/* -Worst-case error: 0.54 ULP (~= ulperr_exp + 1024*Ln2*relerr_log*2^53) -relerr_log: 1.3 * 2^-68 (Relative error of log, 1.5 * 2^-68 without fma) -ulperr_exp: 0.509 ULP (ULP error of exp, 0.511 ULP without fma) -*/ - -#define T __pow_log_data.tab -#define A __pow_log_data.poly -#define Ln2hi __pow_log_data.ln2hi -#define Ln2lo __pow_log_data.ln2lo -#define N (1 << POW_LOG_TABLE_BITS) -#define OFF 0x3fe6955500000000 - -/* Top 12 bits of a double (sign and exponent bits). */ -static inline uint32_t top12(double x) -{ - return asuint64(x) >> 52; -} - -/* Compute y+TAIL = log(x) where the rounded result is y and TAIL has about - additional 15 bits precision. IX is the bit representation of x, but - normalized in the subnormal range using the sign bit for the exponent. */ -static inline double_t log_inline(uint64_t ix, double_t *tail) -{ - /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ - double_t z, r, y, invc, logc, logctail, kd, hi, t1, t2, lo, lo1, lo2, p; - uint64_t iz, tmp; - int k, i; - - /* x = 2^k z; where z is in range [OFF,2*OFF) and exact. - The range is split into N subintervals. - The ith subinterval contains z and c is near its center. */ - tmp = ix - OFF; - i = (tmp >> (52 - POW_LOG_TABLE_BITS)) % N; - k = (int64_t)tmp >> 52; /* arithmetic shift */ - iz = ix - (tmp & 0xfffULL << 52); - z = asdouble(iz); - kd = (double_t)k; - - /* log(x) = k*Ln2 + log(c) + log1p(z/c-1). */ - invc = T[i].invc; - logc = T[i].logc; - logctail = T[i].logctail; - - /* Note: 1/c is j/N or j/N/2 where j is an integer in [N,2N) and - |z/c - 1| < 1/N, so r = z/c - 1 is exactly representible. */ -#if __FP_FAST_FMA - r = __builtin_fma(z, invc, -1.0); -#else - /* Split z such that rhi, rlo and rhi*rhi are exact and |rlo| <= |r|. */ - double_t zhi = asdouble((iz + (1ULL << 31)) & (-1ULL << 32)); - double_t zlo = z - zhi; - double_t rhi = zhi * invc - 1.0; - double_t rlo = zlo * invc; - r = rhi + rlo; -#endif - - /* k*Ln2 + log(c) + r. */ - t1 = kd * Ln2hi + logc; - t2 = t1 + r; - lo1 = kd * Ln2lo + logctail; - lo2 = t1 - t2 + r; - - /* Evaluation is optimized assuming superscalar pipelined execution. */ - double_t ar, ar2, ar3, lo3, lo4; - ar = A[0] * r; /* A[0] = -0.5. */ - ar2 = r * ar; - ar3 = r * ar2; - /* k*Ln2 + log(c) + r + A[0]*r*r. */ -#if __FP_FAST_FMA - hi = t2 + ar2; - lo3 = __builtin_fma(ar, r, -ar2); - lo4 = t2 - hi + ar2; -#else - double_t arhi = A[0] * rhi; - double_t arhi2 = rhi * arhi; - hi = t2 + arhi2; - lo3 = rlo * (ar + arhi); - lo4 = t2 - hi + arhi2; -#endif - /* p = log1p(r) - r - A[0]*r*r. */ - p = (ar3 * (A[1] + r * A[2] + - ar2 * (A[3] + r * A[4] + ar2 * (A[5] + r * A[6])))); - lo = lo1 + lo2 + lo3 + lo4 + p; - y = hi + lo; - *tail = hi - y + lo; - return y; -} - -#undef N -#undef T -#define N (1 << EXP_TABLE_BITS) -#define InvLn2N __exp_data.invln2N -#define NegLn2hiN __exp_data.negln2hiN -#define NegLn2loN __exp_data.negln2loN -#define Shift __exp_data.shift -#define T __exp_data.tab -#define C2 __exp_data.poly[5 - EXP_POLY_ORDER] -#define C3 __exp_data.poly[6 - EXP_POLY_ORDER] -#define C4 __exp_data.poly[7 - EXP_POLY_ORDER] -#define C5 __exp_data.poly[8 - EXP_POLY_ORDER] -#define C6 __exp_data.poly[9 - EXP_POLY_ORDER] - -/* Handle cases that may overflow or underflow when computing the result that - is scale*(1+TMP) without intermediate rounding. The bit representation of - scale is in SBITS, however it has a computed exponent that may have - overflown into the sign bit so that needs to be adjusted before using it as - a double. (int32_t)KI is the k used in the argument reduction and exponent - adjustment of scale, positive k here means the result may overflow and - negative k means the result may underflow. */ -static inline double specialcase(double_t tmp, uint64_t sbits, uint64_t ki) -{ - double_t scale, y; - - if ((ki & 0x80000000) == 0) { - /* k > 0, the exponent of scale might have overflowed by <= 460. */ - sbits -= 1009ull << 52; - scale = asdouble(sbits); - y = 0x1p1009 * (scale + scale * tmp); - return eval_as_double(y); - } - /* k < 0, need special care in the subnormal range. */ - sbits += 1022ull << 52; - /* Note: sbits is signed scale. */ - scale = asdouble(sbits); - y = scale + scale * tmp; - if (fabs(y) < 1.0) { - /* Round y to the right precision before scaling it into the subnormal - range to avoid double rounding that can cause 0.5+E/2 ulp error where - E is the worst-case ulp error outside the subnormal range. So this - is only useful if the goal is better than 1 ulp worst-case error. */ - double_t hi, lo, one = 1.0; - if (y < 0.0) - one = -1.0; - lo = scale - y + scale * tmp; - hi = one + y; - lo = one - hi + y + lo; - y = eval_as_double(hi + lo) - one; - /* Fix the sign of 0. */ - if (y == 0.0) - y = asdouble(sbits & 0x8000000000000000); - /* The underflow exception needs to be signaled explicitly. */ - fp_force_eval(fp_barrier(0x1p-1022) * 0x1p-1022); - } - y = 0x1p-1022 * y; - return eval_as_double(y); -} - -#define SIGN_BIAS (0x800 << EXP_TABLE_BITS) - -/* Computes sign*exp(x+xtail) where |xtail| < 2^-8/N and |xtail| <= |x|. - The sign_bias argument is SIGN_BIAS or 0 and sets the sign to -1 or 1. */ -static inline double exp_inline(double_t x, double_t xtail, uint32_t sign_bias) -{ - uint32_t abstop; - uint64_t ki, idx, top, sbits; - /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ - double_t kd, z, r, r2, scale, tail, tmp; - - abstop = top12(x) & 0x7ff; - if (predict_false(abstop - top12(0x1p-54) >= - top12(512.0) - top12(0x1p-54))) { - if (abstop - top12(0x1p-54) >= 0x80000000) { - /* Avoid spurious underflow for tiny x. */ - /* Note: 0 is common input. */ - double_t one = WANT_ROUNDING ? 1.0 + x : 1.0; - return sign_bias ? -one : one; - } - if (abstop >= top12(1024.0)) { - /* Note: inf and nan are already handled. */ - if (asuint64(x) >> 63) - return __math_uflow(sign_bias); - else - return __math_oflow(sign_bias); - } - /* Large x is special cased below. */ - abstop = 0; - } - - /* exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]. */ - /* x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]. */ - z = InvLn2N * x; -#if TOINT_INTRINSICS - kd = roundtoint(z); - ki = converttoint(z); -#elif EXP_USE_TOINT_NARROW - /* z - kd is in [-0.5-2^-16, 0.5] in all rounding modes. */ - kd = eval_as_double(z + Shift); - ki = asuint64(kd) >> 16; - kd = (double_t)(int32_t)ki; -#else - /* z - kd is in [-1, 1] in non-nearest rounding modes. */ - kd = eval_as_double(z + Shift); - ki = asuint64(kd); - kd -= Shift; -#endif - r = x + kd * NegLn2hiN + kd * NegLn2loN; - /* The code assumes 2^-200 < |xtail| < 2^-8/N. */ - r += xtail; - /* 2^(k/N) ~= scale * (1 + tail). */ - idx = 2 * (ki % N); - top = (ki + sign_bias) << (52 - EXP_TABLE_BITS); - tail = asdouble(T[idx]); - /* This is only a valid scale when -1023*N < k < 1024*N. */ - sbits = T[idx + 1] + top; - /* exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1). */ - /* Evaluation is optimized assuming superscalar pipelined execution. */ - r2 = r * r; - /* Without fma the worst case error is 0.25/N ulp larger. */ - /* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */ - tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5); - if (predict_false(abstop == 0)) - return specialcase(tmp, sbits, ki); - scale = asdouble(sbits); - /* Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there - is no spurious underflow here even without fma. */ - return eval_as_double(scale + scale * tmp); -} - -/* Returns 0 if not int, 1 if odd int, 2 if even int. The argument is - the bit representation of a non-zero finite floating-point value. */ -static inline int checkint(uint64_t iy) -{ - int e = iy >> 52 & 0x7ff; - if (e < 0x3ff) - return 0; - if (e > 0x3ff + 52) - return 2; - if (iy & ((1ULL << (0x3ff + 52 - e)) - 1)) - return 0; - if (iy & (1ULL << (0x3ff + 52 - e))) - return 1; - return 2; -} - -/* Returns 1 if input is the bit representation of 0, infinity or nan. */ -static inline int zeroinfnan(uint64_t i) -{ - return 2 * i - 1 >= 2 * asuint64(INFINITY) - 1; -} - -double pow(double x, double y) -{ - uint32_t sign_bias = 0; - uint64_t ix, iy; - uint32_t topx, topy; - - ix = asuint64(x); - iy = asuint64(y); - topx = top12(x); - topy = top12(y); - if (predict_false(topx - 0x001 >= 0x7ff - 0x001 || - (topy & 0x7ff) - 0x3be >= 0x43e - 0x3be)) { - /* Note: if |y| > 1075 * ln2 * 2^53 ~= 0x1.749p62 then pow(x,y) = inf/0 - and if |y| < 2^-54 / 1075 ~= 0x1.e7b6p-65 then pow(x,y) = +-1. */ - /* Special cases: (x < 0x1p-126 or inf or nan) or - (|y| < 0x1p-65 or |y| >= 0x1p63 or nan). */ - if (predict_false(zeroinfnan(iy))) { - if (2 * iy == 0) - return issignaling_inline(x) ? x + y : 1.0; - if (ix == asuint64(1.0)) - return issignaling_inline(y) ? x + y : 1.0; - if (2 * ix > 2 * asuint64(INFINITY) || - 2 * iy > 2 * asuint64(INFINITY)) - return x + y; - if (2 * ix == 2 * asuint64(1.0)) - return 1.0; - if ((2 * ix < 2 * asuint64(1.0)) == !(iy >> 63)) - return 0.0; /* |x|<1 && y==inf or |x|>1 && y==-inf. */ - return y * y; - } - if (predict_false(zeroinfnan(ix))) { - double_t x2 = x * x; - if (ix >> 63 && checkint(iy) == 1) - x2 = -x2; - /* Without the barrier some versions of clang hoist the 1/x2 and - thus division by zero exception can be signaled spuriously. */ - return iy >> 63 ? fp_barrier(1 / x2) : x2; - } - /* Here x and y are non-zero finite. */ - if (ix >> 63) { - /* Finite x < 0. */ - int yint = checkint(iy); - if (yint == 0) - return __math_invalid(x); - if (yint == 1) - sign_bias = SIGN_BIAS; - ix &= 0x7fffffffffffffff; - topx &= 0x7ff; - } - if ((topy & 0x7ff) - 0x3be >= 0x43e - 0x3be) { - /* Note: sign_bias == 0 here because y is not odd. */ - if (ix == asuint64(1.0)) - return 1.0; - if ((topy & 0x7ff) < 0x3be) { - /* |y| < 2^-65, x^y ~= 1 + y*log(x). */ - if (WANT_ROUNDING) - return ix > asuint64(1.0) ? 1.0 + y : - 1.0 - y; - else - return 1.0; - } - return (ix > asuint64(1.0)) == (topy < 0x800) ? - __math_oflow(0) : - __math_uflow(0); - } - if (topx == 0) { - /* Normalize subnormal x so exponent becomes negative. */ - ix = asuint64(x * 0x1p52); - ix &= 0x7fffffffffffffff; - ix -= 52ULL << 52; - } - } - - double_t lo; - double_t hi = log_inline(ix, &lo); - double_t ehi, elo; -#if __FP_FAST_FMA - ehi = y * hi; - elo = y * lo + __builtin_fma(y, hi, -ehi); -#else - double_t yhi = asdouble(iy & -1ULL << 27); - double_t ylo = y - yhi; - double_t lhi = asdouble(asuint64(hi) & -1ULL << 27); - double_t llo = hi - lhi + lo; - ehi = yhi * lhi; - elo = ylo * lhi + y * llo; /* |elo| < |ehi| * 2^-25. */ -#endif - return exp_inline(ehi, elo, sign_bias); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.c deleted file mode 100644 index 81e760de1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Data for the log part of pow. - * - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "pow_data.h" - -#define N (1 << POW_LOG_TABLE_BITS) - -const struct pow_log_data __pow_log_data = { -.ln2hi = 0x1.62e42fefa3800p-1, -.ln2lo = 0x1.ef35793c76730p-45, -.poly = { -// relative error: 0x1.11922ap-70 -// in -0x1.6bp-8 0x1.6bp-8 -// Coefficients are scaled to match the scaling during evaluation. --0x1p-1, -0x1.555555555556p-2 * -2, --0x1.0000000000006p-2 * -2, -0x1.999999959554ep-3 * 4, --0x1.555555529a47ap-3 * 4, -0x1.2495b9b4845e9p-3 * -8, --0x1.0002b8b263fc3p-3 * -8, -}, -/* Algorithm: - - x = 2^k z - log(x) = k ln2 + log(c) + log(z/c) - log(z/c) = poly(z/c - 1) - -where z is in [0x1.69555p-1; 0x1.69555p0] which is split into N subintervals -and z falls into the ith one, then table entries are computed as - - tab[i].invc = 1/c - tab[i].logc = round(0x1p43*log(c))/0x1p43 - tab[i].logctail = (double)(log(c) - logc) - -where c is chosen near the center of the subinterval such that 1/c has only a -few precision bits so z/c - 1 is exactly representible as double: - - 1/c = center < 1 ? round(N/center)/N : round(2*N/center)/N/2 - -Note: |z/c - 1| < 1/N for the chosen c, |log(c) - logc - logctail| < 0x1p-97, -the last few bits of logc are rounded away so k*ln2hi + logc has no rounding -error and the interval for z is selected such that near x == 1, where log(x) -is tiny, large cancellation error is avoided in logc + poly(z/c - 1). */ -.tab = { -#define A(a, b, c) {a, 0, b, c}, -A(0x1.6a00000000000p+0, -0x1.62c82f2b9c800p-2, 0x1.ab42428375680p-48) -A(0x1.6800000000000p+0, -0x1.5d1bdbf580800p-2, -0x1.ca508d8e0f720p-46) -A(0x1.6600000000000p+0, -0x1.5767717455800p-2, -0x1.362a4d5b6506dp-45) -A(0x1.6400000000000p+0, -0x1.51aad872df800p-2, -0x1.684e49eb067d5p-49) -A(0x1.6200000000000p+0, -0x1.4be5f95777800p-2, -0x1.41b6993293ee0p-47) -A(0x1.6000000000000p+0, -0x1.4618bc21c6000p-2, 0x1.3d82f484c84ccp-46) -A(0x1.5e00000000000p+0, -0x1.404308686a800p-2, 0x1.c42f3ed820b3ap-50) -A(0x1.5c00000000000p+0, -0x1.3a64c55694800p-2, 0x1.0b1c686519460p-45) -A(0x1.5a00000000000p+0, -0x1.347dd9a988000p-2, 0x1.5594dd4c58092p-45) -A(0x1.5800000000000p+0, -0x1.2e8e2bae12000p-2, 0x1.67b1e99b72bd8p-45) -A(0x1.5600000000000p+0, -0x1.2895a13de8800p-2, 0x1.5ca14b6cfb03fp-46) -A(0x1.5600000000000p+0, -0x1.2895a13de8800p-2, 0x1.5ca14b6cfb03fp-46) -A(0x1.5400000000000p+0, -0x1.22941fbcf7800p-2, -0x1.65a242853da76p-46) -A(0x1.5200000000000p+0, -0x1.1c898c1699800p-2, -0x1.fafbc68e75404p-46) -A(0x1.5000000000000p+0, -0x1.1675cababa800p-2, 0x1.f1fc63382a8f0p-46) -A(0x1.4e00000000000p+0, -0x1.1058bf9ae4800p-2, -0x1.6a8c4fd055a66p-45) -A(0x1.4c00000000000p+0, -0x1.0a324e2739000p-2, -0x1.c6bee7ef4030ep-47) -A(0x1.4a00000000000p+0, -0x1.0402594b4d000p-2, -0x1.036b89ef42d7fp-48) -A(0x1.4a00000000000p+0, -0x1.0402594b4d000p-2, -0x1.036b89ef42d7fp-48) -A(0x1.4800000000000p+0, -0x1.fb9186d5e4000p-3, 0x1.d572aab993c87p-47) -A(0x1.4600000000000p+0, -0x1.ef0adcbdc6000p-3, 0x1.b26b79c86af24p-45) -A(0x1.4400000000000p+0, -0x1.e27076e2af000p-3, -0x1.72f4f543fff10p-46) -A(0x1.4200000000000p+0, -0x1.d5c216b4fc000p-3, 0x1.1ba91bbca681bp-45) -A(0x1.4000000000000p+0, -0x1.c8ff7c79aa000p-3, 0x1.7794f689f8434p-45) -A(0x1.4000000000000p+0, -0x1.c8ff7c79aa000p-3, 0x1.7794f689f8434p-45) -A(0x1.3e00000000000p+0, -0x1.bc286742d9000p-3, 0x1.94eb0318bb78fp-46) -A(0x1.3c00000000000p+0, -0x1.af3c94e80c000p-3, 0x1.a4e633fcd9066p-52) -A(0x1.3a00000000000p+0, -0x1.a23bc1fe2b000p-3, -0x1.58c64dc46c1eap-45) -A(0x1.3a00000000000p+0, -0x1.a23bc1fe2b000p-3, -0x1.58c64dc46c1eap-45) -A(0x1.3800000000000p+0, -0x1.9525a9cf45000p-3, -0x1.ad1d904c1d4e3p-45) -A(0x1.3600000000000p+0, -0x1.87fa06520d000p-3, 0x1.bbdbf7fdbfa09p-45) -A(0x1.3400000000000p+0, -0x1.7ab890210e000p-3, 0x1.bdb9072534a58p-45) -A(0x1.3400000000000p+0, -0x1.7ab890210e000p-3, 0x1.bdb9072534a58p-45) -A(0x1.3200000000000p+0, -0x1.6d60fe719d000p-3, -0x1.0e46aa3b2e266p-46) -A(0x1.3000000000000p+0, -0x1.5ff3070a79000p-3, -0x1.e9e439f105039p-46) -A(0x1.3000000000000p+0, -0x1.5ff3070a79000p-3, -0x1.e9e439f105039p-46) -A(0x1.2e00000000000p+0, -0x1.526e5e3a1b000p-3, -0x1.0de8b90075b8fp-45) -A(0x1.2c00000000000p+0, -0x1.44d2b6ccb8000p-3, 0x1.70cc16135783cp-46) -A(0x1.2c00000000000p+0, -0x1.44d2b6ccb8000p-3, 0x1.70cc16135783cp-46) -A(0x1.2a00000000000p+0, -0x1.371fc201e9000p-3, 0x1.178864d27543ap-48) -A(0x1.2800000000000p+0, -0x1.29552f81ff000p-3, -0x1.48d301771c408p-45) -A(0x1.2600000000000p+0, -0x1.1b72ad52f6000p-3, -0x1.e80a41811a396p-45) -A(0x1.2600000000000p+0, -0x1.1b72ad52f6000p-3, -0x1.e80a41811a396p-45) -A(0x1.2400000000000p+0, -0x1.0d77e7cd09000p-3, 0x1.a699688e85bf4p-47) -A(0x1.2400000000000p+0, -0x1.0d77e7cd09000p-3, 0x1.a699688e85bf4p-47) -A(0x1.2200000000000p+0, -0x1.fec9131dbe000p-4, -0x1.575545ca333f2p-45) -A(0x1.2000000000000p+0, -0x1.e27076e2b0000p-4, 0x1.a342c2af0003cp-45) -A(0x1.2000000000000p+0, -0x1.e27076e2b0000p-4, 0x1.a342c2af0003cp-45) -A(0x1.1e00000000000p+0, -0x1.c5e548f5bc000p-4, -0x1.d0c57585fbe06p-46) -A(0x1.1c00000000000p+0, -0x1.a926d3a4ae000p-4, 0x1.53935e85baac8p-45) -A(0x1.1c00000000000p+0, -0x1.a926d3a4ae000p-4, 0x1.53935e85baac8p-45) -A(0x1.1a00000000000p+0, -0x1.8c345d631a000p-4, 0x1.37c294d2f5668p-46) -A(0x1.1a00000000000p+0, -0x1.8c345d631a000p-4, 0x1.37c294d2f5668p-46) -A(0x1.1800000000000p+0, -0x1.6f0d28ae56000p-4, -0x1.69737c93373dap-45) -A(0x1.1600000000000p+0, -0x1.51b073f062000p-4, 0x1.f025b61c65e57p-46) -A(0x1.1600000000000p+0, -0x1.51b073f062000p-4, 0x1.f025b61c65e57p-46) -A(0x1.1400000000000p+0, -0x1.341d7961be000p-4, 0x1.c5edaccf913dfp-45) -A(0x1.1400000000000p+0, -0x1.341d7961be000p-4, 0x1.c5edaccf913dfp-45) -A(0x1.1200000000000p+0, -0x1.16536eea38000p-4, 0x1.47c5e768fa309p-46) -A(0x1.1000000000000p+0, -0x1.f0a30c0118000p-5, 0x1.d599e83368e91p-45) -A(0x1.1000000000000p+0, -0x1.f0a30c0118000p-5, 0x1.d599e83368e91p-45) -A(0x1.0e00000000000p+0, -0x1.b42dd71198000p-5, 0x1.c827ae5d6704cp-46) -A(0x1.0e00000000000p+0, -0x1.b42dd71198000p-5, 0x1.c827ae5d6704cp-46) -A(0x1.0c00000000000p+0, -0x1.77458f632c000p-5, -0x1.cfc4634f2a1eep-45) -A(0x1.0c00000000000p+0, -0x1.77458f632c000p-5, -0x1.cfc4634f2a1eep-45) -A(0x1.0a00000000000p+0, -0x1.39e87b9fec000p-5, 0x1.502b7f526feaap-48) -A(0x1.0a00000000000p+0, -0x1.39e87b9fec000p-5, 0x1.502b7f526feaap-48) -A(0x1.0800000000000p+0, -0x1.f829b0e780000p-6, -0x1.980267c7e09e4p-45) -A(0x1.0800000000000p+0, -0x1.f829b0e780000p-6, -0x1.980267c7e09e4p-45) -A(0x1.0600000000000p+0, -0x1.7b91b07d58000p-6, -0x1.88d5493faa639p-45) -A(0x1.0400000000000p+0, -0x1.fc0a8b0fc0000p-7, -0x1.f1e7cf6d3a69cp-50) -A(0x1.0400000000000p+0, -0x1.fc0a8b0fc0000p-7, -0x1.f1e7cf6d3a69cp-50) -A(0x1.0200000000000p+0, -0x1.fe02a6b100000p-8, -0x1.9e23f0dda40e4p-46) -A(0x1.0200000000000p+0, -0x1.fe02a6b100000p-8, -0x1.9e23f0dda40e4p-46) -A(0x1.0000000000000p+0, 0x0.0000000000000p+0, 0x0.0000000000000p+0) -A(0x1.0000000000000p+0, 0x0.0000000000000p+0, 0x0.0000000000000p+0) -A(0x1.fc00000000000p-1, 0x1.0101575890000p-7, -0x1.0c76b999d2be8p-46) -A(0x1.f800000000000p-1, 0x1.0205658938000p-6, -0x1.3dc5b06e2f7d2p-45) -A(0x1.f400000000000p-1, 0x1.8492528c90000p-6, -0x1.aa0ba325a0c34p-45) -A(0x1.f000000000000p-1, 0x1.0415d89e74000p-5, 0x1.111c05cf1d753p-47) -A(0x1.ec00000000000p-1, 0x1.466aed42e0000p-5, -0x1.c167375bdfd28p-45) -A(0x1.e800000000000p-1, 0x1.894aa149fc000p-5, -0x1.97995d05a267dp-46) -A(0x1.e400000000000p-1, 0x1.ccb73cdddc000p-5, -0x1.a68f247d82807p-46) -A(0x1.e200000000000p-1, 0x1.eea31c006c000p-5, -0x1.e113e4fc93b7bp-47) -A(0x1.de00000000000p-1, 0x1.1973bd1466000p-4, -0x1.5325d560d9e9bp-45) -A(0x1.da00000000000p-1, 0x1.3bdf5a7d1e000p-4, 0x1.cc85ea5db4ed7p-45) -A(0x1.d600000000000p-1, 0x1.5e95a4d97a000p-4, -0x1.c69063c5d1d1ep-45) -A(0x1.d400000000000p-1, 0x1.700d30aeac000p-4, 0x1.c1e8da99ded32p-49) -A(0x1.d000000000000p-1, 0x1.9335e5d594000p-4, 0x1.3115c3abd47dap-45) -A(0x1.cc00000000000p-1, 0x1.b6ac88dad6000p-4, -0x1.390802bf768e5p-46) -A(0x1.ca00000000000p-1, 0x1.c885801bc4000p-4, 0x1.646d1c65aacd3p-45) -A(0x1.c600000000000p-1, 0x1.ec739830a2000p-4, -0x1.dc068afe645e0p-45) -A(0x1.c400000000000p-1, 0x1.fe89139dbe000p-4, -0x1.534d64fa10afdp-45) -A(0x1.c000000000000p-1, 0x1.1178e8227e000p-3, 0x1.1ef78ce2d07f2p-45) -A(0x1.be00000000000p-1, 0x1.1aa2b7e23f000p-3, 0x1.ca78e44389934p-45) -A(0x1.ba00000000000p-1, 0x1.2d1610c868000p-3, 0x1.39d6ccb81b4a1p-47) -A(0x1.b800000000000p-1, 0x1.365fcb0159000p-3, 0x1.62fa8234b7289p-51) -A(0x1.b400000000000p-1, 0x1.4913d8333b000p-3, 0x1.5837954fdb678p-45) -A(0x1.b200000000000p-1, 0x1.527e5e4a1b000p-3, 0x1.633e8e5697dc7p-45) -A(0x1.ae00000000000p-1, 0x1.6574ebe8c1000p-3, 0x1.9cf8b2c3c2e78p-46) -A(0x1.ac00000000000p-1, 0x1.6f0128b757000p-3, -0x1.5118de59c21e1p-45) -A(0x1.aa00000000000p-1, 0x1.7898d85445000p-3, -0x1.c661070914305p-46) -A(0x1.a600000000000p-1, 0x1.8beafeb390000p-3, -0x1.73d54aae92cd1p-47) -A(0x1.a400000000000p-1, 0x1.95a5adcf70000p-3, 0x1.7f22858a0ff6fp-47) -A(0x1.a000000000000p-1, 0x1.a93ed3c8ae000p-3, -0x1.8724350562169p-45) -A(0x1.9e00000000000p-1, 0x1.b31d8575bd000p-3, -0x1.c358d4eace1aap-47) -A(0x1.9c00000000000p-1, 0x1.bd087383be000p-3, -0x1.d4bc4595412b6p-45) -A(0x1.9a00000000000p-1, 0x1.c6ffbc6f01000p-3, -0x1.1ec72c5962bd2p-48) -A(0x1.9600000000000p-1, 0x1.db13db0d49000p-3, -0x1.aff2af715b035p-45) -A(0x1.9400000000000p-1, 0x1.e530effe71000p-3, 0x1.212276041f430p-51) -A(0x1.9200000000000p-1, 0x1.ef5ade4dd0000p-3, -0x1.a211565bb8e11p-51) -A(0x1.9000000000000p-1, 0x1.f991c6cb3b000p-3, 0x1.bcbecca0cdf30p-46) -A(0x1.8c00000000000p-1, 0x1.07138604d5800p-2, 0x1.89cdb16ed4e91p-48) -A(0x1.8a00000000000p-1, 0x1.0c42d67616000p-2, 0x1.7188b163ceae9p-45) -A(0x1.8800000000000p-1, 0x1.1178e8227e800p-2, -0x1.c210e63a5f01cp-45) -A(0x1.8600000000000p-1, 0x1.16b5ccbacf800p-2, 0x1.b9acdf7a51681p-45) -A(0x1.8400000000000p-1, 0x1.1bf99635a6800p-2, 0x1.ca6ed5147bdb7p-45) -A(0x1.8200000000000p-1, 0x1.214456d0eb800p-2, 0x1.a87deba46baeap-47) -A(0x1.7e00000000000p-1, 0x1.2bef07cdc9000p-2, 0x1.a9cfa4a5004f4p-45) -A(0x1.7c00000000000p-1, 0x1.314f1e1d36000p-2, -0x1.8e27ad3213cb8p-45) -A(0x1.7a00000000000p-1, 0x1.36b6776be1000p-2, 0x1.16ecdb0f177c8p-46) -A(0x1.7800000000000p-1, 0x1.3c25277333000p-2, 0x1.83b54b606bd5cp-46) -A(0x1.7600000000000p-1, 0x1.419b423d5e800p-2, 0x1.8e436ec90e09dp-47) -A(0x1.7400000000000p-1, 0x1.4718dc271c800p-2, -0x1.f27ce0967d675p-45) -A(0x1.7200000000000p-1, 0x1.4c9e09e173000p-2, -0x1.e20891b0ad8a4p-45) -A(0x1.7000000000000p-1, 0x1.522ae0738a000p-2, 0x1.ebe708164c759p-45) -A(0x1.6e00000000000p-1, 0x1.57bf753c8d000p-2, 0x1.fadedee5d40efp-46) -A(0x1.6c00000000000p-1, 0x1.5d5bddf596000p-2, -0x1.a0b2a08a465dcp-47) -}, -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.h deleted file mode 100644 index 5d609ae80..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _POW_DATA_H -#define _POW_DATA_H - -#include - -#define POW_LOG_TABLE_BITS 7 -#define POW_LOG_POLY_ORDER 8 -extern hidden const struct pow_log_data { - double ln2hi; - double ln2lo; - double poly[POW_LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ - /* Note: the pad field is unused, but allows slightly faster indexing. */ - struct { - double invc, pad, logc, logctail; - } tab[1 << POW_LOG_TABLE_BITS]; -} __pow_log_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/powf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/powf.c deleted file mode 100644 index de8fab545..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/powf.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include "libm.h" -#include "exp2f_data.h" -#include "powf_data.h" - -/* -POWF_LOG2_POLY_ORDER = 5 -EXP2F_TABLE_BITS = 5 - -ULP error: 0.82 (~ 0.5 + relerr*2^24) -relerr: 1.27 * 2^-26 (Relative error ~= 128*Ln2*relerr_log2 + relerr_exp2) -relerr_log2: 1.83 * 2^-33 (Relative error of logx.) -relerr_exp2: 1.69 * 2^-34 (Relative error of exp2(ylogx).) -*/ - -#define N (1 << POWF_LOG2_TABLE_BITS) -#define T __powf_log2_data.tab -#define A __powf_log2_data.poly -#define OFF 0x3f330000 - -/* Subnormal input is normalized so ix has negative biased exponent. - Output is multiplied by N (POWF_SCALE) if TOINT_INTRINICS is set. */ -static inline double_t log2_inline(uint32_t ix) -{ - double_t z, r, r2, r4, p, q, y, y0, invc, logc; - uint32_t iz, top, tmp; - int k, i; - - /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. - The range is split into N subintervals. - The ith subinterval contains z and c is near its center. */ - tmp = ix - OFF; - i = (tmp >> (23 - POWF_LOG2_TABLE_BITS)) % N; - top = tmp & 0xff800000; - iz = ix - top; - k = (int32_t)top >> (23 - POWF_SCALE_BITS); /* arithmetic shift */ - invc = T[i].invc; - logc = T[i].logc; - z = (double_t)asfloat(iz); - - /* log2(x) = log1p(z/c-1)/ln2 + log2(c) + k */ - r = z * invc - 1; - y0 = logc + (double_t)k; - - /* Pipelined polynomial evaluation to approximate log1p(r)/ln2. */ - r2 = r * r; - y = A[0] * r + A[1]; - p = A[2] * r + A[3]; - r4 = r2 * r2; - q = A[4] * r + y0; - q = p * r2 + q; - y = y * r4 + q; - return y; -} - -#undef N -#undef T -#define N (1 << EXP2F_TABLE_BITS) -#define T __exp2f_data.tab -#define SIGN_BIAS (1 << (EXP2F_TABLE_BITS + 11)) - -/* The output of log2 and thus the input of exp2 is either scaled by N - (in case of fast toint intrinsics) or not. The unscaled xd must be - in [-1021,1023], sign_bias sets the sign of the result. */ -static inline float exp2_inline(double_t xd, uint32_t sign_bias) -{ - uint64_t ki, ski, t; - double_t kd, z, r, r2, y, s; - -#if TOINT_INTRINSICS -#define C __exp2f_data.poly_scaled - /* N*x = k + r with r in [-1/2, 1/2] */ - kd = roundtoint(xd); /* k */ - ki = converttoint(xd); -#else -#define C __exp2f_data.poly -#define SHIFT __exp2f_data.shift_scaled - /* x = k/N + r with r in [-1/(2N), 1/(2N)] */ - kd = eval_as_double(xd + SHIFT); - ki = asuint64(kd); - kd -= SHIFT; /* k/N */ -#endif - r = xd - kd; - - /* exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ - t = T[ki % N]; - ski = ki + sign_bias; - t += ski << (52 - EXP2F_TABLE_BITS); - s = asdouble(t); - z = C[0] * r + C[1]; - r2 = r * r; - y = C[2] * r + 1; - y = z * r2 + y; - y = y * s; - return eval_as_float(y); -} - -/* Returns 0 if not int, 1 if odd int, 2 if even int. The argument is - the bit representation of a non-zero finite floating-point value. */ -static inline int checkint(uint32_t iy) -{ - int e = iy >> 23 & 0xff; - if (e < 0x7f) - return 0; - if (e > 0x7f + 23) - return 2; - if (iy & ((1 << (0x7f + 23 - e)) - 1)) - return 0; - if (iy & (1 << (0x7f + 23 - e))) - return 1; - return 2; -} - -static inline int zeroinfnan(uint32_t ix) -{ - return 2 * ix - 1 >= 2u * 0x7f800000 - 1; -} - -float powf(float x, float y) -{ - uint32_t sign_bias = 0; - uint32_t ix, iy; - - ix = asuint(x); - iy = asuint(y); - if (predict_false(ix - 0x00800000 >= 0x7f800000 - 0x00800000 || - zeroinfnan(iy))) { - /* Either (x < 0x1p-126 or inf or nan) or (y is 0 or inf or nan). */ - if (predict_false(zeroinfnan(iy))) { - if (2 * iy == 0) - return issignalingf_inline(x) ? x + y : 1.0f; - if (ix == 0x3f800000) - return issignalingf_inline(y) ? x + y : 1.0f; - if (2 * ix > 2u * 0x7f800000 || - 2 * iy > 2u * 0x7f800000) - return x + y; - if (2 * ix == 2 * 0x3f800000) - return 1.0f; - if ((2 * ix < 2 * 0x3f800000) == !(iy & 0x80000000)) - return 0.0f; /* |x|<1 && y==inf or |x|>1 && y==-inf. */ - return y * y; - } - if (predict_false(zeroinfnan(ix))) { - float_t x2 = x * x; - if (ix & 0x80000000 && checkint(iy) == 1) - x2 = -x2; - /* Without the barrier some versions of clang hoist the 1/x2 and - thus division by zero exception can be signaled spuriously. */ - return iy & 0x80000000 ? fp_barrierf(1 / x2) : x2; - } - /* x and y are non-zero finite. */ - if (ix & 0x80000000) { - /* Finite x < 0. */ - int yint = checkint(iy); - if (yint == 0) - return __math_invalidf(x); - if (yint == 1) - sign_bias = SIGN_BIAS; - ix &= 0x7fffffff; - } - if (ix < 0x00800000) { - /* Normalize subnormal x so exponent becomes negative. */ - ix = asuint(x * 0x1p23f); - ix &= 0x7fffffff; - ix -= 23 << 23; - } - } - double_t logx = log2_inline(ix); - double_t ylogx = y * logx; /* cannot overflow, y is single prec. */ - if (predict_false((asuint64(ylogx) >> 47 & 0xffff) >= - asuint64(126.0 * POWF_SCALE) >> 47)) { - /* |y*log(x)| >= 126. */ - if (ylogx > 0x1.fffffffd1d571p+6 * POWF_SCALE) - return __math_oflowf(sign_bias); - if (ylogx <= -150.0 * POWF_SCALE) - return __math_uflowf(sign_bias); - } - return exp2_inline(ylogx, sign_bias); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.c deleted file mode 100644 index 13e1d9a06..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Data definition for powf. - * - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ - -#include "powf_data.h" - -const struct powf_log2_data __powf_log2_data = { - .tab = { - { 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2 * POWF_SCALE }, - { 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2 * POWF_SCALE }, - { 0x1.49539f0f010bp+0, -0x1.7418b0a1fb77bp-2 * POWF_SCALE }, - { 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2 * POWF_SCALE }, - { 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2 * POWF_SCALE }, - { 0x1.25e227b0b8eap+0, -0x1.97c1d1b3b7afp-3 * POWF_SCALE }, - { 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3 * POWF_SCALE }, - { 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4 * POWF_SCALE }, - { 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5 * POWF_SCALE }, - { 0x1p+0, 0x0p+0 * POWF_SCALE }, - { 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4 * POWF_SCALE }, - { 0x1.ca4b31f026aap-1, 0x1.476a9543891bap-3 * POWF_SCALE }, - { 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3 * POWF_SCALE }, - { 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2 * POWF_SCALE }, - { 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2 * POWF_SCALE }, - { 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2 * POWF_SCALE }, - }, - .poly = { - 0x1.27616c9496e0bp-2 * POWF_SCALE, -0x1.71969a075c67ap-2 * POWF_SCALE, - 0x1.ec70a6ca7baddp-2 * POWF_SCALE, -0x1.7154748bef6c8p-1 * POWF_SCALE, - 0x1.71547652ab82bp0 * POWF_SCALE, - } -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.h deleted file mode 100644 index 5b136e283..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2017-2018, Arm Limited. - * SPDX-License-Identifier: MIT - */ -#ifndef _POWF_DATA_H -#define _POWF_DATA_H - -#include "libm.h" -#include "exp2f_data.h" - -#define POWF_LOG2_TABLE_BITS 4 -#define POWF_LOG2_POLY_ORDER 5 -#if TOINT_INTRINSICS -#define POWF_SCALE_BITS EXP2F_TABLE_BITS -#else -#define POWF_SCALE_BITS 0 -#endif -#define POWF_SCALE ((double)(1 << POWF_SCALE_BITS)) -extern hidden const struct powf_log2_data { - struct { - double invc, logc; - } tab[1 << POWF_LOG2_TABLE_BITS]; - double poly[POWF_LOG2_POLY_ORDER]; -} __powf_log2_data; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/powl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/powl.c deleted file mode 100644 index 6f64ea711..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/powl.c +++ /dev/null @@ -1,530 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_powl.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* powl.c - * - * Power function, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, z, powl(); - * - * z = powl( x, y ); - * - * - * DESCRIPTION: - * - * Computes x raised to the yth power. Analytically, - * - * x**y = exp( y log(x) ). - * - * Following Cody and Waite, this program uses a lookup table - * of 2**-i/32 and pseudo extended precision arithmetic to - * obtain several extra bits of accuracy in both the logarithm - * and the exponential. - * - * - * ACCURACY: - * - * The relative error of pow(x,y) can be estimated - * by y dl ln(2), where dl is the absolute error of - * the internally computed base 2 logarithm. At the ends - * of the approximation interval the logarithm equal 1/32 - * and its relative error is about 1 lsb = 1.1e-19. Hence - * the predicted relative error in the result is 2.3e-21 y . - * - * Relative error: - * arithmetic domain # trials peak rms - * - * IEEE +-1000 40000 2.8e-18 3.7e-19 - * .001 < x < 1000, with log(x) uniformly distributed. - * -1000 < y < 1000, y uniformly distributed. - * - * IEEE 0,8700 60000 6.5e-18 1.0e-18 - * 0.99 < x < 1.01, 0 < y < 8700, uniformly distributed. - * - * - * ERROR MESSAGES: - * - * message condition value returned - * pow overflow x**y > MAXNUM INFINITY - * pow underflow x**y < 1/MAXNUM 0.0 - * pow domain x<0 and y noninteger 0.0 - * - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double powl(long double x, long double y) -{ - return pow(x, y); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 - -/* Table size */ -#define NXT 32 - -/* log(1+x) = x - .5x^2 + x^3 * P(z)/Q(z) - * on the domain 2^(-1/32) - 1 <= x <= 2^(1/32) - 1 - */ -static const long double P[] = { - 8.3319510773868690346226E-4L, - 4.9000050881978028599627E-1L, - 1.7500123722550302671919E0L, - 1.4000100839971580279335E0L, -}; -static const long double Q[] = { -/* 1.0000000000000000000000E0L,*/ - 5.2500282295834889175431E0L, - 8.4000598057587009834666E0L, - 4.2000302519914740834728E0L, -}; -/* A[i] = 2^(-i/32), rounded to IEEE long double precision. - * If i is even, A[i] + B[i/2] gives additional accuracy. - */ -static const long double A[33] = { - 1.0000000000000000000000E0L, - 9.7857206208770013448287E-1L, - 9.5760328069857364691013E-1L, - 9.3708381705514995065011E-1L, - 9.1700404320467123175367E-1L, - 8.9735453750155359320742E-1L, - 8.7812608018664974155474E-1L, - 8.5930964906123895780165E-1L, - 8.4089641525371454301892E-1L, - 8.2287773907698242225554E-1L, - 8.0524516597462715409607E-1L, - 7.8799042255394324325455E-1L, - 7.7110541270397041179298E-1L, - 7.5458221379671136985669E-1L, - 7.3841307296974965571198E-1L, - 7.2259040348852331001267E-1L, - 7.0710678118654752438189E-1L, - 6.9195494098191597746178E-1L, - 6.7712777346844636413344E-1L, - 6.6261832157987064729696E-1L, - 6.4841977732550483296079E-1L, - 6.3452547859586661129850E-1L, - 6.2092890603674202431705E-1L, - 6.0762367999023443907803E-1L, - 5.9460355750136053334378E-1L, - 5.8186242938878875689693E-1L, - 5.6939431737834582684856E-1L, - 5.5719337129794626814472E-1L, - 5.4525386633262882960438E-1L, - 5.3357020033841180906486E-1L, - 5.2213689121370692017331E-1L, - 5.1094857432705833910408E-1L, - 5.0000000000000000000000E-1L, -}; -static const long double B[17] = { - 0.0000000000000000000000E0L, - 2.6176170809902549338711E-20L, --1.0126791927256478897086E-20L, - 1.3438228172316276937655E-21L, - 1.2207982955417546912101E-20L, --6.3084814358060867200133E-21L, - 1.3164426894366316434230E-20L, --1.8527916071632873716786E-20L, - 1.8950325588932570796551E-20L, - 1.5564775779538780478155E-20L, - 6.0859793637556860974380E-21L, --2.0208749253662532228949E-20L, - 1.4966292219224761844552E-20L, - 3.3540909728056476875639E-21L, --8.6987564101742849540743E-22L, --1.2327176863327626135542E-20L, - 0.0000000000000000000000E0L, -}; - -/* 2^x = 1 + x P(x), - * on the interval -1/32 <= x <= 0 - */ -static const long double R[] = { - 1.5089970579127659901157E-5L, - 1.5402715328927013076125E-4L, - 1.3333556028915671091390E-3L, - 9.6181291046036762031786E-3L, - 5.5504108664798463044015E-2L, - 2.4022650695910062854352E-1L, - 6.9314718055994530931447E-1L, -}; - -#define MEXP (NXT*16384.0L) -/* The following if denormal numbers are supported, else -MEXP: */ -#define MNEXP (-NXT*(16384.0L+64.0L)) -/* log2(e) - 1 */ -#define LOG2EA 0.44269504088896340735992L - -#define F W -#define Fa Wa -#define Fb Wb -#define G W -#define Ga Wa -#define Gb u -#define H W -#define Ha Wb -#define Hb Wb - -static const long double MAXLOGL = 1.1356523406294143949492E4L; -static const long double MINLOGL = -1.13994985314888605586758E4L; -static const long double LOGE2L = 6.9314718055994530941723E-1L; -static const long double huge = 0x1p10000L; -/* XXX Prevent gcc from erroneously constant folding this. */ -static const volatile long double twom10000 = 0x1p-10000L; - -static long double reducl(long double); -static long double powil(long double, int); - -long double powl(long double x, long double y) -{ - /* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */ - int i, nflg, iyflg, yoddint; - long e; - volatile long double z=0; - long double w=0, W=0, Wa=0, Wb=0, ya=0, yb=0, u=0; - - /* make sure no invalid exception is raised by nan comparision */ - if (isnan(x)) { - if (!isnan(y) && y == 0.0) - return 1.0; - return x; - } - if (isnan(y)) { - if (x == 1.0) - return 1.0; - return y; - } - if (x == 1.0) - return 1.0; /* 1**y = 1, even if y is nan */ - if (y == 0.0) - return 1.0; /* x**0 = 1, even if x is nan */ - if (y == 1.0) - return x; - /* if y*log2(x) < log2(LDBL_TRUE_MIN)-1 then x^y uflows to 0 - if y*log2(x) > -log2(LDBL_TRUE_MIN)+1 > LDBL_MAX_EXP then x^y oflows - if |x|!=1 then |log2(x)| > |log(x)| > LDBL_EPSILON/2 so - x^y oflows/uflows if |y|*LDBL_EPSILON/2 > -log2(LDBL_TRUE_MIN)+1 */ - if (fabsl(y) > 2*(-LDBL_MIN_EXP+LDBL_MANT_DIG+1)/LDBL_EPSILON) { - /* y is not an odd int */ - if (x == -1.0) - return 1.0; - if (y == INFINITY) { - if (x > 1.0 || x < -1.0) - return INFINITY; - return 0.0; - } - if (y == -INFINITY) { - if (x > 1.0 || x < -1.0) - return 0.0; - return INFINITY; - } - if ((x > 1.0 || x < -1.0) == (y > 0)) - return huge * huge; - return twom10000 * twom10000; - } - if (x == INFINITY) { - if (y > 0.0) - return INFINITY; - return 0.0; - } - - w = floorl(y); - - /* Set iyflg to 1 if y is an integer. */ - iyflg = 0; - if (w == y) - iyflg = 1; - - /* Test for odd integer y. */ - yoddint = 0; - if (iyflg) { - ya = fabsl(y); - ya = floorl(0.5 * ya); - yb = 0.5 * fabsl(w); - if( ya != yb ) - yoddint = 1; - } - - if (x == -INFINITY) { - if (y > 0.0) { - if (yoddint) - return -INFINITY; - return INFINITY; - } - if (y < 0.0) { - if (yoddint) - return -0.0; - return 0.0; - } - } - nflg = 0; /* (x<0)**(odd int) */ - if (x <= 0.0) { - if (x == 0.0) { - if (y < 0.0) { - if (signbit(x) && yoddint) - /* (-0.0)**(-odd int) = -inf, divbyzero */ - return -1.0/0.0; - /* (+-0.0)**(negative) = inf, divbyzero */ - return 1.0/0.0; - } - if (signbit(x) && yoddint) - return -0.0; - return 0.0; - } - if (iyflg == 0) - return (x - x) / (x - x); /* (x<0)**(non-int) is NaN */ - /* (x<0)**(integer) */ - if (yoddint) - nflg = 1; /* negate result */ - x = -x; - } - /* (+integer)**(integer) */ - if (iyflg && floorl(x) == x && fabsl(y) < 32768.0) { - w = powil(x, (int)y); - return nflg ? -w : w; - } - - /* separate significand from exponent */ - x = frexpl(x, &i); - e = i; - - /* find significand in antilog table A[] */ - i = 1; - if (x <= A[17]) - i = 17; - if (x <= A[i+8]) - i += 8; - if (x <= A[i+4]) - i += 4; - if (x <= A[i+2]) - i += 2; - if (x >= A[1]) - i = -1; - i += 1; - - /* Find (x - A[i])/A[i] - * in order to compute log(x/A[i]): - * - * log(x) = log( a x/a ) = log(a) + log(x/a) - * - * log(x/a) = log(1+v), v = x/a - 1 = (x-a)/a - */ - x -= A[i]; - x -= B[i/2]; - x /= A[i]; - - /* rational approximation for log(1+v): - * - * log(1+v) = v - v**2/2 + v**3 P(v) / Q(v) - */ - z = x*x; - w = x * (z * __polevll(x, P, 3) / __p1evll(x, Q, 3)); - w = w - 0.5*z; - - /* Convert to base 2 logarithm: - * multiply by log2(e) = 1 + LOG2EA - */ - z = LOG2EA * w; - z += w; - z += LOG2EA * x; - z += x; - - /* Compute exponent term of the base 2 logarithm. */ - w = -i; - w /= NXT; - w += e; - /* Now base 2 log of x is w + z. */ - - /* Multiply base 2 log by y, in extended precision. */ - - /* separate y into large part ya - * and small part yb less than 1/NXT - */ - ya = reducl(y); - yb = y - ya; - - /* (w+z)(ya+yb) - * = w*ya + w*yb + z*y - */ - F = z * y + w * yb; - Fa = reducl(F); - Fb = F - Fa; - - G = Fa + w * ya; - Ga = reducl(G); - Gb = G - Ga; - - H = Fb + Gb; - Ha = reducl(H); - w = (Ga + Ha) * NXT; - - /* Test the power of 2 for overflow */ - if (w > MEXP) - return huge * huge; /* overflow */ - if (w < MNEXP) - return twom10000 * twom10000; /* underflow */ - - e = w; - Hb = H - Ha; - - if (Hb > 0.0) { - e += 1; - Hb -= 1.0/NXT; /*0.0625L;*/ - } - - /* Now the product y * log2(x) = Hb + e/NXT. - * - * Compute base 2 exponential of Hb, - * where -0.0625 <= Hb <= 0. - */ - z = Hb * __polevll(Hb, R, 6); /* z = 2**Hb - 1 */ - - /* Express e/NXT as an integer plus a negative number of (1/NXT)ths. - * Find lookup table entry for the fractional power of 2. - */ - if (e < 0) - i = 0; - else - i = 1; - i = e/NXT + i; - e = NXT*i - e; - w = A[e]; - z = w * z; /* 2**-e * ( 1 + (2**Hb-1) ) */ - z = z + w; - z = scalbnl(z, i); /* multiply by integer power of 2 */ - - if (nflg) - z = -z; - return z; -} - - -/* Find a multiple of 1/NXT that is within 1/NXT of x. */ -static long double reducl(long double x) -{ - long double t; - - t = x * NXT; - t = floorl(t); - t = t / NXT; - return t; -} - -/* - * Positive real raised to integer power, long double precision - * - * - * SYNOPSIS: - * - * long double x, y, powil(); - * int n; - * - * y = powil( x, n ); - * - * - * DESCRIPTION: - * - * Returns argument x>0 raised to the nth power. - * The routine efficiently decomposes n as a sum of powers of - * two. The desired power is a product of two-to-the-kth - * powers of x. Thus to compute the 32767 power of x requires - * 28 multiplications instead of 32767 multiplications. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic x domain n domain # trials peak rms - * IEEE .001,1000 -1022,1023 50000 4.3e-17 7.8e-18 - * IEEE 1,2 -1022,1023 20000 3.9e-17 7.6e-18 - * IEEE .99,1.01 0,8700 10000 3.6e-16 7.2e-17 - * - * Returns MAXNUM on overflow, zero on underflow. - */ - -static long double powil(long double x, int nn) -{ - long double ww, y; - long double s; - int n, e, sign, lx; - - if (nn == 0) - return 1.0; - - if (nn < 0) { - sign = -1; - n = -nn; - } else { - sign = 1; - n = nn; - } - - /* Overflow detection */ - - /* Calculate approximate logarithm of answer */ - s = x; - s = frexpl( s, &lx); - e = (lx - 1)*n; - if ((e == 0) || (e > 64) || (e < -64)) { - s = (s - 7.0710678118654752e-1L) / (s + 7.0710678118654752e-1L); - s = (2.9142135623730950L * s - 0.5 + lx) * nn * LOGE2L; - } else { - s = LOGE2L * e; - } - - if (s > MAXLOGL) - return huge * huge; /* overflow */ - - if (s < MINLOGL) - return twom10000 * twom10000; /* underflow */ - /* Handle tiny denormal answer, but with less accuracy - * since roundoff error in 1.0/x will be amplified. - * The precise demarcation should be the gradual underflow threshold. - */ - if (s < -MAXLOGL+2.0) { - x = 1.0/x; - sign = -sign; - } - - /* First bit of the power */ - if (n & 1) - y = x; - else - y = 1.0; - - ww = x; - n >>= 1; - while (n) { - ww = ww * ww; /* arg to the 2-to-the-kth power */ - if (n & 1) /* if that bit is set, then include in product */ - y *= ww; - n >>= 1; - } - - if (sign < 0) - y = 1.0/y; - return y; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double powl(long double x, long double y) -{ - return pow(x, y); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/remainder.c b/src/hyperlight_guest_bin/third_party/musl/src/math/remainder.c deleted file mode 100644 index 612155fed..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/remainder.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -double remainder(double x, double y) -{ - int q; - return remquo(x, y, &q); -} - -weak_alias(remainder, drem); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/remainderf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/remainderf.c deleted file mode 100644 index bf1d7b283..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/remainderf.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -float remainderf(float x, float y) -{ - int q; - return remquof(x, y, &q); -} - -weak_alias(remainderf, dremf); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/remainderl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/remainderl.c deleted file mode 100644 index 2a13c1d5a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/remainderl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double remainderl(long double x, long double y) -{ - return remainder(x, y); -} -#else -long double remainderl(long double x, long double y) -{ - int q; - return remquol(x, y, &q); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/remquo.c b/src/hyperlight_guest_bin/third_party/musl/src/math/remquo.c deleted file mode 100644 index 59d5ad57e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/remquo.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include - -double remquo(double x, double y, int *quo) -{ - union {double f; uint64_t i;} ux = {x}, uy = {y}; - int ex = ux.i>>52 & 0x7ff; - int ey = uy.i>>52 & 0x7ff; - int sx = ux.i>>63; - int sy = uy.i>>63; - uint32_t q; - uint64_t i; - uint64_t uxi = ux.i; - - *quo = 0; - if (uy.i<<1 == 0 || isnan(y) || ex == 0x7ff) - return (x*y)/(x*y); - if (ux.i<<1 == 0) - return x; - - /* normalize x and y */ - if (!ex) { - for (i = uxi<<12; i>>63 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1ULL >> 12; - uxi |= 1ULL << 52; - } - if (!ey) { - for (i = uy.i<<12; i>>63 == 0; ey--, i <<= 1); - uy.i <<= -ey + 1; - } else { - uy.i &= -1ULL >> 12; - uy.i |= 1ULL << 52; - } - - q = 0; - if (ex < ey) { - if (ex+1 == ey) - goto end; - return x; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uy.i; - if (i >> 63 == 0) { - uxi = i; - q++; - } - uxi <<= 1; - q <<= 1; - } - i = uxi - uy.i; - if (i >> 63 == 0) { - uxi = i; - q++; - } - if (uxi == 0) - ex = -60; - else - for (; uxi>>52 == 0; uxi <<= 1, ex--); -end: - /* scale result and decide between |x| and |x|-|y| */ - if (ex > 0) { - uxi -= 1ULL << 52; - uxi |= (uint64_t)ex << 52; - } else { - uxi >>= -ex + 1; - } - ux.i = uxi; - x = ux.f; - if (sy) - y = -y; - if (ex == ey || (ex+1 == ey && (2*x > y || (2*x == y && q%2)))) { - x -= y; - q++; - } - q &= 0x7fffffff; - *quo = sx^sy ? -(int)q : (int)q; - return sx ? -x : x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/remquof.c b/src/hyperlight_guest_bin/third_party/musl/src/math/remquof.c deleted file mode 100644 index 2f41ff706..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/remquof.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include - -float remquof(float x, float y, int *quo) -{ - union {float f; uint32_t i;} ux = {x}, uy = {y}; - int ex = ux.i>>23 & 0xff; - int ey = uy.i>>23 & 0xff; - int sx = ux.i>>31; - int sy = uy.i>>31; - uint32_t q; - uint32_t i; - uint32_t uxi = ux.i; - - *quo = 0; - if (uy.i<<1 == 0 || isnan(y) || ex == 0xff) - return (x*y)/(x*y); - if (ux.i<<1 == 0) - return x; - - /* normalize x and y */ - if (!ex) { - for (i = uxi<<9; i>>31 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1U >> 9; - uxi |= 1U << 23; - } - if (!ey) { - for (i = uy.i<<9; i>>31 == 0; ey--, i <<= 1); - uy.i <<= -ey + 1; - } else { - uy.i &= -1U >> 9; - uy.i |= 1U << 23; - } - - q = 0; - if (ex < ey) { - if (ex+1 == ey) - goto end; - return x; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uy.i; - if (i >> 31 == 0) { - uxi = i; - q++; - } - uxi <<= 1; - q <<= 1; - } - i = uxi - uy.i; - if (i >> 31 == 0) { - uxi = i; - q++; - } - if (uxi == 0) - ex = -30; - else - for (; uxi>>23 == 0; uxi <<= 1, ex--); -end: - /* scale result and decide between |x| and |x|-|y| */ - if (ex > 0) { - uxi -= 1U << 23; - uxi |= (uint32_t)ex << 23; - } else { - uxi >>= -ex + 1; - } - ux.i = uxi; - x = ux.f; - if (sy) - y = -y; - if (ex == ey || (ex+1 == ey && (2*x > y || (2*x == y && q%2)))) { - x -= y; - q++; - } - q &= 0x7fffffff; - *quo = sx^sy ? -(int)q : (int)q; - return sx ? -x : x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/remquol.c b/src/hyperlight_guest_bin/third_party/musl/src/math/remquol.c deleted file mode 100644 index 9b065c007..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/remquol.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double remquol(long double x, long double y, int *quo) -{ - return remquo(x, y, quo); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double remquol(long double x, long double y, int *quo) -{ - union ldshape ux = {x}, uy = {y}; - int ex = ux.i.se & 0x7fff; - int ey = uy.i.se & 0x7fff; - int sx = ux.i.se >> 15; - int sy = uy.i.se >> 15; - uint32_t q; - - *quo = 0; - if (y == 0 || isnan(y) || ex == 0x7fff) - return (x*y)/(x*y); - if (x == 0) - return x; - - /* normalize x and y */ - if (!ex) { - ux.i.se = ex; - ux.f *= 0x1p120f; - ex = ux.i.se - 120; - } - if (!ey) { - uy.i.se = ey; - uy.f *= 0x1p120f; - ey = uy.i.se - 120; - } - - q = 0; - if (ex >= ey) { - /* x mod y */ -#if LDBL_MANT_DIG == 64 - uint64_t i, mx, my; - mx = ux.i.m; - my = uy.i.m; - for (; ex > ey; ex--) { - i = mx - my; - if (mx >= my) { - mx = 2*i; - q++; - q <<= 1; - } else if (2*mx < mx) { - mx = 2*mx - my; - q <<= 1; - q++; - } else { - mx = 2*mx; - q <<= 1; - } - } - i = mx - my; - if (mx >= my) { - mx = i; - q++; - } - if (mx == 0) - ex = -120; - else - for (; mx >> 63 == 0; mx *= 2, ex--); - ux.i.m = mx; -#elif LDBL_MANT_DIG == 113 - uint64_t hi, lo, xhi, xlo, yhi, ylo; - xhi = (ux.i2.hi & -1ULL>>16) | 1ULL<<48; - yhi = (uy.i2.hi & -1ULL>>16) | 1ULL<<48; - xlo = ux.i2.lo; - ylo = ux.i2.lo; - for (; ex > ey; ex--) { - hi = xhi - yhi; - lo = xlo - ylo; - if (xlo < ylo) - hi -= 1; - if (hi >> 63 == 0) { - xhi = 2*hi + (lo>>63); - xlo = 2*lo; - q++; - } else { - xhi = 2*xhi + (xlo>>63); - xlo = 2*xlo; - } - q <<= 1; - } - hi = xhi - yhi; - lo = xlo - ylo; - if (xlo < ylo) - hi -= 1; - if (hi >> 63 == 0) { - xhi = hi; - xlo = lo; - q++; - } - if ((xhi|xlo) == 0) - ex = -120; - else - for (; xhi >> 48 == 0; xhi = 2*xhi + (xlo>>63), xlo = 2*xlo, ex--); - ux.i2.hi = xhi; - ux.i2.lo = xlo; -#endif - } - - /* scale result and decide between |x| and |x|-|y| */ - if (ex <= 0) { - ux.i.se = ex + 120; - ux.f *= 0x1p-120f; - } else - ux.i.se = ex; - x = ux.f; - if (sy) - y = -y; - if (ex == ey || (ex+1 == ey && (2*x > y || (2*x == y && q%2)))) { - x -= y; - q++; - } - q &= 0x7fffffff; - *quo = sx^sy ? -(int)q : (int)q; - return sx ? -x : x; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/rint.c b/src/hyperlight_guest_bin/third_party/musl/src/math/rint.c deleted file mode 100644 index fbba390e7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/rint.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include - -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -static const double_t toint = 1/EPS; - -double rint(double x) -{ - union {double f; uint64_t i;} u = {x}; - int e = u.i>>52 & 0x7ff; - int s = u.i>>63; - double_t y; - - if (e >= 0x3ff+52) - return x; - if (s) - y = x - toint + toint; - else - y = x + toint - toint; - if (y == 0) - return s ? -0.0 : 0; - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/rintf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/rintf.c deleted file mode 100644 index 9047688d2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/rintf.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -#if FLT_EVAL_METHOD==0 -#define EPS FLT_EPSILON -#elif FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -static const float_t toint = 1/EPS; - -float rintf(float x) -{ - union {float f; uint32_t i;} u = {x}; - int e = u.i>>23 & 0xff; - int s = u.i>>31; - float_t y; - - if (e >= 0x7f+23) - return x; - if (s) - y = x - toint + toint; - else - y = x + toint - toint; - if (y == 0) - return s ? -0.0f : 0.0f; - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/rintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/rintl.c deleted file mode 100644 index 374327db2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/rintl.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double rintl(long double x) -{ - return rint(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -static const long double toint = 1/LDBL_EPSILON; - -long double rintl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - int s = u.i.se >> 15; - long double y; - - if (e >= 0x3fff+LDBL_MANT_DIG-1) - return x; - if (s) - y = x - toint + toint; - else - y = x + toint - toint; - if (y == 0) - return 0*x; - return y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/round.c b/src/hyperlight_guest_bin/third_party/musl/src/math/round.c deleted file mode 100644 index 130d58d25..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/round.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "libm.h" - -#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -static const double_t toint = 1/EPS; - -double round(double x) -{ - union {double f; uint64_t i;} u = {x}; - int e = u.i >> 52 & 0x7ff; - double_t y; - - if (e >= 0x3ff+52) - return x; - if (u.i >> 63) - x = -x; - if (e < 0x3ff-1) { - /* raise inexact if x!=0 */ - FORCE_EVAL(x + toint); - return 0*u.f; - } - y = x + toint - toint - x; - if (y > 0.5) - y = y + x - 1; - else if (y <= -0.5) - y = y + x + 1; - else - y = y + x; - if (u.i >> 63) - y = -y; - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/roundf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/roundf.c deleted file mode 100644 index e8210af56..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/roundf.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "libm.h" - -#if FLT_EVAL_METHOD==0 -#define EPS FLT_EPSILON -#elif FLT_EVAL_METHOD==1 -#define EPS DBL_EPSILON -#elif FLT_EVAL_METHOD==2 -#define EPS LDBL_EPSILON -#endif -static const float_t toint = 1/EPS; - -float roundf(float x) -{ - union {float f; uint32_t i;} u = {x}; - int e = u.i >> 23 & 0xff; - float_t y; - - if (e >= 0x7f+23) - return x; - if (u.i >> 31) - x = -x; - if (e < 0x7f-1) { - FORCE_EVAL(x + toint); - return 0*u.f; - } - y = x + toint - toint - x; - if (y > 0.5f) - y = y + x - 1; - else if (y <= -0.5f) - y = y + x + 1; - else - y = y + x; - if (u.i >> 31) - y = -y; - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/roundl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/roundl.c deleted file mode 100644 index f4ff6820a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/roundl.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double roundl(long double x) -{ - return round(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -static const long double toint = 1/LDBL_EPSILON; - -long double roundl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - long double y; - - if (e >= 0x3fff+LDBL_MANT_DIG-1) - return x; - if (u.i.se >> 15) - x = -x; - if (e < 0x3fff-1) { - FORCE_EVAL(x + toint); - return 0*u.f; - } - y = x + toint - toint - x; - if (y > 0.5) - y = y + x - 1; - else if (y <= -0.5) - y = y + x + 1; - else - y = y + x; - if (u.i.se >> 15) - y = -y; - return y; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalb.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalb.c deleted file mode 100644 index efe69e60c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalb.c +++ /dev/null @@ -1,35 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_scalb.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* - * scalb(x, fn) is provide for - * passing various standard test suite. One - * should use scalbn() instead. - */ - -#define _GNU_SOURCE -#include - -double scalb(double x, double fn) -{ - if (isnan(x) || isnan(fn)) - return x*fn; - if (!isfinite(fn)) { - if (fn > 0.0) - return x*fn; - else - return x/(-fn); - } - if (rint(fn) != fn) return (fn-fn)/(fn-fn); - if ( fn > 65000.0) return scalbn(x, 65000); - if (-fn > 65000.0) return scalbn(x,-65000); - return scalbn(x,(int)fn); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalbf.c deleted file mode 100644 index f44ed5b64..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/e_scalbf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#define _GNU_SOURCE -#include - -float scalbf(float x, float fn) -{ - if (isnan(x) || isnan(fn)) return x*fn; - if (!isfinite(fn)) { - if (fn > 0.0f) - return x*fn; - else - return x/(-fn); - } - if (rintf(fn) != fn) return (fn-fn)/(fn-fn); - if ( fn > 65000.0f) return scalbnf(x, 65000); - if (-fn > 65000.0f) return scalbnf(x,-65000); - return scalbnf(x,(int)fn); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbln.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalbln.c deleted file mode 100644 index e6f3f195c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbln.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -double scalbln(double x, long n) -{ - if (n > INT_MAX) - n = INT_MAX; - else if (n < INT_MIN) - n = INT_MIN; - return scalbn(x, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalblnf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalblnf.c deleted file mode 100644 index d8e8166b1..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalblnf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -float scalblnf(float x, long n) -{ - if (n > INT_MAX) - n = INT_MAX; - else if (n < INT_MIN) - n = INT_MIN; - return scalbnf(x, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalblnl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalblnl.c deleted file mode 100644 index 854c51c4c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalblnl.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double scalblnl(long double x, long n) -{ - return scalbln(x, n); -} -#else -long double scalblnl(long double x, long n) -{ - if (n > INT_MAX) - n = INT_MAX; - else if (n < INT_MIN) - n = INT_MIN; - return scalbnl(x, n); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbn.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalbn.c deleted file mode 100644 index 182f56106..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbn.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -double scalbn(double x, int n) -{ - union {double f; uint64_t i;} u; - double_t y = x; - - if (n > 1023) { - y *= 0x1p1023; - n -= 1023; - if (n > 1023) { - y *= 0x1p1023; - n -= 1023; - if (n > 1023) - n = 1023; - } - } else if (n < -1022) { - /* make sure final n < -53 to avoid double - rounding in the subnormal range */ - y *= 0x1p-1022 * 0x1p53; - n += 1022 - 53; - if (n < -1022) { - y *= 0x1p-1022 * 0x1p53; - n += 1022 - 53; - if (n < -1022) - n = -1022; - } - } - u.i = (uint64_t)(0x3ff+n)<<52; - x = y * u.f; - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbnf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalbnf.c deleted file mode 100644 index a5ad208b6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbnf.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -float scalbnf(float x, int n) -{ - union {float f; uint32_t i;} u; - float_t y = x; - - if (n > 127) { - y *= 0x1p127f; - n -= 127; - if (n > 127) { - y *= 0x1p127f; - n -= 127; - if (n > 127) - n = 127; - } - } else if (n < -126) { - y *= 0x1p-126f * 0x1p24f; - n += 126 - 24; - if (n < -126) { - y *= 0x1p-126f * 0x1p24f; - n += 126 - 24; - if (n < -126) - n = -126; - } - } - u.i = (uint32_t)(0x7f+n)<<23; - x = y * u.f; - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbnl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/scalbnl.c deleted file mode 100644 index db44dab06..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/scalbnl.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double scalbnl(long double x, int n) -{ - return scalbn(x, n); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double scalbnl(long double x, int n) -{ - union ldshape u; - - if (n > 16383) { - x *= 0x1p16383L; - n -= 16383; - if (n > 16383) { - x *= 0x1p16383L; - n -= 16383; - if (n > 16383) - n = 16383; - } - } else if (n < -16382) { - x *= 0x1p-16382L * 0x1p113L; - n += 16382 - 113; - if (n < -16382) { - x *= 0x1p-16382L * 0x1p113L; - n += 16382 - 113; - if (n < -16382) - n = -16382; - } - } - u.f = 1.0; - u.i.se = 0x3fff + n; - return x * u.f; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/signgam.c b/src/hyperlight_guest_bin/third_party/musl/src/math/signgam.c deleted file mode 100644 index ee331b274..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/signgam.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include "libm.h" - -int __signgam = 0; - -weak_alias(__signgam, signgam); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/significand.c b/src/hyperlight_guest_bin/third_party/musl/src/math/significand.c deleted file mode 100644 index 40d9aa9f4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/significand.c +++ /dev/null @@ -1,7 +0,0 @@ -#define _GNU_SOURCE -#include - -double significand(double x) -{ - return scalbn(x, -ilogb(x)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/significandf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/significandf.c deleted file mode 100644 index 8a697e1aa..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/significandf.c +++ /dev/null @@ -1,7 +0,0 @@ -#define _GNU_SOURCE -#include - -float significandf(float x) -{ - return scalbnf(x, -ilogbf(x)); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sin.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sin.c deleted file mode 100644 index 055e215bc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sin.c +++ /dev/null @@ -1,78 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* sin(x) - * Return sine function of x. - * - * kernel function: - * __sin ... sine function on [-pi/4,pi/4] - * __cos ... cose function on [-pi/4,pi/4] - * __rem_pio2 ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "libm.h" - -double sin(double x) -{ - double y[2]; - uint32_t ix; - unsigned n; - - /* High word of x. */ - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - - /* |x| ~< pi/4 */ - if (ix <= 0x3fe921fb) { - if (ix < 0x3e500000) { /* |x| < 2**-26 */ - /* raise inexact if x != 0 and underflow if subnormal*/ - FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f); - return x; - } - return __sin(x, 0.0, 0); - } - - /* sin(Inf or NaN) is NaN */ - if (ix >= 0x7ff00000) - return x - x; - - /* argument reduction needed */ - n = __rem_pio2(x, y); - switch (n&3) { - case 0: return __sin(y[0], y[1], 1); - case 1: return __cos(y[0], y[1]); - case 2: return -__sin(y[0], y[1], 1); - default: - return -__cos(y[0], y[1]); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sincos.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sincos.c deleted file mode 100644 index 35b2d9239..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sincos.c +++ /dev/null @@ -1,69 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#define _GNU_SOURCE -#include "libm.h" - -void sincos(double x, double *sin, double *cos) -{ - double y[2], s, c; - uint32_t ix; - unsigned n; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - - /* |x| ~< pi/4 */ - if (ix <= 0x3fe921fb) { - /* if |x| < 2**-27 * sqrt(2) */ - if (ix < 0x3e46a09e) { - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f); - *sin = x; - *cos = 1.0; - return; - } - *sin = __sin(x, 0.0, 0); - *cos = __cos(x, 0.0); - return; - } - - /* sincos(Inf or NaN) is NaN */ - if (ix >= 0x7ff00000) { - *sin = *cos = x - x; - return; - } - - /* argument reduction needed */ - n = __rem_pio2(x, y); - s = __sin(y[0], y[1], 1); - c = __cos(y[0], y[1]); - switch (n&3) { - case 0: - *sin = s; - *cos = c; - break; - case 1: - *sin = c; - *cos = -s; - break; - case 2: - *sin = -s; - *cos = -c; - break; - case 3: - default: - *sin = -c; - *cos = s; - break; - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sincosf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sincosf.c deleted file mode 100644 index f8ca7232c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sincosf.c +++ /dev/null @@ -1,117 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#define _GNU_SOURCE -#include "libm.h" - -/* Small multiples of pi/2 rounded to double precision. */ -static const double -s1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */ -s2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */ -s3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ -s4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ - -void sincosf(float x, float *sin, float *cos) -{ - double y; - float_t s, c; - uint32_t ix; - unsigned n, sign; - - GET_FLOAT_WORD(ix, x); - sign = ix >> 31; - ix &= 0x7fffffff; - - /* |x| ~<= pi/4 */ - if (ix <= 0x3f490fda) { - /* |x| < 2**-12 */ - if (ix < 0x39800000) { - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f); - *sin = x; - *cos = 1.0f; - return; - } - *sin = __sindf(x); - *cos = __cosdf(x); - return; - } - - /* |x| ~<= 5*pi/4 */ - if (ix <= 0x407b53d1) { - if (ix <= 0x4016cbe3) { /* |x| ~<= 3pi/4 */ - if (sign) { - *sin = -__cosdf(x + s1pio2); - *cos = __sindf(x + s1pio2); - } else { - *sin = __cosdf(s1pio2 - x); - *cos = __sindf(s1pio2 - x); - } - return; - } - /* -sin(x+c) is not correct if x+c could be 0: -0 vs +0 */ - *sin = -__sindf(sign ? x + s2pio2 : x - s2pio2); - *cos = -__cosdf(sign ? x + s2pio2 : x - s2pio2); - return; - } - - /* |x| ~<= 9*pi/4 */ - if (ix <= 0x40e231d5) { - if (ix <= 0x40afeddf) { /* |x| ~<= 7*pi/4 */ - if (sign) { - *sin = __cosdf(x + s3pio2); - *cos = -__sindf(x + s3pio2); - } else { - *sin = -__cosdf(x - s3pio2); - *cos = __sindf(x - s3pio2); - } - return; - } - *sin = __sindf(sign ? x + s4pio2 : x - s4pio2); - *cos = __cosdf(sign ? x + s4pio2 : x - s4pio2); - return; - } - - /* sin(Inf or NaN) is NaN */ - if (ix >= 0x7f800000) { - *sin = *cos = x - x; - return; - } - - /* general argument reduction needed */ - n = __rem_pio2f(x, &y); - s = __sindf(y); - c = __cosdf(y); - switch (n&3) { - case 0: - *sin = s; - *cos = c; - break; - case 1: - *sin = c; - *cos = -s; - break; - case 2: - *sin = -s; - *cos = -c; - break; - case 3: - default: - *sin = -c; - *cos = s; - break; - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sincosl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sincosl.c deleted file mode 100644 index d3ac1c4c8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sincosl.c +++ /dev/null @@ -1,60 +0,0 @@ -#define _GNU_SOURCE -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -void sincosl(long double x, long double *sin, long double *cos) -{ - double sind, cosd; - sincos(x, &sind, &cosd); - *sin = sind; - *cos = cosd; -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -void sincosl(long double x, long double *sin, long double *cos) -{ - union ldshape u = {x}; - unsigned n; - long double y[2], s, c; - - u.i.se &= 0x7fff; - if (u.i.se == 0x7fff) { - *sin = *cos = x - x; - return; - } - if (u.f < M_PI_4) { - if (u.i.se < 0x3fff - LDBL_MANT_DIG) { - /* raise underflow if subnormal */ - if (u.i.se == 0) FORCE_EVAL(x*0x1p-120f); - *sin = x; - /* raise inexact if x!=0 */ - *cos = 1.0 + x; - return; - } - *sin = __sinl(x, 0, 0); - *cos = __cosl(x, 0); - return; - } - n = __rem_pio2l(x, y); - s = __sinl(y[0], y[1], 1); - c = __cosl(y[0], y[1]); - switch (n & 3) { - case 0: - *sin = s; - *cos = c; - break; - case 1: - *sin = c; - *cos = -s; - break; - case 2: - *sin = -s; - *cos = -c; - break; - case 3: - default: - *sin = -c; - *cos = s; - break; - } -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sinf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sinf.c deleted file mode 100644 index 64e39f501..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sinf.c +++ /dev/null @@ -1,76 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -/* Small multiples of pi/2 rounded to double precision. */ -static const double -s1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */ -s2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */ -s3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ -s4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ - -float sinf(float x) -{ - double y; - uint32_t ix; - int n, sign; - - GET_FLOAT_WORD(ix, x); - sign = ix >> 31; - ix &= 0x7fffffff; - - if (ix <= 0x3f490fda) { /* |x| ~<= pi/4 */ - if (ix < 0x39800000) { /* |x| < 2**-12 */ - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(ix < 0x00800000 ? x/0x1p120f : x+0x1p120f); - return x; - } - return __sindf(x); - } - if (ix <= 0x407b53d1) { /* |x| ~<= 5*pi/4 */ - if (ix <= 0x4016cbe3) { /* |x| ~<= 3pi/4 */ - if (sign) - return -__cosdf(x + s1pio2); - else - return __cosdf(x - s1pio2); - } - return __sindf(sign ? -(x + s2pio2) : -(x - s2pio2)); - } - if (ix <= 0x40e231d5) { /* |x| ~<= 9*pi/4 */ - if (ix <= 0x40afeddf) { /* |x| ~<= 7*pi/4 */ - if (sign) - return __cosdf(x + s3pio2); - else - return -__cosdf(x - s3pio2); - } - return __sindf(sign ? x + s4pio2 : x - s4pio2); - } - - /* sin(Inf or NaN) is NaN */ - if (ix >= 0x7f800000) - return x - x; - - /* general argument reduction needed */ - n = __rem_pio2f(x, &y); - switch (n&3) { - case 0: return __sindf(y); - case 1: return __cosdf(y); - case 2: return __sindf(-y); - default: - return -__cosdf(y); - } -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sinh.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sinh.c deleted file mode 100644 index a01951ae6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sinh.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "libm.h" - -/* sinh(x) = (exp(x) - 1/exp(x))/2 - * = (exp(x)-1 + (exp(x)-1)/exp(x))/2 - * = x + x^3/6 + o(x^5) - */ -double sinh(double x) -{ - union {double f; uint64_t i;} u = {.f = x}; - uint32_t w; - double t, h, absx; - - h = 0.5; - if (u.i >> 63) - h = -h; - /* |x| */ - u.i &= (uint64_t)-1/2; - absx = u.f; - w = u.i >> 32; - - /* |x| < log(DBL_MAX) */ - if (w < 0x40862e42) { - t = expm1(absx); - if (w < 0x3ff00000) { - if (w < 0x3ff00000 - (26<<20)) - /* note: inexact and underflow are raised by expm1 */ - /* note: this branch avoids spurious underflow */ - return x; - return h*(2*t - t*t/(t+1)); - } - /* note: |x|>log(0x1p26)+eps could be just h*exp(x) */ - return h*(t + t/(t+1)); - } - - /* |x| > log(DBL_MAX) or nan */ - /* note: the result is stored to handle overflow */ - t = __expo2(absx, 2*h); - return t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sinhf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sinhf.c deleted file mode 100644 index b9caa793c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sinhf.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "libm.h" - -float sinhf(float x) -{ - union {float f; uint32_t i;} u = {.f = x}; - uint32_t w; - float t, h, absx; - - h = 0.5; - if (u.i >> 31) - h = -h; - /* |x| */ - u.i &= 0x7fffffff; - absx = u.f; - w = u.i; - - /* |x| < log(FLT_MAX) */ - if (w < 0x42b17217) { - t = expm1f(absx); - if (w < 0x3f800000) { - if (w < 0x3f800000 - (12<<23)) - return x; - return h*(2*t - t*t/(t+1)); - } - return h*(t + t/(t+1)); - } - - /* |x| > logf(FLT_MAX) or nan */ - t = __expo2f(absx, 2*h); - return t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sinhl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sinhl.c deleted file mode 100644 index b305d4d2f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sinhl.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double sinhl(long double x) -{ - return sinh(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -long double sinhl(long double x) -{ - union ldshape u = {x}; - unsigned ex = u.i.se & 0x7fff; - long double h, t, absx; - - h = 0.5; - if (u.i.se & 0x8000) - h = -h; - /* |x| */ - u.i.se = ex; - absx = u.f; - - /* |x| < log(LDBL_MAX) */ - if (ex < 0x3fff+13 || (ex == 0x3fff+13 && u.i.m>>32 < 0xb17217f7)) { - t = expm1l(absx); - if (ex < 0x3fff) { - if (ex < 0x3fff-32) - return x; - return h*(2*t - t*t/(1+t)); - } - return h*(t + t/(t+1)); - } - - /* |x| > log(LDBL_MAX) or nan */ - t = expl(0.5*absx); - return h*t*t; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double sinhl(long double x) -{ - return sinh(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sinl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sinl.c deleted file mode 100644 index 9c0b16eed..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sinl.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double sinl(long double x) -{ - return sin(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double sinl(long double x) -{ - union ldshape u = {x}; - unsigned n; - long double y[2], hi, lo; - - u.i.se &= 0x7fff; - if (u.i.se == 0x7fff) - return x - x; - if (u.f < M_PI_4) { - if (u.i.se < 0x3fff - LDBL_MANT_DIG/2) { - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(u.i.se == 0 ? x*0x1p-120f : x+0x1p120f); - return x; - } - return __sinl(x, 0.0, 0); - } - n = __rem_pio2l(x, y); - hi = y[0]; - lo = y[1]; - switch (n & 3) { - case 0: - return __sinl(hi, lo, 1); - case 1: - return __cosl(hi, lo); - case 2: - return -__sinl(hi, lo, 1); - case 3: - default: - return -__cosl(hi, lo); - } -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt.c deleted file mode 100644 index 5ba265596..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include "libm.h" -#include "sqrt_data.h" - -#define FENV_SUPPORT 1 - -/* returns a*b*2^-32 - e, with error 0 <= e < 1. */ -static inline uint32_t mul32(uint32_t a, uint32_t b) -{ - return (uint64_t)a*b >> 32; -} - -/* returns a*b*2^-64 - e, with error 0 <= e < 3. */ -static inline uint64_t mul64(uint64_t a, uint64_t b) -{ - uint64_t ahi = a>>32; - uint64_t alo = a&0xffffffff; - uint64_t bhi = b>>32; - uint64_t blo = b&0xffffffff; - return ahi*bhi + (ahi*blo >> 32) + (alo*bhi >> 32); -} - -double sqrt(double x) -{ - uint64_t ix, top, m; - - /* special case handling. */ - ix = asuint64(x); - top = ix >> 52; - if (predict_false(top - 0x001 >= 0x7ff - 0x001)) { - /* x < 0x1p-1022 or inf or nan. */ - if (ix * 2 == 0) - return x; - if (ix == 0x7ff0000000000000) - return x; - if (ix > 0x7ff0000000000000) - return __math_invalid(x); - /* x is subnormal, normalize it. */ - ix = asuint64(x * 0x1p52); - top = ix >> 52; - top -= 52; - } - - /* argument reduction: - x = 4^e m; with integer e, and m in [1, 4) - m: fixed point representation [2.62] - 2^e is the exponent part of the result. */ - int even = top & 1; - m = (ix << 11) | 0x8000000000000000; - if (even) m >>= 1; - top = (top + 0x3ff) >> 1; - - /* approximate r ~ 1/sqrt(m) and s ~ sqrt(m) when m in [1,4) - - initial estimate: - 7bit table lookup (1bit exponent and 6bit significand). - - iterative approximation: - using 2 goldschmidt iterations with 32bit int arithmetics - and a final iteration with 64bit int arithmetics. - - details: - - the relative error (e = r0 sqrt(m)-1) of a linear estimate - (r0 = a m + b) is |e| < 0.085955 ~ 0x1.6p-4 at best, - a table lookup is faster and needs one less iteration - 6 bit lookup table (128b) gives |e| < 0x1.f9p-8 - 7 bit lookup table (256b) gives |e| < 0x1.fdp-9 - for single and double prec 6bit is enough but for quad - prec 7bit is needed (or modified iterations). to avoid - one more iteration >=13bit table would be needed (16k). - - a newton-raphson iteration for r is - w = r*r - u = 3 - m*w - r = r*u/2 - can use a goldschmidt iteration for s at the end or - s = m*r - - first goldschmidt iteration is - s = m*r - u = 3 - s*r - r = r*u/2 - s = s*u/2 - next goldschmidt iteration is - u = 3 - s*r - r = r*u/2 - s = s*u/2 - and at the end r is not computed only s. - - they use the same amount of operations and converge at the - same quadratic rate, i.e. if - r1 sqrt(m) - 1 = e, then - r2 sqrt(m) - 1 = -3/2 e^2 - 1/2 e^3 - the advantage of goldschmidt is that the mul for s and r - are independent (computed in parallel), however it is not - "self synchronizing": it only uses the input m in the - first iteration so rounding errors accumulate. at the end - or when switching to larger precision arithmetics rounding - errors dominate so the first iteration should be used. - - the fixed point representations are - m: 2.30 r: 0.32, s: 2.30, d: 2.30, u: 2.30, three: 2.30 - and after switching to 64 bit - m: 2.62 r: 0.64, s: 2.62, d: 2.62, u: 2.62, three: 2.62 */ - - static const uint64_t three = 0xc0000000; - uint64_t r, s, d, u, i; - - i = (ix >> 46) % 128; - r = (uint32_t)__rsqrt_tab[i] << 16; - /* |r sqrt(m) - 1| < 0x1.fdp-9 */ - s = mul32(m>>32, r); - /* |s/sqrt(m) - 1| < 0x1.fdp-9 */ - d = mul32(s, r); - u = three - d; - r = mul32(r, u) << 1; - /* |r sqrt(m) - 1| < 0x1.7bp-16 */ - s = mul32(s, u) << 1; - /* |s/sqrt(m) - 1| < 0x1.7bp-16 */ - d = mul32(s, r); - u = three - d; - r = mul32(r, u) << 1; - /* |r sqrt(m) - 1| < 0x1.3704p-29 (measured worst-case) */ - r = r << 32; - s = mul64(m, r); - d = mul64(s, r); - u = (three<<32) - d; - s = mul64(s, u); /* repr: 3.61 */ - /* -0x1p-57 < s - sqrt(m) < 0x1.8001p-61 */ - s = (s - 2) >> 9; /* repr: 12.52 */ - /* -0x1.09p-52 < s - sqrt(m) < -0x1.fffcp-63 */ - - /* s < sqrt(m) < s + 0x1.09p-52, - compute nearest rounded result: - the nearest result to 52 bits is either s or s+0x1p-52, - we can decide by comparing (2^52 s + 0.5)^2 to 2^104 m. */ - uint64_t d0, d1, d2; - double y, t; - d0 = (m << 42) - s*s; - d1 = s - d0; - d2 = d1 + s + 1; - s += d1 >> 63; - s &= 0x000fffffffffffff; - s |= top << 52; - y = asdouble(s); - if (FENV_SUPPORT) { - /* handle rounding modes and inexact exception: - only (s+1)^2 == 2^42 m case is exact otherwise - add a tiny value to cause the fenv effects. */ - uint64_t tiny = predict_false(d2==0) ? 0 : 0x0010000000000000; - tiny |= (d1^d2) & 0x8000000000000000; - t = asdouble(tiny); - y = eval_as_double(y + t); - } - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.c deleted file mode 100644 index 61bc22f43..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "sqrt_data.h" -const uint16_t __rsqrt_tab[128] = { -0xb451,0xb2f0,0xb196,0xb044,0xaef9,0xadb6,0xac79,0xab43, -0xaa14,0xa8eb,0xa7c8,0xa6aa,0xa592,0xa480,0xa373,0xa26b, -0xa168,0xa06a,0x9f70,0x9e7b,0x9d8a,0x9c9d,0x9bb5,0x9ad1, -0x99f0,0x9913,0x983a,0x9765,0x9693,0x95c4,0x94f8,0x9430, -0x936b,0x92a9,0x91ea,0x912e,0x9075,0x8fbe,0x8f0a,0x8e59, -0x8daa,0x8cfe,0x8c54,0x8bac,0x8b07,0x8a64,0x89c4,0x8925, -0x8889,0x87ee,0x8756,0x86c0,0x862b,0x8599,0x8508,0x8479, -0x83ec,0x8361,0x82d8,0x8250,0x81c9,0x8145,0x80c2,0x8040, -0xff02,0xfd0e,0xfb25,0xf947,0xf773,0xf5aa,0xf3ea,0xf234, -0xf087,0xeee3,0xed47,0xebb3,0xea27,0xe8a3,0xe727,0xe5b2, -0xe443,0xe2dc,0xe17a,0xe020,0xdecb,0xdd7d,0xdc34,0xdaf1, -0xd9b3,0xd87b,0xd748,0xd61a,0xd4f1,0xd3cd,0xd2ad,0xd192, -0xd07b,0xcf69,0xce5b,0xcd51,0xcc4a,0xcb48,0xca4a,0xc94f, -0xc858,0xc764,0xc674,0xc587,0xc49d,0xc3b7,0xc2d4,0xc1f4, -0xc116,0xc03c,0xbf65,0xbe90,0xbdbe,0xbcef,0xbc23,0xbb59, -0xba91,0xb9cc,0xb90a,0xb84a,0xb78c,0xb6d0,0xb617,0xb560, -}; diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.h b/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.h deleted file mode 100644 index 260c7f9c2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _SQRT_DATA_H -#define _SQRT_DATA_H - -#include -#include - -/* if x in [1,2): i = (int)(64*x); - if x in [2,4): i = (int)(32*x-64); - __rsqrt_tab[i]*2^-16 is estimating 1/sqrt(x) with small relative error: - |__rsqrt_tab[i]*0x1p-16*sqrt(x) - 1| < -0x1.fdp-9 < 2^-8 */ -extern hidden const uint16_t __rsqrt_tab[128]; - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrtf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sqrtf.c deleted file mode 100644 index 740d81cba..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrtf.c +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include -#include "libm.h" -#include "sqrt_data.h" - -#define FENV_SUPPORT 1 - -static inline uint32_t mul32(uint32_t a, uint32_t b) -{ - return (uint64_t)a*b >> 32; -} - -/* see sqrt.c for more detailed comments. */ - -float sqrtf(float x) -{ - uint32_t ix, m, m1, m0, even, ey; - - ix = asuint(x); - if (predict_false(ix - 0x00800000 >= 0x7f800000 - 0x00800000)) { - /* x < 0x1p-126 or inf or nan. */ - if (ix * 2 == 0) - return x; - if (ix == 0x7f800000) - return x; - if (ix > 0x7f800000) - return __math_invalidf(x); - /* x is subnormal, normalize it. */ - ix = asuint(x * 0x1p23f); - ix -= 23 << 23; - } - - /* x = 4^e m; with int e and m in [1, 4). */ - even = ix & 0x00800000; - m1 = (ix << 8) | 0x80000000; - m0 = (ix << 7) & 0x7fffffff; - m = even ? m0 : m1; - - /* 2^e is the exponent part of the return value. */ - ey = ix >> 1; - ey += 0x3f800000 >> 1; - ey &= 0x7f800000; - - /* compute r ~ 1/sqrt(m), s ~ sqrt(m) with 2 goldschmidt iterations. */ - static const uint32_t three = 0xc0000000; - uint32_t r, s, d, u, i; - i = (ix >> 17) % 128; - r = (uint32_t)__rsqrt_tab[i] << 16; - /* |r*sqrt(m) - 1| < 0x1p-8 */ - s = mul32(m, r); - /* |s/sqrt(m) - 1| < 0x1p-8 */ - d = mul32(s, r); - u = three - d; - r = mul32(r, u) << 1; - /* |r*sqrt(m) - 1| < 0x1.7bp-16 */ - s = mul32(s, u) << 1; - /* |s/sqrt(m) - 1| < 0x1.7bp-16 */ - d = mul32(s, r); - u = three - d; - s = mul32(s, u); - /* -0x1.03p-28 < s/sqrt(m) - 1 < 0x1.fp-31 */ - s = (s - 1)>>6; - /* s < sqrt(m) < s + 0x1.08p-23 */ - - /* compute nearest rounded result. */ - uint32_t d0, d1, d2; - float y, t; - d0 = (m << 16) - s*s; - d1 = s - d0; - d2 = d1 + s + 1; - s += d1 >> 31; - s &= 0x007fffff; - s |= ey; - y = asfloat(s); - if (FENV_SUPPORT) { - /* handle rounding and inexact exception. */ - uint32_t tiny = predict_false(d2==0) ? 0 : 0x01000000; - tiny |= (d1^d2) & 0x80000000; - t = asfloat(tiny); - y = eval_as_float(y + t); - } - return y; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrtl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/sqrtl.c deleted file mode 100644 index a231b3f20..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/sqrtl.c +++ /dev/null @@ -1,259 +0,0 @@ -#include -#include -#include -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double sqrtl(long double x) -{ - return sqrt(x); -} -#elif (LDBL_MANT_DIG == 113 || LDBL_MANT_DIG == 64) && LDBL_MAX_EXP == 16384 -#include "sqrt_data.h" - -#define FENV_SUPPORT 1 - -typedef struct { - uint64_t hi; - uint64_t lo; -} u128; - -/* top: 16 bit sign+exponent, x: significand. */ -static inline long double mkldbl(uint64_t top, u128 x) -{ - union ldshape u; -#if LDBL_MANT_DIG == 113 - u.i2.hi = x.hi; - u.i2.lo = x.lo; - u.i2.hi &= 0x0000ffffffffffff; - u.i2.hi |= top << 48; -#elif LDBL_MANT_DIG == 64 - u.i.se = top; - u.i.m = x.lo; - /* force the top bit on non-zero (and non-subnormal) results. */ - if (top & 0x7fff) - u.i.m |= 0x8000000000000000; -#endif - return u.f; -} - -/* return: top 16 bit is sign+exp and following bits are the significand. */ -static inline u128 asu128(long double x) -{ - union ldshape u = {.f=x}; - u128 r; -#if LDBL_MANT_DIG == 113 - r.hi = u.i2.hi; - r.lo = u.i2.lo; -#elif LDBL_MANT_DIG == 64 - r.lo = u.i.m<<49; - /* ignore the top bit: pseudo numbers are not handled. */ - r.hi = u.i.m>>15; - r.hi &= 0x0000ffffffffffff; - r.hi |= (uint64_t)u.i.se << 48; -#endif - return r; -} - -/* returns a*b*2^-32 - e, with error 0 <= e < 1. */ -static inline uint32_t mul32(uint32_t a, uint32_t b) -{ - return (uint64_t)a*b >> 32; -} - -/* returns a*b*2^-64 - e, with error 0 <= e < 3. */ -static inline uint64_t mul64(uint64_t a, uint64_t b) -{ - uint64_t ahi = a>>32; - uint64_t alo = a&0xffffffff; - uint64_t bhi = b>>32; - uint64_t blo = b&0xffffffff; - return ahi*bhi + (ahi*blo >> 32) + (alo*bhi >> 32); -} - -static inline u128 add64(u128 a, uint64_t b) -{ - u128 r; - r.lo = a.lo + b; - r.hi = a.hi; - if (r.lo < a.lo) - r.hi++; - return r; -} - -static inline u128 add128(u128 a, u128 b) -{ - u128 r; - r.lo = a.lo + b.lo; - r.hi = a.hi + b.hi; - if (r.lo < a.lo) - r.hi++; - return r; -} - -static inline u128 sub64(u128 a, uint64_t b) -{ - u128 r; - r.lo = a.lo - b; - r.hi = a.hi; - if (a.lo < b) - r.hi--; - return r; -} - -static inline u128 sub128(u128 a, u128 b) -{ - u128 r; - r.lo = a.lo - b.lo; - r.hi = a.hi - b.hi; - if (a.lo < b.lo) - r.hi--; - return r; -} - -/* a<= 64) { - a.hi = a.lo<<(n-64); - a.lo = 0; - } else { - a.hi = (a.hi<>(64-n)); - a.lo = a.lo<>n, 0 <= n <= 127 */ -static inline u128 rsh(u128 a, int n) -{ - if (n == 0) - return a; - if (n >= 64) { - a.lo = a.hi>>(n-64); - a.hi = 0; - } else { - a.lo = (a.lo>>n) | (a.hi<<(64-n)); - a.hi = a.hi>>n; - } - return a; -} - -/* returns a*b exactly. */ -static inline u128 mul64_128(uint64_t a, uint64_t b) -{ - u128 r; - uint64_t ahi = a>>32; - uint64_t alo = a&0xffffffff; - uint64_t bhi = b>>32; - uint64_t blo = b&0xffffffff; - uint64_t lo1 = ((ahi*blo)&0xffffffff) + ((alo*bhi)&0xffffffff) + (alo*blo>>32); - uint64_t lo2 = (alo*blo)&0xffffffff; - r.hi = ahi*bhi + (ahi*blo>>32) + (alo*bhi>>32) + (lo1>>32); - r.lo = (lo1<<32) + lo2; - return r; -} - -/* returns a*b*2^-128 - e, with error 0 <= e < 7. */ -static inline u128 mul128(u128 a, u128 b) -{ - u128 hi = mul64_128(a.hi, b.hi); - uint64_t m1 = mul64(a.hi, b.lo); - uint64_t m2 = mul64(a.lo, b.hi); - return add64(add64(hi, m1), m2); -} - -/* returns a*b % 2^128. */ -static inline u128 mul128_tail(u128 a, u128 b) -{ - u128 lo = mul64_128(a.lo, b.lo); - lo.hi += a.hi*b.lo + a.lo*b.hi; - return lo; -} - - -/* see sqrt.c for detailed comments. */ - -long double sqrtl(long double x) -{ - u128 ix, ml; - uint64_t top; - - ix = asu128(x); - top = ix.hi >> 48; - if (predict_false(top - 0x0001 >= 0x7fff - 0x0001)) { - /* x < 0x1p-16382 or inf or nan. */ - if (2*ix.hi == 0 && ix.lo == 0) - return x; - if (ix.hi == 0x7fff000000000000 && ix.lo == 0) - return x; - if (top >= 0x7fff) - return __math_invalidl(x); - /* x is subnormal, normalize it. */ - ix = asu128(x * 0x1p112); - top = ix.hi >> 48; - top -= 112; - } - - /* x = 4^e m; with int e and m in [1, 4) */ - int even = top & 1; - ml = lsh(ix, 15); - ml.hi |= 0x8000000000000000; - if (even) ml = rsh(ml, 1); - top = (top + 0x3fff) >> 1; - - /* r ~ 1/sqrt(m) */ - const uint64_t three = 0xc0000000; - uint64_t r, s, d, u, i; - i = (ix.hi >> 42) % 128; - r = (uint32_t)__rsqrt_tab[i] << 16; - /* |r sqrt(m) - 1| < 0x1p-8 */ - s = mul32(ml.hi>>32, r); - d = mul32(s, r); - u = three - d; - r = mul32(u, r) << 1; - /* |r sqrt(m) - 1| < 0x1.7bp-16, switch to 64bit */ - r = r<<32; - s = mul64(ml.hi, r); - d = mul64(s, r); - u = (three<<32) - d; - r = mul64(u, r) << 1; - /* |r sqrt(m) - 1| < 0x1.a5p-31 */ - s = mul64(u, s) << 1; - d = mul64(s, r); - u = (three<<32) - d; - r = mul64(u, r) << 1; - /* |r sqrt(m) - 1| < 0x1.c001p-59, switch to 128bit */ - - const u128 threel = {.hi=three<<32, .lo=0}; - u128 rl, sl, dl, ul; - rl.hi = r; - rl.lo = 0; - sl = mul128(ml, rl); - dl = mul128(sl, rl); - ul = sub128(threel, dl); - sl = mul128(ul, sl); /* repr: 3.125 */ - /* -0x1p-116 < s - sqrt(m) < 0x3.8001p-125 */ - sl = rsh(sub64(sl, 4), 125-(LDBL_MANT_DIG-1)); - /* s < sqrt(m) < s + 1 ULP + tiny */ - - long double y; - u128 d2, d1, d0; - d0 = sub128(lsh(ml, 2*(LDBL_MANT_DIG-1)-126), mul128_tail(sl,sl)); - d1 = sub128(sl, d0); - d2 = add128(add64(sl, 1), d1); - sl = add64(sl, d1.hi >> 63); - y = mkldbl(top, sl); - if (FENV_SUPPORT) { - /* handle rounding modes and inexact exception. */ - top = predict_false((d2.hi|d2.lo)==0) ? 0 : 1; - top |= ((d1.hi^d2.hi)&0x8000000000000000) >> 48; - y += mkldbl(top, (u128){0}); - } - return y; -} -#else -#error unsupported long double format -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tan.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tan.c deleted file mode 100644 index 9c724a45a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tan.c +++ /dev/null @@ -1,70 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_tan.c */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ -/* tan(x) - * Return tangent function of x. - * - * kernel function: - * __tan ... tangent function on [-pi/4,pi/4] - * __rem_pio2 ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "libm.h" - -double tan(double x) -{ - double y[2]; - uint32_t ix; - unsigned n; - - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; - - /* |x| ~< pi/4 */ - if (ix <= 0x3fe921fb) { - if (ix < 0x3e400000) { /* |x| < 2**-27 */ - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f); - return x; - } - return __tan(x, 0.0, 0); - } - - /* tan(Inf or NaN) is NaN */ - if (ix >= 0x7ff00000) - return x - x; - - /* argument reduction */ - n = __rem_pio2(x, y); - return __tan(y[0], y[1], n&1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tanf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tanf.c deleted file mode 100644 index aba197777..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tanf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* origin: FreeBSD /usr/src/lib/msun/src/s_tanf.c */ -/* - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * Optimized by Bruce D. Evans. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "libm.h" - -/* Small multiples of pi/2 rounded to double precision. */ -static const double -t1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */ -t2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */ -t3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ -t4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ - -float tanf(float x) -{ - double y; - uint32_t ix; - unsigned n, sign; - - GET_FLOAT_WORD(ix, x); - sign = ix >> 31; - ix &= 0x7fffffff; - - if (ix <= 0x3f490fda) { /* |x| ~<= pi/4 */ - if (ix < 0x39800000) { /* |x| < 2**-12 */ - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(ix < 0x00800000 ? x/0x1p120f : x+0x1p120f); - return x; - } - return __tandf(x, 0); - } - if (ix <= 0x407b53d1) { /* |x| ~<= 5*pi/4 */ - if (ix <= 0x4016cbe3) /* |x| ~<= 3pi/4 */ - return __tandf((sign ? x+t1pio2 : x-t1pio2), 1); - else - return __tandf((sign ? x+t2pio2 : x-t2pio2), 0); - } - if (ix <= 0x40e231d5) { /* |x| ~<= 9*pi/4 */ - if (ix <= 0x40afeddf) /* |x| ~<= 7*pi/4 */ - return __tandf((sign ? x+t3pio2 : x-t3pio2), 1); - else - return __tandf((sign ? x+t4pio2 : x-t4pio2), 0); - } - - /* tan(Inf or NaN) is NaN */ - if (ix >= 0x7f800000) - return x - x; - - /* argument reduction */ - n = __rem_pio2f(x, &y); - return __tandf(y, n&1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tanh.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tanh.c deleted file mode 100644 index 20d6dbcf4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tanh.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "libm.h" - -/* tanh(x) = (exp(x) - exp(-x))/(exp(x) + exp(-x)) - * = (exp(2*x) - 1)/(exp(2*x) - 1 + 2) - * = (1 - exp(-2*x))/(exp(-2*x) - 1 + 2) - */ -double tanh(double x) -{ - union {double f; uint64_t i;} u = {.f = x}; - uint32_t w; - int sign; - double_t t; - - /* x = |x| */ - sign = u.i >> 63; - u.i &= (uint64_t)-1/2; - x = u.f; - w = u.i >> 32; - - if (w > 0x3fe193ea) { - /* |x| > log(3)/2 ~= 0.5493 or nan */ - if (w > 0x40340000) { - /* |x| > 20 or nan */ - /* note: this branch avoids raising overflow */ - t = 1 - 0/x; - } else { - t = expm1(2*x); - t = 1 - 2/(t+2); - } - } else if (w > 0x3fd058ae) { - /* |x| > log(5/3)/2 ~= 0.2554 */ - t = expm1(2*x); - t = t/(t+2); - } else if (w >= 0x00100000) { - /* |x| >= 0x1p-1022, up to 2ulp error in [0.1,0.2554] */ - t = expm1(-2*x); - t = -t/(t+2); - } else { - /* |x| is subnormal */ - /* note: the branch above would not raise underflow in [0x1p-1023,0x1p-1022) */ - FORCE_EVAL((float)x); - t = x; - } - return sign ? -t : t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tanhf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tanhf.c deleted file mode 100644 index 10636fbd7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tanhf.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "libm.h" - -float tanhf(float x) -{ - union {float f; uint32_t i;} u = {.f = x}; - uint32_t w; - int sign; - float t; - - /* x = |x| */ - sign = u.i >> 31; - u.i &= 0x7fffffff; - x = u.f; - w = u.i; - - if (w > 0x3f0c9f54) { - /* |x| > log(3)/2 ~= 0.5493 or nan */ - if (w > 0x41200000) { - /* |x| > 10 */ - t = 1 + 0/x; - } else { - t = expm1f(2*x); - t = 1 - 2/(t+2); - } - } else if (w > 0x3e82c578) { - /* |x| > log(5/3)/2 ~= 0.2554 */ - t = expm1f(2*x); - t = t/(t+2); - } else if (w >= 0x00800000) { - /* |x| >= 0x1p-126 */ - t = expm1f(-2*x); - t = -t/(t+2); - } else { - /* |x| is subnormal */ - FORCE_EVAL(x*x); - t = x; - } - return sign ? -t : t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tanhl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tanhl.c deleted file mode 100644 index 4e1aa9f87..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tanhl.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double tanhl(long double x) -{ - return tanh(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -long double tanhl(long double x) -{ - union ldshape u = {x}; - unsigned ex = u.i.se & 0x7fff; - unsigned sign = u.i.se & 0x8000; - uint32_t w; - long double t; - - /* x = |x| */ - u.i.se = ex; - x = u.f; - w = u.i.m >> 32; - - if (ex > 0x3ffe || (ex == 0x3ffe && w > 0x8c9f53d5)) { - /* |x| > log(3)/2 ~= 0.5493 or nan */ - if (ex >= 0x3fff+5) { - /* |x| >= 32 */ - t = 1 + 0/(x + 0x1p-120f); - } else { - t = expm1l(2*x); - t = 1 - 2/(t+2); - } - } else if (ex > 0x3ffd || (ex == 0x3ffd && w > 0x82c577d4)) { - /* |x| > log(5/3)/2 ~= 0.2554 */ - t = expm1l(2*x); - t = t/(t+2); - } else { - /* |x| is small */ - t = expm1l(-2*x); - t = -t/(t+2); - } - return sign ? -t : t; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double tanhl(long double x) -{ - return tanh(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tanl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tanl.c deleted file mode 100644 index 6af067127..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tanl.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double tanl(long double x) -{ - return tan(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 -long double tanl(long double x) -{ - union ldshape u = {x}; - long double y[2]; - unsigned n; - - u.i.se &= 0x7fff; - if (u.i.se == 0x7fff) - return x - x; - if (u.f < M_PI_4) { - if (u.i.se < 0x3fff - LDBL_MANT_DIG/2) { - /* raise inexact if x!=0 and underflow if subnormal */ - FORCE_EVAL(u.i.se == 0 ? x*0x1p-120f : x+0x1p120f); - return x; - } - return __tanl(x, 0, 0); - } - n = __rem_pio2l(x, y); - return __tanl(y[0], y[1], n&1); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tgamma.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tgamma.c deleted file mode 100644 index 28f6e0f83..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tgamma.c +++ /dev/null @@ -1,222 +0,0 @@ -/* -"A Precision Approximation of the Gamma Function" - Cornelius Lanczos (1964) -"Lanczos Implementation of the Gamma Function" - Paul Godfrey (2001) -"An Analysis of the Lanczos Gamma Approximation" - Glendon Ralph Pugh (2004) - -approximation method: - - (x - 0.5) S(x) -Gamma(x) = (x + g - 0.5) * ---------------- - exp(x + g - 0.5) - -with - a1 a2 a3 aN -S(x) ~= [ a0 + ----- + ----- + ----- + ... + ----- ] - x + 1 x + 2 x + 3 x + N - -with a0, a1, a2, a3,.. aN constants which depend on g. - -for x < 0 the following reflection formula is used: - -Gamma(x)*Gamma(-x) = -pi/(x sin(pi x)) - -most ideas and constants are from boost and python -*/ -#include "libm.h" - -static const double pi = 3.141592653589793238462643383279502884; - -/* sin(pi x) with x > 0x1p-100, if sin(pi*x)==0 the sign is arbitrary */ -static double sinpi(double x) -{ - int n; - - /* argument reduction: x = |x| mod 2 */ - /* spurious inexact when x is odd int */ - x = x * 0.5; - x = 2 * (x - floor(x)); - - /* reduce x into [-.25,.25] */ - n = 4 * x; - n = (n+1)/2; - x -= n * 0.5; - - x *= pi; - switch (n) { - default: /* case 4 */ - case 0: - return __sin(x, 0, 0); - case 1: - return __cos(x, 0); - case 2: - return __sin(-x, 0, 0); - case 3: - return -__cos(x, 0); - } -} - -#define N 12 -//static const double g = 6.024680040776729583740234375; -static const double gmhalf = 5.524680040776729583740234375; -static const double Snum[N+1] = { - 23531376880.410759688572007674451636754734846804940, - 42919803642.649098768957899047001988850926355848959, - 35711959237.355668049440185451547166705960488635843, - 17921034426.037209699919755754458931112671403265390, - 6039542586.3520280050642916443072979210699388420708, - 1439720407.3117216736632230727949123939715485786772, - 248874557.86205415651146038641322942321632125127801, - 31426415.585400194380614231628318205362874684987640, - 2876370.6289353724412254090516208496135991145378768, - 186056.26539522349504029498971604569928220784236328, - 8071.6720023658162106380029022722506138218516325024, - 210.82427775157934587250973392071336271166969580291, - 2.5066282746310002701649081771338373386264310793408, -}; -static const double Sden[N+1] = { - 0, 39916800, 120543840, 150917976, 105258076, 45995730, 13339535, - 2637558, 357423, 32670, 1925, 66, 1, -}; -/* n! for small integer n */ -static const double fact[] = { - 1, 1, 2, 6, 24, 120, 720, 5040.0, 40320.0, 362880.0, 3628800.0, 39916800.0, - 479001600.0, 6227020800.0, 87178291200.0, 1307674368000.0, 20922789888000.0, - 355687428096000.0, 6402373705728000.0, 121645100408832000.0, - 2432902008176640000.0, 51090942171709440000.0, 1124000727777607680000.0, -}; - -/* S(x) rational function for positive x */ -static double S(double x) -{ - double_t num = 0, den = 0; - int i; - - /* to avoid overflow handle large x differently */ - if (x < 8) - for (i = N; i >= 0; i--) { - num = num * x + Snum[i]; - den = den * x + Sden[i]; - } - else - for (i = 0; i <= N; i++) { - num = num / x + Snum[i]; - den = den / x + Sden[i]; - } - return num/den; -} - -double tgamma(double x) -{ - union {double f; uint64_t i;} u = {x}; - double absx, y; - double_t dy, z, r; - uint32_t ix = u.i>>32 & 0x7fffffff; - int sign = u.i>>63; - - /* special cases */ - if (ix >= 0x7ff00000) - /* tgamma(nan)=nan, tgamma(inf)=inf, tgamma(-inf)=nan with invalid */ - return x + INFINITY; - if (ix < (0x3ff-54)<<20) - /* |x| < 2^-54: tgamma(x) ~ 1/x, +-0 raises div-by-zero */ - return 1/x; - - /* integer arguments */ - /* raise inexact when non-integer */ - if (x == floor(x)) { - if (sign) - return 0/0.0; - if (x <= sizeof fact/sizeof *fact) - return fact[(int)x - 1]; - } - - /* x >= 172: tgamma(x)=inf with overflow */ - /* x =< -184: tgamma(x)=+-0 with underflow */ - if (ix >= 0x40670000) { /* |x| >= 184 */ - if (sign) { - FORCE_EVAL((float)(0x1p-126/x)); - if (floor(x) * 0.5 == floor(x * 0.5)) - return 0; - return -0.0; - } - x *= 0x1p1023; - return x; - } - - absx = sign ? -x : x; - - /* handle the error of x + g - 0.5 */ - y = absx + gmhalf; - if (absx > gmhalf) { - dy = y - absx; - dy -= gmhalf; - } else { - dy = y - gmhalf; - dy -= absx; - } - - z = absx - 0.5; - r = S(absx) * exp(-y); - if (x < 0) { - /* reflection formula for negative x */ - /* sinpi(absx) is not 0, integers are already handled */ - r = -pi / (sinpi(absx) * absx * r); - dy = -dy; - z = -z; - } - r += dy * (gmhalf+0.5) * r / y; - z = pow(y, 0.5*z); - y = r * z * z; - return y; -} - -#if 0 -double __lgamma_r(double x, int *sign) -{ - double r, absx; - - *sign = 1; - - /* special cases */ - if (!isfinite(x)) - /* lgamma(nan)=nan, lgamma(+-inf)=inf */ - return x*x; - - /* integer arguments */ - if (x == floor(x) && x <= 2) { - /* n <= 0: lgamma(n)=inf with divbyzero */ - /* n == 1,2: lgamma(n)=0 */ - if (x <= 0) - return 1/0.0; - return 0; - } - - absx = fabs(x); - - /* lgamma(x) ~ -log(|x|) for tiny |x| */ - if (absx < 0x1p-54) { - *sign = 1 - 2*!!signbit(x); - return -log(absx); - } - - /* use tgamma for smaller |x| */ - if (absx < 128) { - x = tgamma(x); - *sign = 1 - 2*!!signbit(x); - return log(fabs(x)); - } - - /* second term (log(S)-g) could be more precise here.. */ - /* or with stirling: (|x|-0.5)*(log(|x|)-1) + poly(1/|x|) */ - r = (absx-0.5)*(log(absx+gmhalf)-1) + (log(S(absx)) - (gmhalf+0.5)); - if (x < 0) { - /* reflection formula for negative x */ - x = sinpi(absx); - *sign = 2*!!signbit(x) - 1; - r = log(pi/(fabs(x)*absx)) - r; - } - return r; -} - -weak_alias(__lgamma_r, lgamma_r); -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tgammaf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tgammaf.c deleted file mode 100644 index b4ca51c9f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tgammaf.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -float tgammaf(float x) -{ - return tgamma(x); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/tgammal.c b/src/hyperlight_guest_bin/third_party/musl/src/math/tgammal.c deleted file mode 100644 index 5336c5b19..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/tgammal.c +++ /dev/null @@ -1,281 +0,0 @@ -/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_tgammal.c */ -/* - * Copyright (c) 2008 Stephen L. Moshier - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Gamma function - * - * - * SYNOPSIS: - * - * long double x, y, tgammal(); - * - * y = tgammal( x ); - * - * - * DESCRIPTION: - * - * Returns gamma function of the argument. The result is - * correctly signed. - * - * Arguments |x| <= 13 are reduced by recurrence and the function - * approximated by a rational function of degree 7/8 in the - * interval (2,3). Large arguments are handled by Stirling's - * formula. Large negative arguments are made positive using - * a reflection formula. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -40,+40 10000 3.6e-19 7.9e-20 - * IEEE -1755,+1755 10000 4.8e-18 6.5e-19 - * - * Accuracy for large arguments is dominated by error in powl(). - * - */ - -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double tgammal(long double x) -{ - return tgamma(x); -} -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -/* -tgamma(x+2) = tgamma(x+2) P(x)/Q(x) -0 <= x <= 1 -Relative error -n=7, d=8 -Peak error = 1.83e-20 -Relative error spread = 8.4e-23 -*/ -static const long double P[8] = { - 4.212760487471622013093E-5L, - 4.542931960608009155600E-4L, - 4.092666828394035500949E-3L, - 2.385363243461108252554E-2L, - 1.113062816019361559013E-1L, - 3.629515436640239168939E-1L, - 8.378004301573126728826E-1L, - 1.000000000000000000009E0L, -}; -static const long double Q[9] = { --1.397148517476170440917E-5L, - 2.346584059160635244282E-4L, --1.237799246653152231188E-3L, --7.955933682494738320586E-4L, - 2.773706565840072979165E-2L, --4.633887671244534213831E-2L, --2.243510905670329164562E-1L, - 4.150160950588455434583E-1L, - 9.999999999999999999908E-1L, -}; - -/* -static const long double P[] = { --3.01525602666895735709e0L, --3.25157411956062339893e1L, --2.92929976820724030353e2L, --1.70730828800510297666e3L, --7.96667499622741999770e3L, --2.59780216007146401957e4L, --5.99650230220855581642e4L, --7.15743521530849602425e4L -}; -static const long double Q[] = { - 1.00000000000000000000e0L, --1.67955233807178858919e1L, - 8.85946791747759881659e1L, - 5.69440799097468430177e1L, --1.98526250512761318471e3L, - 3.31667508019495079814e3L, - 1.60577839621734713377e4L, --2.97045081369399940529e4L, --7.15743521530849602412e4L -}; -*/ -#define MAXGAML 1755.455L -/*static const long double LOGPI = 1.14472988584940017414L;*/ - -/* Stirling's formula for the gamma function -tgamma(x) = sqrt(2 pi) x^(x-.5) exp(-x) (1 + 1/x P(1/x)) -z(x) = x -13 <= x <= 1024 -Relative error -n=8, d=0 -Peak error = 9.44e-21 -Relative error spread = 8.8e-4 -*/ -static const long double STIR[9] = { - 7.147391378143610789273E-4L, --2.363848809501759061727E-5L, --5.950237554056330156018E-4L, - 6.989332260623193171870E-5L, - 7.840334842744753003862E-4L, --2.294719747873185405699E-4L, --2.681327161876304418288E-3L, - 3.472222222230075327854E-3L, - 8.333333333333331800504E-2L, -}; - -#define MAXSTIR 1024.0L -static const long double SQTPI = 2.50662827463100050242E0L; - -/* 1/tgamma(x) = z P(z) - * z(x) = 1/x - * 0 < x < 0.03125 - * Peak relative error 4.2e-23 - */ -static const long double S[9] = { --1.193945051381510095614E-3L, - 7.220599478036909672331E-3L, --9.622023360406271645744E-3L, --4.219773360705915470089E-2L, - 1.665386113720805206758E-1L, --4.200263503403344054473E-2L, --6.558780715202540684668E-1L, - 5.772156649015328608253E-1L, - 1.000000000000000000000E0L, -}; - -/* 1/tgamma(-x) = z P(z) - * z(x) = 1/x - * 0 < x < 0.03125 - * Peak relative error 5.16e-23 - * Relative error spread = 2.5e-24 - */ -static const long double SN[9] = { - 1.133374167243894382010E-3L, - 7.220837261893170325704E-3L, - 9.621911155035976733706E-3L, --4.219773343731191721664E-2L, --1.665386113944413519335E-1L, --4.200263503402112910504E-2L, - 6.558780715202536547116E-1L, - 5.772156649015328608727E-1L, --1.000000000000000000000E0L, -}; - -static const long double PIL = 3.1415926535897932384626L; - -/* Gamma function computed by Stirling's formula. - */ -static long double stirf(long double x) -{ - long double y, w, v; - - w = 1.0/x; - /* For large x, use rational coefficients from the analytical expansion. */ - if (x > 1024.0) - w = (((((6.97281375836585777429E-5L * w - + 7.84039221720066627474E-4L) * w - - 2.29472093621399176955E-4L) * w - - 2.68132716049382716049E-3L) * w - + 3.47222222222222222222E-3L) * w - + 8.33333333333333333333E-2L) * w - + 1.0; - else - w = 1.0 + w * __polevll(w, STIR, 8); - y = expl(x); - if (x > MAXSTIR) { /* Avoid overflow in pow() */ - v = powl(x, 0.5L * x - 0.25L); - y = v * (v / y); - } else { - y = powl(x, x - 0.5L) / y; - } - y = SQTPI * y * w; - return y; -} - -long double tgammal(long double x) -{ - long double p, q, z; - - if (!isfinite(x)) - return x + INFINITY; - - q = fabsl(x); - if (q > 13.0) { - if (x < 0.0) { - p = floorl(q); - z = q - p; - if (z == 0) - return 0 / z; - if (q > MAXGAML) { - z = 0; - } else { - if (z > 0.5) { - p += 1.0; - z = q - p; - } - z = q * sinl(PIL * z); - z = fabsl(z) * stirf(q); - z = PIL/z; - } - if (0.5 * p == floorl(q * 0.5)) - z = -z; - } else if (x > MAXGAML) { - z = x * 0x1p16383L; - } else { - z = stirf(x); - } - return z; - } - - z = 1.0; - while (x >= 3.0) { - x -= 1.0; - z *= x; - } - while (x < -0.03125L) { - z /= x; - x += 1.0; - } - if (x <= 0.03125L) - goto small; - while (x < 2.0) { - z /= x; - x += 1.0; - } - if (x == 2.0) - return z; - - x -= 2.0; - p = __polevll(x, P, 7); - q = __polevll(x, Q, 8); - z = z * p / q; - return z; - -small: - /* z==1 if x was originally +-0 */ - if (x == 0 && z != 1) - return x / x; - if (x < 0.0) { - x = -x; - q = z / (x * __polevll(x, SN, 8)); - } else - q = z / (x * __polevll(x, S, 8)); - return q; -} -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -// TODO: broken implementation to make things compile -long double tgammal(long double x) -{ - return tgamma(x); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/trunc.c b/src/hyperlight_guest_bin/third_party/musl/src/math/trunc.c deleted file mode 100644 index d13711b50..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/trunc.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "libm.h" - -double trunc(double x) -{ - union {double f; uint64_t i;} u = {x}; - int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff + 12; - uint64_t m; - - if (e >= 52 + 12) - return x; - if (e < 12) - e = 1; - m = -1ULL >> e; - if ((u.i & m) == 0) - return x; - FORCE_EVAL(x + 0x1p120f); - u.i &= ~m; - return u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/truncf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/truncf.c deleted file mode 100644 index 1a7d03c3b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/truncf.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "libm.h" - -float truncf(float x) -{ - union {float f; uint32_t i;} u = {x}; - int e = (int)(u.i >> 23 & 0xff) - 0x7f + 9; - uint32_t m; - - if (e >= 23 + 9) - return x; - if (e < 9) - e = 1; - m = -1U >> e; - if ((u.i & m) == 0) - return x; - FORCE_EVAL(x + 0x1p120f); - u.i &= ~m; - return u.f; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/truncl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/truncl.c deleted file mode 100644 index f07b19340..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/truncl.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "libm.h" - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -long double truncl(long double x) -{ - return trunc(x); -} -#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 - -static const long double toint = 1/LDBL_EPSILON; - -long double truncl(long double x) -{ - union ldshape u = {x}; - int e = u.i.se & 0x7fff; - int s = u.i.se >> 15; - long double y; - - if (e >= 0x3fff+LDBL_MANT_DIG-1) - return x; - if (e <= 0x3fff-1) { - FORCE_EVAL(x + 0x1p120f); - return x*0; - } - /* y = int(|x|) - |x|, where int(|x|) is an integer neighbor of |x| */ - if (s) - x = -x; - y = x + toint - toint - x; - if (y > 0) - y -= 1; - x += y; - return s ? -x : x; -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/__invtrigl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/__invtrigl.s deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/acosl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/acosl.s deleted file mode 100644 index 5f6c3f55a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/acosl.s +++ /dev/null @@ -1,15 +0,0 @@ -# see ../i386/acos.s - -.global acosl -acosl: - fldt 8(%rsp) -1: fld %st(0) - fld1 - fsub %st(0),%st(1) - fadd %st(2) - fmulp - fsqrt - fabs - fxch %st(1) - fpatan - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/asinl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/asinl.s deleted file mode 100644 index 34cc38155..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/asinl.s +++ /dev/null @@ -1,11 +0,0 @@ -.global asinl -asinl: - fldt 8(%rsp) -1: fld %st(0) - fld1 - fsub %st(0),%st(1) - fadd %st(2) - fmulp - fsqrt - fpatan - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atan2l.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atan2l.s deleted file mode 100644 index 8b5e52e53..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atan2l.s +++ /dev/null @@ -1,6 +0,0 @@ -.global atan2l -atan2l: - fldt 8(%rsp) - fldt 24(%rsp) - fpatan - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atanl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atanl.s deleted file mode 100644 index 25c3723a3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atanl.s +++ /dev/null @@ -1,6 +0,0 @@ -.global atanl -atanl: - fldt 8(%rsp) - fld1 - fpatan - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/ceill.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/ceill.s deleted file mode 100644 index f5cfa3b30..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/ceill.s +++ /dev/null @@ -1 +0,0 @@ -# see floorl.s diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/exp2l.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/exp2l.s deleted file mode 100644 index 02a3f71a2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/exp2l.s +++ /dev/null @@ -1,81 +0,0 @@ -.global expm1l -expm1l: - fldt 8(%rsp) - fldl2e - fmulp - movl $0xc2820000,-4(%rsp) - flds -4(%rsp) - fucomip %st(1),%st - fld1 - jb 1f - # x*log2e <= -65, return -1 without underflow - fstp %st(1) - fchs - ret -1: fld %st(1) - fabs - fucomip %st(1),%st - fstp %st(0) - ja 1f - f2xm1 - ret -1: push %rax - call 1f - pop %rax - fld1 - fsubrp - ret - -.global exp2l -exp2l: - fldt 8(%rsp) -1: fld %st(0) - sub $16,%rsp - fstpt (%rsp) - mov 8(%rsp),%ax - and $0x7fff,%ax - cmp $0x3fff+13,%ax - jb 4f # |x| < 8192 - cmp $0x3fff+15,%ax - jae 3f # |x| >= 32768 - fsts (%rsp) - cmpl $0xc67ff800,(%rsp) - jb 2f # x > -16382 - movl $0x5f000000,(%rsp) - flds (%rsp) # 0x1p63 - fld %st(1) - fsub %st(1) - faddp - fucomip %st(1),%st - je 2f # x - 0x1p63 + 0x1p63 == x - movl $1,(%rsp) - flds (%rsp) # 0x1p-149 - fdiv %st(1) - fstps (%rsp) # raise underflow -2: fld1 - fld %st(1) - frndint - fxch %st(2) - fsub %st(2) # st(0)=x-rint(x), st(1)=1, st(2)=rint(x) - f2xm1 - faddp # 2^(x-rint(x)) -1: fscale - fstp %st(1) - add $16,%rsp - ret -3: xor %eax,%eax -4: cmp $0x3fff-64,%ax - fld1 - jb 1b # |x| < 0x1p-64 - fstpt (%rsp) - fistl 8(%rsp) - fildl 8(%rsp) - fsubrp %st(1) - addl $0x3fff,8(%rsp) - f2xm1 - fld1 - faddp # 2^(x-rint(x)) - fldt (%rsp) # 2^rint(x) - fmulp - add $16,%rsp - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expl.s deleted file mode 100644 index 3b82d1327..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expl.s +++ /dev/null @@ -1,100 +0,0 @@ -# exp(x) = 2^hi + 2^hi (2^lo - 1) -# where hi+lo = log2e*x with 128bit precision -# exact log2e*x calculation depends on nearest rounding mode -# using the exact multiplication method of Dekker and Veltkamp - -.global expl -expl: - fldt 8(%rsp) - - # interesting case: 0x1p-32 <= |x| < 16384 - # check if (exponent|0x8000) is in [0xbfff-32, 0xbfff+13] - mov 16(%rsp), %ax - or $0x8000, %ax - sub $0xbfdf, %ax - cmp $45, %ax - jbe 2f - test %ax, %ax - fld1 - js 1f - # if |x|>=0x1p14 or nan return 2^trunc(x) - fscale - fstp %st(1) - ret - # if |x|<0x1p-32 return 1+x -1: faddp - ret - - # should be 0x1.71547652b82fe178p0L == 0x3fff b8aa3b29 5c17f0bc - # it will be wrong on non-nearest rounding mode -2: fldl2e - subq $48, %rsp - # hi = log2e_hi*x - # 2^hi = exp2l(hi) - fmul %st(1),%st - fld %st(0) - fstpt (%rsp) - fstpt 16(%rsp) - fstpt 32(%rsp) - call exp2l@PLT - # if 2^hi == inf return 2^hi - fld %st(0) - fstpt (%rsp) - cmpw $0x7fff, 8(%rsp) - je 1f - fldt 32(%rsp) - fldt 16(%rsp) - # fpu stack: 2^hi x hi - # exact mult: x*log2e - fld %st(1) - # c = 0x1p32+1 - movq $0x41f0000000100000,%rax - pushq %rax - fldl (%rsp) - # xh = x - c*x + c*x - # xl = x - xh - fmulp - fld %st(2) - fsub %st(1), %st - faddp - fld %st(2) - fsub %st(1), %st - # yh = log2e_hi - c*log2e_hi + c*log2e_hi - movq $0x3ff7154765200000,%rax - pushq %rax - fldl (%rsp) - # fpu stack: 2^hi x hi xh xl yh - # lo = hi - xh*yh + xl*yh - fld %st(2) - fmul %st(1), %st - fsubp %st, %st(4) - fmul %st(1), %st - faddp %st, %st(3) - # yl = log2e_hi - yh - movq $0x3de705fc2f000000,%rax - pushq %rax - fldl (%rsp) - # fpu stack: 2^hi x lo xh xl yl - # lo += xh*yl + xl*yl - fmul %st, %st(2) - fmulp %st, %st(1) - fxch %st(2) - faddp - faddp - # log2e_lo - movq $0xbfbe,%rax - pushq %rax - movq $0x82f0025f2dc582ee,%rax - pushq %rax - fldt (%rsp) - addq $40,%rsp - # fpu stack: 2^hi x lo log2e_lo - # lo += log2e_lo*x - # return 2^hi + 2^hi (2^lo - 1) - fmulp %st, %st(2) - faddp - f2xm1 - fmul %st(1), %st - faddp -1: addq $48, %rsp - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expm1l.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expm1l.s deleted file mode 100644 index e773f0805..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expm1l.s +++ /dev/null @@ -1 +0,0 @@ -# see exp2l.s diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabs.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabs.c deleted file mode 100644 index 165624777..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabs.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -double fabs(double x) -{ - double t; - __asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0 - __asm__ ("psrlq $1, %0" : "+x"(t)); // t >>= 1 - __asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsf.c deleted file mode 100644 index 36ea7481f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -float fabsf(float x) -{ - float t; - __asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0 - __asm__ ("psrld $1, %0" : "+x"(t)); // t >>= 1 - __asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsl.c deleted file mode 100644 index cc1c9ed9c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -long double fabsl(long double x) -{ - __asm__ ("fabs" : "+t"(x)); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/floorl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/floorl.s deleted file mode 100644 index f8f1ed359..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/floorl.s +++ /dev/null @@ -1,24 +0,0 @@ -.global floorl -floorl: - fldt 8(%rsp) -1: mov $0x7,%al -1: fstcw 8(%rsp) - mov 9(%rsp),%ah - mov %al,9(%rsp) - fldcw 8(%rsp) - frndint - mov %ah,9(%rsp) - fldcw 8(%rsp) - ret - -.global ceill -ceill: - fldt 8(%rsp) - mov $0xb,%al - jmp 1b - -.global truncl -truncl: - fldt 8(%rsp) - mov $0xf,%al - jmp 1b diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fma.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fma.c deleted file mode 100644 index 4dd53f2ac..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fma.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#if __FMA__ - -double fma(double x, double y, double z) -{ - __asm__ ("vfmadd132sd %1, %2, %0" : "+x" (x) : "x" (y), "x" (z)); - return x; -} - -#elif __FMA4__ - -double fma(double x, double y, double z) -{ - __asm__ ("vfmaddsd %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z)); - return x; -} - -#else - -#include "../fma.c" - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmaf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmaf.c deleted file mode 100644 index 30b971ff9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmaf.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#if __FMA__ - -float fmaf(float x, float y, float z) -{ - __asm__ ("vfmadd132ss %1, %2, %0" : "+x" (x) : "x" (y), "x" (z)); - return x; -} - -#elif __FMA4__ - -float fmaf(float x, float y, float z) -{ - __asm__ ("vfmaddss %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z)); - return x; -} - -#else - -#include "../fmaf.c" - -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmodl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmodl.c deleted file mode 100644 index 3daeab060..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmodl.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -long double fmodl(long double x, long double y) -{ - unsigned short fpsr; - do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); - while (fpsr & 0x400); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrint.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrint.c deleted file mode 100644 index dd38a7223..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrint.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -long long llrint(double x) -{ - long long r; - __asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x)); - return r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintf.c deleted file mode 100644 index fc8625e88..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -long long llrintf(float x) -{ - long long r; - __asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x)); - return r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintl.c deleted file mode 100644 index c439ef28d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintl.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -long long llrintl(long double x) -{ - long long r; - __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); - return r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log10l.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log10l.s deleted file mode 100644 index 859855134..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log10l.s +++ /dev/null @@ -1,6 +0,0 @@ -.global log10l -log10l: - fldlg2 - fldt 8(%rsp) - fyl2x - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log1pl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log1pl.s deleted file mode 100644 index 6b7e70b06..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log1pl.s +++ /dev/null @@ -1,14 +0,0 @@ -.global log1pl -log1pl: - mov 14(%rsp),%eax - fldln2 - and $0x7fffffff,%eax - fldt 8(%rsp) - cmp $0x3ffd9400,%eax - ja 1f - fyl2xp1 - ret -1: fld1 - faddp - fyl2x - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log2l.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log2l.s deleted file mode 100644 index c8298ad53..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log2l.s +++ /dev/null @@ -1,6 +0,0 @@ -.global log2l -log2l: - fld1 - fldt 8(%rsp) - fyl2x - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/logl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/logl.s deleted file mode 100644 index 6511215e8..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/logl.s +++ /dev/null @@ -1,6 +0,0 @@ -.global logl -logl: - fldln2 - fldt 8(%rsp) - fyl2x - ret diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrint.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrint.c deleted file mode 100644 index a742fec64..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrint.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -long lrint(double x) -{ - long r; - __asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x)); - return r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintf.c deleted file mode 100644 index 2ba5639dc..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -long lrintf(float x) -{ - long r; - __asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x)); - return r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintl.c deleted file mode 100644 index 068e2e4d6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintl.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -long lrintl(long double x) -{ - long r; - __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); - return r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remainderl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remainderl.c deleted file mode 100644 index 8cf75071e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remainderl.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -long double remainderl(long double x, long double y) -{ - unsigned short fpsr; - do __asm__ ("fprem1; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); - while (fpsr & 0x400); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remquol.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remquol.c deleted file mode 100644 index 60eef089f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remquol.c +++ /dev/null @@ -1,32 +0,0 @@ -#include - -long double remquol(long double x, long double y, int *quo) -{ - signed char *cx = (void *)&x, *cy = (void *)&y; - /* By ensuring that addresses of x and y cannot be discarded, - * this empty asm guides GCC into representing extraction of - * their sign bits as memory loads rather than making x and y - * not-address-taken internally and using bitfield operations, - * which in the end wouldn't work out, as extraction from FPU - * registers needs to go through memory anyway. This way GCC - * should manage to use incoming stack slots without spills. */ - __asm__ ("" :: "X"(cx), "X"(cy)); - - long double t = x; - unsigned fpsr; - do __asm__ ("fprem1; fnstsw %%ax" : "+t"(t), "=a"(fpsr) : "u"(y)); - while (fpsr & 0x400); - /* C0, C1, C3 flags in x87 status word carry low bits of quotient: - * 15 14 13 12 11 10 9 8 - * . C3 . . . C2 C1 C0 - * . b1 . . . 0 b0 b2 */ - unsigned char i = fpsr >> 8; - i = i>>4 | i<<4; - /* i[5:2] is now {b0 b2 ? b1}. Retrieve {0 b2 b1 b0} via - * in-register table lookup. */ - unsigned qbits = 0x7575313164642020 >> (i & 60); - qbits &= 7; - - *quo = (cx[9]^cy[9]) < 0 ? -qbits : qbits; - return t; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/rintl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/rintl.c deleted file mode 100644 index e1a92077f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/rintl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -long double rintl(long double x) -{ - __asm__ ("frndint" : "+t"(x)); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrt.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrt.c deleted file mode 100644 index 657e09e3b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -double sqrt(double x) -{ - __asm__ ("sqrtsd %1, %0" : "=x"(x) : "x"(x)); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtf.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtf.c deleted file mode 100644 index 720baec60..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -float sqrtf(float x) -{ - __asm__ ("sqrtss %1, %0" : "=x"(x) : "x"(x)); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtl.c b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtl.c deleted file mode 100644 index 864cfcc4f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -long double sqrtl(long double x) -{ - __asm__ ("fsqrt" : "+t"(x)); - return x; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/truncl.s b/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/truncl.s deleted file mode 100644 index f5cfa3b30..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/truncl.s +++ /dev/null @@ -1 +0,0 @@ -# see floorl.s diff --git a/src/hyperlight_guest_bin/third_party/musl/src/misc/a64l.c b/src/hyperlight_guest_bin/third_party/musl/src/misc/a64l.c deleted file mode 100644 index 605577104..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/misc/a64l.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -static const char digits[] = - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - -long a64l(const char *s) -{ - int e; - uint32_t x = 0; - for (e=0; e<36 && *s; e+=6, s++) { - const char *d = strchr(digits, *s); - if (!d) break; - x |= (uint32_t)(d-digits)<>=6) - *p = digits[x&63]; - *p = 0; - return s; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/misc/basename.c b/src/hyperlight_guest_bin/third_party/musl/src/misc/basename.c deleted file mode 100644 index 438377b64..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/misc/basename.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -char *basename(char *s) -{ - size_t i; - if (!s || !*s) return "."; - i = strlen(s)-1; - for (; i&&s[i]=='/'; i--) s[i] = 0; - for (; i&&s[i-1]!='/'; i--); - return s+i; -} - -weak_alias(basename, __xpg_basename); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/misc/dirname.c b/src/hyperlight_guest_bin/third_party/musl/src/misc/dirname.c deleted file mode 100644 index dd570883d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/misc/dirname.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -char *dirname(char *s) -{ - size_t i; - if (!s || !*s) return "."; - i = strlen(s)-1; - for (; s[i]=='/'; i--) if (!i) return "/"; - for (; s[i]!='/'; i--) if (!i) return "."; - for (; s[i]=='/'; i--) if (!i) return "/"; - s[i+1] = 0; - return s; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/prng/rand.c b/src/hyperlight_guest_bin/third_party/musl/src/prng/rand.c deleted file mode 100644 index c000cd248..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/prng/rand.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -static uint64_t seed; - -void srand(unsigned s) -{ - seed = s-1; -} - -int rand(void) -{ - seed = 6364136223846793005ULL*seed + 1; - return seed>>33; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/longjmp.s b/src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/longjmp.s deleted file mode 100644 index 64aad91c2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/longjmp.s +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ -.global _longjmp -.global longjmp -.type _longjmp,@function -.type longjmp,@function -_longjmp: -longjmp: - xor %eax,%eax - cmp $1,%esi /* CF = val ? 0 : 1 */ - adc %esi,%eax /* eax = val + !val */ - mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */ - mov 8(%rdi),%rbp - mov 16(%rdi),%r12 - mov 24(%rdi),%r13 - mov 32(%rdi),%r14 - mov 40(%rdi),%r15 - mov 48(%rdi),%rsp - jmp *56(%rdi) /* goto saved address without altering rsp */ \ No newline at end of file diff --git a/src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/setjmp.s b/src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/setjmp.s deleted file mode 100644 index 0cd4b3135..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/setjmp.s +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ -.global __setjmp -.global _setjmp -.global setjmp -.type __setjmp,@function -.type _setjmp,@function -.type setjmp,@function -__setjmp: -_setjmp: -setjmp: - mov %rbx,(%rdi) /* rdi is jmp_buf, move registers onto it */ - mov %rbp,8(%rdi) - mov %r12,16(%rdi) - mov %r13,24(%rdi) - mov %r14,32(%rdi) - mov %r15,40(%rdi) - lea 8(%rsp),%rdx /* this is our rsp WITHOUT current ret addr */ - mov %rdx,48(%rdi) - mov (%rsp),%rdx /* save return addr ptr for new rip */ - mov %rdx,56(%rdi) - xor %eax,%eax /* always return 0 */ - ret \ No newline at end of file diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdio/__toread.c b/src/hyperlight_guest_bin/third_party/musl/src/stdio/__toread.c deleted file mode 100644 index e5206294b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdio/__toread.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int __toread(FILE *f) -{ - f->mode |= f->mode-1; - if (f->wpos != f->wbase) f->write(f, 0, 0); - f->wpos = f->wbase = f->wend = 0; - if (f->flags & F_NORD) { - f->flags |= F_ERR; - return EOF; - } - f->rpos = f->rend = f->buf + f->buf_size; - return (f->flags & F_EOF) ? EOF : 0; -} - -#ifndef HYPERLIGHT -hidden void __toread_needs_stdio_exit() -{ - __stdio_exit_needed(); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdio/__towrite.c b/src/hyperlight_guest_bin/third_party/musl/src/stdio/__towrite.c deleted file mode 100644 index 8ca54ca17..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdio/__towrite.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "stdio_impl.h" - -int __towrite(FILE *f) -{ - f->mode |= f->mode-1; - if (f->flags & F_NOWR) { - f->flags |= F_ERR; - return EOF; - } - /* Clear read buffer (easier than summoning nasal demons) */ - f->rpos = f->rend = 0; - - /* Activate write through the buffer. */ - f->wpos = f->wbase = f->buf; - f->wend = f->buf + f->buf_size; - - return 0; -} - -#ifndef HYPERLIGHT -hidden void __towrite_needs_stdio_exit() -{ - __stdio_exit_needed(); -} -#endif diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdio/__uflow.c b/src/hyperlight_guest_bin/third_party/musl/src/stdio/__uflow.c deleted file mode 100644 index 2a88bca6b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdio/__uflow.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "stdio_impl.h" - -/* This function assumes it will never be called if there is already - * data buffered for reading. */ - -int __uflow(FILE *f) -{ - unsigned char c; - if (!__toread(f) && f->read(f, &c, 1)==1) return c; - return EOF; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/abs.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/abs.c deleted file mode 100644 index e721fdc2b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/abs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int abs(int a) -{ - return a>0 ? a : -a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atof.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atof.c deleted file mode 100644 index f7fcd8266..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atof.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -double atof(const char *s) -{ - return strtod(s, 0); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoi.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoi.c deleted file mode 100644 index 9baca7b89..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoi.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int atoi(const char *s) -{ - int n=0, neg=0; - while (isspace(*s)) s++; - switch (*s) { - case '-': neg=1; - case '+': s++; - } - /* Compute n as a negative number to avoid overflow on INT_MIN */ - while (isdigit(*s)) - n = 10*n - (*s++ - '0'); - return neg ? n : -n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atol.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atol.c deleted file mode 100644 index 140ea3ea3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atol.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -long atol(const char *s) -{ - long n=0; - int neg=0; - while (isspace(*s)) s++; - switch (*s) { - case '-': neg=1; - case '+': s++; - } - /* Compute n as a negative number to avoid overflow on LONG_MIN */ - while (isdigit(*s)) - n = 10*n - (*s++ - '0'); - return neg ? n : -n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoll.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoll.c deleted file mode 100644 index b69304895..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoll.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -long long atoll(const char *s) -{ - long long n=0; - int neg=0; - while (isspace(*s)) s++; - switch (*s) { - case '-': neg=1; - case '+': s++; - } - /* Compute n as a negative number to avoid overflow on LLONG_MIN */ - while (isdigit(*s)) - n = 10*n - (*s++ - '0'); - return neg ? n : -n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/bsearch.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/bsearch.c deleted file mode 100644 index fe050ea30..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/bsearch.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*cmp)(const void *, const void *)) -{ - void *try; - int sign; - while (nel > 0) { - try = (char *)base + width*(nel/2); - sign = cmp(key, try); - if (sign < 0) { - nel /= 2; - } else if (sign > 0) { - base = (char *)try + width; - nel -= nel/2+1; - } else { - return try; - } - } - return NULL; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/div.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/div.c deleted file mode 100644 index e42c1f14f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/div.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -div_t div(int num, int den) -{ - return (div_t){ num/den, num%den }; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/ecvt.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/ecvt.c deleted file mode 100644 index fad5391e6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/ecvt.c +++ /dev/null @@ -1,21 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include "printf.h" - -char *ecvt(double x, int n, int *dp, int *sign) -{ - static char buf[16]; - char tmp[32]; - int i, j; - - if (n-1U > 15) n = 15; - sprintf(tmp, "%.*e", n-1, x); - i = *sign = (tmp[0]=='-'); - for (j=0; tmp[i]!='e'; j+=(tmp[i++]!='.')) - buf[j] = tmp[i]; - buf[j] = 0; - *dp = atoi(tmp+i+1)+1; - - return buf; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/fcvt.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/fcvt.c deleted file mode 100644 index 59ead8c38..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/fcvt.c +++ /dev/null @@ -1,26 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include "printf.h" - -char *fcvt(double x, int n, int *dp, int *sign) -{ - char tmp[1500]; - int i, lz; - - if (n > 1400U) n = 1400; - sprintf(tmp, "%.*f", n, x); - i = (tmp[0] == '-'); - if (tmp[i] == '0') lz = strspn(tmp+i+2, "0"); - else lz = -(int)strcspn(tmp+i, "."); - - if (n<=lz) { - *sign = i; - *dp = 1; - if (n>14U) n = 14; - return "000000000000000"+14-n; - } - - return ecvt(x, n-lz, dp, sign); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/gcvt.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/gcvt.c deleted file mode 100644 index bd5e19c82..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/gcvt.c +++ /dev/null @@ -1,10 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include "printf.h" - -char *gcvt(double x, int n, char *b) -{ - sprintf(b, "%.*g", n, x); - return b; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxabs.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxabs.c deleted file mode 100644 index 810018193..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxabs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -intmax_t imaxabs(intmax_t a) -{ - return a>0 ? a : -a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxdiv.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxdiv.c deleted file mode 100644 index b2ce821f5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxdiv.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -imaxdiv_t imaxdiv(intmax_t num, intmax_t den) -{ - return (imaxdiv_t){ num/den, num%den }; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/labs.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/labs.c deleted file mode 100644 index 83ddb1475..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/labs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long labs(long a) -{ - return a>0 ? a : -a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/ldiv.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/ldiv.c deleted file mode 100644 index 36eb960b0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/ldiv.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -ldiv_t ldiv(long num, long den) -{ - return (ldiv_t){ num/den, num%den }; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/llabs.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/llabs.c deleted file mode 100644 index 9dfaf5cf7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/llabs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -long long llabs(long long a) -{ - return a>0 ? a : -a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/lldiv.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/lldiv.c deleted file mode 100644 index 7aaf7a0e6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/lldiv.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -lldiv_t lldiv(long long num, long long den) -{ - return (lldiv_t){ num/den, num%den }; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort.c deleted file mode 100644 index 314ddc29d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort.c +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright (C) 2011 by Valentin Ochs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/* Minor changes by Rich Felker for integration in musl, 2011-04-27. */ - -/* Smoothsort, an adaptive variant of Heapsort. Memory usage: O(1). - Run time: Worst case O(n log n), close to O(n) in the mostly-sorted case. */ - -#define _BSD_SOURCE -#include -#include -#include - -#include "atomic.h" -#define ntz(x) a_ctz_l((x)) - -typedef int (*cmpfun)(const void *, const void *, void *); - -static inline int pntz(size_t p[2]) { - int r = ntz(p[0] - 1); - if(r != 0 || (r = 8*sizeof(size_t) + ntz(p[1])) != 8*sizeof(size_t)) { - return r; - } - return 0; -} - -static void cycle(size_t width, unsigned char* ar[], int n) -{ - unsigned char tmp[256]; - size_t l; - int i; - - if(n < 2) { - return; - } - - ar[n] = tmp; - while(width) { - l = sizeof(tmp) < width ? sizeof(tmp) : width; - memcpy(ar[n], ar[0], l); - for(i = 0; i < n; i++) { - memcpy(ar[i], ar[i + 1], l); - ar[i] += l; - } - width -= l; - } -} - -/* shl() and shr() need n > 0 */ -static inline void shl(size_t p[2], int n) -{ - if(n >= 8 * sizeof(size_t)) { - n -= 8 * sizeof(size_t); - p[1] = p[0]; - p[0] = 0; - } - p[1] <<= n; - p[1] |= p[0] >> (sizeof(size_t) * 8 - n); - p[0] <<= n; -} - -static inline void shr(size_t p[2], int n) -{ - if(n >= 8 * sizeof(size_t)) { - n -= 8 * sizeof(size_t); - p[0] = p[1]; - p[1] = 0; - } - p[0] >>= n; - p[0] |= p[1] << (sizeof(size_t) * 8 - n); - p[1] >>= n; -} - -static void sift(unsigned char *head, size_t width, cmpfun cmp, void *arg, int pshift, size_t lp[]) -{ - unsigned char *rt, *lf; - unsigned char *ar[14 * sizeof(size_t) + 1]; - int i = 1; - - ar[0] = head; - while(pshift > 1) { - rt = head - width; - lf = head - width - lp[pshift - 2]; - - if(cmp(ar[0], lf, arg) >= 0 && cmp(ar[0], rt, arg) >= 0) { - break; - } - if(cmp(lf, rt, arg) >= 0) { - ar[i++] = lf; - head = lf; - pshift -= 1; - } else { - ar[i++] = rt; - head = rt; - pshift -= 2; - } - } - cycle(width, ar, i); -} - -static void trinkle(unsigned char *head, size_t width, cmpfun cmp, void *arg, size_t pp[2], int pshift, int trusty, size_t lp[]) -{ - unsigned char *stepson, - *rt, *lf; - size_t p[2]; - unsigned char *ar[14 * sizeof(size_t) + 1]; - int i = 1; - int trail; - - p[0] = pp[0]; - p[1] = pp[1]; - - ar[0] = head; - while(p[0] != 1 || p[1] != 0) { - stepson = head - lp[pshift]; - if(cmp(stepson, ar[0], arg) <= 0) { - break; - } - if(!trusty && pshift > 1) { - rt = head - width; - lf = head - width - lp[pshift - 2]; - if(cmp(rt, stepson, arg) >= 0 || cmp(lf, stepson, arg) >= 0) { - break; - } - } - - ar[i++] = stepson; - head = stepson; - trail = pntz(p); - shr(p, trail); - pshift += trail; - trusty = 0; - } - if(!trusty) { - cycle(width, ar, i); - sift(head, width, cmp, arg, pshift, lp); - } -} - -void __qsort_r(void *base, size_t nel, size_t width, cmpfun cmp, void *arg) -{ - size_t lp[12*sizeof(size_t)]; - size_t i, size = width * nel; - unsigned char *head, *high; - size_t p[2] = {1, 0}; - int pshift = 1; - int trail; - - if (!size) return; - - head = base; - high = head + size - width; - - /* Precompute Leonardo numbers, scaled by element width */ - for(lp[0]=lp[1]=width, i=2; (lp[i]=lp[i-2]+lp[i-1]+width) < size; i++); - - while(head < high) { - if((p[0] & 3) == 3) { - sift(head, width, cmp, arg, pshift, lp); - shr(p, 2); - pshift += 2; - } else { - if(lp[pshift - 1] >= high - head) { - trinkle(head, width, cmp, arg, p, pshift, 0, lp); - } else { - sift(head, width, cmp, arg, pshift, lp); - } - - if(pshift == 1) { - shl(p, 1); - pshift = 0; - } else { - shl(p, pshift - 1); - pshift = 1; - } - } - - p[0] |= 1; - head += width; - } - - trinkle(head, width, cmp, arg, p, pshift, 0, lp); - - while(pshift != 1 || p[0] != 1 || p[1] != 0) { - if(pshift <= 1) { - trail = pntz(p); - shr(p, trail); - pshift += trail; - } else { - shl(p, 2); - pshift -= 2; - p[0] ^= 7; - shr(p, 1); - trinkle(head - lp[pshift] - width, width, cmp, arg, p, pshift + 1, 1, lp); - shl(p, 1); - p[0] |= 1; - trinkle(head - width, width, cmp, arg, p, pshift, 1, lp); - } - head -= width; - } -} - -weak_alias(__qsort_r, qsort_r); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort_nr.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort_nr.c deleted file mode 100644 index 8ffe71d03..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort_nr.c +++ /dev/null @@ -1,14 +0,0 @@ -#define _BSD_SOURCE -#include - -typedef int (*cmpfun)(const void *, const void *); - -static int wrapper_cmp(const void *v1, const void *v2, void *cmp) -{ - return ((cmpfun)cmp)(v1, v2); -} - -void qsort(void *base, size_t nel, size_t width, cmpfun cmp) -{ - __qsort_r(base, nel, width, wrapper_cmp, (void *)cmp); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtod.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtod.c deleted file mode 100644 index 39b9daada..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtod.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "shgetc.h" -#include "floatscan.h" -#include "stdio_impl.h" - -static long double strtox(const char *s, char **p, int prec) -{ - FILE f; - sh_fromstring(&f, s); - shlim(&f, 0); - long double y = __floatscan(&f, prec, 1); - off_t cnt = shcnt(&f); - if (p) *p = cnt ? (char *)s + cnt : (char *)s; - return y; -} - -float strtof(const char *restrict s, char **restrict p) -{ - return strtox(s, p, 0); -} - -double strtod(const char *restrict s, char **restrict p) -{ - return strtox(s, p, 1); -} - -long double strtold(const char *restrict s, char **restrict p) -{ - return strtox(s, p, 2); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtol.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtol.c deleted file mode 100644 index bfefea69d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtol.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "stdio_impl.h" -#include "intscan.h" -#include "shgetc.h" -#include -#include -#include - -static unsigned long long strtox(const char *s, char **p, int base, unsigned long long lim) -{ - FILE f; - sh_fromstring(&f, s); - shlim(&f, 0); - unsigned long long y = __intscan(&f, base, 1, lim); - if (p) { - size_t cnt = shcnt(&f); - *p = (char *)s + cnt; - } - return y; -} - -unsigned long long strtoull(const char *restrict s, char **restrict p, int base) -{ - return strtox(s, p, base, ULLONG_MAX); -} - -long long strtoll(const char *restrict s, char **restrict p, int base) -{ - return strtox(s, p, base, LLONG_MIN); -} - -unsigned long strtoul(const char *restrict s, char **restrict p, int base) -{ - return strtox(s, p, base, ULONG_MAX); -} - -long strtol(const char *restrict s, char **restrict p, int base) -{ - return strtox(s, p, base, 0UL+LONG_MIN); -} - -intmax_t strtoimax(const char *restrict s, char **restrict p, int base) -{ - return strtoll(s, p, base); -} - -uintmax_t strtoumax(const char *restrict s, char **restrict p, int base) -{ - return strtoull(s, p, base); -} - -weak_alias(strtol, __strtol_internal); -weak_alias(strtoul, __strtoul_internal); -weak_alias(strtoll, __strtoll_internal); -weak_alias(strtoull, __strtoull_internal); -weak_alias(strtoimax, __strtoimax_internal); -weak_alias(strtoumax, __strtoumax_internal); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/wcstod.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/wcstod.c deleted file mode 100644 index 0deb7010b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/wcstod.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "shgetc.h" -#include "floatscan.h" -#include "stdio_impl.h" -#include -#include - -/* This read function heavily cheats. It knows: - * (1) len will always be 1 - * (2) non-ascii characters don't matter */ - -static size_t do_read(FILE *f, unsigned char *buf, size_t len) -{ - size_t i; - const wchar_t *wcs = f->cookie; - - if (!wcs[0]) wcs=L"@"; - for (i=0; ibuf_size && wcs[i]; i++) - f->buf[i] = wcs[i] < 128 ? wcs[i] : '@'; - f->rpos = f->buf; - f->rend = f->buf + i; - f->cookie = (void *)(wcs+i); - - if (i && len) { - *buf = *f->rpos++; - return 1; - } - return 0; -} - -static long double wcstox(const wchar_t *s, wchar_t **p, int prec) -{ - wchar_t *t = (wchar_t *)s; - unsigned char buf[64]; - FILE f = {0}; - f.flags = 0; - f.rpos = f.rend = f.buf = buf + 4; - f.buf_size = sizeof buf - 4; - f.lock = -1; - f.read = do_read; - while (iswspace(*t)) t++; - f.cookie = (void *)t; - shlim(&f, 0); - long double y = __floatscan(&f, prec, 1); - if (p) { - size_t cnt = shcnt(&f); - *p = cnt ? t + cnt : (wchar_t *)s; - } - return y; -} - -float wcstof(const wchar_t *restrict s, wchar_t **restrict p) -{ - return wcstox(s, p, 0); -} - -double wcstod(const wchar_t *restrict s, wchar_t **restrict p) -{ - return wcstox(s, p, 1); -} - -long double wcstold(const wchar_t *restrict s, wchar_t **restrict p) -{ - return wcstox(s, p, 2); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/wcstol.c b/src/hyperlight_guest_bin/third_party/musl/src/stdlib/wcstol.c deleted file mode 100644 index 1eeb495fd..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/stdlib/wcstol.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "stdio_impl.h" -#include "intscan.h" -#include "shgetc.h" -#include -#include -#include -#include - -/* This read function heavily cheats. It knows: - * (1) len will always be 1 - * (2) non-ascii characters don't matter */ - -static size_t do_read(FILE *f, unsigned char *buf, size_t len) -{ - size_t i; - const wchar_t *wcs = f->cookie; - - if (!wcs[0]) wcs=L"@"; - for (i=0; ibuf_size && wcs[i]; i++) - f->buf[i] = wcs[i] < 128 ? wcs[i] : '@'; - f->rpos = f->buf; - f->rend = f->buf + i; - f->cookie = (void *)(wcs+i); - - if (i && len) { - *buf = *f->rpos++; - return 1; - } - return 0; -} - -static unsigned long long wcstox(const wchar_t *s, wchar_t **p, int base, unsigned long long lim) -{ - wchar_t *t = (wchar_t *)s; - unsigned char buf[64]; - FILE f = {0}; - f.flags = 0; - f.rpos = f.rend = f.buf = buf + 4; - f.buf_size = sizeof buf - 4; - f.lock = -1; - f.read = do_read; - while (iswspace(*t)) t++; - f.cookie = (void *)t; - shlim(&f, 0); - unsigned long long y = __intscan(&f, base, 1, lim); - if (p) { - size_t cnt = shcnt(&f); - *p = cnt ? t + cnt : (wchar_t *)s; - } - return y; -} - -unsigned long long wcstoull(const wchar_t *restrict s, wchar_t **restrict p, int base) -{ - return wcstox(s, p, base, ULLONG_MAX); -} - -long long wcstoll(const wchar_t *restrict s, wchar_t **restrict p, int base) -{ - return wcstox(s, p, base, LLONG_MIN); -} - -unsigned long wcstoul(const wchar_t *restrict s, wchar_t **restrict p, int base) -{ - return wcstox(s, p, base, ULONG_MAX); -} - -long wcstol(const wchar_t *restrict s, wchar_t **restrict p, int base) -{ - return wcstox(s, p, base, 0UL+LONG_MIN); -} - -intmax_t wcstoimax(const wchar_t *restrict s, wchar_t **restrict p, int base) -{ - return wcstoll(s, p, base); -} - -uintmax_t wcstoumax(const wchar_t *restrict s, wchar_t **restrict p, int base) -{ - return wcstoull(s, p, base); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/bcmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/bcmp.c deleted file mode 100644 index 87c6007ee..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/bcmp.c +++ /dev/null @@ -1,8 +0,0 @@ -#define _BSD_SOURCE -#include -#include - -int bcmp(const void *s1, const void *s2, size_t n) -{ - return memcmp(s1, s2, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/bcopy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/bcopy.c deleted file mode 100644 index a07129f50..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/bcopy.c +++ /dev/null @@ -1,8 +0,0 @@ -#define _BSD_SOURCE -#include -#include - -void bcopy(const void *s1, void *s2, size_t n) -{ - memmove(s2, s1, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/bzero.c b/src/hyperlight_guest_bin/third_party/musl/src/string/bzero.c deleted file mode 100644 index ba536b07e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/bzero.c +++ /dev/null @@ -1,8 +0,0 @@ -#define _BSD_SOURCE -#include -#include - -void bzero(void *s, size_t n) -{ - memset(s, 0, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/explicit_bzero.c b/src/hyperlight_guest_bin/third_party/musl/src/string/explicit_bzero.c deleted file mode 100644 index f2e12f237..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/explicit_bzero.c +++ /dev/null @@ -1,8 +0,0 @@ -#define _BSD_SOURCE -#include - -void explicit_bzero(void *d, size_t n) -{ - d = memset(d, 0, n); - __asm__ __volatile__ ("" : : "r"(d) : "memory"); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/index.c b/src/hyperlight_guest_bin/third_party/musl/src/string/index.c deleted file mode 100644 index 252948f9f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/index.c +++ /dev/null @@ -1,8 +0,0 @@ -#define _BSD_SOURCE -#include -#include - -char *index(const char *s, int c) -{ - return strchr(s, c); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memccpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memccpy.c deleted file mode 100644 index 3b0a37002..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memccpy.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include - -#define ALIGN (sizeof(size_t)-1) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n) -{ - unsigned char *d = dest; - const unsigned char *s = src; - - c = (unsigned char)c; -#ifdef __GNUC__ - typedef size_t __attribute__((__may_alias__)) word; - word *wd; - const word *ws; - if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { - for (; ((uintptr_t)s & ALIGN) && n && (*d=*s)!=c; n--, s++, d++); - if ((uintptr_t)s & ALIGN) goto tail; - size_t k = ONES * c; - wd=(void *)d; ws=(const void *)s; - for (; n>=sizeof(size_t) && !HASZERO(*ws^k); - n-=sizeof(size_t), ws++, wd++) *wd = *ws; - d=(void *)wd; s=(const void *)ws; - } -#endif - for (; n && (*d=*s)!=c; n--, s++, d++); -tail: - if (n) return d+1; - return 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memchr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memchr.c deleted file mode 100644 index 65f0d789b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memchr.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - -#define SS (sizeof(size_t)) -#define ALIGN (sizeof(size_t)-1) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -void *memchr(const void *src, int c, size_t n) -{ - const unsigned char *s = src; - c = (unsigned char)c; -#ifdef __GNUC__ - for (; ((uintptr_t)s & ALIGN) && n && *s != c; s++, n--); - if (n && *s != c) { - typedef size_t __attribute__((__may_alias__)) word; - const word *w; - size_t k = ONES * c; - for (w = (const void *)s; n>=SS && !HASZERO(*w^k); w++, n-=SS); - s = (const void *)w; - } -#endif - for (; n && *s != c; s++, n--); - return n ? (void *)s : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memcmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memcmp.c deleted file mode 100644 index bdbce9f0f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memcmp.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int memcmp(const void *vl, const void *vr, size_t n) -{ - const unsigned char *l=vl, *r=vr; - for (; n && *l == *r; n--, l++, r++); - return n ? *l-*r : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memcpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memcpy.c deleted file mode 100644 index 06e88742b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memcpy.c +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include - -void *memcpy(void *restrict dest, const void *restrict src, size_t n) -{ - unsigned char *d = dest; - const unsigned char *s = src; - -#ifdef __GNUC__ - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define LS >> -#define RS << -#else -#define LS << -#define RS >> -#endif - - typedef uint32_t __attribute__((__may_alias__)) u32; - uint32_t w, x; - - for (; (uintptr_t)s % 4 && n; n--) *d++ = *s++; - - if ((uintptr_t)d % 4 == 0) { - for (; n>=16; s+=16, d+=16, n-=16) { - *(u32 *)(d+0) = *(u32 *)(s+0); - *(u32 *)(d+4) = *(u32 *)(s+4); - *(u32 *)(d+8) = *(u32 *)(s+8); - *(u32 *)(d+12) = *(u32 *)(s+12); - } - if (n&8) { - *(u32 *)(d+0) = *(u32 *)(s+0); - *(u32 *)(d+4) = *(u32 *)(s+4); - d += 8; s += 8; - } - if (n&4) { - *(u32 *)(d+0) = *(u32 *)(s+0); - d += 4; s += 4; - } - if (n&2) { - *d++ = *s++; *d++ = *s++; - } - if (n&1) { - *d = *s; - } - return dest; - } - - if (n >= 32) switch ((uintptr_t)d % 4) { - case 1: - w = *(u32 *)s; - *d++ = *s++; - *d++ = *s++; - *d++ = *s++; - n -= 3; - for (; n>=17; s+=16, d+=16, n-=16) { - x = *(u32 *)(s+1); - *(u32 *)(d+0) = (w LS 24) | (x RS 8); - w = *(u32 *)(s+5); - *(u32 *)(d+4) = (x LS 24) | (w RS 8); - x = *(u32 *)(s+9); - *(u32 *)(d+8) = (w LS 24) | (x RS 8); - w = *(u32 *)(s+13); - *(u32 *)(d+12) = (x LS 24) | (w RS 8); - } - break; - case 2: - w = *(u32 *)s; - *d++ = *s++; - *d++ = *s++; - n -= 2; - for (; n>=18; s+=16, d+=16, n-=16) { - x = *(u32 *)(s+2); - *(u32 *)(d+0) = (w LS 16) | (x RS 16); - w = *(u32 *)(s+6); - *(u32 *)(d+4) = (x LS 16) | (w RS 16); - x = *(u32 *)(s+10); - *(u32 *)(d+8) = (w LS 16) | (x RS 16); - w = *(u32 *)(s+14); - *(u32 *)(d+12) = (x LS 16) | (w RS 16); - } - break; - case 3: - w = *(u32 *)s; - *d++ = *s++; - n -= 1; - for (; n>=19; s+=16, d+=16, n-=16) { - x = *(u32 *)(s+3); - *(u32 *)(d+0) = (w LS 8) | (x RS 24); - w = *(u32 *)(s+7); - *(u32 *)(d+4) = (x LS 8) | (w RS 24); - x = *(u32 *)(s+11); - *(u32 *)(d+8) = (w LS 8) | (x RS 24); - w = *(u32 *)(s+15); - *(u32 *)(d+12) = (x LS 8) | (w RS 24); - } - break; - } - if (n&16) { - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - } - if (n&8) { - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - } - if (n&4) { - *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; - } - if (n&2) { - *d++ = *s++; *d++ = *s++; - } - if (n&1) { - *d = *s; - } - return dest; -#endif - - for (; n; n--) *d++ = *s++; - return dest; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memmem.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memmem.c deleted file mode 100644 index 11eff86e4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memmem.c +++ /dev/null @@ -1,149 +0,0 @@ -#define _GNU_SOURCE -#include -#include - -static char *twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) -{ - uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1]; - for (h+=2, k-=2; k; k--, hw = hw<<8 | *h++) - if (hw == nw) return (char *)h-2; - return hw == nw ? (char *)h-2 : 0; -} - -static char *threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) -{ - uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8; - uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8; - for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8) - if (hw == nw) return (char *)h-3; - return hw == nw ? (char *)h-3 : 0; -} - -static char *fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) -{ - uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3]; - uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3]; - for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++) - if (hw == nw) return (char *)h-4; - return hw == nw ? (char *)h-4 : 0; -} - -#define MAX(a,b) ((a)>(b)?(a):(b)) -#define MIN(a,b) ((a)<(b)?(a):(b)) - -#define BITOP(a,b,op) \ - ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) - -static char *twoway_memmem(const unsigned char *h, const unsigned char *z, const unsigned char *n, size_t l) -{ - size_t i, ip, jp, k, p, ms, p0, mem, mem0; - size_t byteset[32 / sizeof(size_t)] = { 0 }; - size_t shift[256]; - - /* Computing length of needle and fill shift table */ - for (i=0; i n[jp+k]) { - jp += k; - k = 1; - p = jp - ip; - } else { - ip = jp++; - k = p = 1; - } - } - ms = ip; - p0 = p; - - /* And with the opposite comparison */ - ip = -1; jp = 0; k = p = 1; - while (jp+k ms+1) ms = ip; - else p = p0; - - /* Periodic needle? */ - if (memcmp(n, n+p, ms+1)) { - mem0 = 0; - p = MAX(ms, l-ms-1) + 1; - } else mem0 = l-p; - mem = 0; - - /* Search loop */ - for (;;) { - /* If remainder of haystack is shorter than needle, done */ - if (z-h < l) return 0; - - /* Check last byte first; advance by shift on mismatch */ - if (BITOP(byteset, h[l-1], &)) { - k = l-shift[h[l-1]]; - if (k) { - if (k < mem) k = mem; - h += k; - mem = 0; - continue; - } - } else { - h += l; - mem = 0; - continue; - } - - /* Compare right half */ - for (k=MAX(ms+1,mem); kmem && n[k-1] == h[k-1]; k--); - if (k <= mem) return (char *)h; - h += p; - mem = mem0; - } -} - -void *memmem(const void *h0, size_t k, const void *n0, size_t l) -{ - const unsigned char *h = h0, *n = n0; - - /* Return immediately on empty needle */ - if (!l) return (void *)h; - - /* Return immediately when needle is longer than haystack */ - if (k -#include - -#ifdef __GNUC__ -typedef __attribute__((__may_alias__)) size_t WT; -#define WS (sizeof(WT)) -#endif - -void *memmove(void *dest, const void *src, size_t n) -{ - char *d = dest; - const char *s = src; - - if (d==s) return d; - if ((uintptr_t)s-(uintptr_t)d-n <= -2*n) return memcpy(d, s, n); - - if (d=WS; n-=WS, d+=WS, s+=WS) *(WT *)d = *(WT *)s; - } -#endif - for (; n; n--) *d++ = *s++; - } else { -#ifdef __GNUC__ - if ((uintptr_t)s % WS == (uintptr_t)d % WS) { - while ((uintptr_t)(d+n) % WS) { - if (!n--) return dest; - d[n] = s[n]; - } - while (n>=WS) n-=WS, *(WT *)(d+n) = *(WT *)(s+n); - } -#endif - while (n) n--, d[n] = s[n]; - } - - return dest; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/mempcpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/mempcpy.c deleted file mode 100644 index a297985e6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/mempcpy.c +++ /dev/null @@ -1,7 +0,0 @@ -#define _GNU_SOURCE -#include - -void *mempcpy(void *dest, const void *src, size_t n) -{ - return (char *)memcpy(dest, src, n) + n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memrchr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memrchr.c deleted file mode 100644 index e51748b80..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memrchr.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void *__memrchr(const void *m, int c, size_t n) -{ - const unsigned char *s = m; - c = (unsigned char)c; - while (n--) if (s[n]==c) return (void *)(s+n); - return 0; -} - -weak_alias(__memrchr, memrchr); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/memset.c b/src/hyperlight_guest_bin/third_party/musl/src/string/memset.c deleted file mode 100644 index 5613a1486..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/memset.c +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include - -void *memset(void *dest, int c, size_t n) -{ - unsigned char *s = dest; - size_t k; - - /* Fill head and tail with minimal branching. Each - * conditional ensures that all the subsequently used - * offsets are well-defined and in the dest region. */ - - if (!n) return dest; - s[0] = c; - s[n-1] = c; - if (n <= 2) return dest; - s[1] = c; - s[2] = c; - s[n-2] = c; - s[n-3] = c; - if (n <= 6) return dest; - s[3] = c; - s[n-4] = c; - if (n <= 8) return dest; - - /* Advance pointer to align it at a 4-byte boundary, - * and truncate n to a multiple of 4. The previous code - * already took care of any head/tail that get cut off - * by the alignment. */ - - k = -(uintptr_t)s & 3; - s += k; - n -= k; - n &= -4; - -#ifdef __GNUC__ - typedef uint32_t __attribute__((__may_alias__)) u32; - typedef uint64_t __attribute__((__may_alias__)) u64; - - u32 c32 = ((u32)-1)/255 * (unsigned char)c; - - /* In preparation to copy 32 bytes at a time, aligned on - * an 8-byte bounary, fill head/tail up to 28 bytes each. - * As in the initial byte-based head/tail fill, each - * conditional below ensures that the subsequent offsets - * are valid (e.g. !(n<=24) implies n>=28). */ - - *(u32 *)(s+0) = c32; - *(u32 *)(s+n-4) = c32; - if (n <= 8) return dest; - *(u32 *)(s+4) = c32; - *(u32 *)(s+8) = c32; - *(u32 *)(s+n-12) = c32; - *(u32 *)(s+n-8) = c32; - if (n <= 24) return dest; - *(u32 *)(s+12) = c32; - *(u32 *)(s+16) = c32; - *(u32 *)(s+20) = c32; - *(u32 *)(s+24) = c32; - *(u32 *)(s+n-28) = c32; - *(u32 *)(s+n-24) = c32; - *(u32 *)(s+n-20) = c32; - *(u32 *)(s+n-16) = c32; - - /* Align to a multiple of 8 so we can fill 64 bits at a time, - * and avoid writing the same bytes twice as much as is - * practical without introducing additional branching. */ - - k = 24 + ((uintptr_t)s & 4); - s += k; - n -= k; - - /* If this loop is reached, 28 tail bytes have already been - * filled, so any remainder when n drops below 32 can be - * safely ignored. */ - - u64 c64 = c32 | ((u64)c32 << 32); - for (; n >= 32; n-=32, s+=32) { - *(u64 *)(s+0) = c64; - *(u64 *)(s+8) = c64; - *(u64 *)(s+16) = c64; - *(u64 *)(s+24) = c64; - } -#else - /* Pure C fallback with no aliasing violations. */ - for (; n; n--, s++) *s = c; -#endif - - return dest; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/rindex.c b/src/hyperlight_guest_bin/third_party/musl/src/string/rindex.c deleted file mode 100644 index 693c750b6..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/rindex.c +++ /dev/null @@ -1,8 +0,0 @@ -#define _BSD_SOURCE -#include -#include - -char *rindex(const char *s, int c) -{ - return strrchr(s, c); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/stpcpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/stpcpy.c deleted file mode 100644 index 4db46a9e5..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/stpcpy.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -#define ALIGN (sizeof(size_t)) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -char *__stpcpy(char *restrict d, const char *restrict s) -{ -#ifdef __GNUC__ - typedef size_t __attribute__((__may_alias__)) word; - word *wd; - const word *ws; - if ((uintptr_t)s % ALIGN == (uintptr_t)d % ALIGN) { - for (; (uintptr_t)s % ALIGN; s++, d++) - if (!(*d=*s)) return d; - wd=(void *)d; ws=(const void *)s; - for (; !HASZERO(*ws); *wd++ = *ws++); - d=(void *)wd; s=(const void *)ws; - } -#endif - for (; (*d=*s); s++, d++); - - return d; -} - -weak_alias(__stpcpy, stpcpy); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/stpncpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/stpncpy.c deleted file mode 100644 index f57fa6b71..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/stpncpy.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include - -#define ALIGN (sizeof(size_t)-1) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -char *__stpncpy(char *restrict d, const char *restrict s, size_t n) -{ -#ifdef __GNUC__ - typedef size_t __attribute__((__may_alias__)) word; - word *wd; - const word *ws; - if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { - for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); - if (!n || !*s) goto tail; - wd=(void *)d; ws=(const void *)s; - for (; n>=sizeof(size_t) && !HASZERO(*ws); - n-=sizeof(size_t), ws++, wd++) *wd = *ws; - d=(void *)wd; s=(const void *)ws; - } -#endif - for (; n && (*d=*s); n--, s++, d++); -tail: - memset(d, 0, n); - return d; -} - -weak_alias(__stpncpy, stpncpy); - diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strcasecmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strcasecmp.c deleted file mode 100644 index 002c6aa15..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strcasecmp.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int strcasecmp(const char *_l, const char *_r) -{ - const unsigned char *l=(void *)_l, *r=(void *)_r; - for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++); - return tolower(*l) - tolower(*r); -} - -int __strcasecmp_l(const char *l, const char *r, locale_t loc) -{ - return strcasecmp(l, r); -} - -weak_alias(__strcasecmp_l, strcasecmp_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strcasestr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strcasestr.c deleted file mode 100644 index af109f361..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strcasestr.c +++ /dev/null @@ -1,9 +0,0 @@ -#define _GNU_SOURCE -#include - -char *strcasestr(const char *h, const char *n) -{ - size_t l = strlen(n); - for (; *h; h++) if (!strncasecmp(h, n, l)) return (char *)h; - return 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strcat.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strcat.c deleted file mode 100644 index 33f749b1d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strcat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -char *strcat(char *restrict dest, const char *restrict src) -{ - strcpy(dest + strlen(dest), src); - return dest; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strchr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strchr.c deleted file mode 100644 index 3cbc828be..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strchr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -char *strchr(const char *s, int c) -{ - char *r = __strchrnul(s, c); - return *(unsigned char *)r == (unsigned char)c ? r : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strchrnul.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strchrnul.c deleted file mode 100644 index 39e2635b3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strchrnul.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include - -#define ALIGN (sizeof(size_t)) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -char *__strchrnul(const char *s, int c) -{ - c = (unsigned char)c; - if (!c) return (char *)s + strlen(s); - -#ifdef __GNUC__ - typedef size_t __attribute__((__may_alias__)) word; - const word *w; - for (; (uintptr_t)s % ALIGN; s++) - if (!*s || *(unsigned char *)s == c) return (char *)s; - size_t k = ONES * c; - for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w^k); w++); - s = (void *)w; -#endif - for (; *s && *(unsigned char *)s != c; s++); - return (char *)s; -} - -weak_alias(__strchrnul, strchrnul); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strcmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strcmp.c deleted file mode 100644 index 808bd8370..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strcmp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int strcmp(const char *l, const char *r) -{ - for (; *l==*r && *l; l++, r++); - return *(unsigned char *)l - *(unsigned char *)r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strcpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strcpy.c deleted file mode 100644 index 6668a1295..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strcpy.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -char *strcpy(char *restrict dest, const char *restrict src) -{ - __stpcpy(dest, src); - return dest; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strcspn.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strcspn.c deleted file mode 100644 index a0c617bd7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strcspn.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#define BITOP(a,b,op) \ - ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) - -size_t strcspn(const char *s, const char *c) -{ - const char *a = s; - size_t byteset[32/sizeof(size_t)]; - - if (!c[0] || !c[1]) return __strchrnul(s, *c)-a; - - memset(byteset, 0, sizeof byteset); - for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++); - for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++); - return s-a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strdup.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strdup.c deleted file mode 100644 index d4c274494..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strdup.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -char *strdup(const char *s) -{ - size_t l = strlen(s); - char *d = malloc(l+1); - if (!d) return NULL; - return memcpy(d, s, l+1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strerror_r.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strerror_r.c deleted file mode 100644 index 1dc88bb16..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strerror_r.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -int strerror_r(int err, char *buf, size_t buflen) -{ - char *msg = strerror(err); - size_t l = strlen(msg); - if (l >= buflen) { - if (buflen) { - memcpy(buf, msg, buflen-1); - buf[buflen-1] = 0; - } - return ERANGE; - } - memcpy(buf, msg, l+1); - return 0; -} - -weak_alias(strerror_r, __xpg_strerror_r); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strlcat.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strlcat.c deleted file mode 100644 index ef81209e3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strlcat.c +++ /dev/null @@ -1,9 +0,0 @@ -#define _BSD_SOURCE -#include - -size_t strlcat(char *d, const char *s, size_t n) -{ - size_t l = strnlen(d, n); - if (l == n) return l + strlen(s); - return l + strlcpy(d+l, s, n-l); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strlcpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strlcpy.c deleted file mode 100644 index ffa0b0b01..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strlcpy.c +++ /dev/null @@ -1,34 +0,0 @@ -#define _BSD_SOURCE -#include -#include -#include - -#define ALIGN (sizeof(size_t)-1) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -size_t strlcpy(char *d, const char *s, size_t n) -{ - char *d0 = d; - size_t *wd; - - if (!n--) goto finish; -#ifdef __GNUC__ - typedef size_t __attribute__((__may_alias__)) word; - const word *ws; - if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { - for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); - if (n && *s) { - wd=(void *)d; ws=(const void *)s; - for (; n>=sizeof(size_t) && !HASZERO(*ws); - n-=sizeof(size_t), ws++, wd++) *wd = *ws; - d=(void *)wd; s=(const void *)ws; - } - } -#endif - for (; n && (*d=*s); n--, s++, d++); - *d = 0; -finish: - return d-d0 + strlen(s); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strlen.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strlen.c deleted file mode 100644 index 309990f02..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strlen.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include - -#define ALIGN (sizeof(size_t)) -#define ONES ((size_t)-1/UCHAR_MAX) -#define HIGHS (ONES * (UCHAR_MAX/2+1)) -#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) - -size_t strlen(const char *s) -{ - const char *a = s; -#ifdef __GNUC__ - typedef size_t __attribute__((__may_alias__)) word; - const word *w; - for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a; - for (w = (const void *)s; !HASZERO(*w); w++); - s = (const void *)w; -#endif - for (; *s; s++); - return s-a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strncasecmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strncasecmp.c deleted file mode 100644 index e0ef93c20..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strncasecmp.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -int strncasecmp(const char *_l, const char *_r, size_t n) -{ - const unsigned char *l=(void *)_l, *r=(void *)_r; - if (!n--) return 0; - for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--); - return tolower(*l) - tolower(*r); -} - -int __strncasecmp_l(const char *l, const char *r, size_t n, locale_t loc) -{ - return strncasecmp(l, r, n); -} - -weak_alias(__strncasecmp_l, strncasecmp_l); diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strncat.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strncat.c deleted file mode 100644 index 01ca2a231..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strncat.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -char *strncat(char *restrict d, const char *restrict s, size_t n) -{ - char *a = d; - d += strlen(d); - while (n && *s) n--, *d++ = *s++; - *d++ = 0; - return a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strncmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strncmp.c deleted file mode 100644 index e228843f0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strncmp.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int strncmp(const char *_l, const char *_r, size_t n) -{ - const unsigned char *l=(void *)_l, *r=(void *)_r; - if (!n--) return 0; - for (; *l && *r && n && *l == *r ; l++, r++, n--); - return *l - *r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strncpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strncpy.c deleted file mode 100644 index 545892e6e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strncpy.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -char *strncpy(char *restrict d, const char *restrict s, size_t n) -{ - __stpncpy(d, s, n); - return d; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strndup.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strndup.c deleted file mode 100644 index 617d27ba9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strndup.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -char *strndup(const char *s, size_t n) -{ - size_t l = strnlen(s, n); - char *d = malloc(l+1); - if (!d) return NULL; - memcpy(d, s, l); - d[l] = 0; - return d; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strnlen.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strnlen.c deleted file mode 100644 index 6442eb793..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strnlen.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -size_t strnlen(const char *s, size_t n) -{ - const char *p = memchr(s, 0, n); - return p ? p-s : n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strpbrk.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strpbrk.c deleted file mode 100644 index 55947c641..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strpbrk.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -char *strpbrk(const char *s, const char *b) -{ - s += strcspn(s, b); - return *s ? (char *)s : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strrchr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strrchr.c deleted file mode 100644 index 98ad1b045..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strrchr.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -char *strrchr(const char *s, int c) -{ - return __memrchr(s, c, strlen(s) + 1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strsep.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strsep.c deleted file mode 100644 index cb37c32eb..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strsep.c +++ /dev/null @@ -1,13 +0,0 @@ -#define _GNU_SOURCE -#include - -char *strsep(char **str, const char *sep) -{ - char *s = *str, *end; - if (!s) return NULL; - end = s + strcspn(s, sep); - if (*end) *end++ = 0; - else end = 0; - *str = end; - return s; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strspn.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strspn.c deleted file mode 100644 index 9543dad09..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strspn.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -#define BITOP(a,b,op) \ - ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) - -size_t strspn(const char *s, const char *c) -{ - const char *a = s; - size_t byteset[32/sizeof(size_t)] = { 0 }; - - if (!c[0]) return 0; - if (!c[1]) { - for (; *s == *c; s++); - return s-a; - } - - for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++); - for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++); - return s-a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strstr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strstr.c deleted file mode 100644 index 96657bc23..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strstr.c +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include - -static char *twobyte_strstr(const unsigned char *h, const unsigned char *n) -{ - uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1]; - for (h++; *h && hw != nw; hw = hw<<8 | *++h); - return *h ? (char *)h-1 : 0; -} - -static char *threebyte_strstr(const unsigned char *h, const unsigned char *n) -{ - uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8; - uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8; - for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8); - return *h ? (char *)h-2 : 0; -} - -static char *fourbyte_strstr(const unsigned char *h, const unsigned char *n) -{ - uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3]; - uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3]; - for (h+=3; *h && hw != nw; hw = hw<<8 | *++h); - return *h ? (char *)h-3 : 0; -} - -#define MAX(a,b) ((a)>(b)?(a):(b)) -#define MIN(a,b) ((a)<(b)?(a):(b)) - -#define BITOP(a,b,op) \ - ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) - -static char *twoway_strstr(const unsigned char *h, const unsigned char *n) -{ - const unsigned char *z; - size_t l, ip, jp, k, p, ms, p0, mem, mem0; - size_t byteset[32 / sizeof(size_t)] = { 0 }; - size_t shift[256]; - - /* Computing length of needle and fill shift table */ - for (l=0; n[l] && h[l]; l++) - BITOP(byteset, n[l], |=), shift[n[l]] = l+1; - if (n[l]) return 0; /* hit the end of h */ - - /* Compute maximal suffix */ - ip = -1; jp = 0; k = p = 1; - while (jp+k n[jp+k]) { - jp += k; - k = 1; - p = jp - ip; - } else { - ip = jp++; - k = p = 1; - } - } - ms = ip; - p0 = p; - - /* And with the opposite comparison */ - ip = -1; jp = 0; k = p = 1; - while (jp+k ms+1) ms = ip; - else p = p0; - - /* Periodic needle? */ - if (memcmp(n, n+p, ms+1)) { - mem0 = 0; - p = MAX(ms, l-ms-1) + 1; - } else mem0 = l-p; - mem = 0; - - /* Initialize incremental end-of-haystack pointer */ - z = h; - - /* Search loop */ - for (;;) { - /* Update incremental end-of-haystack pointer */ - if (z-h < l) { - /* Fast estimate for MAX(l,63) */ - size_t grow = l | 63; - const unsigned char *z2 = memchr(z, 0, grow); - if (z2) { - z = z2; - if (z-h < l) return 0; - } else z += grow; - } - - /* Check last byte first; advance by shift on mismatch */ - if (BITOP(byteset, h[l-1], &)) { - k = l-shift[h[l-1]]; - if (k) { - if (k < mem) k = mem; - h += k; - mem = 0; - continue; - } - } else { - h += l; - mem = 0; - continue; - } - - /* Compare right half */ - for (k=MAX(ms+1,mem); n[k] && n[k] == h[k]; k++); - if (n[k]) { - h += k-ms; - mem = 0; - continue; - } - /* Compare left half */ - for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--); - if (k <= mem) return (char *)h; - h += p; - mem = mem0; - } -} - -char *strstr(const char *h, const char *n) -{ - /* Return immediately on empty needle */ - if (!n[0]) return (char *)h; - - /* Use faster algorithms for short needles */ - h = strchr(h, *n); - if (!h || !n[1]) return (char *)h; - if (!h[1]) return 0; - if (!n[2]) return twobyte_strstr((void *)h, (void *)n); - if (!h[2]) return 0; - if (!n[3]) return threebyte_strstr((void *)h, (void *)n); - if (!h[3]) return 0; - if (!n[4]) return fourbyte_strstr((void *)h, (void *)n); - - return twoway_strstr((void *)h, (void *)n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strtok.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strtok.c deleted file mode 100644 index 35087902d..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strtok.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -char *strtok(char *restrict s, const char *restrict sep) -{ - static char *p; - if (!s && !(s = p)) return NULL; - s += strspn(s, sep); - if (!*s) return p = 0; - p = s + strcspn(s, sep); - if (*p) *p++ = 0; - else p = 0; - return s; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strtok_r.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strtok_r.c deleted file mode 100644 index 862d4fe48..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strtok_r.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -char *strtok_r(char *restrict s, const char *restrict sep, char **restrict p) -{ - if (!s && !(s = *p)) return NULL; - s += strspn(s, sep); - if (!*s) return *p = 0; - *p = s + strcspn(s, sep); - if (**p) *(*p)++ = 0; - else *p = 0; - return s; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/strverscmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/strverscmp.c deleted file mode 100644 index 16c1da224..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/strverscmp.c +++ /dev/null @@ -1,34 +0,0 @@ -#define _GNU_SOURCE -#include -#include - -int strverscmp(const char *l0, const char *r0) -{ - const unsigned char *l = (const void *)l0; - const unsigned char *r = (const void *)r0; - size_t i, dp, j; - int z = 1; - - /* Find maximal matching prefix and track its maximal digit - * suffix and whether those digits are all zeros. */ - for (dp=i=0; l[i]==r[i]; i++) { - int c = l[i]; - if (!c) return 0; - if (!isdigit(c)) dp=i+1, z=1; - else if (c!='0') z=0; - } - - if (l[dp]-'1'<9U && r[dp]-'1'<9U) { - /* If we're looking at non-degenerate digit sequences starting - * with nonzero digits, longest digit string is greater. */ - for (j=i; isdigit(l[j]); j++) - if (!isdigit(r[j])) return 1; - if (isdigit(r[j])) return -1; - } else if (z && dp - -wchar_t *wcpcpy(wchar_t *restrict d, const wchar_t *restrict s) -{ - return wcscpy(d, s) + wcslen(s); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcpncpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcpncpy.c deleted file mode 100644 index b667f6d6a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcpncpy.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -wchar_t *wcpncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) -{ - return wcsncpy(d, s, n) + wcsnlen(s, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp.c deleted file mode 100644 index 3edeec7d3..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int wcscasecmp(const wchar_t *l, const wchar_t *r) -{ - return wcsncasecmp(l, r, -1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp_l.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp_l.c deleted file mode 100644 index 065dd0aad..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp_l.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int wcscasecmp_l(const wchar_t *l, const wchar_t *r, locale_t locale) -{ - return wcscasecmp(l, r); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscat.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcscat.c deleted file mode 100644 index d4f00ebdf..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -wchar_t *wcscat(wchar_t *restrict dest, const wchar_t *restrict src) -{ - wcscpy(dest + wcslen(dest), src); - return dest; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcschr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcschr.c deleted file mode 100644 index 8dfc2f318..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcschr.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -wchar_t *wcschr(const wchar_t *s, wchar_t c) -{ - if (!c) return (wchar_t *)s + wcslen(s); - for (; *s && *s != c; s++); - return *s ? (wchar_t *)s : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcscmp.c deleted file mode 100644 index 286ec3ea4..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscmp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int wcscmp(const wchar_t *l, const wchar_t *r) -{ - for (; *l==*r && *l && *r; l++, r++); - return *l < *r ? -1 : *l > *r; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcscpy.c deleted file mode 100644 index 625bf53d0..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscpy.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -wchar_t *wcscpy(wchar_t *restrict d, const wchar_t *restrict s) -{ - wchar_t *a = d; - while ((*d++ = *s++)); - return a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscspn.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcscspn.c deleted file mode 100644 index c4e52722e..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcscspn.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -size_t wcscspn(const wchar_t *s, const wchar_t *c) -{ - const wchar_t *a; - if (!c[0]) return wcslen(s); - if (!c[1]) return (s=wcschr(a=s, *c)) ? s-a : wcslen(a); - for (a=s; *s && !wcschr(c, *s); s++); - return s-a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsdup.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsdup.c deleted file mode 100644 index f398e8091..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsdup.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -wchar_t *wcsdup(const wchar_t *s) -{ - size_t l = wcslen(s); - wchar_t *d = malloc((l+1)*sizeof(wchar_t)); - if (!d) return NULL; - return wmemcpy(d, s, l+1); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcslen.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcslen.c deleted file mode 100644 index 1b7b66550..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcslen.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -size_t wcslen(const wchar_t *s) -{ - const wchar_t *a; - for (a=s; *s; s++); - return s-a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp.c deleted file mode 100644 index 8fefe799c..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -int wcsncasecmp(const wchar_t *l, const wchar_t *r, size_t n) -{ - if (!n--) return 0; - for (; *l && *r && n && (*l == *r || towlower(*l) == towlower(*r)); l++, r++, n--); - return towlower(*l) - towlower(*r); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp_l.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp_l.c deleted file mode 100644 index 638724819..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp_l.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int wcsncasecmp_l(const wchar_t *l, const wchar_t *r, size_t n, locale_t locale) -{ - return wcsncasecmp(l, r, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncat.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncat.c deleted file mode 100644 index 8563f1a2a..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncat.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -wchar_t *wcsncat(wchar_t *restrict d, const wchar_t *restrict s, size_t n) -{ - wchar_t *a = d; - d += wcslen(d); - while (n && *s) n--, *d++ = *s++; - *d++ = 0; - return a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncmp.c deleted file mode 100644 index 2b3558bf7..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncmp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n) -{ - for (; n && *l==*r && *l && *r; n--, l++, r++); - return n ? (*l < *r ? -1 : *l > *r) : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncpy.c deleted file mode 100644 index 4bede04d2..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsncpy.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -wchar_t *wcsncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) -{ - wchar_t *a = d; - while (n && *s) n--, *d++ = *s++; - wmemset(d, 0, n); - return a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsnlen.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsnlen.c deleted file mode 100644 index a77633731..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsnlen.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -size_t wcsnlen(const wchar_t *s, size_t n) -{ - const wchar_t *z = wmemchr(s, 0, n); - if (z) n = z-s; - return n; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcspbrk.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcspbrk.c deleted file mode 100644 index 0c72c197b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcspbrk.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -wchar_t *wcspbrk(const wchar_t *s, const wchar_t *b) -{ - s += wcscspn(s, b); - return *s ? (wchar_t *)s : NULL; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsrchr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsrchr.c deleted file mode 100644 index 8961b9e2f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsrchr.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -wchar_t *wcsrchr(const wchar_t *s, wchar_t c) -{ - const wchar_t *p; - for (p=s+wcslen(s); p>=s && *p!=c; p--); - return p>=s ? (wchar_t *)p : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsspn.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsspn.c deleted file mode 100644 index 4320d8f6b..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsspn.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -size_t wcsspn(const wchar_t *s, const wchar_t *c) -{ - const wchar_t *a; - for (a=s; *s && wcschr(c, *s); s++); - return s-a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsstr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcsstr.c deleted file mode 100644 index 4caaef3c9..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcsstr.c +++ /dev/null @@ -1,105 +0,0 @@ -#include - -#define MAX(a,b) ((a)>(b)?(a):(b)) -#define MIN(a,b) ((a)<(b)?(a):(b)) - -static wchar_t *twoway_wcsstr(const wchar_t *h, const wchar_t *n) -{ - const wchar_t *z; - size_t l, ip, jp, k, p, ms, p0, mem, mem0; - - /* Computing length of needle */ - for (l=0; n[l] && h[l]; l++); - if (n[l]) return 0; /* hit the end of h */ - - /* Compute maximal suffix */ - ip = -1; jp = 0; k = p = 1; - while (jp+k n[jp+k]) { - jp += k; - k = 1; - p = jp - ip; - } else { - ip = jp++; - k = p = 1; - } - } - ms = ip; - p0 = p; - - /* And with the opposite comparison */ - ip = -1; jp = 0; k = p = 1; - while (jp+k ms+1) ms = ip; - else p = p0; - - /* Periodic needle? */ - if (wmemcmp(n, n+p, ms+1)) { - mem0 = 0; - p = MAX(ms, l-ms-1) + 1; - } else mem0 = l-p; - mem = 0; - - /* Initialize incremental end-of-haystack pointer */ - z = h; - - /* Search loop */ - for (;;) { - /* Update incremental end-of-haystack pointer */ - if (z-h < l) { - /* Fast estimate for MIN(l,63) */ - size_t grow = l | 63; - const wchar_t *z2 = wmemchr(z, 0, grow); - if (z2) { - z = z2; - if (z-h < l) return 0; - } else z += grow; - } - - /* Compare right half */ - for (k=MAX(ms+1,mem); n[k] && n[k] == h[k]; k++); - if (n[k]) { - h += k-ms; - mem = 0; - continue; - } - /* Compare left half */ - for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--); - if (k <= mem) return (wchar_t *)h; - h += p; - mem = mem0; - } -} - -wchar_t *wcsstr(const wchar_t *restrict h, const wchar_t *restrict n) -{ - /* Return immediately on empty needle or haystack */ - if (!n[0]) return (wchar_t *)h; - if (!h[0]) return 0; - - /* Use faster algorithms for short needles */ - h = wcschr(h, *n); - if (!h || !n[1]) return (wchar_t *)h; - if (!h[1]) return 0; - - return twoway_wcsstr(h, n); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcstok.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcstok.c deleted file mode 100644 index ecc803319..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcstok.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -wchar_t *wcstok(wchar_t *restrict s, const wchar_t *restrict sep, wchar_t **restrict p) -{ - if (!s && !(s = *p)) return NULL; - s += wcsspn(s, sep); - if (!*s) return *p = 0; - *p = s + wcscspn(s, sep); - if (**p) *(*p)++ = 0; - else *p = 0; - return s; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wcswcs.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wcswcs.c deleted file mode 100644 index 9cfe4ac40..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wcswcs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -wchar_t *wcswcs(const wchar_t *haystack, const wchar_t *needle) -{ - return wcsstr(haystack, needle); -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemchr.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wmemchr.c deleted file mode 100644 index 2bc2c2702..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemchr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n) -{ - for (; n && *s != c; n--, s++); - return n ? (wchar_t *)s : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemcmp.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wmemcmp.c deleted file mode 100644 index 717d77b17..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemcmp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n) -{ - for (; n && *l==*r; n--, l++, r++); - return n ? (*l < *r ? -1 : *l > *r) : 0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemcpy.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wmemcpy.c deleted file mode 100644 index 52e6e6e07..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemcpy.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -wchar_t *wmemcpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) -{ - wchar_t *a = d; - while (n--) *d++ = *s++; - return a; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemmove.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wmemmove.c deleted file mode 100644 index 964c90329..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemmove.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n) -{ - wchar_t *d0 = d; - if (d == s) return d; - if ((uintptr_t)d-(uintptr_t)s < n * sizeof *d) - while (n--) d[n] = s[n]; - else - while (n--) *d++ = *s++; - return d0; -} diff --git a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemset.c b/src/hyperlight_guest_bin/third_party/musl/src/string/wmemset.c deleted file mode 100644 index 07a037a0f..000000000 --- a/src/hyperlight_guest_bin/third_party/musl/src/string/wmemset.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -wchar_t *wmemset(wchar_t *d, wchar_t c, size_t n) -{ - wchar_t *ret = d; - while (n--) *d++ = c; - return ret; -} diff --git a/src/hyperlight_guest_bin/third_party/picolibc b/src/hyperlight_guest_bin/third_party/picolibc new file mode 160000 index 000000000..e60f45b1a --- /dev/null +++ b/src/hyperlight_guest_bin/third_party/picolibc @@ -0,0 +1 @@ +Subproject commit e60f45b1a614281dec6c058e01947844827ea14e diff --git a/src/hyperlight_guest_bin/third_party/printf/.gitattributes b/src/hyperlight_guest_bin/third_party/printf/.gitattributes deleted file mode 100644 index eef9aef0e..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# ignore test path -test/* linguist-vendored diff --git a/src/hyperlight_guest_bin/third_party/printf/.travis.yml b/src/hyperlight_guest_bin/third_party/printf/.travis.yml deleted file mode 100644 index f86e44493..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Use a C++11 distro -dist: trusty -sudo: required - -# Enable C++ support -language: cpp - -# Compiler selection -compiler: gcc - -env: - global: - # coverity key - - secure: "NKZbBnMALGIIQJy/s2kc3EST/stw+gjhtrGq0jkbsWr7Wx3FH+lmLeHNsDXRnD1VbpG02c5YsLllqz9OVu+0yxWGepvKNmCz1cNITIALEHbrax8/Af9LzPRL/QZxS/Qe11sMuySp4X16mFBUyxMd/X+I9i96Xf1vKkZABklYD1Q=" - -# addons -addons: - apt: - packages: - - gcc-6 - - g++-6 - sources: - - ubuntu-toolchain-r-test - - coverity_scan: - project: - name: "mpaland/printf" - description: "Tiny printf implementation" - notification_email: marco@paland.com - build_command_prepend: "make clean" - build_command: "make" - branch_pattern: master - -before_install: - # connect coverity - - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - -# Active branches -branches: - only: - - master - -script: - # Link gcc-6 and g++-6 to their standard commands - - sudo rm /usr/bin/gcc - - sudo rm /usr/bin/g++ - - sudo ln -s /usr/bin/gcc-6 /usr/bin/gcc - - sudo ln -s /usr/bin/g++-6 /usr/bin/g++ - # Export CC and CXX - - export CC=/usr/bin/gcc-6 - - export CXX=/usr/bin/g++-6 - # Check versions of gcc, g++ - - gcc -v && g++ -v - # Run build commands - - make - # execute the text suite - - bin/test_suite -d yes - # coverall profiling - - tmp/cov/test_suite - -after_success: - ## Report to codecov - - bash <(curl -s https://codecov.io/bash) diff --git a/src/hyperlight_guest_bin/third_party/printf/LICENSE b/src/hyperlight_guest_bin/third_party/printf/LICENSE deleted file mode 100644 index 8f7ebd0b9..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Marco Paland - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/src/hyperlight_guest_bin/third_party/printf/Makefile b/src/hyperlight_guest_bin/third_party/printf/Makefile deleted file mode 100644 index 9dba1f0b4..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/Makefile +++ /dev/null @@ -1,271 +0,0 @@ -# ------------------------------------------------------------------------------ -# -# Generic Makefile -# -# Copyright Marco Paland 2007 - 2017 -# Distributed under the MIT License -# -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Paths -# ------------------------------------------------------------------------------ -PATH_TOOLS_CC = /usr/bin/ -PATH_TOOLS_CC_LIB = /usr/lib/ -PATH_TOOLS_UTIL = - -PATH_BIN = bin -PATH_TMP = tmp -PATH_NUL = /dev/null -PATH_OBJ = $(PATH_TMP)/obj -PATH_LST = $(PATH_TMP)/lst -PATH_ERR = $(PATH_TMP)/err -PATH_PRE = $(PATH_TMP)/pre -PATH_COV = $(PATH_TMP)/cov - - -# ------------------------------------------------------------------------------ -# Application to build -# ------------------------------------------------------------------------------ - -APP = test_suite - - -# ----------------------------------------------------------------------------- -# Project file list -# Format is: -# FILES_PRJ = file1 \ -# foo/file2 \ -# bar/file3 -# ----------------------------------------------------------------------------- - -FILES_PRJ = test/test_suite - - -# ------------------------------------------------------------------------------ -# Additional include files and compiler defines -# Format is: -# C_INCLUDES = -Iinclude_path1 \ -# -Iinclude_path2 \ -# -Iinclude_path3 \ -# ------------------------------------------------------------------------------ - -C_INCLUDES = - -C_DEFINES = - - -# ------------------------------------------------------------------------------ -# The target name and location -# ------------------------------------------------------------------------------ -TRG = $(PATH_BIN)/$(APP) - - -# ------------------------------------------------------------------------------ -# object files -# ------------------------------------------------------------------------------ -FILES_TMP = $(FILES_PRJ) -FILES_O = $(addsuffix .o, $(FILES_TMP)) - - -# ------------------------------------------------------------------------------ -# VPATH definition -# -# VPATH is required for the maker to find the C-/ASM-Source files. -# Extract the directory/module names from the file list with the dir -# command and remove the duplicated directory names with the sort command. -# FILES_PRJ is listed first to make sure that the source files in the project -# directory are searched first. -# ------------------------------------------------------------------------------ -VPATH := $(sort $(dir $(FILES_TMP))) - - -# ------------------------------------------------------------------------------ -# Development tools -# ------------------------------------------------------------------------------ -AR = $(PATH_TOOLS_CC)ar -AS = $(PATH_TOOLS_CC)g++ -CC = $(PATH_TOOLS_CC)g++ -CL = $(PATH_TOOLS_CC)g++ -NM = $(PATH_TOOLS_CC)nm -GCOV = $(PATH_TOOLS_CC)gcov -OBJDUMP = $(PATH_TOOLS_CC)objdump -OBJCOPY = $(PATH_TOOLS_CC)objcopy -READELF = $(PATH_TOOLS_CC)readelf -SIZE = $(PATH_TOOLS_CC)size - -ECHO = $(PATH_TOOLS_UTIL)echo -MAKE = $(PATH_TOOLS_UTIL)make -MKDIR = $(PATH_TOOLS_UTIL)mkdir -RM = $(PATH_TOOLS_UTIL)rm -SED = $(PATH_TOOLS_UTIL)sed - - -# ------------------------------------------------------------------------------ -# Compiler flags for the target architecture -# ------------------------------------------------------------------------------ - -GCCFLAGS = $(C_INCLUDES) \ - $(C_DEFINES) \ - -std=c++11 \ - -g \ - -Wall \ - -pedantic \ - -Wmain \ - -Wundef \ - -Wsign-conversion \ - -Wuninitialized \ - -Wshadow \ - -Wunreachable-code \ - -Wswitch-default \ - -Wswitch \ - -Wcast-align \ - -Wmissing-include-dirs \ - -Winit-self \ - -Wdouble-promotion \ - -gdwarf-2 \ - -fno-exceptions \ - -O2 \ - -ffunction-sections \ - -ffat-lto-objects \ - -fdata-sections \ - -fverbose-asm \ - -Wextra \ - -Wunused-parameter \ - -Wfloat-equal - -CFLAGS = $(GCCFLAGS) \ - -Wunsuffixed-float-constants \ - -x c \ - -std=c99 - -CPPFLAGS = $(GCCFLAGS) \ - -x c++ \ - -fno-rtti \ - -fstrict-enums \ - -fno-use-cxa-atexit \ - -fno-use-cxa-get-exception-ptr \ - -fno-nonansi-builtins \ - -fno-threadsafe-statics \ - -fno-enforce-eh-specs \ - -ftemplate-depth-64 \ - -fexceptions - -AFLAGS = $(GCCFLAGS) \ - -x assembler - -LFLAGS = $(GCCFLAGS) \ - -x none \ - -Wl,--gc-sections - -# ------------------------------------------------------------------------------ -# Targets -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Main-Dependencies (app: all) -# ------------------------------------------------------------------------------ -.PHONY: all -all: clean_prj $(TRG) $(TRG)_nm.txt - - -# ------------------------------------------------------------------------------ -# Main-Dependencies (app: rebuild) -# ------------------------------------------------------------------------------ -.PHONY: rebuild -rebuild: clean $(TRG) $(TRG)_nm.txt - - -# ------------------------------------------------------------------------------ -# clean project -# ------------------------------------------------------------------------------ -.PHONY: clean_prj -clean_prj: - @-$(ECHO) +++ cleaning project - @-$(RM) -rf $(PATH_BIN) 2> $(PATH_NUL) - @-$(MKDIR) -p $(PATH_BIN) - @-$(MKDIR) -p $(PATH_OBJ) - @-$(MKDIR) -p $(PATH_ERR) - @-$(MKDIR) -p $(PATH_LST) - @-$(MKDIR) -p $(PATH_PRE) - @-$(MKDIR) -p $(PATH_COV) - - -# ------------------------------------------------------------------------------ -# clean all -# ------------------------------------------------------------------------------ -.PHONY: clean -clean: - @-$(ECHO) +++ cleaning all - @-$(RM) -rf $(PATH_BIN) 2> $(PATH_NUL) - @-$(RM) -rf $(PATH_TMP) 2> $(PATH_NUL) - @-$(MKDIR) -p $(PATH_BIN) - @-$(MKDIR) -p $(PATH_OBJ) - @-$(MKDIR) -p $(PATH_ERR) - @-$(MKDIR) -p $(PATH_LST) - @-$(MKDIR) -p $(PATH_COV) - - -# ------------------------------------------------------------------------------ -# print the GNUmake version and the compiler version -# ------------------------------------------------------------------------------ -.PHONY: version -version: - # Print the GNU make version and the compiler version - @$(ECHO) GNUmake version: - @$(MAKE) --version - @$(ECHO) GCC version: - @$(CL) -v - - -# ------------------------------------------------------------------------------ -# Rules -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Link/locate application -# ------------------------------------------------------------------------------ -$(TRG) : $(FILES_O) - @-$(ECHO) +++ linkink application to generate: $(TRG) - @-$(CL) $(LFLAGS) -L. -lc $(PATH_OBJ)/*.o -Wl,-Map,$(TRG).map -o $(TRG) - # profiling - @-$(CL) $(LFLAGS) -L. -lc $(PATH_COV)/*.o --coverage -o $(PATH_COV)/$(APP) - - -# ------------------------------------------------------------------------------ -# parse the object files to obtain symbol information, and create a size summary -# ------------------------------------------------------------------------------ -$(TRG)_nm.txt : $(TRG) - @-$(ECHO) +++ parsing symbols with nm to generate: $(TRG)_nm.txt - @-$(NM) --numeric-sort --print-size $(TRG) > $(TRG)_nm.txt - @-$(ECHO) +++ demangling symbols with c++filt to generate: $(TRG)_cppfilt.txt - @-$(NM) --numeric-sort --print-size $(TRG) | $(CPPFILT) > $(TRG)_cppfilt.txt - @-$(ECHO) +++ creating size summary table with size to generate: $(TRG)_size.txt - @-$(SIZE) -A -t $(TRG) > $(TRG)_size.txt - - -%.o : %.cpp - @$(ECHO) +++ compile: $< - # Compile the source file - # ...and Reformat (using sed) any possible error/warning messages for the VisualStudio(R) output window - # ...and Create an assembly listing using objdump - # ...and Generate a dependency file (using the -MM flag) - @-$(CL) $(CPPFLAGS) $< -E -o $(PATH_PRE)/$(basename $(@F)).pre - @-$(CL) $(CPPFLAGS) $< -c -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err - @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err - @-$(OBJDUMP) --disassemble --line-numbers -S $(PATH_OBJ)/$(basename $(@F)).o > $(PATH_LST)/$(basename $(@F)).lst - @-$(CL) $(CPPFLAGS) $< -MM > $(PATH_OBJ)/$(basename $(@F)).d - # profiling - @-$(CL) $(CPPFLAGS) -O0 --coverage $< -c -o $(PATH_COV)/$(basename $(@F)).o 2> $(PATH_NUL) - -%.o : %.c - @$(ECHO) +++ compile: $< - # Compile the source file - # ...and Reformat (using sed) any possible error/warning messages for the VisualStudio(R) output window - # ...and Create an assembly listing using objdump - # ...and Generate a dependency file (using the -MM flag) - @-$(CL) $(CFLAGS) $< -E -o $(PATH_PRE)/$(basename $(@F)).pre - @-$(CC) $(CFLAGS) $< -c -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err - @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err - @-$(OBJDUMP) -S $(PATH_OBJ)/$(basename $(@F)).o > $(PATH_LST)/$(basename $(@F)).lst - @-$(CC) $(CFLAGS) $< -MM > $(PATH_OBJ)/$(basename $(@F)).d diff --git a/src/hyperlight_guest_bin/third_party/printf/README.md b/src/hyperlight_guest_bin/third_party/printf/README.md deleted file mode 100644 index 51fcd8fb6..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/README.md +++ /dev/null @@ -1,205 +0,0 @@ -# A printf / sprintf Implementation for Embedded Systems - -[![Build Status](https://travis-ci.org/mpaland/printf.svg?branch=master)](https://travis-ci.org/mpaland/printf) -[![codecov](https://codecov.io/gh/mpaland/printf/branch/master/graph/badge.svg)](https://codecov.io/gh/mpaland/printf) -[![Coverity Status](https://img.shields.io/coverity/scan/14180.svg)](https://scan.coverity.com/projects/mpaland-printf) -[![Github Issues](https://img.shields.io/github/issues/mpaland/printf.svg)](http://github.com/mpaland/printf/issues) -[![Github Releases](https://img.shields.io/github/release/mpaland/printf.svg)](https://github.com/mpaland/printf/releases) -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/mpaland/avl_array/master/LICENSE) - -This is a tiny but **fully loaded** printf, sprintf and (v)snprintf implementation. -Primarily designed for usage in embedded systems, where printf is not available due to memory issues or in avoidance of linking against libc. -Using the standard libc printf may pull **a lot** of unwanted library stuff and can bloat code size about 20k or is not 100% thread safe. In this cases the following implementation can be used. -Absolutely **NO dependencies** are required, *printf.c* brings all necessary routines, even its own fast `ftoa` (floating point), `ntoa` (decimal) conversion. - -If memory footprint is really a critical issue, floating point, exponential and 'long long' support and can be turned off via the `PRINTF_DISABLE_SUPPORT_FLOAT`, `PRINTF_DISABLE_SUPPORT_EXPONENTIAL` and `PRINTF_DISABLE_SUPPORT_LONG_LONG` compiler switches. -When using printf (instead of sprintf/snprintf) you have to provide your own `_putchar()` low level function as console/serial output. - - -## Highlights and Design Goals - -There is a boatload of so called 'tiny' printf implementations around. So why this one? -I've tested many implementations, but most of them have very limited flag/specifier support, a lot of other dependencies or are just not standard compliant and failing most of the test suite. -Therefore I decided to write an own, final implementation which meets the following items: - - - Very small implementation (around 600 code lines) - - NO dependencies, no libs, just one module file - - Support of all important flags, width and precision sub-specifiers (see below) - - Support of decimal/floating number representation (with an own fast itoa/ftoa) - - Reentrant and thread-safe, malloc free, no static vars/buffers - - LINT and compiler L4 warning free, mature, coverity clean, automotive ready - - Extensive test suite (> 400 test cases) passing - - Simply the best *printf* around the net - - MIT license - - -## Usage - -Add/link *printf.c* to your project and include *printf.h*. That's it. -Implement your low level output function needed for `printf()`: -```C -void _putchar(char character) -{ - // send char to console etc. -} -``` - -Usage is 1:1 like the according stdio.h library version: -```C -int printf(const char* format, ...); -int sprintf(char* buffer, const char* format, ...); -int snprintf(char* buffer, size_t count, const char* format, ...); -int vsnprintf(char* buffer, size_t count, const char* format, va_list va); - -// use output function (instead of buffer) for streamlike interface -int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...); -``` - -**Due to general security reasons it is highly recommended to prefer and use `snprintf` (with the max buffer size as `count` parameter) instead of `sprintf`.** -`sprintf` has no buffer limitation, so when needed - use it really with care! - -### Streamlike Usage -Besides the regular standard `printf()` functions, this module also provides `fctprintf()`, which takes an output function as first parameter to build a streamlike output like `fprintf()`: -```C -// define the output function -void my_stream_output(char character, void* arg) -{ - // opt. evaluate the argument and send the char somewhere -} - -{ - // in your code - void* arg = (void*)100; // this argument is passed to the output function - fctprintf(&my_stream_output, arg, "This is a test: %X", 0xAA); - fctprintf(&my_stream_output, nullptr, "Send to null dev"); -} -``` - -## Format Specifiers - -A format specifier follows this prototype: `%[flags][width][.precision][length]type` -The following format specifiers are supported: - - -### Supported Types - -| Type | Output | -|--------|--------| -| d or i | Signed decimal integer | -| u | Unsigned decimal integer | -| b | Unsigned binary | -| o | Unsigned octal | -| x | Unsigned hexadecimal integer (lowercase) | -| X | Unsigned hexadecimal integer (uppercase) | -| f or F | Decimal floating point | -| e or E | Scientific-notation (exponential) floating point | -| g or G | Scientific or decimal floating point | -| c | Single character | -| s | String of characters | -| p | Pointer address | -| % | A % followed by another % character will write a single % | - - -### Supported Flags - -| Flags | Description | -|-------|-------------| -| - | Left-justify within the given field width; Right justification is the default. | -| + | Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers.
By default, only negative numbers are preceded with a - sign. | -| (space) | If no sign is going to be written, a blank space is inserted before the value. | -| # | Used with o, b, x or X specifiers the value is preceded with 0, 0b, 0x or 0X respectively for values different than zero.
Used with f, F it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written. | -| 0 | Left-pads the number with zeros (0) instead of spaces when padding is specified (see width sub-specifier). | - - -### Supported Width - -| Width | Description | -|----------|-------------| -| (number) | Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger. | -| * | The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. | - - -### Supported Precision - -| Precision | Description | -|-----------|-------------| -| .number | For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.
For f and F specifiers: this is the number of digits to be printed after the decimal point. **By default, this is 6, maximum is 9**.
For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.
If the period is specified without an explicit value for precision, 0 is assumed. | -| .* | The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. | - - -### Supported Length - -The length sub-specifier modifies the length of the data type. - -| Length | d i | u o x X | -|--------|------|---------| -| (none) | int | unsigned int | -| hh | char | unsigned char | -| h | short int | unsigned short int | -| l | long int | unsigned long int | -| ll | long long int | unsigned long long int (if PRINTF_SUPPORT_LONG_LONG is defined) | -| j | intmax_t | uintmax_t | -| z | size_t | size_t | -| t | ptrdiff_t | ptrdiff_t (if PRINTF_SUPPORT_PTRDIFF_T is defined) | - - -### Return Value - -Upon successful return, all functions return the number of characters written, _excluding_ the terminating null character used to end the string. -Functions `snprintf()` and `vsnprintf()` don't write more than `count` bytes, _including_ the terminating null byte ('\0'). -Anyway, if the output was truncated due to this limit, the return value is the number of characters that _could_ have been written. -Notice that a value equal or larger than `count` indicates a truncation. Only when the returned value is non-negative and less than `count`, -the string has been completely written. -If any error is encountered, `-1` is returned. - -If `buffer` is set to `NULL` (`nullptr`) nothing is written and just the formatted length is returned. -```C -int length = sprintf(NULL, "Hello, world"); // length is set to 12 -``` - - -## Compiler Switches/Defines - -| Name | Default value | Description | -|------|---------------|-------------| -| PRINTF_INCLUDE_CONFIG_H | undefined | Define this as compiler switch (e.g. `gcc -DPRINTF_INCLUDE_CONFIG_H`) to include a "printf_config.h" definition file | -| PRINTF_NTOA_BUFFER_SIZE | 32 | ntoa (integer) conversion buffer size. This must be big enough to hold one converted numeric number _including_ leading zeros, normally 32 is a sufficient value. Created on the stack | -| PRINTF_FTOA_BUFFER_SIZE | 32 | ftoa (float) conversion buffer size. This must be big enough to hold one converted float number _including_ leading zeros, normally 32 is a sufficient value. Created on the stack | -| PRINTF_DEFAULT_FLOAT_PRECISION | 6 | Define the default floating point precision | -| PRINTF_MAX_FLOAT | 1e9 | Define the largest suitable value to be printed with %f, before using exponential representation | -| PRINTF_DISABLE_SUPPORT_FLOAT | undefined | Define this to disable floating point (%f) support | -| PRINTF_DISABLE_SUPPORT_EXPONENTIAL | undefined | Define this to disable exponential floating point (%e) support | -| PRINTF_DISABLE_SUPPORT_LONG_LONG | undefined | Define this to disable long long (%ll) support | -| PRINTF_DISABLE_SUPPORT_PTRDIFF_T | undefined | Define this to disable ptrdiff_t (%t) support | - - -## Caveats -None anymore (finally). - - -## Test Suite -For testing just compile, build and run the test suite located in `test/test_suite.cpp`. This uses the [catch](https://github.com/catchorg/Catch2) framework for unit-tests, which is auto-adding main(). -Running with the `--wait-for-keypress exit` option waits for the enter key after test end. - - -## Projects Using printf -- [turnkeyboard](https://github.com/mpaland/turnkeyboard) uses printf as log and generic tty (formatting) output. -- printf is part of [embeddedartistry/libc](https://github.com/embeddedartistry/libc), a libc targeted for embedded systems usage. -- The [Hatchling Platform]( https://github.com/adrian3git/HatchlingPlatform) uses printf. -(Just send me a mail/issue/PR to get *your* project listed here) - - -## Contributing - -0. Give this project a :star: -1. Create an issue and describe your idea -2. [Fork it](https://github.com/mpaland/printf/fork) -3. Create your feature branch (`git checkout -b my-new-feature`) -4. Commit your changes (`git commit -am 'Add some feature'`) -5. Publish the branch (`git push origin my-new-feature`) -6. Create a new pull request -7. Profit! :heavy_check_mark: - - -## License -printf is written under the [MIT license](http://www.opensource.org/licenses/MIT). diff --git a/src/hyperlight_guest_bin/third_party/printf/codecov.yml b/src/hyperlight_guest_bin/third_party/printf/codecov.yml deleted file mode 100644 index cece49d24..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/codecov.yml +++ /dev/null @@ -1,2 +0,0 @@ -ignore: - - "test" # ignore the test folder diff --git a/src/hyperlight_guest_bin/third_party/printf/printf.c b/src/hyperlight_guest_bin/third_party/printf/printf.c deleted file mode 100644 index f72ddf610..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/printf.c +++ /dev/null @@ -1,912 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// \author (c) Marco Paland (info@paland.com) -// 2014-2019, PALANDesign Hannover, Germany -// -// \license The MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// \brief Tiny printf, sprintf and (v)snprintf implementation, optimized for speed on -// embedded systems with a very limited resources. These routines are thread -// safe and reentrant! -// Use this instead of the bloated standard/newlib printf cause these use -// malloc for printf (and may not be thread safe). -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include - -#include "printf.h" - - -// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the -// printf_config.h header file -// default: undefined -#ifdef PRINTF_INCLUDE_CONFIG_H -#include "printf_config.h" -#endif - - -// 'ntoa' conversion buffer size, this must be big enough to hold one converted -// numeric number including padded zeros (dynamically created on stack) -// default: 32 byte -#ifndef PRINTF_NTOA_BUFFER_SIZE -#define PRINTF_NTOA_BUFFER_SIZE 32U -#endif - -// 'ftoa' conversion buffer size, this must be big enough to hold one converted -// float number including padded zeros (dynamically created on stack) -// default: 32 byte -#ifndef PRINTF_FTOA_BUFFER_SIZE -#define PRINTF_FTOA_BUFFER_SIZE 32U -#endif - -// support for the floating point type (%f) -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_FLOAT -#define PRINTF_SUPPORT_FLOAT -#endif - -// support for exponential floating point notation (%e/%g) -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL -#define PRINTF_SUPPORT_EXPONENTIAL -#endif - -// define the default floating point precision -// default: 6 digits -#ifndef PRINTF_DEFAULT_FLOAT_PRECISION -#define PRINTF_DEFAULT_FLOAT_PRECISION 6U -#endif - -// define the largest float suitable to print with %f -// default: 1e9 -#ifndef PRINTF_MAX_FLOAT -#define PRINTF_MAX_FLOAT 1e9 -#endif - -// support for the long long types (%llu or %p) -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_LONG_LONG -#define PRINTF_SUPPORT_LONG_LONG -#endif - -// support for the ptrdiff_t type (%t) -// ptrdiff_t is normally defined in as long or long long type -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_PTRDIFF_T -#define PRINTF_SUPPORT_PTRDIFF_T -#endif - -/////////////////////////////////////////////////////////////////////////////// - -// internal flag definitions -#define FLAGS_ZEROPAD (1U << 0U) -#define FLAGS_LEFT (1U << 1U) -#define FLAGS_PLUS (1U << 2U) -#define FLAGS_SPACE (1U << 3U) -#define FLAGS_HASH (1U << 4U) -#define FLAGS_UPPERCASE (1U << 5U) -#define FLAGS_CHAR (1U << 6U) -#define FLAGS_SHORT (1U << 7U) -#define FLAGS_LONG (1U << 8U) -#define FLAGS_LONG_LONG (1U << 9U) -#define FLAGS_PRECISION (1U << 10U) -#define FLAGS_ADAPT_EXP (1U << 11U) - - -// import float.h for DBL_MAX -#if defined(PRINTF_SUPPORT_FLOAT) -#include -#endif - - -// output function type -typedef void (*out_fct_type)(char character, void* buffer, size_t idx, size_t maxlen); - - -// wrapper (used as buffer) for output function type -typedef struct { - void (*fct)(char character, void* arg); - void* arg; -} out_fct_wrap_type; - - -// internal buffer output -static inline void _out_buffer(char character, void* buffer, size_t idx, size_t maxlen) -{ - if (idx < maxlen) { - ((char*)buffer)[idx] = character; - } -} - - -// internal null output -static inline void _out_null(char character, void* buffer, size_t idx, size_t maxlen) -{ - (void)character; (void)buffer; (void)idx; (void)maxlen; -} - - -// internal _putchar wrapper -static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen) -{ - (void)buffer; (void)idx; (void)maxlen; - _putchar(character); -} - - -// internal output function wrapper -static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen) -{ - (void)idx; (void)maxlen; - if (character) { - // buffer is the output fct pointer - ((out_fct_wrap_type*)buffer)->fct(character, ((out_fct_wrap_type*)buffer)->arg); - } -} - - -// internal secure strlen -// \return The length of the string (excluding the terminating 0) limited by 'maxsize' -static inline unsigned int _strnlen_s(const char* str, size_t maxsize) -{ - const char* s; - for (s = str; *s && maxsize--; ++s); - return (unsigned int)(s - str); -} - - -// internal test if char is a digit (0-9) -// \return true if char is a digit -static inline bool _is_digit(char ch) -{ - return (ch >= '0') && (ch <= '9'); -} - - -// internal ASCII string to unsigned int conversion -static unsigned int _atoi(const char** str) -{ - unsigned int i = 0U; - while (_is_digit(**str)) { - i = i * 10U + (unsigned int)(*((*str)++) - '0'); - } - return i; -} - - -// output the specified string in reverse, taking care of any zero-padding -static size_t _out_rev(out_fct_type out, char* buffer, size_t idx, size_t maxlen, const char* buf, size_t len, unsigned int width, unsigned int flags) -{ - const size_t start_idx = idx; - - // pad spaces up to given width - if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) { - for (size_t i = len; i < width; i++) { - out(' ', buffer, idx++, maxlen); - } - } - - // reverse string - while (len) { - out(buf[--len], buffer, idx++, maxlen); - } - - // append pad spaces up to given width - if (flags & FLAGS_LEFT) { - while (idx - start_idx < width) { - out(' ', buffer, idx++, maxlen); - } - } - - return idx; -} - - -// internal itoa format -static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t maxlen, char* buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) -{ - // pad leading zeros - if (!(flags & FLAGS_LEFT)) { - if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { - width--; - } - while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = '0'; - } - while ((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = '0'; - } - } - - // handle hash - if (flags & FLAGS_HASH) { - if (!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) { - len--; - if (len && (base == 16U)) { - len--; - } - } - if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = 'x'; - } - else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = 'X'; - } - else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = 'b'; - } - if (len < PRINTF_NTOA_BUFFER_SIZE) { - buf[len++] = '0'; - } - } - - if (len < PRINTF_NTOA_BUFFER_SIZE) { - if (negative) { - buf[len++] = '-'; - } - else if (flags & FLAGS_PLUS) { - buf[len++] = '+'; // ignore the space if the '+' exists - } - else if (flags & FLAGS_SPACE) { - buf[len++] = ' '; - } - } - - return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); -} - - -// internal itoa for 'long' type -static size_t _ntoa_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) -{ - char buf[PRINTF_NTOA_BUFFER_SIZE]; - size_t len = 0U; - - // no hash for 0 values - if (!value) { - flags &= ~FLAGS_HASH; - } - - // write if precision != 0 and value is != 0 - if (!(flags & FLAGS_PRECISION) || value) { - do { - const char digit = (char)(value % base); - buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; - value /= base; - } while (value && (len < PRINTF_NTOA_BUFFER_SIZE)); - } - - return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags); -} - - -// internal itoa for 'long long' type -#if defined(PRINTF_SUPPORT_LONG_LONG) -static size_t _ntoa_long_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen, unsigned long long value, bool negative, unsigned long long base, unsigned int prec, unsigned int width, unsigned int flags) -{ - char buf[PRINTF_NTOA_BUFFER_SIZE]; - size_t len = 0U; - - // no hash for 0 values - if (!value) { - flags &= ~FLAGS_HASH; - } - - // write if precision != 0 and value is != 0 - if (!(flags & FLAGS_PRECISION) || value) { - do { - const char digit = (char)(value % base); - buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; - value /= base; - } while (value && (len < PRINTF_NTOA_BUFFER_SIZE)); - } - - return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags); -} -#endif // PRINTF_SUPPORT_LONG_LONG - - -#if defined(PRINTF_SUPPORT_FLOAT) - -#if defined(PRINTF_SUPPORT_EXPONENTIAL) -// forward declaration so that _ftoa can switch to exp notation for values > PRINTF_MAX_FLOAT -static size_t _etoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags); -#endif - - -// internal ftoa for fixed decimal floating point -static size_t _ftoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags) -{ - char buf[PRINTF_FTOA_BUFFER_SIZE]; - size_t len = 0U; - double diff = 0.0; - - // powers of 10 - static const double pow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; - - // test for special values - if (value != value) - return _out_rev(out, buffer, idx, maxlen, "nan", 3, width, flags); - if (value < -DBL_MAX) - return _out_rev(out, buffer, idx, maxlen, "fni-", 4, width, flags); - if (value > DBL_MAX) - return _out_rev(out, buffer, idx, maxlen, (flags & FLAGS_PLUS) ? "fni+" : "fni", (flags & FLAGS_PLUS) ? 4U : 3U, width, flags); - - // test for very large values - // standard printf behavior is to print EVERY whole number digit -- which could be 100s of characters overflowing your buffers == bad - if ((value > PRINTF_MAX_FLOAT) || (value < -PRINTF_MAX_FLOAT)) { -#if defined(PRINTF_SUPPORT_EXPONENTIAL) - return _etoa(out, buffer, idx, maxlen, value, prec, width, flags); -#else - return 0U; -#endif - } - - // test for negative - bool negative = false; - if (value < 0) { - negative = true; - value = 0 - value; - } - - // set default precision, if not set explicitly - if (!(flags & FLAGS_PRECISION)) { - prec = PRINTF_DEFAULT_FLOAT_PRECISION; - } - // limit precision to 9, cause a prec >= 10 can lead to overflow errors - while ((len < PRINTF_FTOA_BUFFER_SIZE) && (prec > 9U)) { - buf[len++] = '0'; - prec--; - } - - int whole = (int)value; - double tmp = (value - whole) * pow10[prec]; - unsigned long frac = (unsigned long)tmp; - diff = tmp - frac; - - if (diff > 0.5) { - ++frac; - // handle rollover, e.g. case 0.99 with prec 1 is 1.0 - if (frac >= pow10[prec]) { - frac = 0; - ++whole; - } - } - else if (diff < 0.5) { - } - else if ((frac == 0U) || (frac & 1U)) { - // if halfway, round up if odd OR if last digit is 0 - ++frac; - } - - if (prec == 0U) { - diff = value - (double)whole; - if ((!(diff < 0.5) || (diff > 0.5)) && (whole & 1)) { - // exactly 0.5 and ODD, then round up - // 1.5 -> 2, but 2.5 -> 2 - ++whole; - } - } - else { - unsigned int count = prec; - // now do fractional part, as an unsigned number - while (len < PRINTF_FTOA_BUFFER_SIZE) { - --count; - buf[len++] = (char)(48U + (frac % 10U)); - if (!(frac /= 10U)) { - break; - } - } - // add extra 0s - while ((len < PRINTF_FTOA_BUFFER_SIZE) && (count-- > 0U)) { - buf[len++] = '0'; - } - if (len < PRINTF_FTOA_BUFFER_SIZE) { - // add decimal - buf[len++] = '.'; - } - } - - // do whole part, number is reversed - while (len < PRINTF_FTOA_BUFFER_SIZE) { - buf[len++] = (char)(48 + (whole % 10)); - if (!(whole /= 10)) { - break; - } - } - - // pad leading zeros - if (!(flags & FLAGS_LEFT) && (flags & FLAGS_ZEROPAD)) { - if (width && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { - width--; - } - while ((len < width) && (len < PRINTF_FTOA_BUFFER_SIZE)) { - buf[len++] = '0'; - } - } - - if (len < PRINTF_FTOA_BUFFER_SIZE) { - if (negative) { - buf[len++] = '-'; - } - else if (flags & FLAGS_PLUS) { - buf[len++] = '+'; // ignore the space if the '+' exists - } - else if (flags & FLAGS_SPACE) { - buf[len++] = ' '; - } - } - - return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); -} - - -#if defined(PRINTF_SUPPORT_EXPONENTIAL) -// internal ftoa variant for exponential floating-point type, contributed by Martijn Jasperse -static size_t _etoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags) -{ - // check for NaN and special values - if ((value != value) || (value > DBL_MAX) || (value < -DBL_MAX)) { - return _ftoa(out, buffer, idx, maxlen, value, prec, width, flags); - } - - // determine the sign - const bool negative = value < 0; - if (negative) { - value = -value; - } - - // default precision - if (!(flags & FLAGS_PRECISION)) { - prec = PRINTF_DEFAULT_FLOAT_PRECISION; - } - - // determine the decimal exponent - // based on the algorithm by David Gay (https://www.ampl.com/netlib/fp/dtoa.c) - union { - uint64_t U; - double F; - } conv; - - conv.F = value; - int exp2 = (int)((conv.U >> 52U) & 0x07FFU) - 1023; // effectively log2 - conv.U = (conv.U & ((1ULL << 52U) - 1U)) | (1023ULL << 52U); // drop the exponent so conv.F is now in [1,2) - // now approximate log10 from the log2 integer part and an expansion of ln around 1.5 - int expval = (int)(0.1760912590558 + exp2 * 0.301029995663981 + (conv.F - 1.5) * 0.289529654602168); - // now we want to compute 10^expval but we want to be sure it won't overflow - exp2 = (int)(expval * 3.321928094887362 + 0.5); - const double z = expval * 2.302585092994046 - exp2 * 0.6931471805599453; - const double z2 = z * z; - conv.U = (uint64_t)(exp2 + 1023) << 52U; - // compute exp(z) using continued fractions, see https://en.wikipedia.org/wiki/Exponential_function#Continued_fractions_for_ex - conv.F *= 1 + 2 * z / (2 - z + (z2 / (6 + (z2 / (10 + z2 / 14))))); - // correct for rounding errors - if (value < conv.F) { - expval--; - conv.F /= 10; - } - - // the exponent format is "%+03d" and largest value is "307", so set aside 4-5 characters - unsigned int minwidth = ((expval < 100) && (expval > -100)) ? 4U : 5U; - - // in "%g" mode, "prec" is the number of *significant figures* not decimals - if (flags & FLAGS_ADAPT_EXP) { - // do we want to fall-back to "%f" mode? - if ((value >= 1e-4) && (value < 1e6)) { - if ((int)prec > expval) { - prec = (unsigned)((int)prec - expval - 1); - } - else { - prec = 0; - } - flags |= FLAGS_PRECISION; // make sure _ftoa respects precision - // no characters in exponent - minwidth = 0U; - expval = 0; - } - else { - // we use one sigfig for the whole part - if ((prec > 0) && (flags & FLAGS_PRECISION)) { - --prec; - } - } - } - - // will everything fit? - unsigned int fwidth = width; - if (width > minwidth) { - // we didn't fall-back so subtract the characters required for the exponent - fwidth -= minwidth; - } else { - // not enough characters, so go back to default sizing - fwidth = 0U; - } - if ((flags & FLAGS_LEFT) && minwidth) { - // if we're padding on the right, DON'T pad the floating part - fwidth = 0U; - } - - // rescale the float value - if (expval) { - value /= conv.F; - } - - // output the floating part - const size_t start_idx = idx; - idx = _ftoa(out, buffer, idx, maxlen, negative ? -value : value, prec, fwidth, flags & ~FLAGS_ADAPT_EXP); - - // output the exponent part - if (minwidth) { - // output the exponential symbol - out((flags & FLAGS_UPPERCASE) ? 'E' : 'e', buffer, idx++, maxlen); - // output the exponent value - idx = _ntoa_long(out, buffer, idx, maxlen, (expval < 0) ? -expval : expval, expval < 0, 10, 0, minwidth-1, FLAGS_ZEROPAD | FLAGS_PLUS); - // might need to right-pad spaces - if (flags & FLAGS_LEFT) { - while (idx - start_idx < width) out(' ', buffer, idx++, maxlen); - } - } - return idx; -} -#endif // PRINTF_SUPPORT_EXPONENTIAL -#endif // PRINTF_SUPPORT_FLOAT - - -// internal vsnprintf -static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const char* format, va_list va) -{ - unsigned int flags, width, precision, n; - size_t idx = 0U; - - if (!buffer) { - // use null output function - out = _out_null; - } - - while (*format) - { - // format specifier? %[flags][width][.precision][length] - if (*format != '%') { - // no - out(*format, buffer, idx++, maxlen); - format++; - continue; - } - else { - // yes, evaluate it - format++; - } - - // evaluate flags - flags = 0U; - do { - switch (*format) { - case '0': flags |= FLAGS_ZEROPAD; format++; n = 1U; break; - case '-': flags |= FLAGS_LEFT; format++; n = 1U; break; - case '+': flags |= FLAGS_PLUS; format++; n = 1U; break; - case ' ': flags |= FLAGS_SPACE; format++; n = 1U; break; - case '#': flags |= FLAGS_HASH; format++; n = 1U; break; - default : n = 0U; break; - } - } while (n); - - // evaluate width field - width = 0U; - if (_is_digit(*format)) { - width = _atoi(&format); - } - else if (*format == '*') { - const int w = va_arg(va, int); - if (w < 0) { - flags |= FLAGS_LEFT; // reverse padding - width = (unsigned int)-w; - } - else { - width = (unsigned int)w; - } - format++; - } - - // evaluate precision field - precision = 0U; - if (*format == '.') { - flags |= FLAGS_PRECISION; - format++; - if (_is_digit(*format)) { - precision = _atoi(&format); - } - else if (*format == '*') { - const int prec = (int)va_arg(va, int); - precision = prec > 0 ? (unsigned int)prec : 0U; - format++; - } - } - - // evaluate length field - switch (*format) { - case 'l' : - flags |= FLAGS_LONG; - format++; - if (*format == 'l') { - flags |= FLAGS_LONG_LONG; - format++; - } - break; - case 'h' : - flags |= FLAGS_SHORT; - format++; - if (*format == 'h') { - flags |= FLAGS_CHAR; - format++; - } - break; -#if defined(PRINTF_SUPPORT_PTRDIFF_T) - case 't' : - flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); - format++; - break; -#endif - case 'j' : - flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); - format++; - break; - case 'z' : - flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); - format++; - break; - default : - break; - } - - // evaluate specifier - switch (*format) { - case 'd' : - case 'i' : - case 'u' : - case 'x' : - case 'X' : - case 'o' : - case 'b' : { - // set the base - unsigned int base; - if (*format == 'x' || *format == 'X') { - base = 16U; - } - else if (*format == 'o') { - base = 8U; - } - else if (*format == 'b') { - base = 2U; - } - else { - base = 10U; - flags &= ~FLAGS_HASH; // no hash for dec format - } - // uppercase - if (*format == 'X') { - flags |= FLAGS_UPPERCASE; - } - - // no plus or space flag for u, x, X, o, b - if ((*format != 'i') && (*format != 'd')) { - flags &= ~(FLAGS_PLUS | FLAGS_SPACE); - } - - // ignore '0' flag when precision is given - if (flags & FLAGS_PRECISION) { - flags &= ~FLAGS_ZEROPAD; - } - - // convert the integer - if ((*format == 'i') || (*format == 'd')) { - // signed - if (flags & FLAGS_LONG_LONG) { -#if defined(PRINTF_SUPPORT_LONG_LONG) - const long long value = va_arg(va, long long); - idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); -#endif - } - else if (flags & FLAGS_LONG) { - const long value = va_arg(va, long); - idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); - } - else { - const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int); - idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); - } - } - else { - // unsigned - if (flags & FLAGS_LONG_LONG) { -#if defined(PRINTF_SUPPORT_LONG_LONG) - idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags); -#endif - } - else if (flags & FLAGS_LONG) { - idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision, width, flags); - } - else { - const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) : (flags & FLAGS_SHORT) ? (unsigned short int)va_arg(va, unsigned int) : va_arg(va, unsigned int); - idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags); - } - } - format++; - break; - } -#if defined(PRINTF_SUPPORT_FLOAT) - case 'f' : - case 'F' : - if (*format == 'F') flags |= FLAGS_UPPERCASE; - idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags); - format++; - break; -#if defined(PRINTF_SUPPORT_EXPONENTIAL) - case 'e': - case 'E': - case 'g': - case 'G': - if ((*format == 'g')||(*format == 'G')) flags |= FLAGS_ADAPT_EXP; - if ((*format == 'E')||(*format == 'G')) flags |= FLAGS_UPPERCASE; - idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags); - format++; - break; -#endif // PRINTF_SUPPORT_EXPONENTIAL -#endif // PRINTF_SUPPORT_FLOAT - case 'c' : { - unsigned int l = 1U; - // pre padding - if (!(flags & FLAGS_LEFT)) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - // char output - out((char)va_arg(va, int), buffer, idx++, maxlen); - // post padding - if (flags & FLAGS_LEFT) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - format++; - break; - } - - case 's' : { - const char* p = va_arg(va, char*); - unsigned int l = _strnlen_s(p, precision ? precision : (size_t)-1); - // pre padding - if (flags & FLAGS_PRECISION) { - l = (l < precision ? l : precision); - } - if (!(flags & FLAGS_LEFT)) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - // string output - while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) { - out(*(p++), buffer, idx++, maxlen); - } - // post padding - if (flags & FLAGS_LEFT) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - format++; - break; - } - - case 'p' : { - width = sizeof(void*) * 2U; - flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE; -#if defined(PRINTF_SUPPORT_LONG_LONG) - const bool is_ll = sizeof(uintptr_t) == sizeof(long long); - if (is_ll) { - idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void*), false, 16U, precision, width, flags); - } - else { -#endif - idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((uintptr_t)va_arg(va, void*)), false, 16U, precision, width, flags); -#if defined(PRINTF_SUPPORT_LONG_LONG) - } -#endif - format++; - break; - } - - case '%' : - out('%', buffer, idx++, maxlen); - format++; - break; - - default : - out(*format, buffer, idx++, maxlen); - format++; - break; - } - } - - // termination - out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen); - - // return written chars without terminating \0 - return (int)idx; -} - - -/////////////////////////////////////////////////////////////////////////////// - -int printf_(const char* format, ...) -{ - va_list va; - va_start(va, format); - char buffer[1]; - const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va); - va_end(va); - return ret; -} - - -int sprintf_(char* buffer, const char* format, ...) -{ - va_list va; - va_start(va, format); - const int ret = _vsnprintf(_out_buffer, buffer, (size_t)-1, format, va); - va_end(va); - return ret; -} - - -int snprintf_(char* buffer, size_t count, const char* format, ...) -{ - va_list va; - va_start(va, format); - const int ret = _vsnprintf(_out_buffer, buffer, count, format, va); - va_end(va); - return ret; -} - - -int vprintf_(const char* format, va_list va) -{ - char buffer[1]; - return _vsnprintf(_out_char, buffer, (size_t)-1, format, va); -} - - -int vsnprintf_(char* buffer, size_t count, const char* format, va_list va) -{ - return _vsnprintf(_out_buffer, buffer, count, format, va); -} - - -int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...) -{ - va_list va; - va_start(va, format); - const out_fct_wrap_type out_fct_wrap = { out, arg }; - const int ret = _vsnprintf(_out_fct, (char*)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va); - va_end(va); - return ret; -} diff --git a/src/hyperlight_guest_bin/third_party/printf/printf.h b/src/hyperlight_guest_bin/third_party/printf/printf.h deleted file mode 100644 index 8bce7378b..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/printf.h +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// \author (c) Marco Paland (info@paland.com) -// 2014-2019, PALANDesign Hannover, Germany -// -// \license The MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// \brief Tiny printf, sprintf and snprintf implementation, optimized for speed on -// embedded systems with a very limited resources. -// Use this instead of bloated standard/newlib printf. -// These routines are thread safe and reentrant. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _PRINTF_H_ -#define _PRINTF_H_ - -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Output a character to a custom device like UART, used by the printf() function - * This function is declared here only. You have to write your custom implementation somewhere - * \param character Character to output - */ -void _putchar(char character); - - -/** - * Tiny printf implementation - * You have to implement _putchar if you use printf() - * To avoid conflicts with the regular printf() API it is overridden by macro defines - * and internal underscore-appended functions like printf_() are used - * \param format A string that specifies the format of the output - * \return The number of characters that are written into the array, not counting the terminating null character - */ -#define printf printf_ -int printf_(const char* format, ...); - - -/** - * Tiny sprintf implementation - * Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD! - * \param buffer A pointer to the buffer where to store the formatted string. MUST be big enough to store the output! - * \param format A string that specifies the format of the output - * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character - */ -#define sprintf sprintf_ -int sprintf_(char* buffer, const char* format, ...); - - -/** - * Tiny snprintf/vsnprintf implementation - * \param buffer A pointer to the buffer where to store the formatted string - * \param count The maximum number of characters to store in the buffer, including a terminating null character - * \param format A string that specifies the format of the output - * \param va A value identifying a variable arguments list - * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character - * If the formatted string is truncated the buffer size (count) is returned - */ -#define snprintf snprintf_ -#define vsnprintf vsnprintf_ -int snprintf_(char* buffer, size_t count, const char* format, ...); -int vsnprintf_(char* buffer, size_t count, const char* format, va_list va); - - -/** - * Tiny vprintf implementation - * \param format A string that specifies the format of the output - * \param va A value identifying a variable arguments list - * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character - */ -#define vprintf vprintf_ -int vprintf_(const char* format, va_list va); - - -/** - * printf with output function - * You may use this as dynamic alternative to printf() with its fixed _putchar() output - * \param out An output function which takes one character and an argument pointer - * \param arg An argument pointer for user data passed to output function - * \param format A string that specifies the format of the output - * \return The number of characters that are sent to the output function, not counting the terminating null character - */ -int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...); - - -#ifdef __cplusplus -} -#endif - - -#endif // _PRINTF_H_ diff --git a/src/hyperlight_guest_bin/third_party/printf/printf.patch b/src/hyperlight_guest_bin/third_party/printf/printf.patch deleted file mode 100644 index 85a8f8a51..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/printf.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/hyperlight_guest/third_party/printf/printf.c b/src/hyperlight_guest/third_party/printf/printf.c -index 8a700ad..caf375a 100644 ---- a/src/hyperlight_guest/third_party/printf/printf.c -+++ b/src/hyperlight_guest/third_party/printf/printf.c -@@ -149,9 +149,7 @@ static inline void _out_null(char character, void* buffer, size_t idx, size_t ma - static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen) - { - (void)buffer; (void)idx; (void)maxlen; -- if (character) { - _putchar(character); -- } - } - - diff --git a/src/hyperlight_guest_bin/third_party/printf/test/catch.hpp b/src/hyperlight_guest_bin/third_party/printf/test/catch.hpp deleted file mode 100644 index 1850fff12..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/test/catch.hpp +++ /dev/null @@ -1,14934 +0,0 @@ -/* - * Catch v2.7.0 - * Generated: 2019-03-07 21:34:30.252164 - * ---------------------------------------------------------- - * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -// start catch.hpp - - -#define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 7 -#define CATCH_VERSION_PATCH 0 - -#ifdef __clang__ -# pragma clang system_header -#elif defined __GNUC__ -# pragma GCC system_header -#endif - -// start catch_suppress_warnings.h - -#ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif -#elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" -#endif -// end catch_suppress_warnings.h -#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS -#endif - -// In the impl file, we want to have access to all parts of the headers -// Can also be used to sanely support PCHs -#if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif -#endif - -#if !defined(CATCH_CONFIG_IMPL_ONLY) -// start catch_platform.h - -#ifdef __APPLE__ -# include -# if TARGET_OS_OSX == 1 -# define CATCH_PLATFORM_MAC -# elif TARGET_OS_IPHONE == 1 -# define CATCH_PLATFORM_IPHONE -# endif - -#elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX - -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS -#endif - -// end catch_platform.h - -#ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif -#endif - -// start catch_user_interfaces.h - -namespace Catch { - unsigned int rngSeed(); -} - -// end catch_user_interfaces.h -// start catch_tag_alias_autoregistrar.h - -// start catch_common.h - -// start catch_compiler_capabilities.h - -// Detect a number of compiler features - by compiler -// The following features are defined: -// -// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? -// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? -// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? -// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? -// **************** -// Note to maintainers: if new toggles are added please document them -// in configuration.md, too -// **************** - -// In general each macro has a _NO_ form -// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. -// Many features, at point of detection, define an _INTERNAL_ macro, so they -// can be combined, en-mass, with the _NO_ forms later. - -#ifdef __cplusplus - -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif - -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif - -#endif - -#if defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#endif - -#ifdef __clang__ - -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") -# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -#endif // __clang__ - -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif - -//////////////////////////////////////////////////////////////////////////////// -// We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -#endif - -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Android somehow still does not support std::to_string -#if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Not all Windows environments support SEH properly -#if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH -#endif - -//////////////////////////////////////////////////////////////////////////////// -// PS4 -#if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Cygwin -#ifdef __CYGWIN__ - -// Required for some versions of Cygwin to declare gettimeofday -// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE -// some versions of cygwin (most) do not support std::to_string. Use the libstd check. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) - -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING - -# endif -#endif // __CYGWIN__ - -//////////////////////////////////////////////////////////////////////////////// -// Visual C++ -#ifdef _MSC_VER - -# if _MSC_VER >= 1900 // Visual Studio 2015 or newer -# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -# endif - -// Universal Windows platform does not support SEH -// Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif - -// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ -// _MSVC_TRADITIONAL == 0 means new conformant preprocessor -// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif - -#endif // _MSC_VER - -//////////////////////////////////////////////////////////////////////////////// -// Check if we are compiled with -fno-exceptions or equivalent -#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED -#endif - -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ - -//////////////////////////////////////////////////////////////////////////////// -// Embarcadero C++Build -#if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// Use of __COUNTER__ is suppressed during code analysis in -// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly -// handled by it. -// Otherwise all supported compilers support COUNTER macro, -// but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Check if string_view is available and usable -// The check is split apart to work around v140 (VS2015) preprocessor issue... -#if defined(__has_include) -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW -#endif -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Check if optional is available and usable -#if defined(__has_include) -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // __has_include - -//////////////////////////////////////////////////////////////////////////////// -// Check if variant is available and usable -#if defined(__has_include) -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 -# include -# if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) -# define CATCH_CONFIG_NO_CPP17_VARIANT -# else -# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT -# endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) -# else -# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT -# endif // defined(__clang__) && (__clang_major__ < 8) -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // __has_include - -#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER -#endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH -#endif -// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS -#endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) -# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT -#endif - -#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN -#endif - -#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS -#endif - -#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) -#define CATCH_CATCH_ANON(type) if ((false)) -#else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) -#define CATCH_CATCH_ANON(type) catch (type) -#endif - -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) -#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#endif - -// end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) -#ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) -#else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) -#endif - -#include -#include -#include - -// We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); - -namespace Catch { - - struct CaseSensitive { enum Choice { - Yes, - No - }; }; - - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} - - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - - bool empty() const noexcept; - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; - - char const* file; - std::size_t line; - }; - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } -} - -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) - -// end catch_common.h -namespace Catch { - - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; - -} // end namespace Catch - -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS - -// end catch_tag_alias_autoregistrar.h -// start catch_test_registry.h - -// start catch_interfaces_testcase.h - -#include - -namespace Catch { - - class TestSpec; - - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; - - class TestCase; - struct IConfig; - - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; - - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); - -} - -// end catch_interfaces_testcase.h -// start catch_stringref.h - -#include -#include -#include - -namespace Catch { - - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. c_str() must return a null terminated - /// string, however, and so the StringRef will internally take ownership - /// (taking a copy), if necessary. In theory this ownership is not externally - /// visible - but it does mean (substring) StringRefs should not be shared between - /// threads. - class StringRef { - public: - using size_type = std::size_t; - - private: - friend struct StringRefTestAccess; - - char const* m_start; - size_type m_size; - - char* m_data = nullptr; - - void takeOwnership(); - - static constexpr char const* const s_empty = ""; - - public: // construction/ assignment - StringRef() noexcept - : StringRef( s_empty, 0 ) - {} - - StringRef( StringRef const& other ) noexcept - : m_start( other.m_start ), - m_size( other.m_size ) - {} - - StringRef( StringRef&& other ) noexcept - : m_start( other.m_start ), - m_size( other.m_size ), - m_data( other.m_data ) - { - other.m_data = nullptr; - } - - StringRef( char const* rawChars ) noexcept; - - StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} - - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} - - ~StringRef() noexcept { - delete[] m_data; - } - - auto operator = ( StringRef const &other ) noexcept -> StringRef& { - delete[] m_data; - m_data = nullptr; - m_start = other.m_start; - m_size = other.m_size; - return *this; - } - - operator std::string() const; - - void swap( StringRef& other ) noexcept; - - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != ( StringRef const& other ) const noexcept -> bool; - - auto operator[] ( size_type index ) const noexcept -> char; - - public: // named queries - auto empty() const noexcept -> bool { - return m_size == 0; - } - auto size() const noexcept -> size_type { - return m_size; - } - - auto numberOfCharacters() const noexcept -> size_type; - auto c_str() const -> char const*; - - public: // substrings and searches - auto substr( size_type start, size_type size ) const noexcept -> StringRef; - - // Returns the current start pointer. - // Note that the pointer can change when if the StringRef is a substring - auto currentData() const noexcept -> char const*; - - private: // ownership queries - may not be consistent between calls - auto isOwned() const noexcept -> bool; - auto isSubstring() const noexcept -> bool; - }; - - auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string; - auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string; - auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string; - - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - - inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } - -} // namespace Catch - -inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); -} - -// end catch_stringref.h -// start catch_type_traits.hpp - - -#include - -namespace Catch{ - -#ifdef CATCH_CPP17_OR_GREATER - template - inline constexpr auto is_unique = std::true_type{}; - - template - inline constexpr auto is_unique = std::bool_constant< - (!std::is_same_v && ...) && is_unique - >{}; -#else - -template -struct is_unique : std::true_type{}; - -template -struct is_unique : std::integral_constant -::value - && is_unique::value - && is_unique::value ->{}; - -#endif -} - -// end catch_type_traits.hpp -// start catch_preprocessor.hpp - - -#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ -#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) - -#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ -// MSVC needs more evaluations -#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) -#else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) -#endif - -#define CATCH_REC_END(...) -#define CATCH_REC_OUT - -#define CATCH_EMPTY() -#define CATCH_DEFER(id) id CATCH_EMPTY() - -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 -#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) - -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, -// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ -#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) -#else -// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) -#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) -#endif - -#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) - -#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name, __VA_ARGS__) -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " - " #__VA_ARGS__ -#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name,...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) -#else -// MSVC is adding extra space and needs more calls to properly remove () -#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " -" #__VA_ARGS__ -#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, __VA_ARGS__) -#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) -#endif - -#define INTERNAL_CATCH_MAKE_TYPE_LIST(types) Catch::TypeList - -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(types)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,INTERNAL_CATCH_REMOVE_PARENS(types)) - -// end catch_preprocessor.hpp -// start catch_meta.hpp - - -#include - -namespace Catch { -template< typename... > -struct TypeList {}; - -template< typename... > -struct append; - -template< template class L1 - , typename...E1 - , template class L2 - , typename...E2 -> -struct append< L1, L2 > { - using type = L1; -}; - -template< template class L1 - , typename...E1 - , template class L2 - , typename...E2 - , typename...Rest -> -struct append< L1, L2, Rest...> { - using type = typename append< L1, Rest... >::type; -}; - -template< template class - , typename... -> -struct rewrap; - -template< template class Container - , template class List - , typename...elems -> -struct rewrap> { - using type = TypeList< Container< elems... > >; -}; - -template< template class Container - , template class List - , class...Elems - , typename...Elements> - struct rewrap, Elements...> { - using type = typename append>, typename rewrap::type>::type; -}; - -template< template class...Containers > -struct combine { - template< typename...Types > - struct with_types { - template< template class Final > - struct into { - using type = typename append, typename rewrap::type...>::type; - }; - }; -}; - -template -struct always_false : std::false_type {}; - -} // namespace Catch - -// end catch_meta.hpp -namespace Catch { - -template -class TestInvokerAsMethod : public ITestInvoker { - void (C::*m_testAsMethod)(); -public: - TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {} - - void invoke() const override { - C obj; - (obj.*m_testAsMethod)(); - } -}; - -auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*; - -template -auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* { - return new(std::nothrow) TestInvokerAsMethod( testAsMethod ); -} - -struct NameAndTags { - NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept; - StringRef name; - StringRef tags; -}; - -struct AutoReg : NonCopyable { - AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept; - ~AutoReg(); -}; - -} // end namespace Catch - -#if defined(CATCH_CONFIG_DISABLE) - #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ - static void TestName() - #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ - namespace{ \ - struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ - void test(); \ - }; \ - } \ - void TestName::test() - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION( TestName, ... ) \ - template \ - static void TestName() - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ - namespace{ \ - template \ - struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName ) { \ - void test(); \ - }; \ - } \ - template \ - void TestName::test() -#endif - - /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ - static void TestName(); \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - static void TestName() - #define INTERNAL_CATCH_TESTCASE( ... ) \ - INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) - - /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS - - /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ \ - struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ - void test(); \ - }; \ - Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ - } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - void TestName::test() - #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ - INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) - - /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS - - /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, ... )\ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - template \ - static void TestFunc();\ - namespace {\ - template \ - struct TestName{\ - template \ - TestName(Ts...names){\ - CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \ - using expander = int[];\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \ - }\ - };\ - INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, __VA_ARGS__) \ - }\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - template \ - static void TestFunc() - -#if defined(CATCH_CPP17_OR_GREATER) -#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>,"Duplicate type detected in declaration of template test case"); -#else -#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>::value,"Duplicate type detected in declaration of template test case"); -#endif - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ - INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) -#else - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ - INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) ) -#endif - - #define INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, ...)\ - static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ - TestName(CATCH_REC_LIST_UD(INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME,Name, __VA_ARGS__));\ - return 0;\ - }(); - - #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, TmplTypes, TypesList) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - template static void TestFuncName(); \ - namespace { \ - template \ - struct TestName { \ - TestName() { \ - CATCH_INTERNAL_CHECK_UNIQUE_TYPES(Types...) \ - int index = 0; \ - using expander = int[]; \ - constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ - constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ - constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\ - } \ - }; \ - static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ - using TestInit = Catch::combine \ - ::with_types::into::type; \ - TestInit(); \ - return 0; \ - }(); \ - } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - template \ - static void TestFuncName() - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR - #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ - INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ),Name,Tags,__VA_ARGS__) -#else - #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ - INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) ) -#endif - - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, ... ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ \ - template \ - struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName ) { \ - void test();\ - };\ - template \ - struct TestNameClass{\ - template \ - TestNameClass(Ts...names){\ - CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \ - using expander = int[];\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \ - }\ - };\ - INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestNameClass, Name, __VA_ARGS__)\ - }\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\ - template \ - void TestName::test() - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ - INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ ) -#else - #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ - INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ ) ) -#endif - - #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, TmplTypes, TypesList)\ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - template \ - struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName ) { \ - void test();\ - };\ - namespace {\ - template\ - struct TestNameClass{\ - TestNameClass(){\ - CATCH_INTERNAL_CHECK_UNIQUE_TYPES(Types...)\ - int index = 0;\ - using expander = int[];\ - constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ - constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ - constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \ - }\ - };\ - static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ - using TestInit = Catch::combine\ - ::with_types::into::type;\ - TestInit();\ - return 0;\ - }(); \ - }\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - template \ - void TestName::test() - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR - #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ - INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, __VA_ARGS__ ) -#else - #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ - INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, __VA_ARGS__ ) ) -#endif - -// end catch_test_registry.h -// start catch_capture.hpp - -// start catch_assertionhandler.h - -// start catch_assertioninfo.h - -// start catch_result_type.h - -namespace Catch { - - // ResultWas::OfType enum - struct ResultWas { enum OfType { - Unknown = -1, - Ok = 0, - Info = 1, - Warning = 2, - - FailureBit = 0x10, - - ExpressionFailed = FailureBit | 1, - ExplicitFailure = FailureBit | 2, - - Exception = 0x100 | FailureBit, - - ThrewException = Exception | 1, - DidntThrowException = Exception | 2, - - FatalErrorCondition = 0x200 | FailureBit - - }; }; - - bool isOk( ResultWas::OfType resultType ); - bool isJustInfo( int flags ); - - // ResultDisposition::Flags enum - struct ResultDisposition { enum Flags { - Normal = 0x01, - - ContinueOnFailure = 0x02, // Failures fail test, but execution continues - FalseTest = 0x04, // Prefix expression with ! - SuppressFail = 0x08 // Failures are reported but do not fail the test - }; }; - - ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); - - bool shouldContinueOnFailure( int flags ); - inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } - bool shouldSuppressFailure( int flags ); - -} // end namespace Catch - -// end catch_result_type.h -namespace Catch { - - struct AssertionInfo - { - StringRef macroName; - SourceLineInfo lineInfo; - StringRef capturedExpression; - ResultDisposition::Flags resultDisposition; - - // We want to delete this constructor but a compiler bug in 4.8 means - // the struct is then treated as non-aggregate - //AssertionInfo() = delete; - }; - -} // end namespace Catch - -// end catch_assertioninfo.h -// start catch_decomposer.h - -// start catch_tostring.h - -#include -#include -#include -#include -// start catch_stream.h - -#include -#include -#include - -namespace Catch { - - std::ostream& cout(); - std::ostream& cerr(); - std::ostream& clog(); - - class StringRef; - - struct IStream { - virtual ~IStream(); - virtual std::ostream& stream() const = 0; - }; - - auto makeStream( StringRef const &filename ) -> IStream const*; - - class ReusableStringStream { - std::size_t m_index; - std::ostream* m_oss; - public: - ReusableStringStream(); - ~ReusableStringStream(); - - auto str() const -> std::string; - - template - auto operator << ( T const& value ) -> ReusableStringStream& { - *m_oss << value; - return *this; - } - auto get() -> std::ostream& { return *m_oss; } - }; -} - -// end catch_stream.h - -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW -#include -#endif - -#ifdef __OBJC__ -// start catch_objc_arc.hpp - -#import - -#ifdef __has_feature -#define CATCH_ARC_ENABLED __has_feature(objc_arc) -#else -#define CATCH_ARC_ENABLED 0 -#endif - -void arcSafeRelease( NSObject* obj ); -id performOptionalSelector( id obj, SEL sel ); - -#if !CATCH_ARC_ENABLED -inline void arcSafeRelease( NSObject* obj ) { - [obj release]; -} -inline id performOptionalSelector( id obj, SEL sel ) { - if( [obj respondsToSelector: sel] ) - return [obj performSelector: sel]; - return nil; -} -#define CATCH_UNSAFE_UNRETAINED -#define CATCH_ARC_STRONG -#else -inline void arcSafeRelease( NSObject* ){} -inline id performOptionalSelector( id obj, SEL sel ) { -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" -#endif - if( [obj respondsToSelector: sel] ) - return [obj performSelector: sel]; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - return nil; -} -#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained -#define CATCH_ARC_STRONG __strong -#endif - -// end catch_objc_arc.hpp -#endif - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless -#endif - -namespace Catch { - namespace Detail { - - extern const std::string unprintableString; - - std::string rawMemoryToString( const void *object, std::size_t size ); - - template - std::string rawMemoryToString( const T& object ) { - return rawMemoryToString( &object, sizeof(object) ); - } - - template - class IsStreamInsertable { - template - static auto test(int) - -> decltype(std::declval() << std::declval(), std::true_type()); - - template - static auto test(...)->std::false_type; - - public: - static const bool value = decltype(test(0))::value; - }; - - template - std::string convertUnknownEnumToString( E e ); - - template - typename std::enable_if< - !std::is_enum::value && !std::is_base_of::value, - std::string>::type convertUnstreamable( T const& ) { - return Detail::unprintableString; - } - template - typename std::enable_if< - !std::is_enum::value && std::is_base_of::value, - std::string>::type convertUnstreamable(T const& ex) { - return ex.what(); - } - - template - typename std::enable_if< - std::is_enum::value - , std::string>::type convertUnstreamable( T const& value ) { - return convertUnknownEnumToString( value ); - } - -#if defined(_MANAGED) - //! Convert a CLR string to a utf8 std::string - template - std::string clrReferenceToString( T^ ref ) { - if (ref == nullptr) - return std::string("null"); - auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString()); - cli::pin_ptr p = &bytes[0]; - return std::string(reinterpret_cast(p), bytes->Length); - } -#endif - - } // namespace Detail - - // If we decide for C++14, change these to enable_if_ts - template - struct StringMaker { - template - static - typename std::enable_if<::Catch::Detail::IsStreamInsertable::value, std::string>::type - convert(const Fake& value) { - ReusableStringStream rss; - // NB: call using the function-like syntax to avoid ambiguity with - // user-defined templated operator<< under clang. - rss.operator<<(value); - return rss.str(); - } - - template - static - typename std::enable_if::value, std::string>::type - convert( const Fake& value ) { -#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) - return Detail::convertUnstreamable(value); -#else - return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); -#endif - } - }; - - namespace Detail { - - // This function dispatches all stringification requests inside of Catch. - // Should be preferably called fully qualified, like ::Catch::Detail::stringify - template - std::string stringify(const T& e) { - return ::Catch::StringMaker::type>::type>::convert(e); - } - - template - std::string convertUnknownEnumToString( E e ) { - return ::Catch::Detail::stringify(static_cast::type>(e)); - } - -#if defined(_MANAGED) - template - std::string stringify( T^ e ) { - return ::Catch::StringMaker::convert(e); - } -#endif - - } // namespace Detail - - // Some predefined specializations - - template<> - struct StringMaker { - static std::string convert(const std::string& str); - }; - -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW - template<> - struct StringMaker { - static std::string convert(std::string_view str); - }; -#endif - - template<> - struct StringMaker { - static std::string convert(char const * str); - }; - template<> - struct StringMaker { - static std::string convert(char * str); - }; - -#ifdef CATCH_CONFIG_WCHAR - template<> - struct StringMaker { - static std::string convert(const std::wstring& wstr); - }; - -# ifdef CATCH_CONFIG_CPP17_STRING_VIEW - template<> - struct StringMaker { - static std::string convert(std::wstring_view str); - }; -# endif - - template<> - struct StringMaker { - static std::string convert(wchar_t const * str); - }; - template<> - struct StringMaker { - static std::string convert(wchar_t * str); - }; -#endif - - // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, - // while keeping string semantics? - template - struct StringMaker { - static std::string convert(char const* str) { - return ::Catch::Detail::stringify(std::string{ str }); - } - }; - template - struct StringMaker { - static std::string convert(signed char const* str) { - return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); - } - }; - template - struct StringMaker { - static std::string convert(unsigned char const* str) { - return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); - } - }; - - template<> - struct StringMaker { - static std::string convert(int value); - }; - template<> - struct StringMaker { - static std::string convert(long value); - }; - template<> - struct StringMaker { - static std::string convert(long long value); - }; - template<> - struct StringMaker { - static std::string convert(unsigned int value); - }; - template<> - struct StringMaker { - static std::string convert(unsigned long value); - }; - template<> - struct StringMaker { - static std::string convert(unsigned long long value); - }; - - template<> - struct StringMaker { - static std::string convert(bool b); - }; - - template<> - struct StringMaker { - static std::string convert(char c); - }; - template<> - struct StringMaker { - static std::string convert(signed char c); - }; - template<> - struct StringMaker { - static std::string convert(unsigned char c); - }; - - template<> - struct StringMaker { - static std::string convert(std::nullptr_t); - }; - - template<> - struct StringMaker { - static std::string convert(float value); - }; - template<> - struct StringMaker { - static std::string convert(double value); - }; - - template - struct StringMaker { - template - static std::string convert(U* p) { - if (p) { - return ::Catch::Detail::rawMemoryToString(p); - } else { - return "nullptr"; - } - } - }; - - template - struct StringMaker { - static std::string convert(R C::* p) { - if (p) { - return ::Catch::Detail::rawMemoryToString(p); - } else { - return "nullptr"; - } - } - }; - -#if defined(_MANAGED) - template - struct StringMaker { - static std::string convert( T^ ref ) { - return ::Catch::Detail::clrReferenceToString(ref); - } - }; -#endif - - namespace Detail { - template - std::string rangeToString(InputIterator first, InputIterator last) { - ReusableStringStream rss; - rss << "{ "; - if (first != last) { - rss << ::Catch::Detail::stringify(*first); - for (++first; first != last; ++first) - rss << ", " << ::Catch::Detail::stringify(*first); - } - rss << " }"; - return rss.str(); - } - } - -#ifdef __OBJC__ - template<> - struct StringMaker { - static std::string convert(NSString * nsstring) { - if (!nsstring) - return "nil"; - return std::string("@") + [nsstring UTF8String]; - } - }; - template<> - struct StringMaker { - static std::string convert(NSObject* nsObject) { - return ::Catch::Detail::stringify([nsObject description]); - } - - }; - namespace Detail { - inline std::string stringify( NSString* nsstring ) { - return StringMaker::convert( nsstring ); - } - - } // namespace Detail -#endif // __OBJC__ - -} // namespace Catch - -////////////////////////////////////////////////////// -// Separate std-lib types stringification, so it can be selectively enabled -// This means that we do not bring in - -#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) -# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER -# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER -# define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER -#endif - -// Separate std::pair specialization -#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER) -#include -namespace Catch { - template - struct StringMaker > { - static std::string convert(const std::pair& pair) { - ReusableStringStream rss; - rss << "{ " - << ::Catch::Detail::stringify(pair.first) - << ", " - << ::Catch::Detail::stringify(pair.second) - << " }"; - return rss.str(); - } - }; -} -#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER - -#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL) -#include -namespace Catch { - template - struct StringMaker > { - static std::string convert(const std::optional& optional) { - ReusableStringStream rss; - if (optional.has_value()) { - rss << ::Catch::Detail::stringify(*optional); - } else { - rss << "{ }"; - } - return rss.str(); - } - }; -} -#endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER - -// Separate std::tuple specialization -#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER) -#include -namespace Catch { - namespace Detail { - template< - typename Tuple, - std::size_t N = 0, - bool = (N < std::tuple_size::value) - > - struct TupleElementPrinter { - static void print(const Tuple& tuple, std::ostream& os) { - os << (N ? ", " : " ") - << ::Catch::Detail::stringify(std::get(tuple)); - TupleElementPrinter::print(tuple, os); - } - }; - - template< - typename Tuple, - std::size_t N - > - struct TupleElementPrinter { - static void print(const Tuple&, std::ostream&) {} - }; - - } - - template - struct StringMaker> { - static std::string convert(const std::tuple& tuple) { - ReusableStringStream rss; - rss << '{'; - Detail::TupleElementPrinter>::print(tuple, rss.get()); - rss << " }"; - return rss.str(); - } - }; -} -#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER - -#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT) -#include -namespace Catch { - template<> - struct StringMaker { - static std::string convert(const std::monostate&) { - return "{ }"; - } - }; - - template - struct StringMaker> { - static std::string convert(const std::variant& variant) { - if (variant.valueless_by_exception()) { - return "{valueless variant}"; - } else { - return std::visit( - [](const auto& value) { - return ::Catch::Detail::stringify(value); - }, - variant - ); - } - } - }; -} -#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER - -namespace Catch { - struct not_this_one {}; // Tag type for detecting which begin/ end are being selected - - // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace - using std::begin; - using std::end; - - not_this_one begin( ... ); - not_this_one end( ... ); - - template - struct is_range { - static const bool value = - !std::is_same())), not_this_one>::value && - !std::is_same())), not_this_one>::value; - }; - -#if defined(_MANAGED) // Managed types are never ranges - template - struct is_range { - static const bool value = false; - }; -#endif - - template - std::string rangeToString( Range const& range ) { - return ::Catch::Detail::rangeToString( begin( range ), end( range ) ); - } - - // Handle vector specially - template - std::string rangeToString( std::vector const& v ) { - ReusableStringStream rss; - rss << "{ "; - bool first = true; - for( bool b : v ) { - if( first ) - first = false; - else - rss << ", "; - rss << ::Catch::Detail::stringify( b ); - } - rss << " }"; - return rss.str(); - } - - template - struct StringMaker::value && !::Catch::Detail::IsStreamInsertable::value>::type> { - static std::string convert( R const& range ) { - return rangeToString( range ); - } - }; - - template - struct StringMaker { - static std::string convert(T const(&arr)[SZ]) { - return rangeToString(arr); - } - }; - -} // namespace Catch - -// Separate std::chrono::duration specialization -#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -#include -#include -#include - -namespace Catch { - -template -struct ratio_string { - static std::string symbol(); -}; - -template -std::string ratio_string::symbol() { - Catch::ReusableStringStream rss; - rss << '[' << Ratio::num << '/' - << Ratio::den << ']'; - return rss.str(); -} -template <> -struct ratio_string { - static std::string symbol(); -}; -template <> -struct ratio_string { - static std::string symbol(); -}; -template <> -struct ratio_string { - static std::string symbol(); -}; -template <> -struct ratio_string { - static std::string symbol(); -}; -template <> -struct ratio_string { - static std::string symbol(); -}; -template <> -struct ratio_string { - static std::string symbol(); -}; - - //////////// - // std::chrono::duration specializations - template - struct StringMaker> { - static std::string convert(std::chrono::duration const& duration) { - ReusableStringStream rss; - rss << duration.count() << ' ' << ratio_string::symbol() << 's'; - return rss.str(); - } - }; - template - struct StringMaker>> { - static std::string convert(std::chrono::duration> const& duration) { - ReusableStringStream rss; - rss << duration.count() << " s"; - return rss.str(); - } - }; - template - struct StringMaker>> { - static std::string convert(std::chrono::duration> const& duration) { - ReusableStringStream rss; - rss << duration.count() << " m"; - return rss.str(); - } - }; - template - struct StringMaker>> { - static std::string convert(std::chrono::duration> const& duration) { - ReusableStringStream rss; - rss << duration.count() << " h"; - return rss.str(); - } - }; - - //////////// - // std::chrono::time_point specialization - // Generic time_point cannot be specialized, only std::chrono::time_point - template - struct StringMaker> { - static std::string convert(std::chrono::time_point const& time_point) { - return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch"; - } - }; - // std::chrono::time_point specialization - template - struct StringMaker> { - static std::string convert(std::chrono::time_point const& time_point) { - auto converted = std::chrono::system_clock::to_time_t(time_point); - -#ifdef _MSC_VER - std::tm timeInfo = {}; - gmtime_s(&timeInfo, &converted); -#else - std::tm* timeInfo = std::gmtime(&converted); -#endif - - auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); - char timeStamp[timeStampSize]; - const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; - -#ifdef _MSC_VER - std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); -#else - std::strftime(timeStamp, timeStampSize, fmt, timeInfo); -#endif - return std::string(timeStamp); - } - }; -} -#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -// end catch_tostring.h -#include - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4389) // '==' : signed/unsigned mismatch -#pragma warning(disable:4018) // more "signed/unsigned mismatch" -#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform) -#pragma warning(disable:4180) // qualifier applied to function type has no meaning -#pragma warning(disable:4800) // Forcing result to true or false -#endif - -namespace Catch { - - struct ITransientExpression { - auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } - auto getResult() const -> bool { return m_result; } - virtual void streamReconstructedExpression( std::ostream &os ) const = 0; - - ITransientExpression( bool isBinaryExpression, bool result ) - : m_isBinaryExpression( isBinaryExpression ), - m_result( result ) - {} - - // We don't actually need a virtual destructor, but many static analysers - // complain if it's not here :-( - virtual ~ITransientExpression(); - - bool m_isBinaryExpression; - bool m_result; - - }; - - void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); - - template - class BinaryExpr : public ITransientExpression { - LhsT m_lhs; - StringRef m_op; - RhsT m_rhs; - - void streamReconstructedExpression( std::ostream &os ) const override { - formatReconstructedExpression - ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) ); - } - - public: - BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs ) - : ITransientExpression{ true, comparisonResult }, - m_lhs( lhs ), - m_op( op ), - m_rhs( rhs ) - {} - - template - auto operator && ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator || ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator == ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator != ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator > ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator < ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator >= ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator <= ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - }; - - template - class UnaryExpr : public ITransientExpression { - LhsT m_lhs; - - void streamReconstructedExpression( std::ostream &os ) const override { - os << Catch::Detail::stringify( m_lhs ); - } - - public: - explicit UnaryExpr( LhsT lhs ) - : ITransientExpression{ false, static_cast(lhs) }, - m_lhs( lhs ) - {} - }; - - // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) - template - auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast(lhs == rhs); } - template - auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } - template - auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } - template - auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } - template - auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } - - template - auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast(lhs != rhs); } - template - auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } - template - auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } - template - auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } - template - auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } - - template - class ExprLhs { - LhsT m_lhs; - public: - explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} - - template - auto operator == ( RhsT const& rhs ) -> BinaryExpr const { - return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; - } - auto operator == ( bool rhs ) -> BinaryExpr const { - return { m_lhs == rhs, m_lhs, "==", rhs }; - } - - template - auto operator != ( RhsT const& rhs ) -> BinaryExpr const { - return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; - } - auto operator != ( bool rhs ) -> BinaryExpr const { - return { m_lhs != rhs, m_lhs, "!=", rhs }; - } - - template - auto operator > ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs > rhs), m_lhs, ">", rhs }; - } - template - auto operator < ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs < rhs), m_lhs, "<", rhs }; - } - template - auto operator >= ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs >= rhs), m_lhs, ">=", rhs }; - } - template - auto operator <= ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs <= rhs), m_lhs, "<=", rhs }; - } - - template - auto operator && ( RhsT const& ) -> BinaryExpr const { - static_assert(always_false::value, - "operator&& is not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - template - auto operator || ( RhsT const& ) -> BinaryExpr const { - static_assert(always_false::value, - "operator|| is not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } - - auto makeUnaryExpr() const -> UnaryExpr { - return UnaryExpr{ m_lhs }; - } - }; - - void handleExpression( ITransientExpression const& expr ); - - template - void handleExpression( ExprLhs const& expr ) { - handleExpression( expr.makeUnaryExpr() ); - } - - struct Decomposer { - template - auto operator <= ( T const& lhs ) -> ExprLhs { - return ExprLhs{ lhs }; - } - - auto operator <=( bool value ) -> ExprLhs { - return ExprLhs{ value }; - } - }; - -} // end namespace Catch - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -// end catch_decomposer.h -// start catch_interfaces_capture.h - -#include - -namespace Catch { - - class AssertionResult; - struct AssertionInfo; - struct SectionInfo; - struct SectionEndInfo; - struct MessageInfo; - struct MessageBuilder; - struct Counts; - struct BenchmarkInfo; - struct BenchmarkStats; - struct AssertionReaction; - struct SourceLineInfo; - - struct ITransientExpression; - struct IGeneratorTracker; - - struct IResultCapture { - - virtual ~IResultCapture(); - - virtual bool sectionStarted( SectionInfo const& sectionInfo, - Counts& assertions ) = 0; - virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; - virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; - - virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; - - virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; - virtual void benchmarkEnded( BenchmarkStats const& stats ) = 0; - - virtual void pushScopedMessage( MessageInfo const& message ) = 0; - virtual void popScopedMessage( MessageInfo const& message ) = 0; - - virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0; - - virtual void handleFatalErrorCondition( StringRef message ) = 0; - - virtual void handleExpr - ( AssertionInfo const& info, - ITransientExpression const& expr, - AssertionReaction& reaction ) = 0; - virtual void handleMessage - ( AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef const& message, - AssertionReaction& reaction ) = 0; - virtual void handleUnexpectedExceptionNotThrown - ( AssertionInfo const& info, - AssertionReaction& reaction ) = 0; - virtual void handleUnexpectedInflightException - ( AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction ) = 0; - virtual void handleIncomplete - ( AssertionInfo const& info ) = 0; - virtual void handleNonExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction ) = 0; - - virtual bool lastAssertionPassed() = 0; - virtual void assertionPassed() = 0; - - // Deprecated, do not use: - virtual std::string getCurrentTestName() const = 0; - virtual const AssertionResult* getLastResult() const = 0; - virtual void exceptionEarlyReported() = 0; - }; - - IResultCapture& getResultCapture(); -} - -// end catch_interfaces_capture.h -namespace Catch { - - struct TestFailureException{}; - struct AssertionResultData; - struct IResultCapture; - class RunContext; - - class LazyExpression { - friend class AssertionHandler; - friend struct AssertionStats; - friend class RunContext; - - ITransientExpression const* m_transientExpression = nullptr; - bool m_isNegated; - public: - LazyExpression( bool isNegated ); - LazyExpression( LazyExpression const& other ); - LazyExpression& operator = ( LazyExpression const& ) = delete; - - explicit operator bool() const; - - friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; - }; - - struct AssertionReaction { - bool shouldDebugBreak = false; - bool shouldThrow = false; - }; - - class AssertionHandler { - AssertionInfo m_assertionInfo; - AssertionReaction m_reaction; - bool m_completed = false; - IResultCapture& m_resultCapture; - - public: - AssertionHandler - ( StringRef const& macroName, - SourceLineInfo const& lineInfo, - StringRef capturedExpression, - ResultDisposition::Flags resultDisposition ); - ~AssertionHandler() { - if ( !m_completed ) { - m_resultCapture.handleIncomplete( m_assertionInfo ); - } - } - - template - void handleExpr( ExprLhs const& expr ) { - handleExpr( expr.makeUnaryExpr() ); - } - void handleExpr( ITransientExpression const& expr ); - - void handleMessage(ResultWas::OfType resultType, StringRef const& message); - - void handleExceptionThrownAsExpected(); - void handleUnexpectedExceptionNotThrown(); - void handleExceptionNotThrownAsExpected(); - void handleThrowingCallSkipped(); - void handleUnexpectedInflightException(); - - void complete(); - void setCompleted(); - - // query - auto allowThrows() const -> bool; - }; - - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ); - -} // namespace Catch - -// end catch_assertionhandler.h -// start catch_message.h - -#include -#include - -namespace Catch { - - struct MessageInfo { - MessageInfo( StringRef const& _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ); - - StringRef macroName; - std::string message; - SourceLineInfo lineInfo; - ResultWas::OfType type; - unsigned int sequence; - - bool operator == ( MessageInfo const& other ) const; - bool operator < ( MessageInfo const& other ) const; - private: - static unsigned int globalCount; - }; - - struct MessageStream { - - template - MessageStream& operator << ( T const& value ) { - m_stream << value; - return *this; - } - - ReusableStringStream m_stream; - }; - - struct MessageBuilder : MessageStream { - MessageBuilder( StringRef const& macroName, - SourceLineInfo const& lineInfo, - ResultWas::OfType type ); - - template - MessageBuilder& operator << ( T const& value ) { - m_stream << value; - return *this; - } - - MessageInfo m_info; - }; - - class ScopedMessage { - public: - explicit ScopedMessage( MessageBuilder const& builder ); - ScopedMessage( ScopedMessage& duplicate ) = delete; - ScopedMessage( ScopedMessage&& old ); - ~ScopedMessage(); - - MessageInfo m_info; - bool m_moved; - }; - - class Capturer { - std::vector m_messages; - IResultCapture& m_resultCapture = getResultCapture(); - size_t m_captured = 0; - public: - Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); - ~Capturer(); - - void captureValue( size_t index, std::string const& value ); - - template - void captureValues( size_t index, T const& value ) { - captureValue( index, Catch::Detail::stringify( value ) ); - } - - template - void captureValues( size_t index, T const& value, Ts const&... values ) { - captureValue( index, Catch::Detail::stringify(value) ); - captureValues( index+1, values... ); - } - }; - -} // end namespace Catch - -// end catch_message.h -#if !defined(CATCH_CONFIG_DISABLE) - -#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) - #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ -#else - #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" -#endif - -#if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - -/////////////////////////////////////////////////////////////////////////////// -// Another way to speed-up compilation is to omit local try-catch for REQUIRE* -// macros. -#define INTERNAL_CATCH_TRY -#define INTERNAL_CATCH_CATCH( capturer ) - -#else // CATCH_CONFIG_FAST_COMPILE - -#define INTERNAL_CATCH_TRY try -#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); } - -#endif - -#define INTERNAL_CATCH_REACT( handler ) handler.complete(); - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ - INTERNAL_CATCH_TRY { \ - CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ - CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ - } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( (void)0, (false) && static_cast( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look - // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ - INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ - if( Catch::getResultCapture().lastAssertionPassed() ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \ - INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ - if( !Catch::getResultCapture().lastAssertionPassed() ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ - try { \ - static_cast(__VA_ARGS__); \ - catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ - } \ - catch( ... ) { \ - catchAssertionHandler.handleUnexpectedInflightException(); \ - } \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ - if( catchAssertionHandler.allowThrows() ) \ - try { \ - static_cast(__VA_ARGS__); \ - catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } \ - catch( ... ) { \ - catchAssertionHandler.handleExceptionThrownAsExpected(); \ - } \ - else \ - catchAssertionHandler.handleThrowingCallSkipped(); \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ - if( catchAssertionHandler.allowThrows() ) \ - try { \ - static_cast(expr); \ - catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } \ - catch( exceptionType const& ) { \ - catchAssertionHandler.handleExceptionThrownAsExpected(); \ - } \ - catch( ... ) { \ - catchAssertionHandler.handleUnexpectedInflightException(); \ - } \ - else \ - catchAssertionHandler.handleThrowingCallSkipped(); \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \ - catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ - auto varName = Catch::Capturer( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ - varName.captureValues( 0, __VA_ARGS__ ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_INFO( macroName, log ) \ - Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ); - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \ - Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) - -/////////////////////////////////////////////////////////////////////////////// -// Although this is matcher-based, it can be used with just a string -#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ - if( catchAssertionHandler.allowThrows() ) \ - try { \ - static_cast(__VA_ARGS__); \ - catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } \ - catch( ... ) { \ - Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \ - } \ - else \ - catchAssertionHandler.handleThrowingCallSkipped(); \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -#endif // CATCH_CONFIG_DISABLE - -// end catch_capture.hpp -// start catch_section.h - -// start catch_section_info.h - -// start catch_totals.h - -#include - -namespace Catch { - - struct Counts { - Counts operator - ( Counts const& other ) const; - Counts& operator += ( Counts const& other ); - - std::size_t total() const; - bool allPassed() const; - bool allOk() const; - - std::size_t passed = 0; - std::size_t failed = 0; - std::size_t failedButOk = 0; - }; - - struct Totals { - - Totals operator - ( Totals const& other ) const; - Totals& operator += ( Totals const& other ); - - Totals delta( Totals const& prevTotals ) const; - - int error = 0; - Counts assertions; - Counts testCases; - }; -} - -// end catch_totals.h -#include - -namespace Catch { - - struct SectionInfo { - SectionInfo - ( SourceLineInfo const& _lineInfo, - std::string const& _name ); - - // Deprecated - SectionInfo - ( SourceLineInfo const& _lineInfo, - std::string const& _name, - std::string const& ) : SectionInfo( _lineInfo, _name ) {} - - std::string name; - std::string description; // !Deprecated: this will always be empty - SourceLineInfo lineInfo; - }; - - struct SectionEndInfo { - SectionInfo sectionInfo; - Counts prevAssertions; - double durationInSeconds; - }; - -} // end namespace Catch - -// end catch_section_info.h -// start catch_timer.h - -#include - -namespace Catch { - - auto getCurrentNanosecondsSinceEpoch() -> uint64_t; - auto getEstimatedClockResolution() -> uint64_t; - - class Timer { - uint64_t m_nanoseconds = 0; - public: - void start(); - auto getElapsedNanoseconds() const -> uint64_t; - auto getElapsedMicroseconds() const -> uint64_t; - auto getElapsedMilliseconds() const -> unsigned int; - auto getElapsedSeconds() const -> double; - }; - -} // namespace Catch - -// end catch_timer.h -#include - -namespace Catch { - - class Section : NonCopyable { - public: - Section( SectionInfo const& info ); - ~Section(); - - // This indicates whether the section should be executed or not - explicit operator bool() const; - - private: - SectionInfo m_info; - - std::string m_name; - Counts m_assertions; - bool m_sectionIncluded; - Timer m_timer; - }; - -} // end namespace Catch - -#define INTERNAL_CATCH_SECTION( ... ) \ - CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS - -#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ - CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS - -// end catch_section.h -// start catch_benchmark.h - -#include -#include - -namespace Catch { - - class BenchmarkLooper { - - std::string m_name; - std::size_t m_count = 0; - std::size_t m_iterationsToRun = 1; - uint64_t m_resolution; - Timer m_timer; - - static auto getResolution() -> uint64_t; - public: - // Keep most of this inline as it's on the code path that is being timed - BenchmarkLooper( StringRef name ) - : m_name( name ), - m_resolution( getResolution() ) - { - reportStart(); - m_timer.start(); - } - - explicit operator bool() { - if( m_count < m_iterationsToRun ) - return true; - return needsMoreIterations(); - } - - void increment() { - ++m_count; - } - - void reportStart(); - auto needsMoreIterations() -> bool; - }; - -} // end namespace Catch - -#define BENCHMARK( name ) \ - for( Catch::BenchmarkLooper looper( name ); looper; looper.increment() ) - -// end catch_benchmark.h -// start catch_interfaces_exception.h - -// start catch_interfaces_registry_hub.h - -#include -#include - -namespace Catch { - - class TestCase; - struct ITestCaseRegistry; - struct IExceptionTranslatorRegistry; - struct IExceptionTranslator; - struct IReporterRegistry; - struct IReporterFactory; - struct ITagAliasRegistry; - class StartupExceptionRegistry; - - using IReporterFactoryPtr = std::shared_ptr; - - struct IRegistryHub { - virtual ~IRegistryHub(); - - virtual IReporterRegistry const& getReporterRegistry() const = 0; - virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; - virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; - - virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; - - virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; - }; - - struct IMutableRegistryHub { - virtual ~IMutableRegistryHub(); - virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; - virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; - virtual void registerTest( TestCase const& testInfo ) = 0; - virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; - virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; - virtual void registerStartupException() noexcept = 0; - }; - - IRegistryHub const& getRegistryHub(); - IMutableRegistryHub& getMutableRegistryHub(); - void cleanUp(); - std::string translateActiveException(); - -} - -// end catch_interfaces_registry_hub.h -#if defined(CATCH_CONFIG_DISABLE) - #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ - static std::string translatorName( signature ) -#endif - -#include -#include -#include - -namespace Catch { - using exceptionTranslateFunction = std::string(*)(); - - struct IExceptionTranslator; - using ExceptionTranslators = std::vector>; - - struct IExceptionTranslator { - virtual ~IExceptionTranslator(); - virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; - }; - - struct IExceptionTranslatorRegistry { - virtual ~IExceptionTranslatorRegistry(); - - virtual std::string translateActiveException() const = 0; - }; - - class ExceptionTranslatorRegistrar { - template - class ExceptionTranslator : public IExceptionTranslator { - public: - - ExceptionTranslator( std::string(*translateFunction)( T& ) ) - : m_translateFunction( translateFunction ) - {} - - std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { - try { - if( it == itEnd ) - std::rethrow_exception(std::current_exception()); - else - return (*it)->translate( it+1, itEnd ); - } - catch( T& ex ) { - return m_translateFunction( ex ); - } - } - - protected: - std::string(*m_translateFunction)( T& ); - }; - - public: - template - ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { - getMutableRegistryHub().registerTranslator - ( new ExceptionTranslator( translateFunction ) ); - } - }; -} - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ - static std::string translatorName( signature ); \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - static std::string translatorName( signature ) - -#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) - -// end catch_interfaces_exception.h -// start catch_approx.h - -#include - -namespace Catch { -namespace Detail { - - class Approx { - private: - bool equalityComparisonImpl(double other) const; - // Validates the new margin (margin >= 0) - // out-of-line to avoid including stdexcept in the header - void setMargin(double margin); - // Validates the new epsilon (0 < epsilon < 1) - // out-of-line to avoid including stdexcept in the header - void setEpsilon(double epsilon); - - public: - explicit Approx ( double value ); - - static Approx custom(); - - Approx operator-() const; - - template ::value>::type> - Approx operator()( T const& value ) { - Approx approx( static_cast(value) ); - approx.m_epsilon = m_epsilon; - approx.m_margin = m_margin; - approx.m_scale = m_scale; - return approx; - } - - template ::value>::type> - explicit Approx( T const& value ): Approx(static_cast(value)) - {} - - template ::value>::type> - friend bool operator == ( const T& lhs, Approx const& rhs ) { - auto lhs_v = static_cast(lhs); - return rhs.equalityComparisonImpl(lhs_v); - } - - template ::value>::type> - friend bool operator == ( Approx const& lhs, const T& rhs ) { - return operator==( rhs, lhs ); - } - - template ::value>::type> - friend bool operator != ( T const& lhs, Approx const& rhs ) { - return !operator==( lhs, rhs ); - } - - template ::value>::type> - friend bool operator != ( Approx const& lhs, T const& rhs ) { - return !operator==( rhs, lhs ); - } - - template ::value>::type> - friend bool operator <= ( T const& lhs, Approx const& rhs ) { - return static_cast(lhs) < rhs.m_value || lhs == rhs; - } - - template ::value>::type> - friend bool operator <= ( Approx const& lhs, T const& rhs ) { - return lhs.m_value < static_cast(rhs) || lhs == rhs; - } - - template ::value>::type> - friend bool operator >= ( T const& lhs, Approx const& rhs ) { - return static_cast(lhs) > rhs.m_value || lhs == rhs; - } - - template ::value>::type> - friend bool operator >= ( Approx const& lhs, T const& rhs ) { - return lhs.m_value > static_cast(rhs) || lhs == rhs; - } - - template ::value>::type> - Approx& epsilon( T const& newEpsilon ) { - double epsilonAsDouble = static_cast(newEpsilon); - setEpsilon(epsilonAsDouble); - return *this; - } - - template ::value>::type> - Approx& margin( T const& newMargin ) { - double marginAsDouble = static_cast(newMargin); - setMargin(marginAsDouble); - return *this; - } - - template ::value>::type> - Approx& scale( T const& newScale ) { - m_scale = static_cast(newScale); - return *this; - } - - std::string toString() const; - - private: - double m_epsilon; - double m_margin; - double m_scale; - double m_value; - }; -} // end namespace Detail - -namespace literals { - Detail::Approx operator "" _a(long double val); - Detail::Approx operator "" _a(unsigned long long val); -} // end namespace literals - -template<> -struct StringMaker { - static std::string convert(Catch::Detail::Approx const& value); -}; - -} // end namespace Catch - -// end catch_approx.h -// start catch_string_manip.h - -#include -#include - -namespace Catch { - - bool startsWith( std::string const& s, std::string const& prefix ); - bool startsWith( std::string const& s, char prefix ); - bool endsWith( std::string const& s, std::string const& suffix ); - bool endsWith( std::string const& s, char suffix ); - bool contains( std::string const& s, std::string const& infix ); - void toLowerInPlace( std::string& s ); - std::string toLower( std::string const& s ); - std::string trim( std::string const& str ); - bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); - - struct pluralise { - pluralise( std::size_t count, std::string const& label ); - - friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); - - std::size_t m_count; - std::string m_label; - }; -} - -// end catch_string_manip.h -#ifndef CATCH_CONFIG_DISABLE_MATCHERS -// start catch_capture_matchers.h - -// start catch_matchers.h - -#include -#include - -namespace Catch { -namespace Matchers { - namespace Impl { - - template struct MatchAllOf; - template struct MatchAnyOf; - template struct MatchNotOf; - - class MatcherUntypedBase { - public: - MatcherUntypedBase() = default; - MatcherUntypedBase ( MatcherUntypedBase const& ) = default; - MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete; - std::string toString() const; - - protected: - virtual ~MatcherUntypedBase(); - virtual std::string describe() const = 0; - mutable std::string m_cachedToString; - }; - -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif - - template - struct MatcherMethod { - virtual bool match( ObjectT const& arg ) const = 0; - }; - -#ifdef __clang__ -# pragma clang diagnostic pop -#endif - - template - struct MatcherBase : MatcherUntypedBase, MatcherMethod { - - MatchAllOf operator && ( MatcherBase const& other ) const; - MatchAnyOf operator || ( MatcherBase const& other ) const; - MatchNotOf operator ! () const; - }; - - template - struct MatchAllOf : MatcherBase { - bool match( ArgT const& arg ) const override { - for( auto matcher : m_matchers ) { - if (!matcher->match(arg)) - return false; - } - return true; - } - std::string describe() const override { - std::string description; - description.reserve( 4 + m_matchers.size()*32 ); - description += "( "; - bool first = true; - for( auto matcher : m_matchers ) { - if( first ) - first = false; - else - description += " and "; - description += matcher->toString(); - } - description += " )"; - return description; - } - - MatchAllOf& operator && ( MatcherBase const& other ) { - m_matchers.push_back( &other ); - return *this; - } - - std::vector const*> m_matchers; - }; - template - struct MatchAnyOf : MatcherBase { - - bool match( ArgT const& arg ) const override { - for( auto matcher : m_matchers ) { - if (matcher->match(arg)) - return true; - } - return false; - } - std::string describe() const override { - std::string description; - description.reserve( 4 + m_matchers.size()*32 ); - description += "( "; - bool first = true; - for( auto matcher : m_matchers ) { - if( first ) - first = false; - else - description += " or "; - description += matcher->toString(); - } - description += " )"; - return description; - } - - MatchAnyOf& operator || ( MatcherBase const& other ) { - m_matchers.push_back( &other ); - return *this; - } - - std::vector const*> m_matchers; - }; - - template - struct MatchNotOf : MatcherBase { - - MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} - - bool match( ArgT const& arg ) const override { - return !m_underlyingMatcher.match( arg ); - } - - std::string describe() const override { - return "not " + m_underlyingMatcher.toString(); - } - MatcherBase const& m_underlyingMatcher; - }; - - template - MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { - return MatchAllOf() && *this && other; - } - template - MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { - return MatchAnyOf() || *this || other; - } - template - MatchNotOf MatcherBase::operator ! () const { - return MatchNotOf( *this ); - } - - } // namespace Impl - -} // namespace Matchers - -using namespace Matchers; -using Matchers::Impl::MatcherBase; - -} // namespace Catch - -// end catch_matchers.h -// start catch_matchers_floating.h - -#include -#include - -namespace Catch { -namespace Matchers { - - namespace Floating { - - enum class FloatingPointKind : uint8_t; - - struct WithinAbsMatcher : MatcherBase { - WithinAbsMatcher(double target, double margin); - bool match(double const& matchee) const override; - std::string describe() const override; - private: - double m_target; - double m_margin; - }; - - struct WithinUlpsMatcher : MatcherBase { - WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType); - bool match(double const& matchee) const override; - std::string describe() const override; - private: - double m_target; - int m_ulps; - FloatingPointKind m_type; - }; - - } // namespace Floating - - // The following functions create the actual matcher objects. - // This allows the types to be inferred - Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff); - Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff); - Floating::WithinAbsMatcher WithinAbs(double target, double margin); - -} // namespace Matchers -} // namespace Catch - -// end catch_matchers_floating.h -// start catch_matchers_generic.hpp - -#include -#include - -namespace Catch { -namespace Matchers { -namespace Generic { - -namespace Detail { - std::string finalizeDescription(const std::string& desc); -} - -template -class PredicateMatcher : public MatcherBase { - std::function m_predicate; - std::string m_description; -public: - - PredicateMatcher(std::function const& elem, std::string const& descr) - :m_predicate(std::move(elem)), - m_description(Detail::finalizeDescription(descr)) - {} - - bool match( T const& item ) const override { - return m_predicate(item); - } - - std::string describe() const override { - return m_description; - } -}; - -} // namespace Generic - - // The following functions create the actual matcher objects. - // The user has to explicitly specify type to the function, because - // infering std::function is hard (but possible) and - // requires a lot of TMP. - template - Generic::PredicateMatcher Predicate(std::function const& predicate, std::string const& description = "") { - return Generic::PredicateMatcher(predicate, description); - } - -} // namespace Matchers -} // namespace Catch - -// end catch_matchers_generic.hpp -// start catch_matchers_string.h - -#include - -namespace Catch { -namespace Matchers { - - namespace StdString { - - struct CasedString - { - CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); - std::string adjustString( std::string const& str ) const; - std::string caseSensitivitySuffix() const; - - CaseSensitive::Choice m_caseSensitivity; - std::string m_str; - }; - - struct StringMatcherBase : MatcherBase { - StringMatcherBase( std::string const& operation, CasedString const& comparator ); - std::string describe() const override; - - CasedString m_comparator; - std::string m_operation; - }; - - struct EqualsMatcher : StringMatcherBase { - EqualsMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; - }; - struct ContainsMatcher : StringMatcherBase { - ContainsMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; - }; - struct StartsWithMatcher : StringMatcherBase { - StartsWithMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; - }; - struct EndsWithMatcher : StringMatcherBase { - EndsWithMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; - }; - - struct RegexMatcher : MatcherBase { - RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity ); - bool match( std::string const& matchee ) const override; - std::string describe() const override; - - private: - std::string m_regex; - CaseSensitive::Choice m_caseSensitivity; - }; - - } // namespace StdString - - // The following functions create the actual matcher objects. - // This allows the types to be inferred - - StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); - StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); - StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); - StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); - StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); - -} // namespace Matchers -} // namespace Catch - -// end catch_matchers_string.h -// start catch_matchers_vector.h - -#include - -namespace Catch { -namespace Matchers { - - namespace Vector { - namespace Detail { - template - size_t count(InputIterator first, InputIterator last, T const& item) { - size_t cnt = 0; - for (; first != last; ++first) { - if (*first == item) { - ++cnt; - } - } - return cnt; - } - template - bool contains(InputIterator first, InputIterator last, T const& item) { - for (; first != last; ++first) { - if (*first == item) { - return true; - } - } - return false; - } - } - - template - struct ContainsElementMatcher : MatcherBase> { - - ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} - - bool match(std::vector const &v) const override { - for (auto const& el : v) { - if (el == m_comparator) { - return true; - } - } - return false; - } - - std::string describe() const override { - return "Contains: " + ::Catch::Detail::stringify( m_comparator ); - } - - T const& m_comparator; - }; - - template - struct ContainsMatcher : MatcherBase> { - - ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} - - bool match(std::vector const &v) const override { - // !TBD: see note in EqualsMatcher - if (m_comparator.size() > v.size()) - return false; - for (auto const& comparator : m_comparator) { - auto present = false; - for (const auto& el : v) { - if (el == comparator) { - present = true; - break; - } - } - if (!present) { - return false; - } - } - return true; - } - std::string describe() const override { - return "Contains: " + ::Catch::Detail::stringify( m_comparator ); - } - - std::vector const& m_comparator; - }; - - template - struct EqualsMatcher : MatcherBase> { - - EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} - - bool match(std::vector const &v) const override { - // !TBD: This currently works if all elements can be compared using != - // - a more general approach would be via a compare template that defaults - // to using !=. but could be specialised for, e.g. std::vector etc - // - then just call that directly - if (m_comparator.size() != v.size()) - return false; - for (std::size_t i = 0; i < v.size(); ++i) - if (m_comparator[i] != v[i]) - return false; - return true; - } - std::string describe() const override { - return "Equals: " + ::Catch::Detail::stringify( m_comparator ); - } - std::vector const& m_comparator; - }; - - template - struct UnorderedEqualsMatcher : MatcherBase> { - UnorderedEqualsMatcher(std::vector const& target) : m_target(target) {} - bool match(std::vector const& vec) const override { - // Note: This is a reimplementation of std::is_permutation, - // because I don't want to include inside the common path - if (m_target.size() != vec.size()) { - return false; - } - auto lfirst = m_target.begin(), llast = m_target.end(); - auto rfirst = vec.begin(), rlast = vec.end(); - // Cut common prefix to optimize checking of permuted parts - while (lfirst != llast && *lfirst == *rfirst) { - ++lfirst; ++rfirst; - } - if (lfirst == llast) { - return true; - } - - for (auto mid = lfirst; mid != llast; ++mid) { - // Skip already counted items - if (Detail::contains(lfirst, mid, *mid)) { - continue; - } - size_t num_vec = Detail::count(rfirst, rlast, *mid); - if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) { - return false; - } - } - - return true; - } - - std::string describe() const override { - return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); - } - private: - std::vector const& m_target; - }; - - } // namespace Vector - - // The following functions create the actual matcher objects. - // This allows the types to be inferred - - template - Vector::ContainsMatcher Contains( std::vector const& comparator ) { - return Vector::ContainsMatcher( comparator ); - } - - template - Vector::ContainsElementMatcher VectorContains( T const& comparator ) { - return Vector::ContainsElementMatcher( comparator ); - } - - template - Vector::EqualsMatcher Equals( std::vector const& comparator ) { - return Vector::EqualsMatcher( comparator ); - } - - template - Vector::UnorderedEqualsMatcher UnorderedEquals(std::vector const& target) { - return Vector::UnorderedEqualsMatcher(target); - } - -} // namespace Matchers -} // namespace Catch - -// end catch_matchers_vector.h -namespace Catch { - - template - class MatchExpr : public ITransientExpression { - ArgT const& m_arg; - MatcherT m_matcher; - StringRef m_matcherString; - public: - MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) - : ITransientExpression{ true, matcher.match( arg ) }, - m_arg( arg ), - m_matcher( matcher ), - m_matcherString( matcherString ) - {} - - void streamReconstructedExpression( std::ostream &os ) const override { - auto matcherAsString = m_matcher.toString(); - os << Catch::Detail::stringify( m_arg ) << ' '; - if( matcherAsString == Detail::unprintableString ) - os << m_matcherString; - else - os << matcherAsString; - } - }; - - using StringMatcher = Matchers::Impl::MatcherBase; - - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); - - template - auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr { - return MatchExpr( arg, matcher, matcherString ); - } - -} // namespace Catch - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ - INTERNAL_CATCH_TRY { \ - catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ - } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \ - do { \ - Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ - if( catchAssertionHandler.allowThrows() ) \ - try { \ - static_cast(__VA_ARGS__ ); \ - catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } \ - catch( exceptionType const& ex ) { \ - catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \ - } \ - catch( ... ) { \ - catchAssertionHandler.handleUnexpectedInflightException(); \ - } \ - else \ - catchAssertionHandler.handleThrowingCallSkipped(); \ - INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( false ) - -// end catch_capture_matchers.h -#endif -// start catch_generators.hpp - -// start catch_interfaces_generatortracker.h - - -#include - -namespace Catch { - - namespace Generators { - class GeneratorUntypedBase { - public: - GeneratorUntypedBase() = default; - virtual ~GeneratorUntypedBase(); - // Attempts to move the generator to the next element - // - // Returns true iff the move succeeded (and a valid element - // can be retrieved). - virtual bool next() = 0; - }; - using GeneratorBasePtr = std::unique_ptr; - - } // namespace Generators - - struct IGeneratorTracker { - virtual ~IGeneratorTracker(); - virtual auto hasGenerator() const -> bool = 0; - virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; - virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; - }; - -} // namespace Catch - -// end catch_interfaces_generatortracker.h -// start catch_enforce.h - -#include - -namespace Catch { -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - template - [[noreturn]] - void throw_exception(Ex const& e) { - throw e; - } -#else // ^^ Exceptions are enabled // Exceptions are disabled vv - [[noreturn]] - void throw_exception(std::exception const& e); -#endif -} // namespace Catch; - -#define CATCH_PREPARE_EXCEPTION( type, msg ) \ - type( ( Catch::ReusableStringStream() << msg ).str() ) -#define CATCH_INTERNAL_ERROR( msg ) \ - Catch::throw_exception(CATCH_PREPARE_EXCEPTION( std::logic_error, CATCH_INTERNAL_LINEINFO << ": Internal Catch error: " << msg)) -#define CATCH_ERROR( msg ) \ - Catch::throw_exception(CATCH_PREPARE_EXCEPTION( std::domain_error, msg )) -#define CATCH_RUNTIME_ERROR( msg ) \ - Catch::throw_exception(CATCH_PREPARE_EXCEPTION( std::runtime_error, msg )) -#define CATCH_ENFORCE( condition, msg ) \ - do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false) - -// end catch_enforce.h -#include -#include -#include - -#include -#include - -namespace Catch { - -class GeneratorException : public std::exception { - const char* const m_msg = ""; - -public: - GeneratorException(const char* msg): - m_msg(msg) - {} - - const char* what() const noexcept override final; -}; - -namespace Generators { - - // !TBD move this into its own location? - namespace pf{ - template - std::unique_ptr make_unique( Args&&... args ) { - return std::unique_ptr(new T(std::forward(args)...)); - } - } - - template - struct IGenerator : GeneratorUntypedBase { - virtual ~IGenerator() = default; - - // Returns the current element of the generator - // - // \Precondition The generator is either freshly constructed, - // or the last call to `next()` returned true - virtual T const& get() const = 0; - using type = T; - }; - - template - class SingleValueGenerator final : public IGenerator { - T m_value; - public: - SingleValueGenerator(T const& value) : m_value( value ) {} - SingleValueGenerator(T&& value) : m_value(std::move(value)) {} - - T const& get() const override { - return m_value; - } - bool next() override { - return false; - } - }; - - template - class FixedValuesGenerator final : public IGenerator { - std::vector m_values; - size_t m_idx = 0; - public: - FixedValuesGenerator( std::initializer_list values ) : m_values( values ) {} - - T const& get() const override { - return m_values[m_idx]; - } - bool next() override { - ++m_idx; - return m_idx < m_values.size(); - } - }; - - template - class GeneratorWrapper final { - std::unique_ptr> m_generator; - public: - GeneratorWrapper(std::unique_ptr> generator): - m_generator(std::move(generator)) - {} - T const& get() const { - return m_generator->get(); - } - bool next() { - return m_generator->next(); - } - }; - - template - GeneratorWrapper value(T&& value) { - return GeneratorWrapper(pf::make_unique>(std::forward(value))); - } - template - GeneratorWrapper values(std::initializer_list values) { - return GeneratorWrapper(pf::make_unique>(values)); - } - - template - class Generators : public IGenerator { - std::vector> m_generators; - size_t m_current = 0; - - void populate(GeneratorWrapper&& generator) { - m_generators.emplace_back(std::move(generator)); - } - void populate(T&& val) { - m_generators.emplace_back(value(std::move(val))); - } - template - void populate(U&& val) { - populate(T(std::move(val))); - } - template - void populate(U&& valueOrGenerator, Gs... moreGenerators) { - populate(std::forward(valueOrGenerator)); - populate(std::forward(moreGenerators)...); - } - - public: - template - Generators(Gs... moreGenerators) { - m_generators.reserve(sizeof...(Gs)); - populate(std::forward(moreGenerators)...); - } - - T const& get() const override { - return m_generators[m_current].get(); - } - - bool next() override { - if (m_current >= m_generators.size()) { - return false; - } - const bool current_status = m_generators[m_current].next(); - if (!current_status) { - ++m_current; - } - return m_current < m_generators.size(); - } - }; - - template - GeneratorWrapper> table( std::initializer_list::type...>> tuples ) { - return values>( tuples ); - } - - // Tag type to signal that a generator sequence should convert arguments to a specific type - template - struct as {}; - - template - auto makeGenerators( GeneratorWrapper&& generator, Gs... moreGenerators ) -> Generators { - return Generators(std::move(generator), std::forward(moreGenerators)...); - } - template - auto makeGenerators( GeneratorWrapper&& generator ) -> Generators { - return Generators(std::move(generator)); - } - template - auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators { - return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); - } - template - auto makeGenerators( as, U&& val, Gs... moreGenerators ) -> Generators { - return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); - } - - auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; - - template - // Note: The type after -> is weird, because VS2015 cannot parse - // the expression used in the typedef inside, when it is in - // return type. Yeah. - auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval().get()) { - using UnderlyingType = typename decltype(generatorExpression())::type; - - IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo ); - if (!tracker.hasGenerator()) { - tracker.setGenerator(pf::make_unique>(generatorExpression())); - } - - auto const& generator = static_cast const&>( *tracker.getGenerator() ); - return generator.get(); - } - -} // namespace Generators -} // namespace Catch - -#define GENERATE( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, []{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) - -// end catch_generators.hpp -// start catch_generators_generic.hpp - -namespace Catch { -namespace Generators { - - template - class TakeGenerator : public IGenerator { - GeneratorWrapper m_generator; - size_t m_returned = 0; - size_t m_target; - public: - TakeGenerator(size_t target, GeneratorWrapper&& generator): - m_generator(std::move(generator)), - m_target(target) - { - assert(target != 0 && "Empty generators are not allowed"); - } - T const& get() const override { - return m_generator.get(); - } - bool next() override { - ++m_returned; - if (m_returned >= m_target) { - return false; - } - - const auto success = m_generator.next(); - // If the underlying generator does not contain enough values - // then we cut short as well - if (!success) { - m_returned = m_target; - } - return success; - } - }; - - template - GeneratorWrapper take(size_t target, GeneratorWrapper&& generator) { - return GeneratorWrapper(pf::make_unique>(target, std::move(generator))); - } - - template - class FilterGenerator : public IGenerator { - GeneratorWrapper m_generator; - Predicate m_predicate; - public: - template - FilterGenerator(P&& pred, GeneratorWrapper&& generator): - m_generator(std::move(generator)), - m_predicate(std::forward

(pred)) - { - if (!m_predicate(m_generator.get())) { - // It might happen that there are no values that pass the - // filter. In that case we throw an exception. - auto has_initial_value = next(); - if (!has_initial_value) { - Catch::throw_exception(GeneratorException("No valid value found in filtered generator")); - } - } - } - - T const& get() const override { - return m_generator.get(); - } - - bool next() override { - bool success = m_generator.next(); - if (!success) { - return false; - } - while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true); - return success; - } - }; - - template - GeneratorWrapper filter(Predicate&& pred, GeneratorWrapper&& generator) { - return GeneratorWrapper(std::unique_ptr>(pf::make_unique>(std::forward(pred), std::move(generator)))); - } - - template - class RepeatGenerator : public IGenerator { - GeneratorWrapper m_generator; - mutable std::vector m_returned; - size_t m_target_repeats; - size_t m_current_repeat = 0; - size_t m_repeat_index = 0; - public: - RepeatGenerator(size_t repeats, GeneratorWrapper&& generator): - m_generator(std::move(generator)), - m_target_repeats(repeats) - { - assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); - } - - T const& get() const override { - if (m_current_repeat == 0) { - m_returned.push_back(m_generator.get()); - return m_returned.back(); - } - return m_returned[m_repeat_index]; - } - - bool next() override { - // There are 2 basic cases: - // 1) We are still reading the generator - // 2) We are reading our own cache - - // In the first case, we need to poke the underlying generator. - // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache - if (m_current_repeat == 0) { - const auto success = m_generator.next(); - if (!success) { - ++m_current_repeat; - } - return m_current_repeat < m_target_repeats; - } - - // In the second case, we need to move indices forward and check that we haven't run up against the end - ++m_repeat_index; - if (m_repeat_index == m_returned.size()) { - m_repeat_index = 0; - ++m_current_repeat; - } - return m_current_repeat < m_target_repeats; - } - }; - - template - GeneratorWrapper repeat(size_t repeats, GeneratorWrapper&& generator) { - return GeneratorWrapper(pf::make_unique>(repeats, std::move(generator))); - } - - template - class MapGenerator : public IGenerator { - // TBD: provide static assert for mapping function, for friendly error message - GeneratorWrapper m_generator; - Func m_function; - // To avoid returning dangling reference, we have to save the values - T m_cache; - public: - template - MapGenerator(F2&& function, GeneratorWrapper&& generator) : - m_generator(std::move(generator)), - m_function(std::forward(function)), - m_cache(m_function(m_generator.get())) - {} - - T const& get() const override { - return m_cache; - } - bool next() override { - const auto success = m_generator.next(); - if (success) { - m_cache = m_function(m_generator.get()); - } - return success; - } - }; - - template - GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { - return GeneratorWrapper( - pf::make_unique>(std::forward(function), std::move(generator)) - ); - } - template - GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { - return GeneratorWrapper( - pf::make_unique>(std::forward(function), std::move(generator)) - ); - } - - template - class ChunkGenerator final : public IGenerator> { - std::vector m_chunk; - size_t m_chunk_size; - GeneratorWrapper m_generator; - bool m_used_up = false; - public: - ChunkGenerator(size_t size, GeneratorWrapper generator) : - m_chunk_size(size), m_generator(std::move(generator)) - { - m_chunk.reserve(m_chunk_size); - m_chunk.push_back(m_generator.get()); - for (size_t i = 1; i < m_chunk_size; ++i) { - if (!m_generator.next()) { - Catch::throw_exception(GeneratorException("Not enough values to initialize the first chunk")); - } - m_chunk.push_back(m_generator.get()); - } - } - std::vector const& get() const override { - return m_chunk; - } - bool next() override { - m_chunk.clear(); - for (size_t idx = 0; idx < m_chunk_size; ++idx) { - if (!m_generator.next()) { - return false; - } - m_chunk.push_back(m_generator.get()); - } - return true; - } - }; - - template - GeneratorWrapper> chunk(size_t size, GeneratorWrapper&& generator) { - return GeneratorWrapper>( - pf::make_unique>(size, std::move(generator)) - ); - } - -} // namespace Generators -} // namespace Catch - -// end catch_generators_generic.hpp -// start catch_generators_specific.hpp - -// start catch_context.h - -#include - -namespace Catch { - - struct IResultCapture; - struct IRunner; - struct IConfig; - struct IMutableContext; - - using IConfigPtr = std::shared_ptr; - - struct IContext - { - virtual ~IContext(); - - virtual IResultCapture* getResultCapture() = 0; - virtual IRunner* getRunner() = 0; - virtual IConfigPtr const& getConfig() const = 0; - }; - - struct IMutableContext : IContext - { - virtual ~IMutableContext(); - virtual void setResultCapture( IResultCapture* resultCapture ) = 0; - virtual void setRunner( IRunner* runner ) = 0; - virtual void setConfig( IConfigPtr const& config ) = 0; - - private: - static IMutableContext *currentContext; - friend IMutableContext& getCurrentMutableContext(); - friend void cleanUpContext(); - static void createContext(); - }; - - inline IMutableContext& getCurrentMutableContext() - { - if( !IMutableContext::currentContext ) - IMutableContext::createContext(); - return *IMutableContext::currentContext; - } - - inline IContext& getCurrentContext() - { - return getCurrentMutableContext(); - } - - void cleanUpContext(); -} - -// end catch_context.h -// start catch_interfaces_config.h - -#include -#include -#include -#include - -namespace Catch { - - enum class Verbosity { - Quiet = 0, - Normal, - High - }; - - struct WarnAbout { enum What { - Nothing = 0x00, - NoAssertions = 0x01, - NoTests = 0x02 - }; }; - - struct ShowDurations { enum OrNot { - DefaultForReporter, - Always, - Never - }; }; - struct RunTests { enum InWhatOrder { - InDeclarationOrder, - InLexicographicalOrder, - InRandomOrder - }; }; - struct UseColour { enum YesOrNo { - Auto, - Yes, - No - }; }; - struct WaitForKeypress { enum When { - Never, - BeforeStart = 1, - BeforeExit = 2, - BeforeStartAndExit = BeforeStart | BeforeExit - }; }; - - class TestSpec; - - struct IConfig : NonCopyable { - - virtual ~IConfig(); - - virtual bool allowThrows() const = 0; - virtual std::ostream& stream() const = 0; - virtual std::string name() const = 0; - virtual bool includeSuccessfulResults() const = 0; - virtual bool shouldDebugBreak() const = 0; - virtual bool warnAboutMissingAssertions() const = 0; - virtual bool warnAboutNoTests() const = 0; - virtual int abortAfter() const = 0; - virtual bool showInvisibles() const = 0; - virtual ShowDurations::OrNot showDurations() const = 0; - virtual TestSpec const& testSpec() const = 0; - virtual bool hasTestFilters() const = 0; - virtual RunTests::InWhatOrder runOrder() const = 0; - virtual unsigned int rngSeed() const = 0; - virtual int benchmarkResolutionMultiple() const = 0; - virtual UseColour::YesOrNo useColour() const = 0; - virtual std::vector const& getSectionsToRun() const = 0; - virtual Verbosity verbosity() const = 0; - }; - - using IConfigPtr = std::shared_ptr; -} - -// end catch_interfaces_config.h -#include - -namespace Catch { -namespace Generators { - -template -class RandomFloatingGenerator final : public IGenerator { - // FIXME: What is the right seed? - std::minstd_rand m_rand; - std::uniform_real_distribution m_dist; - Float m_current_number; -public: - - RandomFloatingGenerator(Float a, Float b): - m_rand(getCurrentContext().getConfig()->rngSeed()), - m_dist(a, b) { - static_cast(next()); - } - - Float const& get() const override { - return m_current_number; - } - bool next() override { - m_current_number = m_dist(m_rand); - return true; - } -}; - -template -class RandomIntegerGenerator final : public IGenerator { - std::minstd_rand m_rand; - std::uniform_int_distribution m_dist; - Integer m_current_number; -public: - - RandomIntegerGenerator(Integer a, Integer b): - m_rand(getCurrentContext().getConfig()->rngSeed()), - m_dist(a, b) { - static_cast(next()); - } - - Integer const& get() const override { - return m_current_number; - } - bool next() override { - m_current_number = m_dist(m_rand); - return true; - } -}; - -// TODO: Ideally this would be also constrained against the various char types, -// but I don't expect users to run into that in practice. -template -typename std::enable_if::value && !std::is_same::value, -GeneratorWrapper>::type -random(T a, T b) { - return GeneratorWrapper( - pf::make_unique>(a, b) - ); -} - -template -typename std::enable_if::value, -GeneratorWrapper>::type -random(T a, T b) { - return GeneratorWrapper( - pf::make_unique>(a, b) - ); -} - -template -class RangeGenerator final : public IGenerator { - T m_current; - T m_end; - T m_step; - bool m_positive; - -public: - RangeGenerator(T const& start, T const& end, T const& step): - m_current(start), - m_end(end), - m_step(step), - m_positive(m_step > T(0)) - { - assert(m_current != m_end && "Range start and end cannot be equal"); - assert(m_step != T(0) && "Step size cannot be zero"); - assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && "Step moves away from end"); - } - - RangeGenerator(T const& start, T const& end): - RangeGenerator(start, end, (start < end) ? T(1) : T(-1)) - {} - - T const& get() const override { - return m_current; - } - - bool next() override { - m_current += m_step; - return (m_positive) ? (m_current < m_end) : (m_current > m_end); - } -}; - -template -GeneratorWrapper range(T const& start, T const& end, T const& step) { - static_assert(std::is_integral::value && !std::is_same::value, "Type must be an integer"); - return GeneratorWrapper(pf::make_unique>(start, end, step)); -} - -template -GeneratorWrapper range(T const& start, T const& end) { - static_assert(std::is_integral::value && !std::is_same::value, "Type must be an integer"); - return GeneratorWrapper(pf::make_unique>(start, end)); -} - -} // namespace Generators -} // namespace Catch - -// end catch_generators_specific.hpp - -// These files are included here so the single_include script doesn't put them -// in the conditionally compiled sections -// start catch_test_case_info.h - -#include -#include -#include - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -namespace Catch { - - struct ITestInvoker; - - struct TestCaseInfo { - enum SpecialProperties{ - None = 0, - IsHidden = 1 << 1, - ShouldFail = 1 << 2, - MayFail = 1 << 3, - Throws = 1 << 4, - NonPortable = 1 << 5, - Benchmark = 1 << 6 - }; - - TestCaseInfo( std::string const& _name, - std::string const& _className, - std::string const& _description, - std::vector const& _tags, - SourceLineInfo const& _lineInfo ); - - friend void setTags( TestCaseInfo& testCaseInfo, std::vector tags ); - - bool isHidden() const; - bool throws() const; - bool okToFail() const; - bool expectedToFail() const; - - std::string tagsAsString() const; - - std::string name; - std::string className; - std::string description; - std::vector tags; - std::vector lcaseTags; - SourceLineInfo lineInfo; - SpecialProperties properties; - }; - - class TestCase : public TestCaseInfo { - public: - - TestCase( ITestInvoker* testCase, TestCaseInfo&& info ); - - TestCase withName( std::string const& _newName ) const; - - void invoke() const; - - TestCaseInfo const& getTestCaseInfo() const; - - bool operator == ( TestCase const& other ) const; - bool operator < ( TestCase const& other ) const; - - private: - std::shared_ptr test; - }; - - TestCase makeTestCase( ITestInvoker* testCase, - std::string const& className, - NameAndTags const& nameAndTags, - SourceLineInfo const& lineInfo ); -} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -// end catch_test_case_info.h -// start catch_interfaces_runner.h - -namespace Catch { - - struct IRunner { - virtual ~IRunner(); - virtual bool aborting() const = 0; - }; -} - -// end catch_interfaces_runner.h - -#ifdef __OBJC__ -// start catch_objc.hpp - -#import - -#include - -// NB. Any general catch headers included here must be included -// in catch.hpp first to make sure they are included by the single -// header for non obj-usage - -/////////////////////////////////////////////////////////////////////////////// -// This protocol is really only here for (self) documenting purposes, since -// all its methods are optional. -@protocol OcFixture - -@optional - --(void) setUp; --(void) tearDown; - -@end - -namespace Catch { - - class OcMethod : public ITestInvoker { - - public: - OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {} - - virtual void invoke() const { - id obj = [[m_cls alloc] init]; - - performOptionalSelector( obj, @selector(setUp) ); - performOptionalSelector( obj, m_sel ); - performOptionalSelector( obj, @selector(tearDown) ); - - arcSafeRelease( obj ); - } - private: - virtual ~OcMethod() {} - - Class m_cls; - SEL m_sel; - }; - - namespace Detail{ - - inline std::string getAnnotation( Class cls, - std::string const& annotationName, - std::string const& testCaseName ) { - NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()]; - SEL sel = NSSelectorFromString( selStr ); - arcSafeRelease( selStr ); - id value = performOptionalSelector( cls, sel ); - if( value ) - return [(NSString*)value UTF8String]; - return ""; - } - } - - inline std::size_t registerTestMethods() { - std::size_t noTestMethods = 0; - int noClasses = objc_getClassList( nullptr, 0 ); - - Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); - objc_getClassList( classes, noClasses ); - - for( int c = 0; c < noClasses; c++ ) { - Class cls = classes[c]; - { - u_int count; - Method* methods = class_copyMethodList( cls, &count ); - for( u_int m = 0; m < count ; m++ ) { - SEL selector = method_getName(methods[m]); - std::string methodName = sel_getName(selector); - if( startsWith( methodName, "Catch_TestCase_" ) ) { - std::string testCaseName = methodName.substr( 15 ); - std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); - std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); - const char* className = class_getName( cls ); - - getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) ); - noTestMethods++; - } - } - free(methods); - } - } - return noTestMethods; - } - -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) - - namespace Matchers { - namespace Impl { - namespace NSStringMatchers { - - struct StringHolder : MatcherBase{ - StringHolder( NSString* substr ) : m_substr( [substr copy] ){} - StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){} - StringHolder() { - arcSafeRelease( m_substr ); - } - - bool match( NSString* arg ) const override { - return false; - } - - NSString* CATCH_ARC_STRONG m_substr; - }; - - struct Equals : StringHolder { - Equals( NSString* substr ) : StringHolder( substr ){} - - bool match( NSString* str ) const override { - return (str != nil || m_substr == nil ) && - [str isEqualToString:m_substr]; - } - - std::string describe() const override { - return "equals string: " + Catch::Detail::stringify( m_substr ); - } - }; - - struct Contains : StringHolder { - Contains( NSString* substr ) : StringHolder( substr ){} - - bool match( NSString* str ) const { - return (str != nil || m_substr == nil ) && - [str rangeOfString:m_substr].location != NSNotFound; - } - - std::string describe() const override { - return "contains string: " + Catch::Detail::stringify( m_substr ); - } - }; - - struct StartsWith : StringHolder { - StartsWith( NSString* substr ) : StringHolder( substr ){} - - bool match( NSString* str ) const override { - return (str != nil || m_substr == nil ) && - [str rangeOfString:m_substr].location == 0; - } - - std::string describe() const override { - return "starts with: " + Catch::Detail::stringify( m_substr ); - } - }; - struct EndsWith : StringHolder { - EndsWith( NSString* substr ) : StringHolder( substr ){} - - bool match( NSString* str ) const override { - return (str != nil || m_substr == nil ) && - [str rangeOfString:m_substr].location == [str length] - [m_substr length]; - } - - std::string describe() const override { - return "ends with: " + Catch::Detail::stringify( m_substr ); - } - }; - - } // namespace NSStringMatchers - } // namespace Impl - - inline Impl::NSStringMatchers::Equals - Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); } - - inline Impl::NSStringMatchers::Contains - Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); } - - inline Impl::NSStringMatchers::StartsWith - StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); } - - inline Impl::NSStringMatchers::EndsWith - EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); } - - } // namespace Matchers - - using namespace Matchers; - -#endif // CATCH_CONFIG_DISABLE_MATCHERS - -} // namespace Catch - -/////////////////////////////////////////////////////////////////////////////// -#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix -#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \ -+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \ -{ \ -return @ name; \ -} \ -+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \ -{ \ -return @ desc; \ -} \ --(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix ) - -#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ ) - -// end catch_objc.hpp -#endif - -#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES -// start catch_external_interfaces.h - -// start catch_reporter_bases.hpp - -// start catch_interfaces_reporter.h - -// start catch_config.hpp - -// start catch_test_spec_parser.h - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -// start catch_test_spec.h - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -// start catch_wildcard_pattern.h - -namespace Catch -{ - class WildcardPattern { - enum WildcardPosition { - NoWildcard = 0, - WildcardAtStart = 1, - WildcardAtEnd = 2, - WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd - }; - - public: - - WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); - virtual ~WildcardPattern() = default; - virtual bool matches( std::string const& str ) const; - - private: - std::string adjustCase( std::string const& str ) const; - CaseSensitive::Choice m_caseSensitivity; - WildcardPosition m_wildcard = NoWildcard; - std::string m_pattern; - }; -} - -// end catch_wildcard_pattern.h -#include -#include -#include - -namespace Catch { - - class TestSpec { - struct Pattern { - virtual ~Pattern(); - virtual bool matches( TestCaseInfo const& testCase ) const = 0; - }; - using PatternPtr = std::shared_ptr; - - class NamePattern : public Pattern { - public: - NamePattern( std::string const& name ); - virtual ~NamePattern(); - virtual bool matches( TestCaseInfo const& testCase ) const override; - private: - WildcardPattern m_wildcardPattern; - }; - - class TagPattern : public Pattern { - public: - TagPattern( std::string const& tag ); - virtual ~TagPattern(); - virtual bool matches( TestCaseInfo const& testCase ) const override; - private: - std::string m_tag; - }; - - class ExcludedPattern : public Pattern { - public: - ExcludedPattern( PatternPtr const& underlyingPattern ); - virtual ~ExcludedPattern(); - virtual bool matches( TestCaseInfo const& testCase ) const override; - private: - PatternPtr m_underlyingPattern; - }; - - struct Filter { - std::vector m_patterns; - - bool matches( TestCaseInfo const& testCase ) const; - }; - - public: - bool hasFilters() const; - bool matches( TestCaseInfo const& testCase ) const; - - private: - std::vector m_filters; - - friend class TestSpecParser; - }; -} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -// end catch_test_spec.h -// start catch_interfaces_tag_alias_registry.h - -#include - -namespace Catch { - - struct TagAlias; - - struct ITagAliasRegistry { - virtual ~ITagAliasRegistry(); - // Nullptr if not present - virtual TagAlias const* find( std::string const& alias ) const = 0; - virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; - - static ITagAliasRegistry const& get(); - }; - -} // end namespace Catch - -// end catch_interfaces_tag_alias_registry.h -namespace Catch { - - class TestSpecParser { - enum Mode{ None, Name, QuotedName, Tag, EscapedName }; - Mode m_mode = None; - bool m_exclusion = false; - std::size_t m_start = std::string::npos, m_pos = 0; - std::string m_arg; - std::vector m_escapeChars; - TestSpec::Filter m_currentFilter; - TestSpec m_testSpec; - ITagAliasRegistry const* m_tagAliases = nullptr; - - public: - TestSpecParser( ITagAliasRegistry const& tagAliases ); - - TestSpecParser& parse( std::string const& arg ); - TestSpec testSpec(); - - private: - void visitChar( char c ); - void startNewMode( Mode mode, std::size_t start ); - void escape(); - std::string subString() const; - - template - void addPattern() { - std::string token = subString(); - for( std::size_t i = 0; i < m_escapeChars.size(); ++i ) - token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 ); - m_escapeChars.clear(); - if( startsWith( token, "exclude:" ) ) { - m_exclusion = true; - token = token.substr( 8 ); - } - if( !token.empty() ) { - TestSpec::PatternPtr pattern = std::make_shared( token ); - if( m_exclusion ) - pattern = std::make_shared( pattern ); - m_currentFilter.m_patterns.push_back( pattern ); - } - m_exclusion = false; - m_mode = None; - } - - void addFilter(); - }; - TestSpec parseTestSpec( std::string const& arg ); - -} // namespace Catch - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -// end catch_test_spec_parser.h -// Libstdc++ doesn't like incomplete classes for unique_ptr - -#include -#include -#include - -#ifndef CATCH_CONFIG_CONSOLE_WIDTH -#define CATCH_CONFIG_CONSOLE_WIDTH 80 -#endif - -namespace Catch { - - struct IStream; - - struct ConfigData { - bool listTests = false; - bool listTags = false; - bool listReporters = false; - bool listTestNamesOnly = false; - - bool showSuccessfulTests = false; - bool shouldDebugBreak = false; - bool noThrow = false; - bool showHelp = false; - bool showInvisibles = false; - bool filenamesAsTags = false; - bool libIdentify = false; - - int abortAfter = -1; - unsigned int rngSeed = 0; - int benchmarkResolutionMultiple = 100; - - Verbosity verbosity = Verbosity::Normal; - WarnAbout::What warnings = WarnAbout::Nothing; - ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter; - RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder; - UseColour::YesOrNo useColour = UseColour::Auto; - WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; - - std::string outputFilename; - std::string name; - std::string processName; -#ifndef CATCH_CONFIG_DEFAULT_REPORTER -#define CATCH_CONFIG_DEFAULT_REPORTER "console" -#endif - std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; -#undef CATCH_CONFIG_DEFAULT_REPORTER - - std::vector testsOrTags; - std::vector sectionsToRun; - }; - - class Config : public IConfig { - public: - - Config() = default; - Config( ConfigData const& data ); - virtual ~Config() = default; - - std::string const& getFilename() const; - - bool listTests() const; - bool listTestNamesOnly() const; - bool listTags() const; - bool listReporters() const; - - std::string getProcessName() const; - std::string const& getReporterName() const; - - std::vector const& getTestsOrTags() const; - std::vector const& getSectionsToRun() const override; - - virtual TestSpec const& testSpec() const override; - bool hasTestFilters() const override; - - bool showHelp() const; - - // IConfig interface - bool allowThrows() const override; - std::ostream& stream() const override; - std::string name() const override; - bool includeSuccessfulResults() const override; - bool warnAboutMissingAssertions() const override; - bool warnAboutNoTests() const override; - ShowDurations::OrNot showDurations() const override; - RunTests::InWhatOrder runOrder() const override; - unsigned int rngSeed() const override; - int benchmarkResolutionMultiple() const override; - UseColour::YesOrNo useColour() const override; - bool shouldDebugBreak() const override; - int abortAfter() const override; - bool showInvisibles() const override; - Verbosity verbosity() const override; - - private: - - IStream const* openStream(); - ConfigData m_data; - - std::unique_ptr m_stream; - TestSpec m_testSpec; - bool m_hasTestFilters = false; - }; - -} // end namespace Catch - -// end catch_config.hpp -// start catch_assertionresult.h - -#include - -namespace Catch { - - struct AssertionResultData - { - AssertionResultData() = delete; - - AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); - - std::string message; - mutable std::string reconstructedExpression; - LazyExpression lazyExpression; - ResultWas::OfType resultType; - - std::string reconstructExpression() const; - }; - - class AssertionResult { - public: - AssertionResult() = delete; - AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); - - bool isOk() const; - bool succeeded() const; - ResultWas::OfType getResultType() const; - bool hasExpression() const; - bool hasMessage() const; - std::string getExpression() const; - std::string getExpressionInMacro() const; - bool hasExpandedExpression() const; - std::string getExpandedExpression() const; - std::string getMessage() const; - SourceLineInfo getSourceInfo() const; - StringRef getTestMacroName() const; - - //protected: - AssertionInfo m_info; - AssertionResultData m_resultData; - }; - -} // end namespace Catch - -// end catch_assertionresult.h -// start catch_option.hpp - -namespace Catch { - - // An optional type - template - class Option { - public: - Option() : nullableValue( nullptr ) {} - Option( T const& _value ) - : nullableValue( new( storage ) T( _value ) ) - {} - Option( Option const& _other ) - : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) - {} - - ~Option() { - reset(); - } - - Option& operator= ( Option const& _other ) { - if( &_other != this ) { - reset(); - if( _other ) - nullableValue = new( storage ) T( *_other ); - } - return *this; - } - Option& operator = ( T const& _value ) { - reset(); - nullableValue = new( storage ) T( _value ); - return *this; - } - - void reset() { - if( nullableValue ) - nullableValue->~T(); - nullableValue = nullptr; - } - - T& operator*() { return *nullableValue; } - T const& operator*() const { return *nullableValue; } - T* operator->() { return nullableValue; } - const T* operator->() const { return nullableValue; } - - T valueOr( T const& defaultValue ) const { - return nullableValue ? *nullableValue : defaultValue; - } - - bool some() const { return nullableValue != nullptr; } - bool none() const { return nullableValue == nullptr; } - - bool operator !() const { return nullableValue == nullptr; } - explicit operator bool() const { - return some(); - } - - private: - T *nullableValue; - alignas(alignof(T)) char storage[sizeof(T)]; - }; - -} // end namespace Catch - -// end catch_option.hpp -#include -#include -#include -#include -#include - -namespace Catch { - - struct ReporterConfig { - explicit ReporterConfig( IConfigPtr const& _fullConfig ); - - ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ); - - std::ostream& stream() const; - IConfigPtr fullConfig() const; - - private: - std::ostream* m_stream; - IConfigPtr m_fullConfig; - }; - - struct ReporterPreferences { - bool shouldRedirectStdOut = false; - bool shouldReportAllAssertions = false; - }; - - template - struct LazyStat : Option { - LazyStat& operator=( T const& _value ) { - Option::operator=( _value ); - used = false; - return *this; - } - void reset() { - Option::reset(); - used = false; - } - bool used = false; - }; - - struct TestRunInfo { - TestRunInfo( std::string const& _name ); - std::string name; - }; - struct GroupInfo { - GroupInfo( std::string const& _name, - std::size_t _groupIndex, - std::size_t _groupsCount ); - - std::string name; - std::size_t groupIndex; - std::size_t groupsCounts; - }; - - struct AssertionStats { - AssertionStats( AssertionResult const& _assertionResult, - std::vector const& _infoMessages, - Totals const& _totals ); - - AssertionStats( AssertionStats const& ) = default; - AssertionStats( AssertionStats && ) = default; - AssertionStats& operator = ( AssertionStats const& ) = delete; - AssertionStats& operator = ( AssertionStats && ) = delete; - virtual ~AssertionStats(); - - AssertionResult assertionResult; - std::vector infoMessages; - Totals totals; - }; - - struct SectionStats { - SectionStats( SectionInfo const& _sectionInfo, - Counts const& _assertions, - double _durationInSeconds, - bool _missingAssertions ); - SectionStats( SectionStats const& ) = default; - SectionStats( SectionStats && ) = default; - SectionStats& operator = ( SectionStats const& ) = default; - SectionStats& operator = ( SectionStats && ) = default; - virtual ~SectionStats(); - - SectionInfo sectionInfo; - Counts assertions; - double durationInSeconds; - bool missingAssertions; - }; - - struct TestCaseStats { - TestCaseStats( TestCaseInfo const& _testInfo, - Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, - bool _aborting ); - - TestCaseStats( TestCaseStats const& ) = default; - TestCaseStats( TestCaseStats && ) = default; - TestCaseStats& operator = ( TestCaseStats const& ) = default; - TestCaseStats& operator = ( TestCaseStats && ) = default; - virtual ~TestCaseStats(); - - TestCaseInfo testInfo; - Totals totals; - std::string stdOut; - std::string stdErr; - bool aborting; - }; - - struct TestGroupStats { - TestGroupStats( GroupInfo const& _groupInfo, - Totals const& _totals, - bool _aborting ); - TestGroupStats( GroupInfo const& _groupInfo ); - - TestGroupStats( TestGroupStats const& ) = default; - TestGroupStats( TestGroupStats && ) = default; - TestGroupStats& operator = ( TestGroupStats const& ) = default; - TestGroupStats& operator = ( TestGroupStats && ) = default; - virtual ~TestGroupStats(); - - GroupInfo groupInfo; - Totals totals; - bool aborting; - }; - - struct TestRunStats { - TestRunStats( TestRunInfo const& _runInfo, - Totals const& _totals, - bool _aborting ); - - TestRunStats( TestRunStats const& ) = default; - TestRunStats( TestRunStats && ) = default; - TestRunStats& operator = ( TestRunStats const& ) = default; - TestRunStats& operator = ( TestRunStats && ) = default; - virtual ~TestRunStats(); - - TestRunInfo runInfo; - Totals totals; - bool aborting; - }; - - struct BenchmarkInfo { - std::string name; - }; - struct BenchmarkStats { - BenchmarkInfo info; - std::size_t iterations; - uint64_t elapsedTimeInNanoseconds; - }; - - struct IStreamingReporter { - virtual ~IStreamingReporter() = default; - - // Implementing class must also provide the following static methods: - // static std::string getDescription(); - // static std::set getSupportedVerbosities() - - virtual ReporterPreferences getPreferences() const = 0; - - virtual void noMatchingTestCases( std::string const& spec ) = 0; - - virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; - virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; - - virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; - virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; - - // *** experimental *** - virtual void benchmarkStarting( BenchmarkInfo const& ) {} - - virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; - - // The return value indicates if the messages buffer should be cleared: - virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; - - // *** experimental *** - virtual void benchmarkEnded( BenchmarkStats const& ) {} - - virtual void sectionEnded( SectionStats const& sectionStats ) = 0; - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; - virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; - - virtual void skipTest( TestCaseInfo const& testInfo ) = 0; - - // Default empty implementation provided - virtual void fatalErrorEncountered( StringRef name ); - - virtual bool isMulti() const; - }; - using IStreamingReporterPtr = std::unique_ptr; - - struct IReporterFactory { - virtual ~IReporterFactory(); - virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; - virtual std::string getDescription() const = 0; - }; - using IReporterFactoryPtr = std::shared_ptr; - - struct IReporterRegistry { - using FactoryMap = std::map; - using Listeners = std::vector; - - virtual ~IReporterRegistry(); - virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; - virtual FactoryMap const& getFactories() const = 0; - virtual Listeners const& getListeners() const = 0; - }; - -} // end namespace Catch - -// end catch_interfaces_reporter.h -#include -#include -#include -#include -#include -#include -#include - -namespace Catch { - void prepareExpandedExpression(AssertionResult& result); - - // Returns double formatted as %.3f (format expected on output) - std::string getFormattedDuration( double duration ); - - template - struct StreamingReporterBase : IStreamingReporter { - - StreamingReporterBase( ReporterConfig const& _config ) - : m_config( _config.fullConfig() ), - stream( _config.stream() ) - { - m_reporterPrefs.shouldRedirectStdOut = false; - if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) - CATCH_ERROR( "Verbosity level not supported by this reporter" ); - } - - ReporterPreferences getPreferences() const override { - return m_reporterPrefs; - } - - static std::set getSupportedVerbosities() { - return { Verbosity::Normal }; - } - - ~StreamingReporterBase() override = default; - - void noMatchingTestCases(std::string const&) override {} - - void testRunStarting(TestRunInfo const& _testRunInfo) override { - currentTestRunInfo = _testRunInfo; - } - void testGroupStarting(GroupInfo const& _groupInfo) override { - currentGroupInfo = _groupInfo; - } - - void testCaseStarting(TestCaseInfo const& _testInfo) override { - currentTestCaseInfo = _testInfo; - } - void sectionStarting(SectionInfo const& _sectionInfo) override { - m_sectionStack.push_back(_sectionInfo); - } - - void sectionEnded(SectionStats const& /* _sectionStats */) override { - m_sectionStack.pop_back(); - } - void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { - currentTestCaseInfo.reset(); - } - void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { - currentGroupInfo.reset(); - } - void testRunEnded(TestRunStats const& /* _testRunStats */) override { - currentTestCaseInfo.reset(); - currentGroupInfo.reset(); - currentTestRunInfo.reset(); - } - - void skipTest(TestCaseInfo const&) override { - // Don't do anything with this by default. - // It can optionally be overridden in the derived class. - } - - IConfigPtr m_config; - std::ostream& stream; - - LazyStat currentTestRunInfo; - LazyStat currentGroupInfo; - LazyStat currentTestCaseInfo; - - std::vector m_sectionStack; - ReporterPreferences m_reporterPrefs; - }; - - template - struct CumulativeReporterBase : IStreamingReporter { - template - struct Node { - explicit Node( T const& _value ) : value( _value ) {} - virtual ~Node() {} - - using ChildNodes = std::vector>; - T value; - ChildNodes children; - }; - struct SectionNode { - explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} - virtual ~SectionNode() = default; - - bool operator == (SectionNode const& other) const { - return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; - } - bool operator == (std::shared_ptr const& other) const { - return operator==(*other); - } - - SectionStats stats; - using ChildSections = std::vector>; - using Assertions = std::vector; - ChildSections childSections; - Assertions assertions; - std::string stdOut; - std::string stdErr; - }; - - struct BySectionInfo { - BySectionInfo( SectionInfo const& other ) : m_other( other ) {} - BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} - bool operator() (std::shared_ptr const& node) const { - return ((node->stats.sectionInfo.name == m_other.name) && - (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); - } - void operator=(BySectionInfo const&) = delete; - - private: - SectionInfo const& m_other; - }; - - using TestCaseNode = Node; - using TestGroupNode = Node; - using TestRunNode = Node; - - CumulativeReporterBase( ReporterConfig const& _config ) - : m_config( _config.fullConfig() ), - stream( _config.stream() ) - { - m_reporterPrefs.shouldRedirectStdOut = false; - if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) - CATCH_ERROR( "Verbosity level not supported by this reporter" ); - } - ~CumulativeReporterBase() override = default; - - ReporterPreferences getPreferences() const override { - return m_reporterPrefs; - } - - static std::set getSupportedVerbosities() { - return { Verbosity::Normal }; - } - - void testRunStarting( TestRunInfo const& ) override {} - void testGroupStarting( GroupInfo const& ) override {} - - void testCaseStarting( TestCaseInfo const& ) override {} - - void sectionStarting( SectionInfo const& sectionInfo ) override { - SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); - std::shared_ptr node; - if( m_sectionStack.empty() ) { - if( !m_rootSection ) - m_rootSection = std::make_shared( incompleteStats ); - node = m_rootSection; - } - else { - SectionNode& parentNode = *m_sectionStack.back(); - auto it = - std::find_if( parentNode.childSections.begin(), - parentNode.childSections.end(), - BySectionInfo( sectionInfo ) ); - if( it == parentNode.childSections.end() ) { - node = std::make_shared( incompleteStats ); - parentNode.childSections.push_back( node ); - } - else - node = *it; - } - m_sectionStack.push_back( node ); - m_deepestSection = std::move(node); - } - - void assertionStarting(AssertionInfo const&) override {} - - bool assertionEnded(AssertionStats const& assertionStats) override { - assert(!m_sectionStack.empty()); - // AssertionResult holds a pointer to a temporary DecomposedExpression, - // which getExpandedExpression() calls to build the expression string. - // Our section stack copy of the assertionResult will likely outlive the - // temporary, so it must be expanded or discarded now to avoid calling - // a destroyed object later. - prepareExpandedExpression(const_cast( assertionStats.assertionResult ) ); - SectionNode& sectionNode = *m_sectionStack.back(); - sectionNode.assertions.push_back(assertionStats); - return true; - } - void sectionEnded(SectionStats const& sectionStats) override { - assert(!m_sectionStack.empty()); - SectionNode& node = *m_sectionStack.back(); - node.stats = sectionStats; - m_sectionStack.pop_back(); - } - void testCaseEnded(TestCaseStats const& testCaseStats) override { - auto node = std::make_shared(testCaseStats); - assert(m_sectionStack.size() == 0); - node->children.push_back(m_rootSection); - m_testCases.push_back(node); - m_rootSection.reset(); - - assert(m_deepestSection); - m_deepestSection->stdOut = testCaseStats.stdOut; - m_deepestSection->stdErr = testCaseStats.stdErr; - } - void testGroupEnded(TestGroupStats const& testGroupStats) override { - auto node = std::make_shared(testGroupStats); - node->children.swap(m_testCases); - m_testGroups.push_back(node); - } - void testRunEnded(TestRunStats const& testRunStats) override { - auto node = std::make_shared(testRunStats); - node->children.swap(m_testGroups); - m_testRuns.push_back(node); - testRunEndedCumulative(); - } - virtual void testRunEndedCumulative() = 0; - - void skipTest(TestCaseInfo const&) override {} - - IConfigPtr m_config; - std::ostream& stream; - std::vector m_assertions; - std::vector>> m_sections; - std::vector> m_testCases; - std::vector> m_testGroups; - - std::vector> m_testRuns; - - std::shared_ptr m_rootSection; - std::shared_ptr m_deepestSection; - std::vector> m_sectionStack; - ReporterPreferences m_reporterPrefs; - }; - - template - char const* getLineOfChars() { - static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; - if( !*line ) { - std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); - line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; - } - return line; - } - - struct TestEventListenerBase : StreamingReporterBase { - TestEventListenerBase( ReporterConfig const& _config ); - - static std::set getSupportedVerbosities(); - - void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const&) override; - }; - -} // end namespace Catch - -// end catch_reporter_bases.hpp -// start catch_console_colour.h - -namespace Catch { - - struct Colour { - enum Code { - None = 0, - - White, - Red, - Green, - Blue, - Cyan, - Yellow, - Grey, - - Bright = 0x10, - - BrightRed = Bright | Red, - BrightGreen = Bright | Green, - LightGrey = Bright | Grey, - BrightWhite = Bright | White, - BrightYellow = Bright | Yellow, - - // By intention - FileName = LightGrey, - Warning = BrightYellow, - ResultError = BrightRed, - ResultSuccess = BrightGreen, - ResultExpectedFailure = Warning, - - Error = BrightRed, - Success = Green, - - OriginalExpression = Cyan, - ReconstructedExpression = BrightYellow, - - SecondaryText = LightGrey, - Headers = White - }; - - // Use constructed object for RAII guard - Colour( Code _colourCode ); - Colour( Colour&& other ) noexcept; - Colour& operator=( Colour&& other ) noexcept; - ~Colour(); - - // Use static method for one-shot changes - static void use( Code _colourCode ); - - private: - bool m_moved = false; - }; - - std::ostream& operator << ( std::ostream& os, Colour const& ); - -} // end namespace Catch - -// end catch_console_colour.h -// start catch_reporter_registrars.hpp - - -namespace Catch { - - template - class ReporterRegistrar { - - class ReporterFactory : public IReporterFactory { - - virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { - return std::unique_ptr( new T( config ) ); - } - - virtual std::string getDescription() const override { - return T::getDescription(); - } - }; - - public: - - explicit ReporterRegistrar( std::string const& name ) { - getMutableRegistryHub().registerReporter( name, std::make_shared() ); - } - }; - - template - class ListenerRegistrar { - - class ListenerFactory : public IReporterFactory { - - virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { - return std::unique_ptr( new T( config ) ); - } - virtual std::string getDescription() const override { - return std::string(); - } - }; - - public: - - ListenerRegistrar() { - getMutableRegistryHub().registerListener( std::make_shared() ); - } - }; -} - -#if !defined(CATCH_CONFIG_DISABLE) - -#define CATCH_REGISTER_REPORTER( name, reporterType ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::ReporterRegistrar catch_internal_RegistrarFor##reporterType( name ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS - -#define CATCH_REGISTER_LISTENER( listenerType ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::ListenerRegistrar catch_internal_RegistrarFor##listenerType; } \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -#else // CATCH_CONFIG_DISABLE - -#define CATCH_REGISTER_REPORTER(name, reporterType) -#define CATCH_REGISTER_LISTENER(listenerType) - -#endif // CATCH_CONFIG_DISABLE - -// end catch_reporter_registrars.hpp -// Allow users to base their work off existing reporters -// start catch_reporter_compact.h - -namespace Catch { - - struct CompactReporter : StreamingReporterBase { - - using StreamingReporterBase::StreamingReporterBase; - - ~CompactReporter() override; - - static std::string getDescription(); - - ReporterPreferences getPreferences() const override; - - void noMatchingTestCases(std::string const& spec) override; - - void assertionStarting(AssertionInfo const&) override; - - bool assertionEnded(AssertionStats const& _assertionStats) override; - - void sectionEnded(SectionStats const& _sectionStats) override; - - void testRunEnded(TestRunStats const& _testRunStats) override; - - }; - -} // end namespace Catch - -// end catch_reporter_compact.h -// start catch_reporter_console.h - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch - // Note that 4062 (not all labels are handled - // and default is missing) is enabled -#endif - -namespace Catch { - // Fwd decls - struct SummaryColumn; - class TablePrinter; - - struct ConsoleReporter : StreamingReporterBase { - std::unique_ptr m_tablePrinter; - - ConsoleReporter(ReporterConfig const& config); - ~ConsoleReporter() override; - static std::string getDescription(); - - void noMatchingTestCases(std::string const& spec) override; - - void assertionStarting(AssertionInfo const&) override; - - bool assertionEnded(AssertionStats const& _assertionStats) override; - - void sectionStarting(SectionInfo const& _sectionInfo) override; - void sectionEnded(SectionStats const& _sectionStats) override; - - void benchmarkStarting(BenchmarkInfo const& info) override; - void benchmarkEnded(BenchmarkStats const& stats) override; - - void testCaseEnded(TestCaseStats const& _testCaseStats) override; - void testGroupEnded(TestGroupStats const& _testGroupStats) override; - void testRunEnded(TestRunStats const& _testRunStats) override; - - private: - - void lazyPrint(); - - void lazyPrintWithoutClosingBenchmarkTable(); - void lazyPrintRunInfo(); - void lazyPrintGroupInfo(); - void printTestCaseAndSectionHeader(); - - void printClosedHeader(std::string const& _name); - void printOpenHeader(std::string const& _name); - - // if string has a : in first line will set indent to follow it on - // subsequent lines - void printHeaderString(std::string const& _string, std::size_t indent = 0); - - void printTotals(Totals const& totals); - void printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row); - - void printTotalsDivider(Totals const& totals); - void printSummaryDivider(); - - private: - bool m_headerPrinted = false; - }; - -} // end namespace Catch - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - -// end catch_reporter_console.h -// start catch_reporter_junit.h - -// start catch_xmlwriter.h - -#include - -namespace Catch { - - class XmlEncode { - public: - enum ForWhat { ForTextNodes, ForAttributes }; - - XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); - - void encodeTo( std::ostream& os ) const; - - friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ); - - private: - std::string m_str; - ForWhat m_forWhat; - }; - - class XmlWriter { - public: - - class ScopedElement { - public: - ScopedElement( XmlWriter* writer ); - - ScopedElement( ScopedElement&& other ) noexcept; - ScopedElement& operator=( ScopedElement&& other ) noexcept; - - ~ScopedElement(); - - ScopedElement& writeText( std::string const& text, bool indent = true ); - - template - ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { - m_writer->writeAttribute( name, attribute ); - return *this; - } - - private: - mutable XmlWriter* m_writer = nullptr; - }; - - XmlWriter( std::ostream& os = Catch::cout() ); - ~XmlWriter(); - - XmlWriter( XmlWriter const& ) = delete; - XmlWriter& operator=( XmlWriter const& ) = delete; - - XmlWriter& startElement( std::string const& name ); - - ScopedElement scopedElement( std::string const& name ); - - XmlWriter& endElement(); - - XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); - - XmlWriter& writeAttribute( std::string const& name, bool attribute ); - - template - XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { - ReusableStringStream rss; - rss << attribute; - return writeAttribute( name, rss.str() ); - } - - XmlWriter& writeText( std::string const& text, bool indent = true ); - - XmlWriter& writeComment( std::string const& text ); - - void writeStylesheetRef( std::string const& url ); - - XmlWriter& writeBlankLine(); - - void ensureTagClosed(); - - private: - - void writeDeclaration(); - - void newlineIfNecessary(); - - bool m_tagIsOpen = false; - bool m_needsNewline = false; - std::vector m_tags; - std::string m_indent; - std::ostream& m_os; - }; - -} - -// end catch_xmlwriter.h -namespace Catch { - - class JunitReporter : public CumulativeReporterBase { - public: - JunitReporter(ReporterConfig const& _config); - - ~JunitReporter() override; - - static std::string getDescription(); - - void noMatchingTestCases(std::string const& /*spec*/) override; - - void testRunStarting(TestRunInfo const& runInfo) override; - - void testGroupStarting(GroupInfo const& groupInfo) override; - - void testCaseStarting(TestCaseInfo const& testCaseInfo) override; - bool assertionEnded(AssertionStats const& assertionStats) override; - - void testCaseEnded(TestCaseStats const& testCaseStats) override; - - void testGroupEnded(TestGroupStats const& testGroupStats) override; - - void testRunEndedCumulative() override; - - void writeGroup(TestGroupNode const& groupNode, double suiteTime); - - void writeTestCase(TestCaseNode const& testCaseNode); - - void writeSection(std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode); - - void writeAssertions(SectionNode const& sectionNode); - void writeAssertion(AssertionStats const& stats); - - XmlWriter xml; - Timer suiteTimer; - std::string stdOutForSuite; - std::string stdErrForSuite; - unsigned int unexpectedExceptions = 0; - bool m_okToFail = false; - }; - -} // end namespace Catch - -// end catch_reporter_junit.h -// start catch_reporter_xml.h - -namespace Catch { - class XmlReporter : public StreamingReporterBase { - public: - XmlReporter(ReporterConfig const& _config); - - ~XmlReporter() override; - - static std::string getDescription(); - - virtual std::string getStylesheetRef() const; - - void writeSourceInfo(SourceLineInfo const& sourceInfo); - - public: // StreamingReporterBase - - void noMatchingTestCases(std::string const& s) override; - - void testRunStarting(TestRunInfo const& testInfo) override; - - void testGroupStarting(GroupInfo const& groupInfo) override; - - void testCaseStarting(TestCaseInfo const& testInfo) override; - - void sectionStarting(SectionInfo const& sectionInfo) override; - - void assertionStarting(AssertionInfo const&) override; - - bool assertionEnded(AssertionStats const& assertionStats) override; - - void sectionEnded(SectionStats const& sectionStats) override; - - void testCaseEnded(TestCaseStats const& testCaseStats) override; - - void testGroupEnded(TestGroupStats const& testGroupStats) override; - - void testRunEnded(TestRunStats const& testRunStats) override; - - private: - Timer m_testCaseTimer; - XmlWriter m_xml; - int m_sectionDepth = 0; - }; - -} // end namespace Catch - -// end catch_reporter_xml.h - -// end catch_external_interfaces.h -#endif - -#endif // ! CATCH_CONFIG_IMPL_ONLY - -#ifdef CATCH_IMPL -// start catch_impl.hpp - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -// Keep these here for external reporters -// start catch_test_case_tracker.h - -#include -#include -#include - -namespace Catch { -namespace TestCaseTracking { - - struct NameAndLocation { - std::string name; - SourceLineInfo location; - - NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); - }; - - struct ITracker; - - using ITrackerPtr = std::shared_ptr; - - struct ITracker { - virtual ~ITracker(); - - // static queries - virtual NameAndLocation const& nameAndLocation() const = 0; - - // dynamic queries - virtual bool isComplete() const = 0; // Successfully completed or failed - virtual bool isSuccessfullyCompleted() const = 0; - virtual bool isOpen() const = 0; // Started but not complete - virtual bool hasChildren() const = 0; - - virtual ITracker& parent() = 0; - - // actions - virtual void close() = 0; // Successfully complete - virtual void fail() = 0; - virtual void markAsNeedingAnotherRun() = 0; - - virtual void addChild( ITrackerPtr const& child ) = 0; - virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0; - virtual void openChild() = 0; - - // Debug/ checking - virtual bool isSectionTracker() const = 0; - virtual bool isGeneratorTracker() const = 0; - }; - - class TrackerContext { - - enum RunState { - NotStarted, - Executing, - CompletedCycle - }; - - ITrackerPtr m_rootTracker; - ITracker* m_currentTracker = nullptr; - RunState m_runState = NotStarted; - - public: - - static TrackerContext& instance(); - - ITracker& startRun(); - void endRun(); - - void startCycle(); - void completeCycle(); - - bool completedCycle() const; - ITracker& currentTracker(); - void setCurrentTracker( ITracker* tracker ); - }; - - class TrackerBase : public ITracker { - protected: - enum CycleState { - NotStarted, - Executing, - ExecutingChildren, - NeedsAnotherRun, - CompletedSuccessfully, - Failed - }; - - using Children = std::vector; - NameAndLocation m_nameAndLocation; - TrackerContext& m_ctx; - ITracker* m_parent; - Children m_children; - CycleState m_runState = NotStarted; - - public: - TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); - - NameAndLocation const& nameAndLocation() const override; - bool isComplete() const override; - bool isSuccessfullyCompleted() const override; - bool isOpen() const override; - bool hasChildren() const override; - - void addChild( ITrackerPtr const& child ) override; - - ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; - ITracker& parent() override; - - void openChild() override; - - bool isSectionTracker() const override; - bool isGeneratorTracker() const override; - - void open(); - - void close() override; - void fail() override; - void markAsNeedingAnotherRun() override; - - private: - void moveToParent(); - void moveToThis(); - }; - - class SectionTracker : public TrackerBase { - std::vector m_filters; - public: - SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); - - bool isSectionTracker() const override; - - bool isComplete() const override; - - static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); - - void tryOpen(); - - void addInitialFilters( std::vector const& filters ); - void addNextFilters( std::vector const& filters ); - }; - -} // namespace TestCaseTracking - -using TestCaseTracking::ITracker; -using TestCaseTracking::TrackerContext; -using TestCaseTracking::SectionTracker; - -} // namespace Catch - -// end catch_test_case_tracker.h - -// start catch_leak_detector.h - -namespace Catch { - - struct LeakDetector { - LeakDetector(); - ~LeakDetector(); - }; - -} -// end catch_leak_detector.h -// Cpp files will be included in the single-header file here -// start catch_approx.cpp - -#include -#include - -namespace { - -// Performs equivalent check of std::fabs(lhs - rhs) <= margin -// But without the subtraction to allow for INFINITY in comparison -bool marginComparison(double lhs, double rhs, double margin) { - return (lhs + margin >= rhs) && (rhs + margin >= lhs); -} - -} - -namespace Catch { -namespace Detail { - - Approx::Approx ( double value ) - : m_epsilon( std::numeric_limits::epsilon()*100 ), - m_margin( 0.0 ), - m_scale( 0.0 ), - m_value( value ) - {} - - Approx Approx::custom() { - return Approx( 0 ); - } - - Approx Approx::operator-() const { - auto temp(*this); - temp.m_value = -temp.m_value; - return temp; - } - - std::string Approx::toString() const { - ReusableStringStream rss; - rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )"; - return rss.str(); - } - - bool Approx::equalityComparisonImpl(const double other) const { - // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value - // Thanks to Richard Harris for his help refining the scaled margin value - return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value))); - } - - void Approx::setMargin(double margin) { - CATCH_ENFORCE(margin >= 0, - "Invalid Approx::margin: " << margin << '.' - << " Approx::Margin has to be non-negative."); - m_margin = margin; - } - - void Approx::setEpsilon(double epsilon) { - CATCH_ENFORCE(epsilon >= 0 && epsilon <= 1.0, - "Invalid Approx::epsilon: " << epsilon << '.' - << " Approx::epsilon has to be in [0, 1]"); - m_epsilon = epsilon; - } - -} // end namespace Detail - -namespace literals { - Detail::Approx operator "" _a(long double val) { - return Detail::Approx(val); - } - Detail::Approx operator "" _a(unsigned long long val) { - return Detail::Approx(val); - } -} // end namespace literals - -std::string StringMaker::convert(Catch::Detail::Approx const& value) { - return value.toString(); -} - -} // end namespace Catch -// end catch_approx.cpp -// start catch_assertionhandler.cpp - -// start catch_debugger.h - -namespace Catch { - bool isDebuggerActive(); -} - -#ifdef CATCH_PLATFORM_MAC - - #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ - -#elif defined(CATCH_PLATFORM_LINUX) - // If we can use inline assembler, do it because this allows us to break - // directly at the location of the failing check instead of breaking inside - // raise() called from it, i.e. one stack frame below. - #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) - #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */ - #else // Fall back to the generic way. - #include - - #define CATCH_TRAP() raise(SIGTRAP) - #endif -#elif defined(_MSC_VER) - #define CATCH_TRAP() __debugbreak() -#elif defined(__MINGW32__) - extern "C" __declspec(dllimport) void __stdcall DebugBreak(); - #define CATCH_TRAP() DebugBreak() -#endif - -#ifdef CATCH_TRAP - #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() -#else - #define CATCH_BREAK_INTO_DEBUGGER() []{}() -#endif - -// end catch_debugger.h -// start catch_run_context.h - -// start catch_fatal_condition.h - -// start catch_windows_h_proxy.h - - -#if defined(CATCH_PLATFORM_WINDOWS) - -#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) -# define CATCH_DEFINED_NOMINMAX -# define NOMINMAX -#endif -#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) -# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif - -#ifdef __AFXDLL -#include -#else -#include -#endif - -#ifdef CATCH_DEFINED_NOMINMAX -# undef NOMINMAX -#endif -#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN -# undef WIN32_LEAN_AND_MEAN -#endif - -#endif // defined(CATCH_PLATFORM_WINDOWS) - -// end catch_windows_h_proxy.h -#if defined( CATCH_CONFIG_WINDOWS_SEH ) - -namespace Catch { - - struct FatalConditionHandler { - - static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); - FatalConditionHandler(); - static void reset(); - ~FatalConditionHandler(); - - private: - static bool isSet; - static ULONG guaranteeSize; - static PVOID exceptionHandlerHandle; - }; - -} // namespace Catch - -#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) - -#include - -namespace Catch { - - struct FatalConditionHandler { - - static bool isSet; - static struct sigaction oldSigActions[]; - static stack_t oldSigStack; - static char altStackMem[]; - - static void handleSignal( int sig ); - - FatalConditionHandler(); - ~FatalConditionHandler(); - static void reset(); - }; - -} // namespace Catch - -#else - -namespace Catch { - struct FatalConditionHandler { - void reset(); - }; -} - -#endif - -// end catch_fatal_condition.h -#include - -namespace Catch { - - struct IMutableContext; - - /////////////////////////////////////////////////////////////////////////// - - class RunContext : public IResultCapture, public IRunner { - - public: - RunContext( RunContext const& ) = delete; - RunContext& operator =( RunContext const& ) = delete; - - explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); - - ~RunContext() override; - - void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ); - void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ); - - Totals runTest(TestCase const& testCase); - - IConfigPtr config() const; - IStreamingReporter& reporter() const; - - public: // IResultCapture - - // Assertion handlers - void handleExpr - ( AssertionInfo const& info, - ITransientExpression const& expr, - AssertionReaction& reaction ) override; - void handleMessage - ( AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef const& message, - AssertionReaction& reaction ) override; - void handleUnexpectedExceptionNotThrown - ( AssertionInfo const& info, - AssertionReaction& reaction ) override; - void handleUnexpectedInflightException - ( AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction ) override; - void handleIncomplete - ( AssertionInfo const& info ) override; - void handleNonExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction ) override; - - bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; - - void sectionEnded( SectionEndInfo const& endInfo ) override; - void sectionEndedEarly( SectionEndInfo const& endInfo ) override; - - auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; - - void benchmarkStarting( BenchmarkInfo const& info ) override; - void benchmarkEnded( BenchmarkStats const& stats ) override; - - void pushScopedMessage( MessageInfo const& message ) override; - void popScopedMessage( MessageInfo const& message ) override; - - void emplaceUnscopedMessage( MessageBuilder const& builder ) override; - - std::string getCurrentTestName() const override; - - const AssertionResult* getLastResult() const override; - - void exceptionEarlyReported() override; - - void handleFatalErrorCondition( StringRef message ) override; - - bool lastAssertionPassed() override; - - void assertionPassed() override; - - public: - // !TBD We need to do this another way! - bool aborting() const final; - - private: - - void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ); - void invokeActiveTestCase(); - - void resetAssertionInfo(); - bool testForMissingAssertions( Counts& assertions ); - - void assertionEnded( AssertionResult const& result ); - void reportExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - ITransientExpression const *expr, - bool negated ); - - void populateReaction( AssertionReaction& reaction ); - - private: - - void handleUnfinishedSections(); - - TestRunInfo m_runInfo; - IMutableContext& m_context; - TestCase const* m_activeTestCase = nullptr; - ITracker* m_testCaseTracker = nullptr; - Option m_lastResult; - - IConfigPtr m_config; - Totals m_totals; - IStreamingReporterPtr m_reporter; - std::vector m_messages; - std::vector m_messageScopes; /* Keeps owners of so-called unscoped messages. */ - AssertionInfo m_lastAssertionInfo; - std::vector m_unfinishedSections; - std::vector m_activeSections; - TrackerContext m_trackerContext; - bool m_lastAssertionPassed = false; - bool m_shouldReportUnexpected = true; - bool m_includeSuccessfulResults; - }; - -} // end namespace Catch - -// end catch_run_context.h -namespace Catch { - - namespace { - auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { - expr.streamReconstructedExpression( os ); - return os; - } - } - - LazyExpression::LazyExpression( bool isNegated ) - : m_isNegated( isNegated ) - {} - - LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {} - - LazyExpression::operator bool() const { - return m_transientExpression != nullptr; - } - - auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& { - if( lazyExpr.m_isNegated ) - os << "!"; - - if( lazyExpr ) { - if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() ) - os << "(" << *lazyExpr.m_transientExpression << ")"; - else - os << *lazyExpr.m_transientExpression; - } - else { - os << "{** error - unchecked empty expression requested **}"; - } - return os; - } - - AssertionHandler::AssertionHandler - ( StringRef const& macroName, - SourceLineInfo const& lineInfo, - StringRef capturedExpression, - ResultDisposition::Flags resultDisposition ) - : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, - m_resultCapture( getResultCapture() ) - {} - - void AssertionHandler::handleExpr( ITransientExpression const& expr ) { - m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); - } - void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { - m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); - } - - auto AssertionHandler::allowThrows() const -> bool { - return getCurrentContext().getConfig()->allowThrows(); - } - - void AssertionHandler::complete() { - setCompleted(); - if( m_reaction.shouldDebugBreak ) { - - // If you find your debugger stopping you here then go one level up on the - // call-stack for the code that caused it (typically a failed assertion) - - // (To go back to the test and change execution, jump over the throw, next) - CATCH_BREAK_INTO_DEBUGGER(); - } - if (m_reaction.shouldThrow) { -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - throw Catch::TestFailureException(); -#else - CATCH_ERROR( "Test failure requires aborting test!" ); -#endif - } - } - void AssertionHandler::setCompleted() { - m_completed = true; - } - - void AssertionHandler::handleUnexpectedInflightException() { - m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction ); - } - - void AssertionHandler::handleExceptionThrownAsExpected() { - m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); - } - void AssertionHandler::handleExceptionNotThrownAsExpected() { - m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); - } - - void AssertionHandler::handleUnexpectedExceptionNotThrown() { - m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction ); - } - - void AssertionHandler::handleThrowingCallSkipped() { - m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); - } - - // This is the overload that takes a string and infers the Equals matcher from it - // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) { - handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); - } - -} // namespace Catch -// end catch_assertionhandler.cpp -// start catch_assertionresult.cpp - -namespace Catch { - AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): - lazyExpression(_lazyExpression), - resultType(_resultType) {} - - std::string AssertionResultData::reconstructExpression() const { - - if( reconstructedExpression.empty() ) { - if( lazyExpression ) { - ReusableStringStream rss; - rss << lazyExpression; - reconstructedExpression = rss.str(); - } - } - return reconstructedExpression; - } - - AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) - : m_info( info ), - m_resultData( data ) - {} - - // Result was a success - bool AssertionResult::succeeded() const { - return Catch::isOk( m_resultData.resultType ); - } - - // Result was a success, or failure is suppressed - bool AssertionResult::isOk() const { - return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); - } - - ResultWas::OfType AssertionResult::getResultType() const { - return m_resultData.resultType; - } - - bool AssertionResult::hasExpression() const { - return m_info.capturedExpression[0] != 0; - } - - bool AssertionResult::hasMessage() const { - return !m_resultData.message.empty(); - } - - std::string AssertionResult::getExpression() const { - if( isFalseTest( m_info.resultDisposition ) ) - return "!(" + m_info.capturedExpression + ")"; - else - return m_info.capturedExpression; - } - - std::string AssertionResult::getExpressionInMacro() const { - std::string expr; - if( m_info.macroName[0] == 0 ) - expr = m_info.capturedExpression; - else { - expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); - expr += m_info.macroName; - expr += "( "; - expr += m_info.capturedExpression; - expr += " )"; - } - return expr; - } - - bool AssertionResult::hasExpandedExpression() const { - return hasExpression() && getExpandedExpression() != getExpression(); - } - - std::string AssertionResult::getExpandedExpression() const { - std::string expr = m_resultData.reconstructExpression(); - return expr.empty() - ? getExpression() - : expr; - } - - std::string AssertionResult::getMessage() const { - return m_resultData.message; - } - SourceLineInfo AssertionResult::getSourceInfo() const { - return m_info.lineInfo; - } - - StringRef AssertionResult::getTestMacroName() const { - return m_info.macroName; - } - -} // end namespace Catch -// end catch_assertionresult.cpp -// start catch_benchmark.cpp - -namespace Catch { - - auto BenchmarkLooper::getResolution() -> uint64_t { - return getEstimatedClockResolution() * getCurrentContext().getConfig()->benchmarkResolutionMultiple(); - } - - void BenchmarkLooper::reportStart() { - getResultCapture().benchmarkStarting( { m_name } ); - } - auto BenchmarkLooper::needsMoreIterations() -> bool { - auto elapsed = m_timer.getElapsedNanoseconds(); - - // Exponentially increasing iterations until we're confident in our timer resolution - if( elapsed < m_resolution ) { - m_iterationsToRun *= 10; - return true; - } - - getResultCapture().benchmarkEnded( { { m_name }, m_count, elapsed } ); - return false; - } - -} // end namespace Catch -// end catch_benchmark.cpp -// start catch_capture_matchers.cpp - -namespace Catch { - - using StringMatcher = Matchers::Impl::MatcherBase; - - // This is the general overload that takes a any string matcher - // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers - // the Equals matcher (so the header does not mention matchers) - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) { - std::string exceptionMessage = Catch::translateActiveException(); - MatchExpr expr( exceptionMessage, matcher, matcherString ); - handler.handleExpr( expr ); - } - -} // namespace Catch -// end catch_capture_matchers.cpp -// start catch_commandline.cpp - -// start catch_commandline.h - -// start catch_clara.h - -// Use Catch's value for console width (store Clara's off to the side, if present) -#ifdef CLARA_CONFIG_CONSOLE_WIDTH -#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH -#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH -#endif -#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1 - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wweak-vtables" -#pragma clang diagnostic ignored "-Wexit-time-destructors" -#pragma clang diagnostic ignored "-Wshadow" -#endif - -// start clara.hpp -// Copyright 2017 Two Blue Cubes Ltd. All rights reserved. -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See https://github.com/philsquared/Clara for more details - -// Clara v1.1.5 - - -#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH -#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80 -#endif - -#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH -#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH -#endif - -#ifndef CLARA_CONFIG_OPTIONAL_TYPE -#ifdef __has_include -#if __has_include() && __cplusplus >= 201703L -#include -#define CLARA_CONFIG_OPTIONAL_TYPE std::optional -#endif -#endif -#endif - -// ----------- #included from clara_textflow.hpp ----------- - -// TextFlowCpp -// -// A single-header library for wrapping and laying out basic text, by Phil Nash -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This project is hosted at https://github.com/philsquared/textflowcpp - - -#include -#include -#include -#include - -#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH -#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80 -#endif - -namespace Catch { -namespace clara { -namespace TextFlow { - -inline auto isWhitespace(char c) -> bool { - static std::string chars = " \t\n\r"; - return chars.find(c) != std::string::npos; -} -inline auto isBreakableBefore(char c) -> bool { - static std::string chars = "[({<|"; - return chars.find(c) != std::string::npos; -} -inline auto isBreakableAfter(char c) -> bool { - static std::string chars = "])}>.,:;*+-=&/\\"; - return chars.find(c) != std::string::npos; -} - -class Columns; - -class Column { - std::vector m_strings; - size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; - size_t m_indent = 0; - size_t m_initialIndent = std::string::npos; - -public: - class iterator { - friend Column; - - Column const& m_column; - size_t m_stringIndex = 0; - size_t m_pos = 0; - - size_t m_len = 0; - size_t m_end = 0; - bool m_suffix = false; - - iterator(Column const& column, size_t stringIndex) - : m_column(column), - m_stringIndex(stringIndex) {} - - auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; } - - auto isBoundary(size_t at) const -> bool { - assert(at > 0); - assert(at <= line().size()); - - return at == line().size() || - (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) || - isBreakableBefore(line()[at]) || - isBreakableAfter(line()[at - 1]); - } - - void calcLength() { - assert(m_stringIndex < m_column.m_strings.size()); - - m_suffix = false; - auto width = m_column.m_width - indent(); - m_end = m_pos; - while (m_end < line().size() && line()[m_end] != '\n') - ++m_end; - - if (m_end < m_pos + width) { - m_len = m_end - m_pos; - } else { - size_t len = width; - while (len > 0 && !isBoundary(m_pos + len)) - --len; - while (len > 0 && isWhitespace(line()[m_pos + len - 1])) - --len; - - if (len > 0) { - m_len = len; - } else { - m_suffix = true; - m_len = width - 1; - } - } - } - - auto indent() const -> size_t { - auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos; - return initial == std::string::npos ? m_column.m_indent : initial; - } - - auto addIndentAndSuffix(std::string const &plain) const -> std::string { - return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain); - } - - public: - using difference_type = std::ptrdiff_t; - using value_type = std::string; - using pointer = value_type * ; - using reference = value_type & ; - using iterator_category = std::forward_iterator_tag; - - explicit iterator(Column const& column) : m_column(column) { - assert(m_column.m_width > m_column.m_indent); - assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent); - calcLength(); - if (m_len == 0) - m_stringIndex++; // Empty string - } - - auto operator *() const -> std::string { - assert(m_stringIndex < m_column.m_strings.size()); - assert(m_pos <= m_end); - return addIndentAndSuffix(line().substr(m_pos, m_len)); - } - - auto operator ++() -> iterator& { - m_pos += m_len; - if (m_pos < line().size() && line()[m_pos] == '\n') - m_pos += 1; - else - while (m_pos < line().size() && isWhitespace(line()[m_pos])) - ++m_pos; - - if (m_pos == line().size()) { - m_pos = 0; - ++m_stringIndex; - } - if (m_stringIndex < m_column.m_strings.size()) - calcLength(); - return *this; - } - auto operator ++(int) -> iterator { - iterator prev(*this); - operator++(); - return prev; - } - - auto operator ==(iterator const& other) const -> bool { - return - m_pos == other.m_pos && - m_stringIndex == other.m_stringIndex && - &m_column == &other.m_column; - } - auto operator !=(iterator const& other) const -> bool { - return !operator==(other); - } - }; - using const_iterator = iterator; - - explicit Column(std::string const& text) { m_strings.push_back(text); } - - auto width(size_t newWidth) -> Column& { - assert(newWidth > 0); - m_width = newWidth; - return *this; - } - auto indent(size_t newIndent) -> Column& { - m_indent = newIndent; - return *this; - } - auto initialIndent(size_t newIndent) -> Column& { - m_initialIndent = newIndent; - return *this; - } - - auto width() const -> size_t { return m_width; } - auto begin() const -> iterator { return iterator(*this); } - auto end() const -> iterator { return { *this, m_strings.size() }; } - - inline friend std::ostream& operator << (std::ostream& os, Column const& col) { - bool first = true; - for (auto line : col) { - if (first) - first = false; - else - os << "\n"; - os << line; - } - return os; - } - - auto operator + (Column const& other)->Columns; - - auto toString() const -> std::string { - std::ostringstream oss; - oss << *this; - return oss.str(); - } -}; - -class Spacer : public Column { - -public: - explicit Spacer(size_t spaceWidth) : Column("") { - width(spaceWidth); - } -}; - -class Columns { - std::vector m_columns; - -public: - - class iterator { - friend Columns; - struct EndTag {}; - - std::vector const& m_columns; - std::vector m_iterators; - size_t m_activeIterators; - - iterator(Columns const& columns, EndTag) - : m_columns(columns.m_columns), - m_activeIterators(0) { - m_iterators.reserve(m_columns.size()); - - for (auto const& col : m_columns) - m_iterators.push_back(col.end()); - } - - public: - using difference_type = std::ptrdiff_t; - using value_type = std::string; - using pointer = value_type * ; - using reference = value_type & ; - using iterator_category = std::forward_iterator_tag; - - explicit iterator(Columns const& columns) - : m_columns(columns.m_columns), - m_activeIterators(m_columns.size()) { - m_iterators.reserve(m_columns.size()); - - for (auto const& col : m_columns) - m_iterators.push_back(col.begin()); - } - - auto operator ==(iterator const& other) const -> bool { - return m_iterators == other.m_iterators; - } - auto operator !=(iterator const& other) const -> bool { - return m_iterators != other.m_iterators; - } - auto operator *() const -> std::string { - std::string row, padding; - - for (size_t i = 0; i < m_columns.size(); ++i) { - auto width = m_columns[i].width(); - if (m_iterators[i] != m_columns[i].end()) { - std::string col = *m_iterators[i]; - row += padding + col; - if (col.size() < width) - padding = std::string(width - col.size(), ' '); - else - padding = ""; - } else { - padding += std::string(width, ' '); - } - } - return row; - } - auto operator ++() -> iterator& { - for (size_t i = 0; i < m_columns.size(); ++i) { - if (m_iterators[i] != m_columns[i].end()) - ++m_iterators[i]; - } - return *this; - } - auto operator ++(int) -> iterator { - iterator prev(*this); - operator++(); - return prev; - } - }; - using const_iterator = iterator; - - auto begin() const -> iterator { return iterator(*this); } - auto end() const -> iterator { return { *this, iterator::EndTag() }; } - - auto operator += (Column const& col) -> Columns& { - m_columns.push_back(col); - return *this; - } - auto operator + (Column const& col) -> Columns { - Columns combined = *this; - combined += col; - return combined; - } - - inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) { - - bool first = true; - for (auto line : cols) { - if (first) - first = false; - else - os << "\n"; - os << line; - } - return os; - } - - auto toString() const -> std::string { - std::ostringstream oss; - oss << *this; - return oss.str(); - } -}; - -inline auto Column::operator + (Column const& other) -> Columns { - Columns cols; - cols += *this; - cols += other; - return cols; -} -} - -} -} - -// ----------- end of #include from clara_textflow.hpp ----------- -// ........... back in clara.hpp - -#include -#include -#include -#include -#include - -#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) ) -#define CATCH_PLATFORM_WINDOWS -#endif - -namespace Catch { namespace clara { -namespace detail { - - // Traits for extracting arg and return type of lambdas (for single argument lambdas) - template - struct UnaryLambdaTraits : UnaryLambdaTraits {}; - - template - struct UnaryLambdaTraits { - static const bool isValid = false; - }; - - template - struct UnaryLambdaTraits { - static const bool isValid = true; - using ArgType = typename std::remove_const::type>::type; - using ReturnType = ReturnT; - }; - - class TokenStream; - - // Transport for raw args (copied from main args, or supplied via init list for testing) - class Args { - friend TokenStream; - std::string m_exeName; - std::vector m_args; - - public: - Args( int argc, char const* const* argv ) - : m_exeName(argv[0]), - m_args(argv + 1, argv + argc) {} - - Args( std::initializer_list args ) - : m_exeName( *args.begin() ), - m_args( args.begin()+1, args.end() ) - {} - - auto exeName() const -> std::string { - return m_exeName; - } - }; - - // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string - // may encode an option + its argument if the : or = form is used - enum class TokenType { - Option, Argument - }; - struct Token { - TokenType type; - std::string token; - }; - - inline auto isOptPrefix( char c ) -> bool { - return c == '-' -#ifdef CATCH_PLATFORM_WINDOWS - || c == '/' -#endif - ; - } - - // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled - class TokenStream { - using Iterator = std::vector::const_iterator; - Iterator it; - Iterator itEnd; - std::vector m_tokenBuffer; - - void loadBuffer() { - m_tokenBuffer.resize( 0 ); - - // Skip any empty strings - while( it != itEnd && it->empty() ) - ++it; - - if( it != itEnd ) { - auto const &next = *it; - if( isOptPrefix( next[0] ) ) { - auto delimiterPos = next.find_first_of( " :=" ); - if( delimiterPos != std::string::npos ) { - m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } ); - m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } ); - } else { - if( next[1] != '-' && next.size() > 2 ) { - std::string opt = "- "; - for( size_t i = 1; i < next.size(); ++i ) { - opt[1] = next[i]; - m_tokenBuffer.push_back( { TokenType::Option, opt } ); - } - } else { - m_tokenBuffer.push_back( { TokenType::Option, next } ); - } - } - } else { - m_tokenBuffer.push_back( { TokenType::Argument, next } ); - } - } - } - - public: - explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {} - - TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) { - loadBuffer(); - } - - explicit operator bool() const { - return !m_tokenBuffer.empty() || it != itEnd; - } - - auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); } - - auto operator*() const -> Token { - assert( !m_tokenBuffer.empty() ); - return m_tokenBuffer.front(); - } - - auto operator->() const -> Token const * { - assert( !m_tokenBuffer.empty() ); - return &m_tokenBuffer.front(); - } - - auto operator++() -> TokenStream & { - if( m_tokenBuffer.size() >= 2 ) { - m_tokenBuffer.erase( m_tokenBuffer.begin() ); - } else { - if( it != itEnd ) - ++it; - loadBuffer(); - } - return *this; - } - }; - - class ResultBase { - public: - enum Type { - Ok, LogicError, RuntimeError - }; - - protected: - ResultBase( Type type ) : m_type( type ) {} - virtual ~ResultBase() = default; - - virtual void enforceOk() const = 0; - - Type m_type; - }; - - template - class ResultValueBase : public ResultBase { - public: - auto value() const -> T const & { - enforceOk(); - return m_value; - } - - protected: - ResultValueBase( Type type ) : ResultBase( type ) {} - - ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) { - if( m_type == ResultBase::Ok ) - new( &m_value ) T( other.m_value ); - } - - ResultValueBase( Type, T const &value ) : ResultBase( Ok ) { - new( &m_value ) T( value ); - } - - auto operator=( ResultValueBase const &other ) -> ResultValueBase & { - if( m_type == ResultBase::Ok ) - m_value.~T(); - ResultBase::operator=(other); - if( m_type == ResultBase::Ok ) - new( &m_value ) T( other.m_value ); - return *this; - } - - ~ResultValueBase() override { - if( m_type == Ok ) - m_value.~T(); - } - - union { - T m_value; - }; - }; - - template<> - class ResultValueBase : public ResultBase { - protected: - using ResultBase::ResultBase; - }; - - template - class BasicResult : public ResultValueBase { - public: - template - explicit BasicResult( BasicResult const &other ) - : ResultValueBase( other.type() ), - m_errorMessage( other.errorMessage() ) - { - assert( type() != ResultBase::Ok ); - } - - template - static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; } - static auto ok() -> BasicResult { return { ResultBase::Ok }; } - static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; } - static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; } - - explicit operator bool() const { return m_type == ResultBase::Ok; } - auto type() const -> ResultBase::Type { return m_type; } - auto errorMessage() const -> std::string { return m_errorMessage; } - - protected: - void enforceOk() const override { - - // Errors shouldn't reach this point, but if they do - // the actual error message will be in m_errorMessage - assert( m_type != ResultBase::LogicError ); - assert( m_type != ResultBase::RuntimeError ); - if( m_type != ResultBase::Ok ) - std::abort(); - } - - std::string m_errorMessage; // Only populated if resultType is an error - - BasicResult( ResultBase::Type type, std::string const &message ) - : ResultValueBase(type), - m_errorMessage(message) - { - assert( m_type != ResultBase::Ok ); - } - - using ResultValueBase::ResultValueBase; - using ResultBase::m_type; - }; - - enum class ParseResultType { - Matched, NoMatch, ShortCircuitAll, ShortCircuitSame - }; - - class ParseState { - public: - - ParseState( ParseResultType type, TokenStream const &remainingTokens ) - : m_type(type), - m_remainingTokens( remainingTokens ) - {} - - auto type() const -> ParseResultType { return m_type; } - auto remainingTokens() const -> TokenStream { return m_remainingTokens; } - - private: - ParseResultType m_type; - TokenStream m_remainingTokens; - }; - - using Result = BasicResult; - using ParserResult = BasicResult; - using InternalParseResult = BasicResult; - - struct HelpColumns { - std::string left; - std::string right; - }; - - template - inline auto convertInto( std::string const &source, T& target ) -> ParserResult { - std::stringstream ss; - ss << source; - ss >> target; - if( ss.fail() ) - return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" ); - else - return ParserResult::ok( ParseResultType::Matched ); - } - inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult { - target = source; - return ParserResult::ok( ParseResultType::Matched ); - } - inline auto convertInto( std::string const &source, bool &target ) -> ParserResult { - std::string srcLC = source; - std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast( std::tolower(c) ); } ); - if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on") - target = true; - else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off") - target = false; - else - return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); - return ParserResult::ok( ParseResultType::Matched ); - } -#ifdef CLARA_CONFIG_OPTIONAL_TYPE - template - inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE& target ) -> ParserResult { - T temp; - auto result = convertInto( source, temp ); - if( result ) - target = std::move(temp); - return result; - } -#endif // CLARA_CONFIG_OPTIONAL_TYPE - - struct NonCopyable { - NonCopyable() = default; - NonCopyable( NonCopyable const & ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable &operator=( NonCopyable const & ) = delete; - NonCopyable &operator=( NonCopyable && ) = delete; - }; - - struct BoundRef : NonCopyable { - virtual ~BoundRef() = default; - virtual auto isContainer() const -> bool { return false; } - virtual auto isFlag() const -> bool { return false; } - }; - struct BoundValueRefBase : BoundRef { - virtual auto setValue( std::string const &arg ) -> ParserResult = 0; - }; - struct BoundFlagRefBase : BoundRef { - virtual auto setFlag( bool flag ) -> ParserResult = 0; - virtual auto isFlag() const -> bool { return true; } - }; - - template - struct BoundValueRef : BoundValueRefBase { - T &m_ref; - - explicit BoundValueRef( T &ref ) : m_ref( ref ) {} - - auto setValue( std::string const &arg ) -> ParserResult override { - return convertInto( arg, m_ref ); - } - }; - - template - struct BoundValueRef> : BoundValueRefBase { - std::vector &m_ref; - - explicit BoundValueRef( std::vector &ref ) : m_ref( ref ) {} - - auto isContainer() const -> bool override { return true; } - - auto setValue( std::string const &arg ) -> ParserResult override { - T temp; - auto result = convertInto( arg, temp ); - if( result ) - m_ref.push_back( temp ); - return result; - } - }; - - struct BoundFlagRef : BoundFlagRefBase { - bool &m_ref; - - explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {} - - auto setFlag( bool flag ) -> ParserResult override { - m_ref = flag; - return ParserResult::ok( ParseResultType::Matched ); - } - }; - - template - struct LambdaInvoker { - static_assert( std::is_same::value, "Lambda must return void or clara::ParserResult" ); - - template - static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { - return lambda( arg ); - } - }; - - template<> - struct LambdaInvoker { - template - static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { - lambda( arg ); - return ParserResult::ok( ParseResultType::Matched ); - } - }; - - template - inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult { - ArgType temp{}; - auto result = convertInto( arg, temp ); - return !result - ? result - : LambdaInvoker::ReturnType>::invoke( lambda, temp ); - } - - template - struct BoundLambda : BoundValueRefBase { - L m_lambda; - - static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); - explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {} - - auto setValue( std::string const &arg ) -> ParserResult override { - return invokeLambda::ArgType>( m_lambda, arg ); - } - }; - - template - struct BoundFlagLambda : BoundFlagRefBase { - L m_lambda; - - static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); - static_assert( std::is_same::ArgType, bool>::value, "flags must be boolean" ); - - explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {} - - auto setFlag( bool flag ) -> ParserResult override { - return LambdaInvoker::ReturnType>::invoke( m_lambda, flag ); - } - }; - - enum class Optionality { Optional, Required }; - - struct Parser; - - class ParserBase { - public: - virtual ~ParserBase() = default; - virtual auto validate() const -> Result { return Result::ok(); } - virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; - virtual auto cardinality() const -> size_t { return 1; } - - auto parse( Args const &args ) const -> InternalParseResult { - return parse( args.exeName(), TokenStream( args ) ); - } - }; - - template - class ComposableParserImpl : public ParserBase { - public: - template - auto operator|( T const &other ) const -> Parser; - - template - auto operator+( T const &other ) const -> Parser; - }; - - // Common code and state for Args and Opts - template - class ParserRefImpl : public ComposableParserImpl { - protected: - Optionality m_optionality = Optionality::Optional; - std::shared_ptr m_ref; - std::string m_hint; - std::string m_description; - - explicit ParserRefImpl( std::shared_ptr const &ref ) : m_ref( ref ) {} - - public: - template - ParserRefImpl( T &ref, std::string const &hint ) - : m_ref( std::make_shared>( ref ) ), - m_hint( hint ) - {} - - template - ParserRefImpl( LambdaT const &ref, std::string const &hint ) - : m_ref( std::make_shared>( ref ) ), - m_hint(hint) - {} - - auto operator()( std::string const &description ) -> DerivedT & { - m_description = description; - return static_cast( *this ); - } - - auto optional() -> DerivedT & { - m_optionality = Optionality::Optional; - return static_cast( *this ); - }; - - auto required() -> DerivedT & { - m_optionality = Optionality::Required; - return static_cast( *this ); - }; - - auto isOptional() const -> bool { - return m_optionality == Optionality::Optional; - } - - auto cardinality() const -> size_t override { - if( m_ref->isContainer() ) - return 0; - else - return 1; - } - - auto hint() const -> std::string { return m_hint; } - }; - - class ExeName : public ComposableParserImpl { - std::shared_ptr m_name; - std::shared_ptr m_ref; - - template - static auto makeRef(LambdaT const &lambda) -> std::shared_ptr { - return std::make_shared>( lambda) ; - } - - public: - ExeName() : m_name( std::make_shared( "" ) ) {} - - explicit ExeName( std::string &ref ) : ExeName() { - m_ref = std::make_shared>( ref ); - } - - template - explicit ExeName( LambdaT const& lambda ) : ExeName() { - m_ref = std::make_shared>( lambda ); - } - - // The exe name is not parsed out of the normal tokens, but is handled specially - auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { - return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); - } - - auto name() const -> std::string { return *m_name; } - auto set( std::string const& newName ) -> ParserResult { - - auto lastSlash = newName.find_last_of( "\\/" ); - auto filename = ( lastSlash == std::string::npos ) - ? newName - : newName.substr( lastSlash+1 ); - - *m_name = filename; - if( m_ref ) - return m_ref->setValue( filename ); - else - return ParserResult::ok( ParseResultType::Matched ); - } - }; - - class Arg : public ParserRefImpl { - public: - using ParserRefImpl::ParserRefImpl; - - auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override { - auto validationResult = validate(); - if( !validationResult ) - return InternalParseResult( validationResult ); - - auto remainingTokens = tokens; - auto const &token = *remainingTokens; - if( token.type != TokenType::Argument ) - return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); - - assert( !m_ref->isFlag() ); - auto valueRef = static_cast( m_ref.get() ); - - auto result = valueRef->setValue( remainingTokens->token ); - if( !result ) - return InternalParseResult( result ); - else - return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); - } - }; - - inline auto normaliseOpt( std::string const &optName ) -> std::string { -#ifdef CATCH_PLATFORM_WINDOWS - if( optName[0] == '/' ) - return "-" + optName.substr( 1 ); - else -#endif - return optName; - } - - class Opt : public ParserRefImpl { - protected: - std::vector m_optNames; - - public: - template - explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared>( ref ) ) {} - - explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared( ref ) ) {} - - template - Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} - - template - Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} - - auto operator[]( std::string const &optName ) -> Opt & { - m_optNames.push_back( optName ); - return *this; - } - - auto getHelpColumns() const -> std::vector { - std::ostringstream oss; - bool first = true; - for( auto const &opt : m_optNames ) { - if (first) - first = false; - else - oss << ", "; - oss << opt; - } - if( !m_hint.empty() ) - oss << " <" << m_hint << ">"; - return { { oss.str(), m_description } }; - } - - auto isMatch( std::string const &optToken ) const -> bool { - auto normalisedToken = normaliseOpt( optToken ); - for( auto const &name : m_optNames ) { - if( normaliseOpt( name ) == normalisedToken ) - return true; - } - return false; - } - - using ParserBase::parse; - - auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { - auto validationResult = validate(); - if( !validationResult ) - return InternalParseResult( validationResult ); - - auto remainingTokens = tokens; - if( remainingTokens && remainingTokens->type == TokenType::Option ) { - auto const &token = *remainingTokens; - if( isMatch(token.token ) ) { - if( m_ref->isFlag() ) { - auto flagRef = static_cast( m_ref.get() ); - auto result = flagRef->setFlag( true ); - if( !result ) - return InternalParseResult( result ); - if( result.value() == ParseResultType::ShortCircuitAll ) - return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); - } else { - auto valueRef = static_cast( m_ref.get() ); - ++remainingTokens; - if( !remainingTokens ) - return InternalParseResult::runtimeError( "Expected argument following " + token.token ); - auto const &argToken = *remainingTokens; - if( argToken.type != TokenType::Argument ) - return InternalParseResult::runtimeError( "Expected argument following " + token.token ); - auto result = valueRef->setValue( argToken.token ); - if( !result ) - return InternalParseResult( result ); - if( result.value() == ParseResultType::ShortCircuitAll ) - return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); - } - return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); - } - } - return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); - } - - auto validate() const -> Result override { - if( m_optNames.empty() ) - return Result::logicError( "No options supplied to Opt" ); - for( auto const &name : m_optNames ) { - if( name.empty() ) - return Result::logicError( "Option name cannot be empty" ); -#ifdef CATCH_PLATFORM_WINDOWS - if( name[0] != '-' && name[0] != '/' ) - return Result::logicError( "Option name must begin with '-' or '/'" ); -#else - if( name[0] != '-' ) - return Result::logicError( "Option name must begin with '-'" ); -#endif - } - return ParserRefImpl::validate(); - } - }; - - struct Help : Opt { - Help( bool &showHelpFlag ) - : Opt([&]( bool flag ) { - showHelpFlag = flag; - return ParserResult::ok( ParseResultType::ShortCircuitAll ); - }) - { - static_cast( *this ) - ("display usage information") - ["-?"]["-h"]["--help"] - .optional(); - } - }; - - struct Parser : ParserBase { - - mutable ExeName m_exeName; - std::vector m_options; - std::vector m_args; - - auto operator|=( ExeName const &exeName ) -> Parser & { - m_exeName = exeName; - return *this; - } - - auto operator|=( Arg const &arg ) -> Parser & { - m_args.push_back(arg); - return *this; - } - - auto operator|=( Opt const &opt ) -> Parser & { - m_options.push_back(opt); - return *this; - } - - auto operator|=( Parser const &other ) -> Parser & { - m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end()); - m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end()); - return *this; - } - - template - auto operator|( T const &other ) const -> Parser { - return Parser( *this ) |= other; - } - - // Forward deprecated interface with '+' instead of '|' - template - auto operator+=( T const &other ) -> Parser & { return operator|=( other ); } - template - auto operator+( T const &other ) const -> Parser { return operator|( other ); } - - auto getHelpColumns() const -> std::vector { - std::vector cols; - for (auto const &o : m_options) { - auto childCols = o.getHelpColumns(); - cols.insert( cols.end(), childCols.begin(), childCols.end() ); - } - return cols; - } - - void writeToStream( std::ostream &os ) const { - if (!m_exeName.name().empty()) { - os << "usage:\n" << " " << m_exeName.name() << " "; - bool required = true, first = true; - for( auto const &arg : m_args ) { - if (first) - first = false; - else - os << " "; - if( arg.isOptional() && required ) { - os << "["; - required = false; - } - os << "<" << arg.hint() << ">"; - if( arg.cardinality() == 0 ) - os << " ... "; - } - if( !required ) - os << "]"; - if( !m_options.empty() ) - os << " options"; - os << "\n\nwhere options are:" << std::endl; - } - - auto rows = getHelpColumns(); - size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; - size_t optWidth = 0; - for( auto const &cols : rows ) - optWidth = (std::max)(optWidth, cols.left.size() + 2); - - optWidth = (std::min)(optWidth, consoleWidth/2); - - for( auto const &cols : rows ) { - auto row = - TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) + - TextFlow::Spacer(4) + - TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth ); - os << row << std::endl; - } - } - - friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& { - parser.writeToStream( os ); - return os; - } - - auto validate() const -> Result override { - for( auto const &opt : m_options ) { - auto result = opt.validate(); - if( !result ) - return result; - } - for( auto const &arg : m_args ) { - auto result = arg.validate(); - if( !result ) - return result; - } - return Result::ok(); - } - - using ParserBase::parse; - - auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override { - - struct ParserInfo { - ParserBase const* parser = nullptr; - size_t count = 0; - }; - const size_t totalParsers = m_options.size() + m_args.size(); - assert( totalParsers < 512 ); - // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do - ParserInfo parseInfos[512]; - - { - size_t i = 0; - for (auto const &opt : m_options) parseInfos[i++].parser = &opt; - for (auto const &arg : m_args) parseInfos[i++].parser = &arg; - } - - m_exeName.set( exeName ); - - auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); - while( result.value().remainingTokens() ) { - bool tokenParsed = false; - - for( size_t i = 0; i < totalParsers; ++i ) { - auto& parseInfo = parseInfos[i]; - if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) { - result = parseInfo.parser->parse(exeName, result.value().remainingTokens()); - if (!result) - return result; - if (result.value().type() != ParseResultType::NoMatch) { - tokenParsed = true; - ++parseInfo.count; - break; - } - } - } - - if( result.value().type() == ParseResultType::ShortCircuitAll ) - return result; - if( !tokenParsed ) - return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token ); - } - // !TBD Check missing required options - return result; - } - }; - - template - template - auto ComposableParserImpl::operator|( T const &other ) const -> Parser { - return Parser() | static_cast( *this ) | other; - } -} // namespace detail - -// A Combined parser -using detail::Parser; - -// A parser for options -using detail::Opt; - -// A parser for arguments -using detail::Arg; - -// Wrapper for argc, argv from main() -using detail::Args; - -// Specifies the name of the executable -using detail::ExeName; - -// Convenience wrapper for option parser that specifies the help option -using detail::Help; - -// enum of result types from a parse -using detail::ParseResultType; - -// Result type for parser operation -using detail::ParserResult; - -}} // namespace Catch::clara - -// end clara.hpp -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -// Restore Clara's value for console width, if present -#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH -#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH -#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH -#endif - -// end catch_clara.h -namespace Catch { - - clara::Parser makeCommandLineParser( ConfigData& config ); - -} // end namespace Catch - -// end catch_commandline.h -#include -#include - -namespace Catch { - - clara::Parser makeCommandLineParser( ConfigData& config ) { - - using namespace clara; - - auto const setWarning = [&]( std::string const& warning ) { - auto warningSet = [&]() { - if( warning == "NoAssertions" ) - return WarnAbout::NoAssertions; - - if ( warning == "NoTests" ) - return WarnAbout::NoTests; - - return WarnAbout::Nothing; - }(); - - if (warningSet == WarnAbout::Nothing) - return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); - config.warnings = static_cast( config.warnings | warningSet ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const loadTestNamesFromFile = [&]( std::string const& filename ) { - std::ifstream f( filename.c_str() ); - if( !f.is_open() ) - return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); - - std::string line; - while( std::getline( f, line ) ) { - line = trim(line); - if( !line.empty() && !startsWith( line, '#' ) ) { - if( !startsWith( line, '"' ) ) - line = '"' + line + '"'; - config.testsOrTags.push_back( line + ',' ); - } - } - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setTestOrder = [&]( std::string const& order ) { - if( startsWith( "declared", order ) ) - config.runOrder = RunTests::InDeclarationOrder; - else if( startsWith( "lexical", order ) ) - config.runOrder = RunTests::InLexicographicalOrder; - else if( startsWith( "random", order ) ) - config.runOrder = RunTests::InRandomOrder; - else - return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setRngSeed = [&]( std::string const& seed ) { - if( seed != "time" ) - return clara::detail::convertInto( seed, config.rngSeed ); - config.rngSeed = static_cast( std::time(nullptr) ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setColourUsage = [&]( std::string const& useColour ) { - auto mode = toLower( useColour ); - - if( mode == "yes" ) - config.useColour = UseColour::Yes; - else if( mode == "no" ) - config.useColour = UseColour::No; - else if( mode == "auto" ) - config.useColour = UseColour::Auto; - else - return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setWaitForKeypress = [&]( std::string const& keypress ) { - auto keypressLc = toLower( keypress ); - if( keypressLc == "start" ) - config.waitForKeypress = WaitForKeypress::BeforeStart; - else if( keypressLc == "exit" ) - config.waitForKeypress = WaitForKeypress::BeforeExit; - else if( keypressLc == "both" ) - config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; - else - return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setVerbosity = [&]( std::string const& verbosity ) { - auto lcVerbosity = toLower( verbosity ); - if( lcVerbosity == "quiet" ) - config.verbosity = Verbosity::Quiet; - else if( lcVerbosity == "normal" ) - config.verbosity = Verbosity::Normal; - else if( lcVerbosity == "high" ) - config.verbosity = Verbosity::High; - else - return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setReporter = [&]( std::string const& reporter ) { - IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); - - auto lcReporter = toLower( reporter ); - auto result = factories.find( lcReporter ); - - if( factories.end() != result ) - config.reporterName = lcReporter; - else - return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - - auto cli - = ExeName( config.processName ) - | Help( config.showHelp ) - | Opt( config.listTests ) - ["-l"]["--list-tests"] - ( "list all/matching test cases" ) - | Opt( config.listTags ) - ["-t"]["--list-tags"] - ( "list all/matching tags" ) - | Opt( config.showSuccessfulTests ) - ["-s"]["--success"] - ( "include successful tests in output" ) - | Opt( config.shouldDebugBreak ) - ["-b"]["--break"] - ( "break into debugger on failure" ) - | Opt( config.noThrow ) - ["-e"]["--nothrow"] - ( "skip exception tests" ) - | Opt( config.showInvisibles ) - ["-i"]["--invisibles"] - ( "show invisibles (tabs, newlines)" ) - | Opt( config.outputFilename, "filename" ) - ["-o"]["--out"] - ( "output filename" ) - | Opt( setReporter, "name" ) - ["-r"]["--reporter"] - ( "reporter to use (defaults to console)" ) - | Opt( config.name, "name" ) - ["-n"]["--name"] - ( "suite name" ) - | Opt( [&]( bool ){ config.abortAfter = 1; } ) - ["-a"]["--abort"] - ( "abort at first failure" ) - | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) - ["-x"]["--abortx"] - ( "abort after x failures" ) - | Opt( setWarning, "warning name" ) - ["-w"]["--warn"] - ( "enable warnings" ) - | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) - ["-d"]["--durations"] - ( "show test durations" ) - | Opt( loadTestNamesFromFile, "filename" ) - ["-f"]["--input-file"] - ( "load test names to run from a file" ) - | Opt( config.filenamesAsTags ) - ["-#"]["--filenames-as-tags"] - ( "adds a tag for the filename" ) - | Opt( config.sectionsToRun, "section name" ) - ["-c"]["--section"] - ( "specify section to run" ) - | Opt( setVerbosity, "quiet|normal|high" ) - ["-v"]["--verbosity"] - ( "set output verbosity" ) - | Opt( config.listTestNamesOnly ) - ["--list-test-names-only"] - ( "list all/matching test cases names only" ) - | Opt( config.listReporters ) - ["--list-reporters"] - ( "list all reporters" ) - | Opt( setTestOrder, "decl|lex|rand" ) - ["--order"] - ( "test case order (defaults to decl)" ) - | Opt( setRngSeed, "'time'|number" ) - ["--rng-seed"] - ( "set a specific seed for random numbers" ) - | Opt( setColourUsage, "yes|no" ) - ["--use-colour"] - ( "should output be colourised" ) - | Opt( config.libIdentify ) - ["--libidentify"] - ( "report name and version according to libidentify standard" ) - | Opt( setWaitForKeypress, "start|exit|both" ) - ["--wait-for-keypress"] - ( "waits for a keypress before exiting" ) - | Opt( config.benchmarkResolutionMultiple, "multiplier" ) - ["--benchmark-resolution-multiple"] - ( "multiple of clock resolution to run benchmarks" ) - - | Arg( config.testsOrTags, "test name|pattern|tags" ) - ( "which test or tests to use" ); - - return cli; - } - -} // end namespace Catch -// end catch_commandline.cpp -// start catch_common.cpp - -#include -#include - -namespace Catch { - - bool SourceLineInfo::empty() const noexcept { - return file[0] == '\0'; - } - bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { - return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); - } - bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { - // We can assume that the same file will usually have the same pointer. - // Thus, if the pointers are the same, there is no point in calling the strcmp - return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); - } - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { -#ifndef __GNUG__ - os << info.file << '(' << info.line << ')'; -#else - os << info.file << ':' << info.line; -#endif - return os; - } - - std::string StreamEndStop::operator+() const { - return std::string(); - } - - NonCopyable::NonCopyable() = default; - NonCopyable::~NonCopyable() = default; - -} -// end catch_common.cpp -// start catch_config.cpp - -namespace Catch { - - Config::Config( ConfigData const& data ) - : m_data( data ), - m_stream( openStream() ) - { - TestSpecParser parser(ITagAliasRegistry::get()); - if (data.testsOrTags.empty()) { - parser.parse("~[.]"); // All not hidden tests - } - else { - m_hasTestFilters = true; - for( auto const& testOrTags : data.testsOrTags ) - parser.parse( testOrTags ); - } - m_testSpec = parser.testSpec(); - } - - std::string const& Config::getFilename() const { - return m_data.outputFilename ; - } - - bool Config::listTests() const { return m_data.listTests; } - bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; } - bool Config::listTags() const { return m_data.listTags; } - bool Config::listReporters() const { return m_data.listReporters; } - - std::string Config::getProcessName() const { return m_data.processName; } - std::string const& Config::getReporterName() const { return m_data.reporterName; } - - std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; } - std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } - - TestSpec const& Config::testSpec() const { return m_testSpec; } - bool Config::hasTestFilters() const { return m_hasTestFilters; } - - bool Config::showHelp() const { return m_data.showHelp; } - - // IConfig interface - bool Config::allowThrows() const { return !m_data.noThrow; } - std::ostream& Config::stream() const { return m_stream->stream(); } - std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } - bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } - bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } - bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } - ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; } - RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; } - unsigned int Config::rngSeed() const { return m_data.rngSeed; } - int Config::benchmarkResolutionMultiple() const { return m_data.benchmarkResolutionMultiple; } - UseColour::YesOrNo Config::useColour() const { return m_data.useColour; } - bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; } - int Config::abortAfter() const { return m_data.abortAfter; } - bool Config::showInvisibles() const { return m_data.showInvisibles; } - Verbosity Config::verbosity() const { return m_data.verbosity; } - - IStream const* Config::openStream() { - return Catch::makeStream(m_data.outputFilename); - } - -} // end namespace Catch -// end catch_config.cpp -// start catch_console_colour.cpp - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wexit-time-destructors" -#endif - -// start catch_errno_guard.h - -namespace Catch { - - class ErrnoGuard { - public: - ErrnoGuard(); - ~ErrnoGuard(); - private: - int m_oldErrno; - }; - -} - -// end catch_errno_guard.h -#include - -namespace Catch { - namespace { - - struct IColourImpl { - virtual ~IColourImpl() = default; - virtual void use( Colour::Code _colourCode ) = 0; - }; - - struct NoColourImpl : IColourImpl { - void use( Colour::Code ) {} - - static IColourImpl* instance() { - static NoColourImpl s_instance; - return &s_instance; - } - }; - - } // anon namespace -} // namespace Catch - -#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) -# ifdef CATCH_PLATFORM_WINDOWS -# define CATCH_CONFIG_COLOUR_WINDOWS -# else -# define CATCH_CONFIG_COLOUR_ANSI -# endif -#endif - -#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// - -namespace Catch { -namespace { - - class Win32ColourImpl : public IColourImpl { - public: - Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) - { - CONSOLE_SCREEN_BUFFER_INFO csbiInfo; - GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); - originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY ); - originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY ); - } - - virtual void use( Colour::Code _colourCode ) override { - switch( _colourCode ) { - case Colour::None: return setTextAttribute( originalForegroundAttributes ); - case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); - case Colour::Red: return setTextAttribute( FOREGROUND_RED ); - case Colour::Green: return setTextAttribute( FOREGROUND_GREEN ); - case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE ); - case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN ); - case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN ); - case Colour::Grey: return setTextAttribute( 0 ); - - case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY ); - case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); - case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); - case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); - case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN ); - - case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); - - default: - CATCH_ERROR( "Unknown colour requested" ); - } - } - - private: - void setTextAttribute( WORD _textAttribute ) { - SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); - } - HANDLE stdoutHandle; - WORD originalForegroundAttributes; - WORD originalBackgroundAttributes; - }; - - IColourImpl* platformColourInstance() { - static Win32ColourImpl s_instance; - - IConfigPtr config = getCurrentContext().getConfig(); - UseColour::YesOrNo colourMode = config - ? config->useColour() - : UseColour::Auto; - if( colourMode == UseColour::Auto ) - colourMode = UseColour::Yes; - return colourMode == UseColour::Yes - ? &s_instance - : NoColourImpl::instance(); - } - -} // end anon namespace -} // end namespace Catch - -#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// - -#include - -namespace Catch { -namespace { - - // use POSIX/ ANSI console terminal codes - // Thanks to Adam Strzelecki for original contribution - // (http://github.com/nanoant) - // https://github.com/philsquared/Catch/pull/131 - class PosixColourImpl : public IColourImpl { - public: - virtual void use( Colour::Code _colourCode ) override { - switch( _colourCode ) { - case Colour::None: - case Colour::White: return setColour( "[0m" ); - case Colour::Red: return setColour( "[0;31m" ); - case Colour::Green: return setColour( "[0;32m" ); - case Colour::Blue: return setColour( "[0;34m" ); - case Colour::Cyan: return setColour( "[0;36m" ); - case Colour::Yellow: return setColour( "[0;33m" ); - case Colour::Grey: return setColour( "[1;30m" ); - - case Colour::LightGrey: return setColour( "[0;37m" ); - case Colour::BrightRed: return setColour( "[1;31m" ); - case Colour::BrightGreen: return setColour( "[1;32m" ); - case Colour::BrightWhite: return setColour( "[1;37m" ); - case Colour::BrightYellow: return setColour( "[1;33m" ); - - case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); - default: CATCH_INTERNAL_ERROR( "Unknown colour requested" ); - } - } - static IColourImpl* instance() { - static PosixColourImpl s_instance; - return &s_instance; - } - - private: - void setColour( const char* _escapeCode ) { - getCurrentContext().getConfig()->stream() - << '\033' << _escapeCode; - } - }; - - bool useColourOnPlatform() { - return -#ifdef CATCH_PLATFORM_MAC - !isDebuggerActive() && -#endif -#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) - isatty(STDOUT_FILENO) -#else - false -#endif - ; - } - IColourImpl* platformColourInstance() { - ErrnoGuard guard; - IConfigPtr config = getCurrentContext().getConfig(); - UseColour::YesOrNo colourMode = config - ? config->useColour() - : UseColour::Auto; - if( colourMode == UseColour::Auto ) - colourMode = useColourOnPlatform() - ? UseColour::Yes - : UseColour::No; - return colourMode == UseColour::Yes - ? PosixColourImpl::instance() - : NoColourImpl::instance(); - } - -} // end anon namespace -} // end namespace Catch - -#else // not Windows or ANSI /////////////////////////////////////////////// - -namespace Catch { - - static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } - -} // end namespace Catch - -#endif // Windows/ ANSI/ None - -namespace Catch { - - Colour::Colour( Code _colourCode ) { use( _colourCode ); } - Colour::Colour( Colour&& rhs ) noexcept { - m_moved = rhs.m_moved; - rhs.m_moved = true; - } - Colour& Colour::operator=( Colour&& rhs ) noexcept { - m_moved = rhs.m_moved; - rhs.m_moved = true; - return *this; - } - - Colour::~Colour(){ if( !m_moved ) use( None ); } - - void Colour::use( Code _colourCode ) { - static IColourImpl* impl = platformColourInstance(); - impl->use( _colourCode ); - } - - std::ostream& operator << ( std::ostream& os, Colour const& ) { - return os; - } - -} // end namespace Catch - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -// end catch_console_colour.cpp -// start catch_context.cpp - -namespace Catch { - - class Context : public IMutableContext, NonCopyable { - - public: // IContext - virtual IResultCapture* getResultCapture() override { - return m_resultCapture; - } - virtual IRunner* getRunner() override { - return m_runner; - } - - virtual IConfigPtr const& getConfig() const override { - return m_config; - } - - virtual ~Context() override; - - public: // IMutableContext - virtual void setResultCapture( IResultCapture* resultCapture ) override { - m_resultCapture = resultCapture; - } - virtual void setRunner( IRunner* runner ) override { - m_runner = runner; - } - virtual void setConfig( IConfigPtr const& config ) override { - m_config = config; - } - - friend IMutableContext& getCurrentMutableContext(); - - private: - IConfigPtr m_config; - IRunner* m_runner = nullptr; - IResultCapture* m_resultCapture = nullptr; - }; - - IMutableContext *IMutableContext::currentContext = nullptr; - - void IMutableContext::createContext() - { - currentContext = new Context(); - } - - void cleanUpContext() { - delete IMutableContext::currentContext; - IMutableContext::currentContext = nullptr; - } - IContext::~IContext() = default; - IMutableContext::~IMutableContext() = default; - Context::~Context() = default; -} -// end catch_context.cpp -// start catch_debug_console.cpp - -// start catch_debug_console.h - -#include - -namespace Catch { - void writeToDebugConsole( std::string const& text ); -} - -// end catch_debug_console.h -#ifdef CATCH_PLATFORM_WINDOWS - - namespace Catch { - void writeToDebugConsole( std::string const& text ) { - ::OutputDebugStringA( text.c_str() ); - } - } - -#else - - namespace Catch { - void writeToDebugConsole( std::string const& text ) { - // !TBD: Need a version for Mac/ XCode and other IDEs - Catch::cout() << text; - } - } - -#endif // Platform -// end catch_debug_console.cpp -// start catch_debugger.cpp - -#ifdef CATCH_PLATFORM_MAC - -# include -# include -# include -# include -# include -# include -# include - -namespace Catch { - - // The following function is taken directly from the following technical note: - // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html - - // Returns true if the current process is being debugged (either - // running under the debugger or has a debugger attached post facto). - bool isDebuggerActive(){ - - int mib[4]; - struct kinfo_proc info; - std::size_t size; - - // Initialize the flags so that, if sysctl fails for some bizarre - // reason, we get a predictable result. - - info.kp_proc.p_flag = 0; - - // Initialize mib, which tells sysctl the info we want, in this case - // we're looking for information about a specific process ID. - - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = getpid(); - - // Call sysctl. - - size = sizeof(info); - if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) { - Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; - return false; - } - - // We're being debugged if the P_TRACED flag is set. - - return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); - } - } // namespace Catch - -#elif defined(CATCH_PLATFORM_LINUX) - #include - #include - - namespace Catch{ - // The standard POSIX way of detecting a debugger is to attempt to - // ptrace() the process, but this needs to be done from a child and not - // this process itself to still allow attaching to this process later - // if wanted, so is rather heavy. Under Linux we have the PID of the - // "debugger" (which doesn't need to be gdb, of course, it could also - // be strace, for example) in /proc/$PID/status, so just get it from - // there instead. - bool isDebuggerActive(){ - // Libstdc++ has a bug, where std::ifstream sets errno to 0 - // This way our users can properly assert over errno values - ErrnoGuard guard; - std::ifstream in("/proc/self/status"); - for( std::string line; std::getline(in, line); ) { - static const int PREFIX_LEN = 11; - if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) { - // We're traced if the PID is not 0 and no other PID starts - // with 0 digit, so it's enough to check for just a single - // character. - return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0'; - } - } - - return false; - } - } // namespace Catch -#elif defined(_MSC_VER) - extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); - namespace Catch { - bool isDebuggerActive() { - return IsDebuggerPresent() != 0; - } - } -#elif defined(__MINGW32__) - extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); - namespace Catch { - bool isDebuggerActive() { - return IsDebuggerPresent() != 0; - } - } -#else - namespace Catch { - bool isDebuggerActive() { return false; } - } -#endif // Platform -// end catch_debugger.cpp -// start catch_decomposer.cpp - -namespace Catch { - - ITransientExpression::~ITransientExpression() = default; - - void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { - if( lhs.size() + rhs.size() < 40 && - lhs.find('\n') == std::string::npos && - rhs.find('\n') == std::string::npos ) - os << lhs << " " << op << " " << rhs; - else - os << lhs << "\n" << op << "\n" << rhs; - } -} -// end catch_decomposer.cpp -// start catch_enforce.cpp - -namespace Catch { -#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) - [[noreturn]] - void throw_exception(std::exception const& e) { - Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" - << "The message was: " << e.what() << '\n'; - std::terminate(); - } -#endif -} // namespace Catch; -// end catch_enforce.cpp -// start catch_errno_guard.cpp - -#include - -namespace Catch { - ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} - ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } -} -// end catch_errno_guard.cpp -// start catch_exception_translator_registry.cpp - -// start catch_exception_translator_registry.h - -#include -#include -#include - -namespace Catch { - - class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { - public: - ~ExceptionTranslatorRegistry(); - virtual void registerTranslator( const IExceptionTranslator* translator ); - virtual std::string translateActiveException() const override; - std::string tryTranslators() const; - - private: - std::vector> m_translators; - }; -} - -// end catch_exception_translator_registry.h -#ifdef __OBJC__ -#import "Foundation/Foundation.h" -#endif - -namespace Catch { - - ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { - } - - void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { - m_translators.push_back( std::unique_ptr( translator ) ); - } - -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - std::string ExceptionTranslatorRegistry::translateActiveException() const { - try { -#ifdef __OBJC__ - // In Objective-C try objective-c exceptions first - @try { - return tryTranslators(); - } - @catch (NSException *exception) { - return Catch::Detail::stringify( [exception description] ); - } -#else - // Compiling a mixed mode project with MSVC means that CLR - // exceptions will be caught in (...) as well. However, these - // do not fill-in std::current_exception and thus lead to crash - // when attempting rethrow. - // /EHa switch also causes structured exceptions to be caught - // here, but they fill-in current_exception properly, so - // at worst the output should be a little weird, instead of - // causing a crash. - if (std::current_exception() == nullptr) { - return "Non C++ exception. Possibly a CLR exception."; - } - return tryTranslators(); -#endif - } - catch( TestFailureException& ) { - std::rethrow_exception(std::current_exception()); - } - catch( std::exception& ex ) { - return ex.what(); - } - catch( std::string& msg ) { - return msg; - } - catch( const char* msg ) { - return msg; - } - catch(...) { - return "Unknown exception"; - } - } - - std::string ExceptionTranslatorRegistry::tryTranslators() const { - if (m_translators.empty()) { - std::rethrow_exception(std::current_exception()); - } else { - return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end()); - } - } - -#else // ^^ Exceptions are enabled // Exceptions are disabled vv - std::string ExceptionTranslatorRegistry::translateActiveException() const { - CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); - } - - std::string ExceptionTranslatorRegistry::tryTranslators() const { - CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); - } -#endif - -} -// end catch_exception_translator_registry.cpp -// start catch_fatal_condition.cpp - -#if defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS ) - -namespace { - // Report the error condition - void reportFatal( char const * const message ) { - Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); - } -} - -#endif // signals/SEH handling - -#if defined( CATCH_CONFIG_WINDOWS_SEH ) - -namespace Catch { - struct SignalDefs { DWORD id; const char* name; }; - - // There is no 1-1 mapping between signals and windows exceptions. - // Windows can easily distinguish between SO and SigSegV, - // but SigInt, SigTerm, etc are handled differently. - static SignalDefs signalDefs[] = { - { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, - { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, - { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, - { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" }, - }; - - LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { - for (auto const& def : signalDefs) { - if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) { - reportFatal(def.name); - } - } - // If its not an exception we care about, pass it along. - // This stops us from eating debugger breaks etc. - return EXCEPTION_CONTINUE_SEARCH; - } - - FatalConditionHandler::FatalConditionHandler() { - isSet = true; - // 32k seems enough for Catch to handle stack overflow, - // but the value was found experimentally, so there is no strong guarantee - guaranteeSize = 32 * 1024; - exceptionHandlerHandle = nullptr; - // Register as first handler in current chain - exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); - // Pass in guarantee size to be filled - SetThreadStackGuarantee(&guaranteeSize); - } - - void FatalConditionHandler::reset() { - if (isSet) { - RemoveVectoredExceptionHandler(exceptionHandlerHandle); - SetThreadStackGuarantee(&guaranteeSize); - exceptionHandlerHandle = nullptr; - isSet = false; - } - } - - FatalConditionHandler::~FatalConditionHandler() { - reset(); - } - -bool FatalConditionHandler::isSet = false; -ULONG FatalConditionHandler::guaranteeSize = 0; -PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; - -} // namespace Catch - -#elif defined( CATCH_CONFIG_POSIX_SIGNALS ) - -namespace Catch { - - struct SignalDefs { - int id; - const char* name; - }; - - // 32kb for the alternate stack seems to be sufficient. However, this value - // is experimentally determined, so that's not guaranteed. - constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; - - static SignalDefs signalDefs[] = { - { SIGINT, "SIGINT - Terminal interrupt signal" }, - { SIGILL, "SIGILL - Illegal instruction signal" }, - { SIGFPE, "SIGFPE - Floating point error signal" }, - { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, - { SIGTERM, "SIGTERM - Termination request signal" }, - { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } - }; - - void FatalConditionHandler::handleSignal( int sig ) { - char const * name = ""; - for (auto const& def : signalDefs) { - if (sig == def.id) { - name = def.name; - break; - } - } - reset(); - reportFatal(name); - raise( sig ); - } - - FatalConditionHandler::FatalConditionHandler() { - isSet = true; - stack_t sigStack; - sigStack.ss_sp = altStackMem; - sigStack.ss_size = sigStackSize; - sigStack.ss_flags = 0; - sigaltstack(&sigStack, &oldSigStack); - struct sigaction sa = { }; - - sa.sa_handler = handleSignal; - sa.sa_flags = SA_ONSTACK; - for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { - sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); - } - } - - FatalConditionHandler::~FatalConditionHandler() { - reset(); - } - - void FatalConditionHandler::reset() { - if( isSet ) { - // Set signals back to previous values -- hopefully nobody overwrote them in the meantime - for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { - sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); - } - // Return the old stack - sigaltstack(&oldSigStack, nullptr); - isSet = false; - } - } - - bool FatalConditionHandler::isSet = false; - struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; - stack_t FatalConditionHandler::oldSigStack = {}; - char FatalConditionHandler::altStackMem[sigStackSize] = {}; - -} // namespace Catch - -#else - -namespace Catch { - void FatalConditionHandler::reset() {} -} - -#endif // signals/SEH handling - -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#endif -// end catch_fatal_condition.cpp -// start catch_generators.cpp - -// start catch_random_number_generator.h - -#include -#include - -namespace Catch { - - struct IConfig; - - std::mt19937& rng(); - void seedRng( IConfig const& config ); - unsigned int rngSeed(); - -} - -// end catch_random_number_generator.h -#include -#include - -namespace Catch { - -IGeneratorTracker::~IGeneratorTracker() {} - -const char* GeneratorException::what() const noexcept { - return m_msg; -} - -namespace Generators { - - GeneratorUntypedBase::~GeneratorUntypedBase() {} - - auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { - return getResultCapture().acquireGeneratorTracker( lineInfo ); - } - -} // namespace Generators -} // namespace Catch -// end catch_generators.cpp -// start catch_interfaces_capture.cpp - -namespace Catch { - IResultCapture::~IResultCapture() = default; -} -// end catch_interfaces_capture.cpp -// start catch_interfaces_config.cpp - -namespace Catch { - IConfig::~IConfig() = default; -} -// end catch_interfaces_config.cpp -// start catch_interfaces_exception.cpp - -namespace Catch { - IExceptionTranslator::~IExceptionTranslator() = default; - IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; -} -// end catch_interfaces_exception.cpp -// start catch_interfaces_registry_hub.cpp - -namespace Catch { - IRegistryHub::~IRegistryHub() = default; - IMutableRegistryHub::~IMutableRegistryHub() = default; -} -// end catch_interfaces_registry_hub.cpp -// start catch_interfaces_reporter.cpp - -// start catch_reporter_listening.h - -namespace Catch { - - class ListeningReporter : public IStreamingReporter { - using Reporters = std::vector; - Reporters m_listeners; - IStreamingReporterPtr m_reporter = nullptr; - ReporterPreferences m_preferences; - - public: - ListeningReporter(); - - void addListener( IStreamingReporterPtr&& listener ); - void addReporter( IStreamingReporterPtr&& reporter ); - - public: // IStreamingReporter - - ReporterPreferences getPreferences() const override; - - void noMatchingTestCases( std::string const& spec ) override; - - static std::set getSupportedVerbosities(); - - void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; - void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override; - - void testRunStarting( TestRunInfo const& testRunInfo ) override; - void testGroupStarting( GroupInfo const& groupInfo ) override; - void testCaseStarting( TestCaseInfo const& testInfo ) override; - void sectionStarting( SectionInfo const& sectionInfo ) override; - void assertionStarting( AssertionInfo const& assertionInfo ) override; - - // The return value indicates if the messages buffer should be cleared: - bool assertionEnded( AssertionStats const& assertionStats ) override; - void sectionEnded( SectionStats const& sectionStats ) override; - void testCaseEnded( TestCaseStats const& testCaseStats ) override; - void testGroupEnded( TestGroupStats const& testGroupStats ) override; - void testRunEnded( TestRunStats const& testRunStats ) override; - - void skipTest( TestCaseInfo const& testInfo ) override; - bool isMulti() const override; - - }; - -} // end namespace Catch - -// end catch_reporter_listening.h -namespace Catch { - - ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig ) - : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} - - ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ) - : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} - - std::ostream& ReporterConfig::stream() const { return *m_stream; } - IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; } - - TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} - - GroupInfo::GroupInfo( std::string const& _name, - std::size_t _groupIndex, - std::size_t _groupsCount ) - : name( _name ), - groupIndex( _groupIndex ), - groupsCounts( _groupsCount ) - {} - - AssertionStats::AssertionStats( AssertionResult const& _assertionResult, - std::vector const& _infoMessages, - Totals const& _totals ) - : assertionResult( _assertionResult ), - infoMessages( _infoMessages ), - totals( _totals ) - { - assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; - - if( assertionResult.hasMessage() ) { - // Copy message into messages list. - // !TBD This should have been done earlier, somewhere - MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); - builder << assertionResult.getMessage(); - builder.m_info.message = builder.m_stream.str(); - - infoMessages.push_back( builder.m_info ); - } - } - - AssertionStats::~AssertionStats() = default; - - SectionStats::SectionStats( SectionInfo const& _sectionInfo, - Counts const& _assertions, - double _durationInSeconds, - bool _missingAssertions ) - : sectionInfo( _sectionInfo ), - assertions( _assertions ), - durationInSeconds( _durationInSeconds ), - missingAssertions( _missingAssertions ) - {} - - SectionStats::~SectionStats() = default; - - TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, - Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, - bool _aborting ) - : testInfo( _testInfo ), - totals( _totals ), - stdOut( _stdOut ), - stdErr( _stdErr ), - aborting( _aborting ) - {} - - TestCaseStats::~TestCaseStats() = default; - - TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, - Totals const& _totals, - bool _aborting ) - : groupInfo( _groupInfo ), - totals( _totals ), - aborting( _aborting ) - {} - - TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo ) - : groupInfo( _groupInfo ), - aborting( false ) - {} - - TestGroupStats::~TestGroupStats() = default; - - TestRunStats::TestRunStats( TestRunInfo const& _runInfo, - Totals const& _totals, - bool _aborting ) - : runInfo( _runInfo ), - totals( _totals ), - aborting( _aborting ) - {} - - TestRunStats::~TestRunStats() = default; - - void IStreamingReporter::fatalErrorEncountered( StringRef ) {} - bool IStreamingReporter::isMulti() const { return false; } - - IReporterFactory::~IReporterFactory() = default; - IReporterRegistry::~IReporterRegistry() = default; - -} // end namespace Catch -// end catch_interfaces_reporter.cpp -// start catch_interfaces_runner.cpp - -namespace Catch { - IRunner::~IRunner() = default; -} -// end catch_interfaces_runner.cpp -// start catch_interfaces_testcase.cpp - -namespace Catch { - ITestInvoker::~ITestInvoker() = default; - ITestCaseRegistry::~ITestCaseRegistry() = default; -} -// end catch_interfaces_testcase.cpp -// start catch_leak_detector.cpp - -#ifdef CATCH_CONFIG_WINDOWS_CRTDBG -#include - -namespace Catch { - - LeakDetector::LeakDetector() { - int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - flag |= _CRTDBG_LEAK_CHECK_DF; - flag |= _CRTDBG_ALLOC_MEM_DF; - _CrtSetDbgFlag(flag); - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - // Change this to leaking allocation's number to break there - _CrtSetBreakAlloc(-1); - } -} - -#else - - Catch::LeakDetector::LeakDetector() {} - -#endif - -Catch::LeakDetector::~LeakDetector() { - Catch::cleanUp(); -} -// end catch_leak_detector.cpp -// start catch_list.cpp - -// start catch_list.h - -#include - -namespace Catch { - - std::size_t listTests( Config const& config ); - - std::size_t listTestsNamesOnly( Config const& config ); - - struct TagInfo { - void add( std::string const& spelling ); - std::string all() const; - - std::set spellings; - std::size_t count = 0; - }; - - std::size_t listTags( Config const& config ); - - std::size_t listReporters(); - - Option list( std::shared_ptr const& config ); - -} // end namespace Catch - -// end catch_list.h -// start catch_text.h - -namespace Catch { - using namespace clara::TextFlow; -} - -// end catch_text.h -#include -#include -#include - -namespace Catch { - - std::size_t listTests( Config const& config ) { - TestSpec testSpec = config.testSpec(); - if( config.hasTestFilters() ) - Catch::cout() << "Matching test cases:\n"; - else { - Catch::cout() << "All available test cases:\n"; - } - - auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( auto const& testCaseInfo : matchedTestCases ) { - Colour::Code colour = testCaseInfo.isHidden() - ? Colour::SecondaryText - : Colour::None; - Colour colourGuard( colour ); - - Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; - if( config.verbosity() >= Verbosity::High ) { - Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; - std::string description = testCaseInfo.description; - if( description.empty() ) - description = "(NO DESCRIPTION)"; - Catch::cout() << Column( description ).indent(4) << std::endl; - } - if( !testCaseInfo.tags.empty() ) - Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; - } - - if( !config.hasTestFilters() ) - Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; - else - Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; - return matchedTestCases.size(); - } - - std::size_t listTestsNamesOnly( Config const& config ) { - TestSpec testSpec = config.testSpec(); - std::size_t matchedTests = 0; - std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( auto const& testCaseInfo : matchedTestCases ) { - matchedTests++; - if( startsWith( testCaseInfo.name, '#' ) ) - Catch::cout() << '"' << testCaseInfo.name << '"'; - else - Catch::cout() << testCaseInfo.name; - if ( config.verbosity() >= Verbosity::High ) - Catch::cout() << "\t@" << testCaseInfo.lineInfo; - Catch::cout() << std::endl; - } - return matchedTests; - } - - void TagInfo::add( std::string const& spelling ) { - ++count; - spellings.insert( spelling ); - } - - std::string TagInfo::all() const { - std::string out; - for( auto const& spelling : spellings ) - out += "[" + spelling + "]"; - return out; - } - - std::size_t listTags( Config const& config ) { - TestSpec testSpec = config.testSpec(); - if( config.hasTestFilters() ) - Catch::cout() << "Tags for matching test cases:\n"; - else { - Catch::cout() << "All available tags:\n"; - } - - std::map tagCounts; - - std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( auto const& testCase : matchedTestCases ) { - for( auto const& tagName : testCase.getTestCaseInfo().tags ) { - std::string lcaseTagName = toLower( tagName ); - auto countIt = tagCounts.find( lcaseTagName ); - if( countIt == tagCounts.end() ) - countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; - countIt->second.add( tagName ); - } - } - - for( auto const& tagCount : tagCounts ) { - ReusableStringStream rss; - rss << " " << std::setw(2) << tagCount.second.count << " "; - auto str = rss.str(); - auto wrapper = Column( tagCount.second.all() ) - .initialIndent( 0 ) - .indent( str.size() ) - .width( CATCH_CONFIG_CONSOLE_WIDTH-10 ); - Catch::cout() << str << wrapper << '\n'; - } - Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; - return tagCounts.size(); - } - - std::size_t listReporters() { - Catch::cout() << "Available reporters:\n"; - IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); - std::size_t maxNameLen = 0; - for( auto const& factoryKvp : factories ) - maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() ); - - for( auto const& factoryKvp : factories ) { - Catch::cout() - << Column( factoryKvp.first + ":" ) - .indent(2) - .width( 5+maxNameLen ) - + Column( factoryKvp.second->getDescription() ) - .initialIndent(0) - .indent(2) - .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) - << "\n"; - } - Catch::cout() << std::endl; - return factories.size(); - } - - Option list( std::shared_ptr const& config ) { - Option listedCount; - getCurrentMutableContext().setConfig( config ); - if( config->listTests() ) - listedCount = listedCount.valueOr(0) + listTests( *config ); - if( config->listTestNamesOnly() ) - listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config ); - if( config->listTags() ) - listedCount = listedCount.valueOr(0) + listTags( *config ); - if( config->listReporters() ) - listedCount = listedCount.valueOr(0) + listReporters(); - return listedCount; - } - -} // end namespace Catch -// end catch_list.cpp -// start catch_matchers.cpp - -namespace Catch { -namespace Matchers { - namespace Impl { - - std::string MatcherUntypedBase::toString() const { - if( m_cachedToString.empty() ) - m_cachedToString = describe(); - return m_cachedToString; - } - - MatcherUntypedBase::~MatcherUntypedBase() = default; - - } // namespace Impl -} // namespace Matchers - -using namespace Matchers; -using Matchers::Impl::MatcherBase; - -} // namespace Catch -// end catch_matchers.cpp -// start catch_matchers_floating.cpp - -// start catch_polyfills.hpp - -namespace Catch { - bool isnan(float f); - bool isnan(double d); -} - -// end catch_polyfills.hpp -// start catch_to_string.hpp - -#include - -namespace Catch { - template - std::string to_string(T const& t) { -#if defined(CATCH_CONFIG_CPP11_TO_STRING) - return std::to_string(t); -#else - ReusableStringStream rss; - rss << t; - return rss.str(); -#endif - } -} // end namespace Catch - -// end catch_to_string.hpp -#include -#include -#include - -namespace Catch { -namespace Matchers { -namespace Floating { -enum class FloatingPointKind : uint8_t { - Float, - Double -}; -} -} -} - -namespace { - -template -struct Converter; - -template <> -struct Converter { - static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); - Converter(float f) { - std::memcpy(&i, &f, sizeof(f)); - } - int32_t i; -}; - -template <> -struct Converter { - static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); - Converter(double d) { - std::memcpy(&i, &d, sizeof(d)); - } - int64_t i; -}; - -template -auto convert(T t) -> Converter { - return Converter(t); -} - -template -bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) { - // Comparison with NaN should always be false. - // This way we can rule it out before getting into the ugly details - if (Catch::isnan(lhs) || Catch::isnan(rhs)) { - return false; - } - - auto lc = convert(lhs); - auto rc = convert(rhs); - - if ((lc.i < 0) != (rc.i < 0)) { - // Potentially we can have +0 and -0 - return lhs == rhs; - } - - auto ulpDiff = std::abs(lc.i - rc.i); - return ulpDiff <= maxUlpDiff; -} - -} - -namespace Catch { -namespace Matchers { -namespace Floating { - WithinAbsMatcher::WithinAbsMatcher(double target, double margin) - :m_target{ target }, m_margin{ margin } { - CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' - << " Margin has to be non-negative."); - } - - // Performs equivalent check of std::fabs(lhs - rhs) <= margin - // But without the subtraction to allow for INFINITY in comparison - bool WithinAbsMatcher::match(double const& matchee) const { - return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee); - } - - std::string WithinAbsMatcher::describe() const { - return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); - } - - WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType) - :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { - CATCH_ENFORCE(ulps >= 0, "Invalid ULP setting: " << ulps << '.' - << " ULPs have to be non-negative."); - } - -#if defined(__clang__) -#pragma clang diagnostic push -// Clang <3.5 reports on the default branch in the switch below -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - - bool WithinUlpsMatcher::match(double const& matchee) const { - switch (m_type) { - case FloatingPointKind::Float: - return almostEqualUlps(static_cast(matchee), static_cast(m_target), m_ulps); - case FloatingPointKind::Double: - return almostEqualUlps(matchee, m_target, m_ulps); - default: - CATCH_INTERNAL_ERROR( "Unknown FloatingPointKind value" ); - } - } - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - - std::string WithinUlpsMatcher::describe() const { - return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : ""); - } - -}// namespace Floating - -Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) { - return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double); -} - -Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) { - return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float); -} - -Floating::WithinAbsMatcher WithinAbs(double target, double margin) { - return Floating::WithinAbsMatcher(target, margin); -} - -} // namespace Matchers -} // namespace Catch - -// end catch_matchers_floating.cpp -// start catch_matchers_generic.cpp - -std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) { - if (desc.empty()) { - return "matches undescribed predicate"; - } else { - return "matches predicate: \"" + desc + '"'; - } -} -// end catch_matchers_generic.cpp -// start catch_matchers_string.cpp - -#include - -namespace Catch { -namespace Matchers { - - namespace StdString { - - CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) - : m_caseSensitivity( caseSensitivity ), - m_str( adjustString( str ) ) - {} - std::string CasedString::adjustString( std::string const& str ) const { - return m_caseSensitivity == CaseSensitive::No - ? toLower( str ) - : str; - } - std::string CasedString::caseSensitivitySuffix() const { - return m_caseSensitivity == CaseSensitive::No - ? " (case insensitive)" - : std::string(); - } - - StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) - : m_comparator( comparator ), - m_operation( operation ) { - } - - std::string StringMatcherBase::describe() const { - std::string description; - description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + - m_comparator.caseSensitivitySuffix().size()); - description += m_operation; - description += ": \""; - description += m_comparator.m_str; - description += "\""; - description += m_comparator.caseSensitivitySuffix(); - return description; - } - - EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} - - bool EqualsMatcher::match( std::string const& source ) const { - return m_comparator.adjustString( source ) == m_comparator.m_str; - } - - ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} - - bool ContainsMatcher::match( std::string const& source ) const { - return contains( m_comparator.adjustString( source ), m_comparator.m_str ); - } - - StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} - - bool StartsWithMatcher::match( std::string const& source ) const { - return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); - } - - EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} - - bool EndsWithMatcher::match( std::string const& source ) const { - return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); - } - - RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} - - bool RegexMatcher::match(std::string const& matchee) const { - auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway - if (m_caseSensitivity == CaseSensitive::Choice::No) { - flags |= std::regex::icase; - } - auto reg = std::regex(m_regex, flags); - return std::regex_match(matchee, reg); - } - - std::string RegexMatcher::describe() const { - return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively"); - } - - } // namespace StdString - - StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); - } - StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); - } - StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); - } - StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); - } - - StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) { - return StdString::RegexMatcher(regex, caseSensitivity); - } - -} // namespace Matchers -} // namespace Catch -// end catch_matchers_string.cpp -// start catch_message.cpp - -// start catch_uncaught_exceptions.h - -namespace Catch { - bool uncaught_exceptions(); -} // end namespace Catch - -// end catch_uncaught_exceptions.h -#include -#include - -namespace Catch { - - MessageInfo::MessageInfo( StringRef const& _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ) - : macroName( _macroName ), - lineInfo( _lineInfo ), - type( _type ), - sequence( ++globalCount ) - {} - - bool MessageInfo::operator==( MessageInfo const& other ) const { - return sequence == other.sequence; - } - - bool MessageInfo::operator<( MessageInfo const& other ) const { - return sequence < other.sequence; - } - - // This may need protecting if threading support is added - unsigned int MessageInfo::globalCount = 0; - - //////////////////////////////////////////////////////////////////////////// - - Catch::MessageBuilder::MessageBuilder( StringRef const& macroName, - SourceLineInfo const& lineInfo, - ResultWas::OfType type ) - :m_info(macroName, lineInfo, type) {} - - //////////////////////////////////////////////////////////////////////////// - - ScopedMessage::ScopedMessage( MessageBuilder const& builder ) - : m_info( builder.m_info ), m_moved() - { - m_info.message = builder.m_stream.str(); - getResultCapture().pushScopedMessage( m_info ); - } - - ScopedMessage::ScopedMessage( ScopedMessage&& old ) - : m_info( old.m_info ), m_moved() - { - old.m_moved = true; - } - - ScopedMessage::~ScopedMessage() { - if ( !uncaught_exceptions() && !m_moved ){ - getResultCapture().popScopedMessage(m_info); - } - } - - Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { - auto trimmed = [&] (size_t start, size_t end) { - while (names[start] == ',' || isspace(names[start])) { - ++start; - } - while (names[end] == ',' || isspace(names[end])) { - --end; - } - return names.substr(start, end - start + 1); - }; - - size_t start = 0; - std::stack openings; - for (size_t pos = 0; pos < names.size(); ++pos) { - char c = names[pos]; - switch (c) { - case '[': - case '{': - case '(': - // It is basically impossible to disambiguate between - // comparison and start of template args in this context -// case '<': - openings.push(c); - break; - case ']': - case '}': - case ')': -// case '>': - openings.pop(); - break; - case ',': - if (start != pos && openings.size() == 0) { - m_messages.emplace_back(macroName, lineInfo, resultType); - m_messages.back().message = trimmed(start, pos); - m_messages.back().message += " := "; - start = pos; - } - } - } - assert(openings.size() == 0 && "Mismatched openings"); - m_messages.emplace_back(macroName, lineInfo, resultType); - m_messages.back().message = trimmed(start, names.size() - 1); - m_messages.back().message += " := "; - } - Capturer::~Capturer() { - if ( !uncaught_exceptions() ){ - assert( m_captured == m_messages.size() ); - for( size_t i = 0; i < m_captured; ++i ) - m_resultCapture.popScopedMessage( m_messages[i] ); - } - } - - void Capturer::captureValue( size_t index, std::string const& value ) { - assert( index < m_messages.size() ); - m_messages[index].message += value; - m_resultCapture.pushScopedMessage( m_messages[index] ); - m_captured++; - } - -} // end namespace Catch -// end catch_message.cpp -// start catch_output_redirect.cpp - -// start catch_output_redirect.h -#ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H -#define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H - -#include -#include -#include - -namespace Catch { - - class RedirectedStream { - std::ostream& m_originalStream; - std::ostream& m_redirectionStream; - std::streambuf* m_prevBuf; - - public: - RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); - ~RedirectedStream(); - }; - - class RedirectedStdOut { - ReusableStringStream m_rss; - RedirectedStream m_cout; - public: - RedirectedStdOut(); - auto str() const -> std::string; - }; - - // StdErr has two constituent streams in C++, std::cerr and std::clog - // This means that we need to redirect 2 streams into 1 to keep proper - // order of writes - class RedirectedStdErr { - ReusableStringStream m_rss; - RedirectedStream m_cerr; - RedirectedStream m_clog; - public: - RedirectedStdErr(); - auto str() const -> std::string; - }; - - class RedirectedStreams { - public: - RedirectedStreams(RedirectedStreams const&) = delete; - RedirectedStreams& operator=(RedirectedStreams const&) = delete; - RedirectedStreams(RedirectedStreams&&) = delete; - RedirectedStreams& operator=(RedirectedStreams&&) = delete; - - RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr); - ~RedirectedStreams(); - private: - std::string& m_redirectedCout; - std::string& m_redirectedCerr; - RedirectedStdOut m_redirectedStdOut; - RedirectedStdErr m_redirectedStdErr; - }; - -#if defined(CATCH_CONFIG_NEW_CAPTURE) - - // Windows's implementation of std::tmpfile is terrible (it tries - // to create a file inside system folder, thus requiring elevated - // privileges for the binary), so we have to use tmpnam(_s) and - // create the file ourselves there. - class TempFile { - public: - TempFile(TempFile const&) = delete; - TempFile& operator=(TempFile const&) = delete; - TempFile(TempFile&&) = delete; - TempFile& operator=(TempFile&&) = delete; - - TempFile(); - ~TempFile(); - - std::FILE* getFile(); - std::string getContents(); - - private: - std::FILE* m_file = nullptr; - #if defined(_MSC_VER) - char m_buffer[L_tmpnam] = { 0 }; - #endif - }; - - class OutputRedirect { - public: - OutputRedirect(OutputRedirect const&) = delete; - OutputRedirect& operator=(OutputRedirect const&) = delete; - OutputRedirect(OutputRedirect&&) = delete; - OutputRedirect& operator=(OutputRedirect&&) = delete; - - OutputRedirect(std::string& stdout_dest, std::string& stderr_dest); - ~OutputRedirect(); - - private: - int m_originalStdout = -1; - int m_originalStderr = -1; - TempFile m_stdoutFile; - TempFile m_stderrFile; - std::string& m_stdoutDest; - std::string& m_stderrDest; - }; - -#endif - -} // end namespace Catch - -#endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H -// end catch_output_redirect.h -#include -#include -#include -#include -#include - -#if defined(CATCH_CONFIG_NEW_CAPTURE) - #if defined(_MSC_VER) - #include //_dup and _dup2 - #define dup _dup - #define dup2 _dup2 - #define fileno _fileno - #else - #include // dup and dup2 - #endif -#endif - -namespace Catch { - - RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ) - : m_originalStream( originalStream ), - m_redirectionStream( redirectionStream ), - m_prevBuf( m_originalStream.rdbuf() ) - { - m_originalStream.rdbuf( m_redirectionStream.rdbuf() ); - } - - RedirectedStream::~RedirectedStream() { - m_originalStream.rdbuf( m_prevBuf ); - } - - RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} - auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } - - RedirectedStdErr::RedirectedStdErr() - : m_cerr( Catch::cerr(), m_rss.get() ), - m_clog( Catch::clog(), m_rss.get() ) - {} - auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } - - RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr) - : m_redirectedCout(redirectedCout), - m_redirectedCerr(redirectedCerr) - {} - - RedirectedStreams::~RedirectedStreams() { - m_redirectedCout += m_redirectedStdOut.str(); - m_redirectedCerr += m_redirectedStdErr.str(); - } - -#if defined(CATCH_CONFIG_NEW_CAPTURE) - -#if defined(_MSC_VER) - TempFile::TempFile() { - if (tmpnam_s(m_buffer)) { - CATCH_RUNTIME_ERROR("Could not get a temp filename"); - } - if (fopen_s(&m_file, m_buffer, "w")) { - char buffer[100]; - if (strerror_s(buffer, errno)) { - CATCH_RUNTIME_ERROR("Could not translate errno to a string"); - } - CATCH_RUNTIME_ERROR("Coul dnot open the temp file: '" << m_buffer << "' because: " << buffer); - } - } -#else - TempFile::TempFile() { - m_file = std::tmpfile(); - if (!m_file) { - CATCH_RUNTIME_ERROR("Could not create a temp file."); - } - } - -#endif - - TempFile::~TempFile() { - // TBD: What to do about errors here? - std::fclose(m_file); - // We manually create the file on Windows only, on Linux - // it will be autodeleted -#if defined(_MSC_VER) - std::remove(m_buffer); -#endif - } - - FILE* TempFile::getFile() { - return m_file; - } - - std::string TempFile::getContents() { - std::stringstream sstr; - char buffer[100] = {}; - std::rewind(m_file); - while (std::fgets(buffer, sizeof(buffer), m_file)) { - sstr << buffer; - } - return sstr.str(); - } - - OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) : - m_originalStdout(dup(1)), - m_originalStderr(dup(2)), - m_stdoutDest(stdout_dest), - m_stderrDest(stderr_dest) { - dup2(fileno(m_stdoutFile.getFile()), 1); - dup2(fileno(m_stderrFile.getFile()), 2); - } - - OutputRedirect::~OutputRedirect() { - Catch::cout() << std::flush; - fflush(stdout); - // Since we support overriding these streams, we flush cerr - // even though std::cerr is unbuffered - Catch::cerr() << std::flush; - Catch::clog() << std::flush; - fflush(stderr); - - dup2(m_originalStdout, 1); - dup2(m_originalStderr, 2); - - m_stdoutDest += m_stdoutFile.getContents(); - m_stderrDest += m_stderrFile.getContents(); - } - -#endif // CATCH_CONFIG_NEW_CAPTURE - -} // namespace Catch - -#if defined(CATCH_CONFIG_NEW_CAPTURE) - #if defined(_MSC_VER) - #undef dup - #undef dup2 - #undef fileno - #endif -#endif -// end catch_output_redirect.cpp -// start catch_polyfills.cpp - -#include - -namespace Catch { - -#if !defined(CATCH_CONFIG_POLYFILL_ISNAN) - bool isnan(float f) { - return std::isnan(f); - } - bool isnan(double d) { - return std::isnan(d); - } -#else - // For now we only use this for embarcadero - bool isnan(float f) { - return std::_isnan(f); - } - bool isnan(double d) { - return std::_isnan(d); - } -#endif - -} // end namespace Catch -// end catch_polyfills.cpp -// start catch_random_number_generator.cpp - -namespace Catch { - - std::mt19937& rng() { - static std::mt19937 s_rng; - return s_rng; - } - - void seedRng( IConfig const& config ) { - if( config.rngSeed() != 0 ) { - std::srand( config.rngSeed() ); - rng().seed( config.rngSeed() ); - } - } - - unsigned int rngSeed() { - return getCurrentContext().getConfig()->rngSeed(); - } -} -// end catch_random_number_generator.cpp -// start catch_registry_hub.cpp - -// start catch_test_case_registry_impl.h - -#include -#include -#include -#include - -namespace Catch { - - class TestCase; - struct IConfig; - - std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - - void enforceNoDuplicateTestCases( std::vector const& functions ); - - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); - - class TestRegistry : public ITestCaseRegistry { - public: - virtual ~TestRegistry() = default; - - virtual void registerTest( TestCase const& testCase ); - - std::vector const& getAllTests() const override; - std::vector const& getAllTestsSorted( IConfig const& config ) const override; - - private: - std::vector m_functions; - mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; - mutable std::vector m_sortedFunctions; - std::size_t m_unnamedCount = 0; - std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised - }; - - /////////////////////////////////////////////////////////////////////////// - - class TestInvokerAsFunction : public ITestInvoker { - void(*m_testAsFunction)(); - public: - TestInvokerAsFunction( void(*testAsFunction)() ) noexcept; - - void invoke() const override; - }; - - std::string extractClassName( StringRef const& classOrQualifiedMethodName ); - - /////////////////////////////////////////////////////////////////////////// - -} // end namespace Catch - -// end catch_test_case_registry_impl.h -// start catch_reporter_registry.h - -#include - -namespace Catch { - - class ReporterRegistry : public IReporterRegistry { - - public: - - ~ReporterRegistry() override; - - IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; - - void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); - void registerListener( IReporterFactoryPtr const& factory ); - - FactoryMap const& getFactories() const override; - Listeners const& getListeners() const override; - - private: - FactoryMap m_factories; - Listeners m_listeners; - }; -} - -// end catch_reporter_registry.h -// start catch_tag_alias_registry.h - -// start catch_tag_alias.h - -#include - -namespace Catch { - - struct TagAlias { - TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); - - std::string tag; - SourceLineInfo lineInfo; - }; - -} // end namespace Catch - -// end catch_tag_alias.h -#include - -namespace Catch { - - class TagAliasRegistry : public ITagAliasRegistry { - public: - ~TagAliasRegistry() override; - TagAlias const* find( std::string const& alias ) const override; - std::string expandAliases( std::string const& unexpandedTestSpec ) const override; - void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); - - private: - std::map m_registry; - }; - -} // end namespace Catch - -// end catch_tag_alias_registry.h -// start catch_startup_exception_registry.h - -#include -#include - -namespace Catch { - - class StartupExceptionRegistry { - public: - void add(std::exception_ptr const& exception) noexcept; - std::vector const& getExceptions() const noexcept; - private: - std::vector m_exceptions; - }; - -} // end namespace Catch - -// end catch_startup_exception_registry.h -// start catch_singletons.hpp - -namespace Catch { - - struct ISingleton { - virtual ~ISingleton(); - }; - - void addSingleton( ISingleton* singleton ); - void cleanupSingletons(); - - template - class Singleton : SingletonImplT, public ISingleton { - - static auto getInternal() -> Singleton* { - static Singleton* s_instance = nullptr; - if( !s_instance ) { - s_instance = new Singleton; - addSingleton( s_instance ); - } - return s_instance; - } - - public: - static auto get() -> InterfaceT const& { - return *getInternal(); - } - static auto getMutable() -> MutableInterfaceT& { - return *getInternal(); - } - }; - -} // namespace Catch - -// end catch_singletons.hpp -namespace Catch { - - namespace { - - class RegistryHub : public IRegistryHub, public IMutableRegistryHub, - private NonCopyable { - - public: // IRegistryHub - RegistryHub() = default; - IReporterRegistry const& getReporterRegistry() const override { - return m_reporterRegistry; - } - ITestCaseRegistry const& getTestCaseRegistry() const override { - return m_testCaseRegistry; - } - IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override { - return m_exceptionTranslatorRegistry; - } - ITagAliasRegistry const& getTagAliasRegistry() const override { - return m_tagAliasRegistry; - } - StartupExceptionRegistry const& getStartupExceptionRegistry() const override { - return m_exceptionRegistry; - } - - public: // IMutableRegistryHub - void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { - m_reporterRegistry.registerReporter( name, factory ); - } - void registerListener( IReporterFactoryPtr const& factory ) override { - m_reporterRegistry.registerListener( factory ); - } - void registerTest( TestCase const& testInfo ) override { - m_testCaseRegistry.registerTest( testInfo ); - } - void registerTranslator( const IExceptionTranslator* translator ) override { - m_exceptionTranslatorRegistry.registerTranslator( translator ); - } - void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { - m_tagAliasRegistry.add( alias, tag, lineInfo ); - } - void registerStartupException() noexcept override { - m_exceptionRegistry.add(std::current_exception()); - } - - private: - TestRegistry m_testCaseRegistry; - ReporterRegistry m_reporterRegistry; - ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; - TagAliasRegistry m_tagAliasRegistry; - StartupExceptionRegistry m_exceptionRegistry; - }; - } - - using RegistryHubSingleton = Singleton; - - IRegistryHub const& getRegistryHub() { - return RegistryHubSingleton::get(); - } - IMutableRegistryHub& getMutableRegistryHub() { - return RegistryHubSingleton::getMutable(); - } - void cleanUp() { - cleanupSingletons(); - cleanUpContext(); - } - std::string translateActiveException() { - return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); - } - -} // end namespace Catch -// end catch_registry_hub.cpp -// start catch_reporter_registry.cpp - -namespace Catch { - - ReporterRegistry::~ReporterRegistry() = default; - - IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { - auto it = m_factories.find( name ); - if( it == m_factories.end() ) - return nullptr; - return it->second->create( ReporterConfig( config ) ); - } - - void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { - m_factories.emplace(name, factory); - } - void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { - m_listeners.push_back( factory ); - } - - IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { - return m_factories; - } - IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { - return m_listeners; - } - -} -// end catch_reporter_registry.cpp -// start catch_result_type.cpp - -namespace Catch { - - bool isOk( ResultWas::OfType resultType ) { - return ( resultType & ResultWas::FailureBit ) == 0; - } - bool isJustInfo( int flags ) { - return flags == ResultWas::Info; - } - - ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { - return static_cast( static_cast( lhs ) | static_cast( rhs ) ); - } - - bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } - bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } - -} // end namespace Catch -// end catch_result_type.cpp -// start catch_run_context.cpp - -#include -#include -#include - -namespace Catch { - - namespace Generators { - struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { - GeneratorBasePtr m_generator; - - GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ) - {} - ~GeneratorTracker(); - - static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { - std::shared_ptr tracker; - - ITracker& currentTracker = ctx.currentTracker(); - if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { - assert( childTracker ); - assert( childTracker->isGeneratorTracker() ); - tracker = std::static_pointer_cast( childTracker ); - } - else { - tracker = std::make_shared( nameAndLocation, ctx, ¤tTracker ); - currentTracker.addChild( tracker ); - } - - if( !ctx.completedCycle() && !tracker->isComplete() ) { - tracker->open(); - } - - return *tracker; - } - - // TrackerBase interface - bool isGeneratorTracker() const override { return true; } - auto hasGenerator() const -> bool override { - return !!m_generator; - } - void close() override { - TrackerBase::close(); - // Generator interface only finds out if it has another item on atual move - if (m_runState == CompletedSuccessfully && m_generator->next()) { - m_children.clear(); - m_runState = Executing; - } - } - - // IGeneratorTracker interface - auto getGenerator() const -> GeneratorBasePtr const& override { - return m_generator; - } - void setGenerator( GeneratorBasePtr&& generator ) override { - m_generator = std::move( generator ); - } - }; - GeneratorTracker::~GeneratorTracker() {} - } - - RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) - : m_runInfo(_config->name()), - m_context(getCurrentMutableContext()), - m_config(_config), - m_reporter(std::move(reporter)), - m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, - m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) - { - m_context.setRunner(this); - m_context.setConfig(m_config); - m_context.setResultCapture(this); - m_reporter->testRunStarting(m_runInfo); - } - - RunContext::~RunContext() { - m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); - } - - void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) { - m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount)); - } - - void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) { - m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting())); - } - - Totals RunContext::runTest(TestCase const& testCase) { - Totals prevTotals = m_totals; - - std::string redirectedCout; - std::string redirectedCerr; - - auto const& testInfo = testCase.getTestCaseInfo(); - - m_reporter->testCaseStarting(testInfo); - - m_activeTestCase = &testCase; - - ITracker& rootTracker = m_trackerContext.startRun(); - assert(rootTracker.isSectionTracker()); - static_cast(rootTracker).addInitialFilters(m_config->getSectionsToRun()); - do { - m_trackerContext.startCycle(); - m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); - runCurrentTest(redirectedCout, redirectedCerr); - } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); - - Totals deltaTotals = m_totals.delta(prevTotals); - if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { - deltaTotals.assertions.failed++; - deltaTotals.testCases.passed--; - deltaTotals.testCases.failed++; - } - m_totals.testCases += deltaTotals.testCases; - m_reporter->testCaseEnded(TestCaseStats(testInfo, - deltaTotals, - redirectedCout, - redirectedCerr, - aborting())); - - m_activeTestCase = nullptr; - m_testCaseTracker = nullptr; - - return deltaTotals; - } - - IConfigPtr RunContext::config() const { - return m_config; - } - - IStreamingReporter& RunContext::reporter() const { - return *m_reporter; - } - - void RunContext::assertionEnded(AssertionResult const & result) { - if (result.getResultType() == ResultWas::Ok) { - m_totals.assertions.passed++; - m_lastAssertionPassed = true; - } else if (!result.isOk()) { - m_lastAssertionPassed = false; - if( m_activeTestCase->getTestCaseInfo().okToFail() ) - m_totals.assertions.failedButOk++; - else - m_totals.assertions.failed++; - } - else { - m_lastAssertionPassed = true; - } - - // We have no use for the return value (whether messages should be cleared), because messages were made scoped - // and should be let to clear themselves out. - static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); - - if (result.getResultType() != ResultWas::Warning) - m_messageScopes.clear(); - - // Reset working state - resetAssertionInfo(); - m_lastResult = result; - } - void RunContext::resetAssertionInfo() { - m_lastAssertionInfo.macroName = StringRef(); - m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; - } - - bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { - ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); - if (!sectionTracker.isOpen()) - return false; - m_activeSections.push_back(§ionTracker); - - m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; - - m_reporter->sectionStarting(sectionInfo); - - assertions = m_totals.assertions; - - return true; - } - auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { - using namespace Generators; - GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) ); - assert( tracker.isOpen() ); - m_lastAssertionInfo.lineInfo = lineInfo; - return tracker; - } - - bool RunContext::testForMissingAssertions(Counts& assertions) { - if (assertions.total() != 0) - return false; - if (!m_config->warnAboutMissingAssertions()) - return false; - if (m_trackerContext.currentTracker().hasChildren()) - return false; - m_totals.assertions.failed++; - assertions.failed++; - return true; - } - - void RunContext::sectionEnded(SectionEndInfo const & endInfo) { - Counts assertions = m_totals.assertions - endInfo.prevAssertions; - bool missingAssertions = testForMissingAssertions(assertions); - - if (!m_activeSections.empty()) { - m_activeSections.back()->close(); - m_activeSections.pop_back(); - } - - m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); - m_messages.clear(); - m_messageScopes.clear(); - } - - void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { - if (m_unfinishedSections.empty()) - m_activeSections.back()->fail(); - else - m_activeSections.back()->close(); - m_activeSections.pop_back(); - - m_unfinishedSections.push_back(endInfo); - } - void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { - m_reporter->benchmarkStarting( info ); - } - void RunContext::benchmarkEnded( BenchmarkStats const& stats ) { - m_reporter->benchmarkEnded( stats ); - } - - void RunContext::pushScopedMessage(MessageInfo const & message) { - m_messages.push_back(message); - } - - void RunContext::popScopedMessage(MessageInfo const & message) { - m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); - } - - void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { - m_messageScopes.emplace_back( builder ); - } - - std::string RunContext::getCurrentTestName() const { - return m_activeTestCase - ? m_activeTestCase->getTestCaseInfo().name - : std::string(); - } - - const AssertionResult * RunContext::getLastResult() const { - return &(*m_lastResult); - } - - void RunContext::exceptionEarlyReported() { - m_shouldReportUnexpected = false; - } - - void RunContext::handleFatalErrorCondition( StringRef message ) { - // First notify reporter that bad things happened - m_reporter->fatalErrorEncountered(message); - - // Don't rebuild the result -- the stringification itself can cause more fatal errors - // Instead, fake a result data. - AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); - tempResult.message = message; - AssertionResult result(m_lastAssertionInfo, tempResult); - - assertionEnded(result); - - handleUnfinishedSections(); - - // Recreate section for test case (as we will lose the one that was in scope) - auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); - SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); - - Counts assertions; - assertions.failed = 1; - SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); - m_reporter->sectionEnded(testCaseSectionStats); - - auto const& testInfo = m_activeTestCase->getTestCaseInfo(); - - Totals deltaTotals; - deltaTotals.testCases.failed = 1; - deltaTotals.assertions.failed = 1; - m_reporter->testCaseEnded(TestCaseStats(testInfo, - deltaTotals, - std::string(), - std::string(), - false)); - m_totals.testCases.failed++; - testGroupEnded(std::string(), m_totals, 1, 1); - m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); - } - - bool RunContext::lastAssertionPassed() { - return m_lastAssertionPassed; - } - - void RunContext::assertionPassed() { - m_lastAssertionPassed = true; - ++m_totals.assertions.passed; - resetAssertionInfo(); - m_messageScopes.clear(); - } - - bool RunContext::aborting() const { - return m_totals.assertions.failed >= static_cast(m_config->abortAfter()); - } - - void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { - auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); - SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); - m_reporter->sectionStarting(testCaseSection); - Counts prevAssertions = m_totals.assertions; - double duration = 0; - m_shouldReportUnexpected = true; - m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; - - seedRng(*m_config); - - Timer timer; - CATCH_TRY { - if (m_reporter->getPreferences().shouldRedirectStdOut) { -#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) - RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr); - - timer.start(); - invokeActiveTestCase(); -#else - OutputRedirect r(redirectedCout, redirectedCerr); - timer.start(); - invokeActiveTestCase(); -#endif - } else { - timer.start(); - invokeActiveTestCase(); - } - duration = timer.getElapsedSeconds(); - } CATCH_CATCH_ANON (TestFailureException&) { - // This just means the test was aborted due to failure - } CATCH_CATCH_ALL { - // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions - // are reported without translation at the point of origin. - if( m_shouldReportUnexpected ) { - AssertionReaction dummyReaction; - handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); - } - } - Counts assertions = m_totals.assertions - prevAssertions; - bool missingAssertions = testForMissingAssertions(assertions); - - m_testCaseTracker->close(); - handleUnfinishedSections(); - m_messages.clear(); - m_messageScopes.clear(); - - SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); - m_reporter->sectionEnded(testCaseSectionStats); - } - - void RunContext::invokeActiveTestCase() { - FatalConditionHandler fatalConditionHandler; // Handle signals - m_activeTestCase->invoke(); - fatalConditionHandler.reset(); - } - - void RunContext::handleUnfinishedSections() { - // If sections ended prematurely due to an exception we stored their - // infos here so we can tear them down outside the unwind process. - for (auto it = m_unfinishedSections.rbegin(), - itEnd = m_unfinishedSections.rend(); - it != itEnd; - ++it) - sectionEnded(*it); - m_unfinishedSections.clear(); - } - - void RunContext::handleExpr( - AssertionInfo const& info, - ITransientExpression const& expr, - AssertionReaction& reaction - ) { - m_reporter->assertionStarting( info ); - - bool negated = isFalseTest( info.resultDisposition ); - bool result = expr.getResult() != negated; - - if( result ) { - if (!m_includeSuccessfulResults) { - assertionPassed(); - } - else { - reportExpr(info, ResultWas::Ok, &expr, negated); - } - } - else { - reportExpr(info, ResultWas::ExpressionFailed, &expr, negated ); - populateReaction( reaction ); - } - } - void RunContext::reportExpr( - AssertionInfo const &info, - ResultWas::OfType resultType, - ITransientExpression const *expr, - bool negated ) { - - m_lastAssertionInfo = info; - AssertionResultData data( resultType, LazyExpression( negated ) ); - - AssertionResult assertionResult{ info, data }; - assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; - - assertionEnded( assertionResult ); - } - - void RunContext::handleMessage( - AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef const& message, - AssertionReaction& reaction - ) { - m_reporter->assertionStarting( info ); - - m_lastAssertionInfo = info; - - AssertionResultData data( resultType, LazyExpression( false ) ); - data.message = message; - AssertionResult assertionResult{ m_lastAssertionInfo, data }; - assertionEnded( assertionResult ); - if( !assertionResult.isOk() ) - populateReaction( reaction ); - } - void RunContext::handleUnexpectedExceptionNotThrown( - AssertionInfo const& info, - AssertionReaction& reaction - ) { - handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction); - } - - void RunContext::handleUnexpectedInflightException( - AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction - ) { - m_lastAssertionInfo = info; - - AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = message; - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); - populateReaction( reaction ); - } - - void RunContext::populateReaction( AssertionReaction& reaction ) { - reaction.shouldDebugBreak = m_config->shouldDebugBreak(); - reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal); - } - - void RunContext::handleIncomplete( - AssertionInfo const& info - ) { - m_lastAssertionInfo = info; - - AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); - } - void RunContext::handleNonExpr( - AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction - ) { - m_lastAssertionInfo = info; - - AssertionResultData data( resultType, LazyExpression( false ) ); - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); - - if( !assertionResult.isOk() ) - populateReaction( reaction ); - } - - IResultCapture& getResultCapture() { - if (auto* capture = getCurrentContext().getResultCapture()) - return *capture; - else - CATCH_INTERNAL_ERROR("No result capture instance"); - } -} -// end catch_run_context.cpp -// start catch_section.cpp - -namespace Catch { - - Section::Section( SectionInfo const& info ) - : m_info( info ), - m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) - { - m_timer.start(); - } - - Section::~Section() { - if( m_sectionIncluded ) { - SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; - if( uncaught_exceptions() ) - getResultCapture().sectionEndedEarly( endInfo ); - else - getResultCapture().sectionEnded( endInfo ); - } - } - - // This indicates whether the section should be executed or not - Section::operator bool() const { - return m_sectionIncluded; - } - -} // end namespace Catch -// end catch_section.cpp -// start catch_section_info.cpp - -namespace Catch { - - SectionInfo::SectionInfo - ( SourceLineInfo const& _lineInfo, - std::string const& _name ) - : name( _name ), - lineInfo( _lineInfo ) - {} - -} // end namespace Catch -// end catch_section_info.cpp -// start catch_session.cpp - -// start catch_session.h - -#include - -namespace Catch { - - class Session : NonCopyable { - public: - - Session(); - ~Session() override; - - void showHelp() const; - void libIdentify(); - - int applyCommandLine( int argc, char const * const * argv ); - #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) - int applyCommandLine( int argc, wchar_t const * const * argv ); - #endif - - void useConfigData( ConfigData const& configData ); - - template - int run(int argc, CharT const * const argv[]) { - if (m_startupExceptions) - return 1; - int returnCode = applyCommandLine(argc, argv); - if (returnCode == 0) - returnCode = run(); - return returnCode; - } - - int run(); - - clara::Parser const& cli() const; - void cli( clara::Parser const& newParser ); - ConfigData& configData(); - Config& config(); - private: - int runInternal(); - - clara::Parser m_cli; - ConfigData m_configData; - std::shared_ptr m_config; - bool m_startupExceptions = false; - }; - -} // end namespace Catch - -// end catch_session.h -// start catch_version.h - -#include - -namespace Catch { - - // Versioning information - struct Version { - Version( Version const& ) = delete; - Version& operator=( Version const& ) = delete; - Version( unsigned int _majorVersion, - unsigned int _minorVersion, - unsigned int _patchNumber, - char const * const _branchName, - unsigned int _buildNumber ); - - unsigned int const majorVersion; - unsigned int const minorVersion; - unsigned int const patchNumber; - - // buildNumber is only used if branchName is not null - char const * const branchName; - unsigned int const buildNumber; - - friend std::ostream& operator << ( std::ostream& os, Version const& version ); - }; - - Version const& libraryVersion(); -} - -// end catch_version.h -#include -#include - -namespace Catch { - - namespace { - const int MaxExitCode = 255; - - IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { - auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); - CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); - - return reporter; - } - - IStreamingReporterPtr makeReporter(std::shared_ptr const& config) { - if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { - return createReporter(config->getReporterName(), config); - } - - // On older platforms, returning std::unique_ptr - // when the return type is std::unique_ptr - // doesn't compile without a std::move call. However, this causes - // a warning on newer platforms. Thus, we have to work around - // it a bit and downcast the pointer manually. - auto ret = std::unique_ptr(new ListeningReporter); - auto& multi = static_cast(*ret); - auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); - for (auto const& listener : listeners) { - multi.addListener(listener->create(Catch::ReporterConfig(config))); - } - multi.addReporter(createReporter(config->getReporterName(), config)); - return ret; - } - - Catch::Totals runTests(std::shared_ptr const& config) { - auto reporter = makeReporter(config); - - RunContext context(config, std::move(reporter)); - - Totals totals; - - context.testGroupStarting(config->name(), 1, 1); - - TestSpec testSpec = config->testSpec(); - - auto const& allTestCases = getAllTestCasesSorted(*config); - for (auto const& testCase : allTestCases) { - if (!context.aborting() && matchTest(testCase, testSpec, *config)) - totals += context.runTest(testCase); - else - context.reporter().skipTest(testCase); - } - - if (config->warnAboutNoTests() && totals.testCases.total() == 0) { - ReusableStringStream testConfig; - - bool first = true; - for (const auto& input : config->getTestsOrTags()) { - if (!first) { testConfig << ' '; } - first = false; - testConfig << input; - } - - context.reporter().noMatchingTestCases(testConfig.str()); - totals.error = -1; - } - - context.testGroupEnded(config->name(), totals, 1, 1); - return totals; - } - - void applyFilenamesAsTags(Catch::IConfig const& config) { - auto& tests = const_cast&>(getAllTestCasesSorted(config)); - for (auto& testCase : tests) { - auto tags = testCase.tags; - - std::string filename = testCase.lineInfo.file; - auto lastSlash = filename.find_last_of("\\/"); - if (lastSlash != std::string::npos) { - filename.erase(0, lastSlash); - filename[0] = '#'; - } - - auto lastDot = filename.find_last_of('.'); - if (lastDot != std::string::npos) { - filename.erase(lastDot); - } - - tags.push_back(std::move(filename)); - setTags(testCase, tags); - } - } - - } // anon namespace - - Session::Session() { - static bool alreadyInstantiated = false; - if( alreadyInstantiated ) { - CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } - CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } - } - - // There cannot be exceptions at startup in no-exception mode. -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); - if ( !exceptions.empty() ) { - m_startupExceptions = true; - Colour colourGuard( Colour::Red ); - Catch::cerr() << "Errors occurred during startup!" << '\n'; - // iterate over all exceptions and notify user - for ( const auto& ex_ptr : exceptions ) { - try { - std::rethrow_exception(ex_ptr); - } catch ( std::exception const& ex ) { - Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; - } - } - } -#endif - - alreadyInstantiated = true; - m_cli = makeCommandLineParser( m_configData ); - } - Session::~Session() { - Catch::cleanUp(); - } - - void Session::showHelp() const { - Catch::cout() - << "\nCatch v" << libraryVersion() << "\n" - << m_cli << std::endl - << "For more detailed usage please see the project docs\n" << std::endl; - } - void Session::libIdentify() { - Catch::cout() - << std::left << std::setw(16) << "description: " << "A Catch test executable\n" - << std::left << std::setw(16) << "category: " << "testframework\n" - << std::left << std::setw(16) << "framework: " << "Catch Test\n" - << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; - } - - int Session::applyCommandLine( int argc, char const * const * argv ) { - if( m_startupExceptions ) - return 1; - - auto result = m_cli.parse( clara::Args( argc, argv ) ); - if( !result ) { - config(); - getCurrentMutableContext().setConfig(m_config); - Catch::cerr() - << Colour( Colour::Red ) - << "\nError(s) in input:\n" - << Column( result.errorMessage() ).indent( 2 ) - << "\n\n"; - Catch::cerr() << "Run with -? for usage\n" << std::endl; - return MaxExitCode; - } - - if( m_configData.showHelp ) - showHelp(); - if( m_configData.libIdentify ) - libIdentify(); - m_config.reset(); - return 0; - } - -#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) - int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { - - char **utf8Argv = new char *[ argc ]; - - for ( int i = 0; i < argc; ++i ) { - int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); - - utf8Argv[ i ] = new char[ bufSize ]; - - WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); - } - - int returnCode = applyCommandLine( argc, utf8Argv ); - - for ( int i = 0; i < argc; ++i ) - delete [] utf8Argv[ i ]; - - delete [] utf8Argv; - - return returnCode; - } -#endif - - void Session::useConfigData( ConfigData const& configData ) { - m_configData = configData; - m_config.reset(); - } - - int Session::run() { - if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { - Catch::cout() << "...waiting for enter/ return before starting" << std::endl; - static_cast(std::getchar()); - } - int exitCode = runInternal(); - if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { - Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; - static_cast(std::getchar()); - } - return exitCode; - } - - clara::Parser const& Session::cli() const { - return m_cli; - } - void Session::cli( clara::Parser const& newParser ) { - m_cli = newParser; - } - ConfigData& Session::configData() { - return m_configData; - } - Config& Session::config() { - if( !m_config ) - m_config = std::make_shared( m_configData ); - return *m_config; - } - - int Session::runInternal() { - if( m_startupExceptions ) - return 1; - - if (m_configData.showHelp || m_configData.libIdentify) { - return 0; - } - - CATCH_TRY { - config(); // Force config to be constructed - - seedRng( *m_config ); - - if( m_configData.filenamesAsTags ) - applyFilenamesAsTags( *m_config ); - - // Handle list request - if( Option listed = list( m_config ) ) - return static_cast( *listed ); - - auto totals = runTests( m_config ); - // Note that on unices only the lower 8 bits are usually used, clamping - // the return value to 255 prevents false negative when some multiple - // of 256 tests has failed - return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast(totals.assertions.failed))); - } -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - catch( std::exception& ex ) { - Catch::cerr() << ex.what() << std::endl; - return MaxExitCode; - } -#endif - } - -} // end namespace Catch -// end catch_session.cpp -// start catch_singletons.cpp - -#include - -namespace Catch { - - namespace { - static auto getSingletons() -> std::vector*& { - static std::vector* g_singletons = nullptr; - if( !g_singletons ) - g_singletons = new std::vector(); - return g_singletons; - } - } - - ISingleton::~ISingleton() {} - - void addSingleton(ISingleton* singleton ) { - getSingletons()->push_back( singleton ); - } - void cleanupSingletons() { - auto& singletons = getSingletons(); - for( auto singleton : *singletons ) - delete singleton; - delete singletons; - singletons = nullptr; - } - -} // namespace Catch -// end catch_singletons.cpp -// start catch_startup_exception_registry.cpp - -namespace Catch { -void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { - CATCH_TRY { - m_exceptions.push_back(exception); - } CATCH_CATCH_ALL { - // If we run out of memory during start-up there's really not a lot more we can do about it - std::terminate(); - } - } - - std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { - return m_exceptions; - } - -} // end namespace Catch -// end catch_startup_exception_registry.cpp -// start catch_stream.cpp - -#include -#include -#include -#include -#include -#include - -namespace Catch { - - Catch::IStream::~IStream() = default; - - namespace detail { namespace { - template - class StreamBufImpl : public std::streambuf { - char data[bufferSize]; - WriterF m_writer; - - public: - StreamBufImpl() { - setp( data, data + sizeof(data) ); - } - - ~StreamBufImpl() noexcept { - StreamBufImpl::sync(); - } - - private: - int overflow( int c ) override { - sync(); - - if( c != EOF ) { - if( pbase() == epptr() ) - m_writer( std::string( 1, static_cast( c ) ) ); - else - sputc( static_cast( c ) ); - } - return 0; - } - - int sync() override { - if( pbase() != pptr() ) { - m_writer( std::string( pbase(), static_cast( pptr() - pbase() ) ) ); - setp( pbase(), epptr() ); - } - return 0; - } - }; - - /////////////////////////////////////////////////////////////////////////// - - struct OutputDebugWriter { - - void operator()( std::string const&str ) { - writeToDebugConsole( str ); - } - }; - - /////////////////////////////////////////////////////////////////////////// - - class FileStream : public IStream { - mutable std::ofstream m_ofs; - public: - FileStream( StringRef filename ) { - m_ofs.open( filename.c_str() ); - CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); - } - ~FileStream() override = default; - public: // IStream - std::ostream& stream() const override { - return m_ofs; - } - }; - - /////////////////////////////////////////////////////////////////////////// - - class CoutStream : public IStream { - mutable std::ostream m_os; - public: - // Store the streambuf from cout up-front because - // cout may get redirected when running tests - CoutStream() : m_os( Catch::cout().rdbuf() ) {} - ~CoutStream() override = default; - - public: // IStream - std::ostream& stream() const override { return m_os; } - }; - - /////////////////////////////////////////////////////////////////////////// - - class DebugOutStream : public IStream { - std::unique_ptr> m_streamBuf; - mutable std::ostream m_os; - public: - DebugOutStream() - : m_streamBuf( new StreamBufImpl() ), - m_os( m_streamBuf.get() ) - {} - - ~DebugOutStream() override = default; - - public: // IStream - std::ostream& stream() const override { return m_os; } - }; - - }} // namespace anon::detail - - /////////////////////////////////////////////////////////////////////////// - - auto makeStream( StringRef const &filename ) -> IStream const* { - if( filename.empty() ) - return new detail::CoutStream(); - else if( filename[0] == '%' ) { - if( filename == "%debug" ) - return new detail::DebugOutStream(); - else - CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); - } - else - return new detail::FileStream( filename ); - } - - // This class encapsulates the idea of a pool of ostringstreams that can be reused. - struct StringStreams { - std::vector> m_streams; - std::vector m_unused; - std::ostringstream m_referenceStream; // Used for copy state/ flags from - - auto add() -> std::size_t { - if( m_unused.empty() ) { - m_streams.push_back( std::unique_ptr( new std::ostringstream ) ); - return m_streams.size()-1; - } - else { - auto index = m_unused.back(); - m_unused.pop_back(); - return index; - } - } - - void release( std::size_t index ) { - m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state - m_unused.push_back(index); - } - }; - - ReusableStringStream::ReusableStringStream() - : m_index( Singleton::getMutable().add() ), - m_oss( Singleton::getMutable().m_streams[m_index].get() ) - {} - - ReusableStringStream::~ReusableStringStream() { - static_cast( m_oss )->str(""); - m_oss->clear(); - Singleton::getMutable().release( m_index ); - } - - auto ReusableStringStream::str() const -> std::string { - return static_cast( m_oss )->str(); - } - - /////////////////////////////////////////////////////////////////////////// - -#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions - std::ostream& cout() { return std::cout; } - std::ostream& cerr() { return std::cerr; } - std::ostream& clog() { return std::clog; } -#endif -} -// end catch_stream.cpp -// start catch_string_manip.cpp - -#include -#include -#include -#include - -namespace Catch { - - namespace { - char toLowerCh(char c) { - return static_cast( std::tolower( c ) ); - } - } - - bool startsWith( std::string const& s, std::string const& prefix ) { - return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); - } - bool startsWith( std::string const& s, char prefix ) { - return !s.empty() && s[0] == prefix; - } - bool endsWith( std::string const& s, std::string const& suffix ) { - return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); - } - bool endsWith( std::string const& s, char suffix ) { - return !s.empty() && s[s.size()-1] == suffix; - } - bool contains( std::string const& s, std::string const& infix ) { - return s.find( infix ) != std::string::npos; - } - void toLowerInPlace( std::string& s ) { - std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); - } - std::string toLower( std::string const& s ) { - std::string lc = s; - toLowerInPlace( lc ); - return lc; - } - std::string trim( std::string const& str ) { - static char const* whitespaceChars = "\n\r\t "; - std::string::size_type start = str.find_first_not_of( whitespaceChars ); - std::string::size_type end = str.find_last_not_of( whitespaceChars ); - - return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); - } - - bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { - bool replaced = false; - std::size_t i = str.find( replaceThis ); - while( i != std::string::npos ) { - replaced = true; - str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); - if( i < str.size()-withThis.size() ) - i = str.find( replaceThis, i+withThis.size() ); - else - i = std::string::npos; - } - return replaced; - } - - pluralise::pluralise( std::size_t count, std::string const& label ) - : m_count( count ), - m_label( label ) - {} - - std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { - os << pluraliser.m_count << ' ' << pluraliser.m_label; - if( pluraliser.m_count != 1 ) - os << 's'; - return os; - } - -} -// end catch_string_manip.cpp -// start catch_stringref.cpp - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wexit-time-destructors" -#endif - -#include -#include -#include - -namespace { - const uint32_t byte_2_lead = 0xC0; - const uint32_t byte_3_lead = 0xE0; - const uint32_t byte_4_lead = 0xF0; -} - -namespace Catch { - StringRef::StringRef( char const* rawChars ) noexcept - : StringRef( rawChars, static_cast(std::strlen(rawChars) ) ) - {} - - StringRef::operator std::string() const { - return std::string( m_start, m_size ); - } - - void StringRef::swap( StringRef& other ) noexcept { - std::swap( m_start, other.m_start ); - std::swap( m_size, other.m_size ); - std::swap( m_data, other.m_data ); - } - - auto StringRef::c_str() const -> char const* { - if( isSubstring() ) - const_cast( this )->takeOwnership(); - return m_start; - } - auto StringRef::currentData() const noexcept -> char const* { - return m_start; - } - - auto StringRef::isOwned() const noexcept -> bool { - return m_data != nullptr; - } - auto StringRef::isSubstring() const noexcept -> bool { - return m_start[m_size] != '\0'; - } - - void StringRef::takeOwnership() { - if( !isOwned() ) { - m_data = new char[m_size+1]; - memcpy( m_data, m_start, m_size ); - m_data[m_size] = '\0'; - m_start = m_data; - } - } - auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { - if( start < m_size ) - return StringRef( m_start+start, size ); - else - return StringRef(); - } - auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { - return - size() == other.size() && - (std::strncmp( m_start, other.m_start, size() ) == 0); - } - auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool { - return !operator==( other ); - } - - auto StringRef::operator[](size_type index) const noexcept -> char { - return m_start[index]; - } - - auto StringRef::numberOfCharacters() const noexcept -> size_type { - size_type noChars = m_size; - // Make adjustments for uft encodings - for( size_type i=0; i < m_size; ++i ) { - char c = m_start[i]; - if( ( c & byte_2_lead ) == byte_2_lead ) { - noChars--; - if (( c & byte_3_lead ) == byte_3_lead ) - noChars--; - if( ( c & byte_4_lead ) == byte_4_lead ) - noChars--; - } - } - return noChars; - } - - auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string { - std::string str; - str.reserve( lhs.size() + rhs.size() ); - str += lhs; - str += rhs; - return str; - } - auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string { - return std::string( lhs ) + std::string( rhs ); - } - auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string { - return std::string( lhs ) + std::string( rhs ); - } - - auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { - return os.write(str.currentData(), str.size()); - } - - auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { - lhs.append(rhs.currentData(), rhs.size()); - return lhs; - } - -} // namespace Catch - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif -// end catch_stringref.cpp -// start catch_tag_alias.cpp - -namespace Catch { - TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} -} -// end catch_tag_alias.cpp -// start catch_tag_alias_autoregistrar.cpp - -namespace Catch { - - RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { - CATCH_TRY { - getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); - } CATCH_CATCH_ALL { - // Do not throw when constructing global objects, instead register the exception to be processed later - getMutableRegistryHub().registerStartupException(); - } - } - -} -// end catch_tag_alias_autoregistrar.cpp -// start catch_tag_alias_registry.cpp - -#include - -namespace Catch { - - TagAliasRegistry::~TagAliasRegistry() {} - - TagAlias const* TagAliasRegistry::find( std::string const& alias ) const { - auto it = m_registry.find( alias ); - if( it != m_registry.end() ) - return &(it->second); - else - return nullptr; - } - - std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { - std::string expandedTestSpec = unexpandedTestSpec; - for( auto const& registryKvp : m_registry ) { - std::size_t pos = expandedTestSpec.find( registryKvp.first ); - if( pos != std::string::npos ) { - expandedTestSpec = expandedTestSpec.substr( 0, pos ) + - registryKvp.second.tag + - expandedTestSpec.substr( pos + registryKvp.first.size() ); - } - } - return expandedTestSpec; - } - - void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { - CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'), - "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo ); - - CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second, - "error: tag alias, '" << alias << "' already registered.\n" - << "\tFirst seen at: " << find(alias)->lineInfo << "\n" - << "\tRedefined at: " << lineInfo ); - } - - ITagAliasRegistry::~ITagAliasRegistry() {} - - ITagAliasRegistry const& ITagAliasRegistry::get() { - return getRegistryHub().getTagAliasRegistry(); - } - -} // end namespace Catch -// end catch_tag_alias_registry.cpp -// start catch_test_case_info.cpp - -#include -#include -#include -#include - -namespace Catch { - - namespace { - TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { - if( startsWith( tag, '.' ) || - tag == "!hide" ) - return TestCaseInfo::IsHidden; - else if( tag == "!throws" ) - return TestCaseInfo::Throws; - else if( tag == "!shouldfail" ) - return TestCaseInfo::ShouldFail; - else if( tag == "!mayfail" ) - return TestCaseInfo::MayFail; - else if( tag == "!nonportable" ) - return TestCaseInfo::NonPortable; - else if( tag == "!benchmark" ) - return static_cast( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden ); - else - return TestCaseInfo::None; - } - bool isReservedTag( std::string const& tag ) { - return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast(tag[0]) ); - } - void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { - CATCH_ENFORCE( !isReservedTag(tag), - "Tag name: [" << tag << "] is not allowed.\n" - << "Tag names starting with non alpha-numeric characters are reserved\n" - << _lineInfo ); - } - } - - TestCase makeTestCase( ITestInvoker* _testCase, - std::string const& _className, - NameAndTags const& nameAndTags, - SourceLineInfo const& _lineInfo ) - { - bool isHidden = false; - - // Parse out tags - std::vector tags; - std::string desc, tag; - bool inTag = false; - std::string _descOrTags = nameAndTags.tags; - for (char c : _descOrTags) { - if( !inTag ) { - if( c == '[' ) - inTag = true; - else - desc += c; - } - else { - if( c == ']' ) { - TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); - if( ( prop & TestCaseInfo::IsHidden ) != 0 ) - isHidden = true; - else if( prop == TestCaseInfo::None ) - enforceNotReservedTag( tag, _lineInfo ); - - tags.push_back( tag ); - tag.clear(); - inTag = false; - } - else - tag += c; - } - } - if( isHidden ) { - tags.push_back( "." ); - } - - TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo ); - return TestCase( _testCase, std::move(info) ); - } - - void setTags( TestCaseInfo& testCaseInfo, std::vector tags ) { - std::sort(begin(tags), end(tags)); - tags.erase(std::unique(begin(tags), end(tags)), end(tags)); - testCaseInfo.lcaseTags.clear(); - - for( auto const& tag : tags ) { - std::string lcaseTag = toLower( tag ); - testCaseInfo.properties = static_cast( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); - testCaseInfo.lcaseTags.push_back( lcaseTag ); - } - testCaseInfo.tags = std::move(tags); - } - - TestCaseInfo::TestCaseInfo( std::string const& _name, - std::string const& _className, - std::string const& _description, - std::vector const& _tags, - SourceLineInfo const& _lineInfo ) - : name( _name ), - className( _className ), - description( _description ), - lineInfo( _lineInfo ), - properties( None ) - { - setTags( *this, _tags ); - } - - bool TestCaseInfo::isHidden() const { - return ( properties & IsHidden ) != 0; - } - bool TestCaseInfo::throws() const { - return ( properties & Throws ) != 0; - } - bool TestCaseInfo::okToFail() const { - return ( properties & (ShouldFail | MayFail ) ) != 0; - } - bool TestCaseInfo::expectedToFail() const { - return ( properties & (ShouldFail ) ) != 0; - } - - std::string TestCaseInfo::tagsAsString() const { - std::string ret; - // '[' and ']' per tag - std::size_t full_size = 2 * tags.size(); - for (const auto& tag : tags) { - full_size += tag.size(); - } - ret.reserve(full_size); - for (const auto& tag : tags) { - ret.push_back('['); - ret.append(tag); - ret.push_back(']'); - } - - return ret; - } - - TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {} - - TestCase TestCase::withName( std::string const& _newName ) const { - TestCase other( *this ); - other.name = _newName; - return other; - } - - void TestCase::invoke() const { - test->invoke(); - } - - bool TestCase::operator == ( TestCase const& other ) const { - return test.get() == other.test.get() && - name == other.name && - className == other.className; - } - - bool TestCase::operator < ( TestCase const& other ) const { - return name < other.name; - } - - TestCaseInfo const& TestCase::getTestCaseInfo() const - { - return *this; - } - -} // end namespace Catch -// end catch_test_case_info.cpp -// start catch_test_case_registry_impl.cpp - -#include - -namespace Catch { - - std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ) { - - std::vector sorted = unsortedTestCases; - - switch( config.runOrder() ) { - case RunTests::InLexicographicalOrder: - std::sort( sorted.begin(), sorted.end() ); - break; - case RunTests::InRandomOrder: - seedRng( config ); - std::shuffle( sorted.begin(), sorted.end(), rng() ); - break; - case RunTests::InDeclarationOrder: - // already in declaration order - break; - } - return sorted; - } - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { - return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); - } - - void enforceNoDuplicateTestCases( std::vector const& functions ) { - std::set seenFunctions; - for( auto const& function : functions ) { - auto prev = seenFunctions.insert( function ); - CATCH_ENFORCE( prev.second, - "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n" - << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" - << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); - } - } - - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ) { - std::vector filtered; - filtered.reserve( testCases.size() ); - for( auto const& testCase : testCases ) - if( matchTest( testCase, testSpec, config ) ) - filtered.push_back( testCase ); - return filtered; - } - std::vector const& getAllTestCasesSorted( IConfig const& config ) { - return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); - } - - void TestRegistry::registerTest( TestCase const& testCase ) { - std::string name = testCase.getTestCaseInfo().name; - if( name.empty() ) { - ReusableStringStream rss; - rss << "Anonymous test case " << ++m_unnamedCount; - return registerTest( testCase.withName( rss.str() ) ); - } - m_functions.push_back( testCase ); - } - - std::vector const& TestRegistry::getAllTests() const { - return m_functions; - } - std::vector const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { - if( m_sortedFunctions.empty() ) - enforceNoDuplicateTestCases( m_functions ); - - if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { - m_sortedFunctions = sortTests( config, m_functions ); - m_currentSortOrder = config.runOrder(); - } - return m_sortedFunctions; - } - - /////////////////////////////////////////////////////////////////////////// - TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {} - - void TestInvokerAsFunction::invoke() const { - m_testAsFunction(); - } - - std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { - std::string className = classOrQualifiedMethodName; - if( startsWith( className, '&' ) ) - { - std::size_t lastColons = className.rfind( "::" ); - std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); - if( penultimateColons == std::string::npos ) - penultimateColons = 1; - className = className.substr( penultimateColons, lastColons-penultimateColons ); - } - return className; - } - -} // end namespace Catch -// end catch_test_case_registry_impl.cpp -// start catch_test_case_tracker.cpp - -#include -#include -#include -#include -#include - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wexit-time-destructors" -#endif - -namespace Catch { -namespace TestCaseTracking { - - NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) - : name( _name ), - location( _location ) - {} - - ITracker::~ITracker() = default; - - TrackerContext& TrackerContext::instance() { - static TrackerContext s_instance; - return s_instance; - } - - ITracker& TrackerContext::startRun() { - m_rootTracker = std::make_shared( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); - m_currentTracker = nullptr; - m_runState = Executing; - return *m_rootTracker; - } - - void TrackerContext::endRun() { - m_rootTracker.reset(); - m_currentTracker = nullptr; - m_runState = NotStarted; - } - - void TrackerContext::startCycle() { - m_currentTracker = m_rootTracker.get(); - m_runState = Executing; - } - void TrackerContext::completeCycle() { - m_runState = CompletedCycle; - } - - bool TrackerContext::completedCycle() const { - return m_runState == CompletedCycle; - } - ITracker& TrackerContext::currentTracker() { - return *m_currentTracker; - } - void TrackerContext::setCurrentTracker( ITracker* tracker ) { - m_currentTracker = tracker; - } - - TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : m_nameAndLocation( nameAndLocation ), - m_ctx( ctx ), - m_parent( parent ) - {} - - NameAndLocation const& TrackerBase::nameAndLocation() const { - return m_nameAndLocation; - } - bool TrackerBase::isComplete() const { - return m_runState == CompletedSuccessfully || m_runState == Failed; - } - bool TrackerBase::isSuccessfullyCompleted() const { - return m_runState == CompletedSuccessfully; - } - bool TrackerBase::isOpen() const { - return m_runState != NotStarted && !isComplete(); - } - bool TrackerBase::hasChildren() const { - return !m_children.empty(); - } - - void TrackerBase::addChild( ITrackerPtr const& child ) { - m_children.push_back( child ); - } - - ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) { - auto it = std::find_if( m_children.begin(), m_children.end(), - [&nameAndLocation]( ITrackerPtr const& tracker ){ - return - tracker->nameAndLocation().location == nameAndLocation.location && - tracker->nameAndLocation().name == nameAndLocation.name; - } ); - return( it != m_children.end() ) - ? *it - : nullptr; - } - ITracker& TrackerBase::parent() { - assert( m_parent ); // Should always be non-null except for root - return *m_parent; - } - - void TrackerBase::openChild() { - if( m_runState != ExecutingChildren ) { - m_runState = ExecutingChildren; - if( m_parent ) - m_parent->openChild(); - } - } - - bool TrackerBase::isSectionTracker() const { return false; } - bool TrackerBase::isGeneratorTracker() const { return false; } - - void TrackerBase::open() { - m_runState = Executing; - moveToThis(); - if( m_parent ) - m_parent->openChild(); - } - - void TrackerBase::close() { - - // Close any still open children (e.g. generators) - while( &m_ctx.currentTracker() != this ) - m_ctx.currentTracker().close(); - - switch( m_runState ) { - case NeedsAnotherRun: - break; - - case Executing: - m_runState = CompletedSuccessfully; - break; - case ExecutingChildren: - if( m_children.empty() || m_children.back()->isComplete() ) - m_runState = CompletedSuccessfully; - break; - - case NotStarted: - case CompletedSuccessfully: - case Failed: - CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState ); - - default: - CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState ); - } - moveToParent(); - m_ctx.completeCycle(); - } - void TrackerBase::fail() { - m_runState = Failed; - if( m_parent ) - m_parent->markAsNeedingAnotherRun(); - moveToParent(); - m_ctx.completeCycle(); - } - void TrackerBase::markAsNeedingAnotherRun() { - m_runState = NeedsAnotherRun; - } - - void TrackerBase::moveToParent() { - assert( m_parent ); - m_ctx.setCurrentTracker( m_parent ); - } - void TrackerBase::moveToThis() { - m_ctx.setCurrentTracker( this ); - } - - SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ) - { - if( parent ) { - while( !parent->isSectionTracker() ) - parent = &parent->parent(); - - SectionTracker& parentSection = static_cast( *parent ); - addNextFilters( parentSection.m_filters ); - } - } - - bool SectionTracker::isComplete() const { - bool complete = true; - - if ((m_filters.empty() || m_filters[0] == "") || - std::find(m_filters.begin(), m_filters.end(), - m_nameAndLocation.name) != m_filters.end()) - complete = TrackerBase::isComplete(); - return complete; - - } - - bool SectionTracker::isSectionTracker() const { return true; } - - SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { - std::shared_ptr section; - - ITracker& currentTracker = ctx.currentTracker(); - if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { - assert( childTracker ); - assert( childTracker->isSectionTracker() ); - section = std::static_pointer_cast( childTracker ); - } - else { - section = std::make_shared( nameAndLocation, ctx, ¤tTracker ); - currentTracker.addChild( section ); - } - if( !ctx.completedCycle() ) - section->tryOpen(); - return *section; - } - - void SectionTracker::tryOpen() { - if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) ) - open(); - } - - void SectionTracker::addInitialFilters( std::vector const& filters ) { - if( !filters.empty() ) { - m_filters.push_back(""); // Root - should never be consulted - m_filters.push_back(""); // Test Case - not a section filter - m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); - } - } - void SectionTracker::addNextFilters( std::vector const& filters ) { - if( filters.size() > 1 ) - m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() ); - } - -} // namespace TestCaseTracking - -using TestCaseTracking::ITracker; -using TestCaseTracking::TrackerContext; -using TestCaseTracking::SectionTracker; - -} // namespace Catch - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif -// end catch_test_case_tracker.cpp -// start catch_test_registry.cpp - -namespace Catch { - - auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { - return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); - } - - NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} - - AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { - CATCH_TRY { - getMutableRegistryHub() - .registerTest( - makeTestCase( - invoker, - extractClassName( classOrMethod ), - nameAndTags, - lineInfo)); - } CATCH_CATCH_ALL { - // Do not throw when constructing global objects, instead register the exception to be processed later - getMutableRegistryHub().registerStartupException(); - } - } - - AutoReg::~AutoReg() = default; -} -// end catch_test_registry.cpp -// start catch_test_spec.cpp - -#include -#include -#include -#include - -namespace Catch { - - TestSpec::Pattern::~Pattern() = default; - TestSpec::NamePattern::~NamePattern() = default; - TestSpec::TagPattern::~TagPattern() = default; - TestSpec::ExcludedPattern::~ExcludedPattern() = default; - - TestSpec::NamePattern::NamePattern( std::string const& name ) - : m_wildcardPattern( toLower( name ), CaseSensitive::No ) - {} - bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { - return m_wildcardPattern.matches( toLower( testCase.name ) ); - } - - TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {} - bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { - return std::find(begin(testCase.lcaseTags), - end(testCase.lcaseTags), - m_tag) != end(testCase.lcaseTags); - } - - TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {} - bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); } - - bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { - // All patterns in a filter must match for the filter to be a match - for( auto const& pattern : m_patterns ) { - if( !pattern->matches( testCase ) ) - return false; - } - return true; - } - - bool TestSpec::hasFilters() const { - return !m_filters.empty(); - } - bool TestSpec::matches( TestCaseInfo const& testCase ) const { - // A TestSpec matches if any filter matches - for( auto const& filter : m_filters ) - if( filter.matches( testCase ) ) - return true; - return false; - } -} -// end catch_test_spec.cpp -// start catch_test_spec_parser.cpp - -namespace Catch { - - TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} - - TestSpecParser& TestSpecParser::parse( std::string const& arg ) { - m_mode = None; - m_exclusion = false; - m_start = std::string::npos; - m_arg = m_tagAliases->expandAliases( arg ); - m_escapeChars.clear(); - for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) - visitChar( m_arg[m_pos] ); - if( m_mode == Name ) - addPattern(); - return *this; - } - TestSpec TestSpecParser::testSpec() { - addFilter(); - return m_testSpec; - } - - void TestSpecParser::visitChar( char c ) { - if( m_mode == None ) { - switch( c ) { - case ' ': return; - case '~': m_exclusion = true; return; - case '[': return startNewMode( Tag, ++m_pos ); - case '"': return startNewMode( QuotedName, ++m_pos ); - case '\\': return escape(); - default: startNewMode( Name, m_pos ); break; - } - } - if( m_mode == Name ) { - if( c == ',' ) { - addPattern(); - addFilter(); - } - else if( c == '[' ) { - if( subString() == "exclude:" ) - m_exclusion = true; - else - addPattern(); - startNewMode( Tag, ++m_pos ); - } - else if( c == '\\' ) - escape(); - } - else if( m_mode == EscapedName ) - m_mode = Name; - else if( m_mode == QuotedName && c == '"' ) - addPattern(); - else if( m_mode == Tag && c == ']' ) - addPattern(); - } - void TestSpecParser::startNewMode( Mode mode, std::size_t start ) { - m_mode = mode; - m_start = start; - } - void TestSpecParser::escape() { - if( m_mode == None ) - m_start = m_pos; - m_mode = EscapedName; - m_escapeChars.push_back( m_pos ); - } - std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); } - - void TestSpecParser::addFilter() { - if( !m_currentFilter.m_patterns.empty() ) { - m_testSpec.m_filters.push_back( m_currentFilter ); - m_currentFilter = TestSpec::Filter(); - } - } - - TestSpec parseTestSpec( std::string const& arg ) { - return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); - } - -} // namespace Catch -// end catch_test_spec_parser.cpp -// start catch_timer.cpp - -#include - -static const uint64_t nanosecondsInSecond = 1000000000; - -namespace Catch { - - auto getCurrentNanosecondsSinceEpoch() -> uint64_t { - return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); - } - - namespace { - auto estimateClockResolution() -> uint64_t { - uint64_t sum = 0; - static const uint64_t iterations = 1000000; - - auto startTime = getCurrentNanosecondsSinceEpoch(); - - for( std::size_t i = 0; i < iterations; ++i ) { - - uint64_t ticks; - uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); - do { - ticks = getCurrentNanosecondsSinceEpoch(); - } while( ticks == baseTicks ); - - auto delta = ticks - baseTicks; - sum += delta; - - // If we have been calibrating for over 3 seconds -- the clock - // is terrible and we should move on. - // TBD: How to signal that the measured resolution is probably wrong? - if (ticks > startTime + 3 * nanosecondsInSecond) { - return sum / ( i + 1u ); - } - } - - // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers - // - and potentially do more iterations if there's a high variance. - return sum/iterations; - } - } - auto getEstimatedClockResolution() -> uint64_t { - static auto s_resolution = estimateClockResolution(); - return s_resolution; - } - - void Timer::start() { - m_nanoseconds = getCurrentNanosecondsSinceEpoch(); - } - auto Timer::getElapsedNanoseconds() const -> uint64_t { - return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; - } - auto Timer::getElapsedMicroseconds() const -> uint64_t { - return getElapsedNanoseconds()/1000; - } - auto Timer::getElapsedMilliseconds() const -> unsigned int { - return static_cast(getElapsedMicroseconds()/1000); - } - auto Timer::getElapsedSeconds() const -> double { - return getElapsedMicroseconds()/1000000.0; - } - -} // namespace Catch -// end catch_timer.cpp -// start catch_tostring.cpp - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wexit-time-destructors" -# pragma clang diagnostic ignored "-Wglobal-constructors" -#endif - -// Enable specific decls locally -#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -#endif - -#include -#include - -namespace Catch { - -namespace Detail { - - const std::string unprintableString = "{?}"; - - namespace { - const int hexThreshold = 255; - - struct Endianness { - enum Arch { Big, Little }; - - static Arch which() { - union _{ - int asInt; - char asChar[sizeof (int)]; - } u; - - u.asInt = 1; - return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little; - } - }; - } - - std::string rawMemoryToString( const void *object, std::size_t size ) { - // Reverse order for little endian architectures - int i = 0, end = static_cast( size ), inc = 1; - if( Endianness::which() == Endianness::Little ) { - i = end-1; - end = inc = -1; - } - - unsigned char const *bytes = static_cast(object); - ReusableStringStream rss; - rss << "0x" << std::setfill('0') << std::hex; - for( ; i != end; i += inc ) - rss << std::setw(2) << static_cast(bytes[i]); - return rss.str(); - } -} - -template -std::string fpToString( T value, int precision ) { - if (Catch::isnan(value)) { - return "nan"; - } - - ReusableStringStream rss; - rss << std::setprecision( precision ) - << std::fixed - << value; - std::string d = rss.str(); - std::size_t i = d.find_last_not_of( '0' ); - if( i != std::string::npos && i != d.size()-1 ) { - if( d[i] == '.' ) - i++; - d = d.substr( 0, i+1 ); - } - return d; -} - -//// ======================================================= //// -// -// Out-of-line defs for full specialization of StringMaker -// -//// ======================================================= //// - -std::string StringMaker::convert(const std::string& str) { - if (!getCurrentContext().getConfig()->showInvisibles()) { - return '"' + str + '"'; - } - - std::string s("\""); - for (char c : str) { - switch (c) { - case '\n': - s.append("\\n"); - break; - case '\t': - s.append("\\t"); - break; - default: - s.push_back(c); - break; - } - } - s.append("\""); - return s; -} - -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW -std::string StringMaker::convert(std::string_view str) { - return ::Catch::Detail::stringify(std::string{ str }); -} -#endif - -std::string StringMaker::convert(char const* str) { - if (str) { - return ::Catch::Detail::stringify(std::string{ str }); - } else { - return{ "{null string}" }; - } -} -std::string StringMaker::convert(char* str) { - if (str) { - return ::Catch::Detail::stringify(std::string{ str }); - } else { - return{ "{null string}" }; - } -} - -#ifdef CATCH_CONFIG_WCHAR -std::string StringMaker::convert(const std::wstring& wstr) { - std::string s; - s.reserve(wstr.size()); - for (auto c : wstr) { - s += (c <= 0xff) ? static_cast(c) : '?'; - } - return ::Catch::Detail::stringify(s); -} - -# ifdef CATCH_CONFIG_CPP17_STRING_VIEW -std::string StringMaker::convert(std::wstring_view str) { - return StringMaker::convert(std::wstring(str)); -} -# endif - -std::string StringMaker::convert(wchar_t const * str) { - if (str) { - return ::Catch::Detail::stringify(std::wstring{ str }); - } else { - return{ "{null string}" }; - } -} -std::string StringMaker::convert(wchar_t * str) { - if (str) { - return ::Catch::Detail::stringify(std::wstring{ str }); - } else { - return{ "{null string}" }; - } -} -#endif - -std::string StringMaker::convert(int value) { - return ::Catch::Detail::stringify(static_cast(value)); -} -std::string StringMaker::convert(long value) { - return ::Catch::Detail::stringify(static_cast(value)); -} -std::string StringMaker::convert(long long value) { - ReusableStringStream rss; - rss << value; - if (value > Detail::hexThreshold) { - rss << " (0x" << std::hex << value << ')'; - } - return rss.str(); -} - -std::string StringMaker::convert(unsigned int value) { - return ::Catch::Detail::stringify(static_cast(value)); -} -std::string StringMaker::convert(unsigned long value) { - return ::Catch::Detail::stringify(static_cast(value)); -} -std::string StringMaker::convert(unsigned long long value) { - ReusableStringStream rss; - rss << value; - if (value > Detail::hexThreshold) { - rss << " (0x" << std::hex << value << ')'; - } - return rss.str(); -} - -std::string StringMaker::convert(bool b) { - return b ? "true" : "false"; -} - -std::string StringMaker::convert(signed char value) { - if (value == '\r') { - return "'\\r'"; - } else if (value == '\f') { - return "'\\f'"; - } else if (value == '\n') { - return "'\\n'"; - } else if (value == '\t') { - return "'\\t'"; - } else if ('\0' <= value && value < ' ') { - return ::Catch::Detail::stringify(static_cast(value)); - } else { - char chstr[] = "' '"; - chstr[1] = value; - return chstr; - } -} -std::string StringMaker::convert(char c) { - return ::Catch::Detail::stringify(static_cast(c)); -} -std::string StringMaker::convert(unsigned char c) { - return ::Catch::Detail::stringify(static_cast(c)); -} - -std::string StringMaker::convert(std::nullptr_t) { - return "nullptr"; -} - -std::string StringMaker::convert(float value) { - return fpToString(value, 5) + 'f'; -} -std::string StringMaker::convert(double value) { - return fpToString(value, 10); -} - -std::string ratio_string::symbol() { return "a"; } -std::string ratio_string::symbol() { return "f"; } -std::string ratio_string::symbol() { return "p"; } -std::string ratio_string::symbol() { return "n"; } -std::string ratio_string::symbol() { return "u"; } -std::string ratio_string::symbol() { return "m"; } - -} // end namespace Catch - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -// end catch_tostring.cpp -// start catch_totals.cpp - -namespace Catch { - - Counts Counts::operator - ( Counts const& other ) const { - Counts diff; - diff.passed = passed - other.passed; - diff.failed = failed - other.failed; - diff.failedButOk = failedButOk - other.failedButOk; - return diff; - } - - Counts& Counts::operator += ( Counts const& other ) { - passed += other.passed; - failed += other.failed; - failedButOk += other.failedButOk; - return *this; - } - - std::size_t Counts::total() const { - return passed + failed + failedButOk; - } - bool Counts::allPassed() const { - return failed == 0 && failedButOk == 0; - } - bool Counts::allOk() const { - return failed == 0; - } - - Totals Totals::operator - ( Totals const& other ) const { - Totals diff; - diff.assertions = assertions - other.assertions; - diff.testCases = testCases - other.testCases; - return diff; - } - - Totals& Totals::operator += ( Totals const& other ) { - assertions += other.assertions; - testCases += other.testCases; - return *this; - } - - Totals Totals::delta( Totals const& prevTotals ) const { - Totals diff = *this - prevTotals; - if( diff.assertions.failed > 0 ) - ++diff.testCases.failed; - else if( diff.assertions.failedButOk > 0 ) - ++diff.testCases.failedButOk; - else - ++diff.testCases.passed; - return diff; - } - -} -// end catch_totals.cpp -// start catch_uncaught_exceptions.cpp - -#include - -namespace Catch { - bool uncaught_exceptions() { -#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) - return std::uncaught_exceptions() > 0; -#else - return std::uncaught_exception(); -#endif - } -} // end namespace Catch -// end catch_uncaught_exceptions.cpp -// start catch_version.cpp - -#include - -namespace Catch { - - Version::Version - ( unsigned int _majorVersion, - unsigned int _minorVersion, - unsigned int _patchNumber, - char const * const _branchName, - unsigned int _buildNumber ) - : majorVersion( _majorVersion ), - minorVersion( _minorVersion ), - patchNumber( _patchNumber ), - branchName( _branchName ), - buildNumber( _buildNumber ) - {} - - std::ostream& operator << ( std::ostream& os, Version const& version ) { - os << version.majorVersion << '.' - << version.minorVersion << '.' - << version.patchNumber; - // branchName is never null -> 0th char is \0 if it is empty - if (version.branchName[0]) { - os << '-' << version.branchName - << '.' << version.buildNumber; - } - return os; - } - - Version const& libraryVersion() { - static Version version( 2, 7, 0, "", 0 ); - return version; - } - -} -// end catch_version.cpp -// start catch_wildcard_pattern.cpp - -#include - -namespace Catch { - - WildcardPattern::WildcardPattern( std::string const& pattern, - CaseSensitive::Choice caseSensitivity ) - : m_caseSensitivity( caseSensitivity ), - m_pattern( adjustCase( pattern ) ) - { - if( startsWith( m_pattern, '*' ) ) { - m_pattern = m_pattern.substr( 1 ); - m_wildcard = WildcardAtStart; - } - if( endsWith( m_pattern, '*' ) ) { - m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); - m_wildcard = static_cast( m_wildcard | WildcardAtEnd ); - } - } - - bool WildcardPattern::matches( std::string const& str ) const { - switch( m_wildcard ) { - case NoWildcard: - return m_pattern == adjustCase( str ); - case WildcardAtStart: - return endsWith( adjustCase( str ), m_pattern ); - case WildcardAtEnd: - return startsWith( adjustCase( str ), m_pattern ); - case WildcardAtBothEnds: - return contains( adjustCase( str ), m_pattern ); - default: - CATCH_INTERNAL_ERROR( "Unknown enum" ); - } - } - - std::string WildcardPattern::adjustCase( std::string const& str ) const { - return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str; - } -} -// end catch_wildcard_pattern.cpp -// start catch_xmlwriter.cpp - -#include - -using uchar = unsigned char; - -namespace Catch { - -namespace { - - size_t trailingBytes(unsigned char c) { - if ((c & 0xE0) == 0xC0) { - return 2; - } - if ((c & 0xF0) == 0xE0) { - return 3; - } - if ((c & 0xF8) == 0xF0) { - return 4; - } - CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); - } - - uint32_t headerValue(unsigned char c) { - if ((c & 0xE0) == 0xC0) { - return c & 0x1F; - } - if ((c & 0xF0) == 0xE0) { - return c & 0x0F; - } - if ((c & 0xF8) == 0xF0) { - return c & 0x07; - } - CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); - } - - void hexEscapeChar(std::ostream& os, unsigned char c) { - std::ios_base::fmtflags f(os.flags()); - os << "\\x" - << std::uppercase << std::hex << std::setfill('0') << std::setw(2) - << static_cast(c); - os.flags(f); - } - -} // anonymous namespace - - XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) - : m_str( str ), - m_forWhat( forWhat ) - {} - - void XmlEncode::encodeTo( std::ostream& os ) const { - // Apostrophe escaping not necessary if we always use " to write attributes - // (see: http://www.w3.org/TR/xml/#syntax) - - for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { - uchar c = m_str[idx]; - switch (c) { - case '<': os << "<"; break; - case '&': os << "&"; break; - - case '>': - // See: http://www.w3.org/TR/xml/#syntax - if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']') - os << ">"; - else - os << c; - break; - - case '\"': - if (m_forWhat == ForAttributes) - os << """; - else - os << c; - break; - - default: - // Check for control characters and invalid utf-8 - - // Escape control characters in standard ascii - // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 - if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) { - hexEscapeChar(os, c); - break; - } - - // Plain ASCII: Write it to stream - if (c < 0x7F) { - os << c; - break; - } - - // UTF-8 territory - // Check if the encoding is valid and if it is not, hex escape bytes. - // Important: We do not check the exact decoded values for validity, only the encoding format - // First check that this bytes is a valid lead byte: - // This means that it is not encoded as 1111 1XXX - // Or as 10XX XXXX - if (c < 0xC0 || - c >= 0xF8) { - hexEscapeChar(os, c); - break; - } - - auto encBytes = trailingBytes(c); - // Are there enough bytes left to avoid accessing out-of-bounds memory? - if (idx + encBytes - 1 >= m_str.size()) { - hexEscapeChar(os, c); - break; - } - // The header is valid, check data - // The next encBytes bytes must together be a valid utf-8 - // This means: bitpattern 10XX XXXX and the extracted value is sane (ish) - bool valid = true; - uint32_t value = headerValue(c); - for (std::size_t n = 1; n < encBytes; ++n) { - uchar nc = m_str[idx + n]; - valid &= ((nc & 0xC0) == 0x80); - value = (value << 6) | (nc & 0x3F); - } - - if ( - // Wrong bit pattern of following bytes - (!valid) || - // Overlong encodings - (value < 0x80) || - (0x80 <= value && value < 0x800 && encBytes > 2) || - (0x800 < value && value < 0x10000 && encBytes > 3) || - // Encoded value out of range - (value >= 0x110000) - ) { - hexEscapeChar(os, c); - break; - } - - // If we got here, this is in fact a valid(ish) utf-8 sequence - for (std::size_t n = 0; n < encBytes; ++n) { - os << m_str[idx + n]; - } - idx += encBytes - 1; - break; - } - } - } - - std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { - xmlEncode.encodeTo( os ); - return os; - } - - XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer ) - : m_writer( writer ) - {} - - XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept - : m_writer( other.m_writer ){ - other.m_writer = nullptr; - } - XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { - if ( m_writer ) { - m_writer->endElement(); - } - m_writer = other.m_writer; - other.m_writer = nullptr; - return *this; - } - - XmlWriter::ScopedElement::~ScopedElement() { - if( m_writer ) - m_writer->endElement(); - } - - XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) { - m_writer->writeText( text, indent ); - return *this; - } - - XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) - { - writeDeclaration(); - } - - XmlWriter::~XmlWriter() { - while( !m_tags.empty() ) - endElement(); - } - - XmlWriter& XmlWriter::startElement( std::string const& name ) { - ensureTagClosed(); - newlineIfNecessary(); - m_os << m_indent << '<' << name; - m_tags.push_back( name ); - m_indent += " "; - m_tagIsOpen = true; - return *this; - } - - XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) { - ScopedElement scoped( this ); - startElement( name ); - return scoped; - } - - XmlWriter& XmlWriter::endElement() { - newlineIfNecessary(); - m_indent = m_indent.substr( 0, m_indent.size()-2 ); - if( m_tagIsOpen ) { - m_os << "/>"; - m_tagIsOpen = false; - } - else { - m_os << m_indent << ""; - } - m_os << std::endl; - m_tags.pop_back(); - return *this; - } - - XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { - if( !name.empty() && !attribute.empty() ) - m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; - return *this; - } - - XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) { - m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; - return *this; - } - - XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) { - if( !text.empty() ){ - bool tagWasOpen = m_tagIsOpen; - ensureTagClosed(); - if( tagWasOpen && indent ) - m_os << m_indent; - m_os << XmlEncode( text ); - m_needsNewline = true; - } - return *this; - } - - XmlWriter& XmlWriter::writeComment( std::string const& text ) { - ensureTagClosed(); - m_os << m_indent << ""; - m_needsNewline = true; - return *this; - } - - void XmlWriter::writeStylesheetRef( std::string const& url ) { - m_os << "\n"; - } - - XmlWriter& XmlWriter::writeBlankLine() { - ensureTagClosed(); - m_os << '\n'; - return *this; - } - - void XmlWriter::ensureTagClosed() { - if( m_tagIsOpen ) { - m_os << ">" << std::endl; - m_tagIsOpen = false; - } - } - - void XmlWriter::writeDeclaration() { - m_os << "\n"; - } - - void XmlWriter::newlineIfNecessary() { - if( m_needsNewline ) { - m_os << std::endl; - m_needsNewline = false; - } - } -} -// end catch_xmlwriter.cpp -// start catch_reporter_bases.cpp - -#include -#include -#include -#include -#include - -namespace Catch { - void prepareExpandedExpression(AssertionResult& result) { - result.getExpandedExpression(); - } - - // Because formatting using c++ streams is stateful, drop down to C is required - // Alternatively we could use stringstream, but its performance is... not good. - std::string getFormattedDuration( double duration ) { - // Max exponent + 1 is required to represent the whole part - // + 1 for decimal point - // + 3 for the 3 decimal places - // + 1 for null terminator - const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; - char buffer[maxDoubleSize]; - - // Save previous errno, to prevent sprintf from overwriting it - ErrnoGuard guard; -#ifdef _MSC_VER - sprintf_s(buffer, "%.3f", duration); -#else - std::sprintf(buffer, "%.3f", duration); -#endif - return std::string(buffer); - } - - TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) - :StreamingReporterBase(_config) {} - - std::set TestEventListenerBase::getSupportedVerbosities() { - return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High }; - } - - void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} - - bool TestEventListenerBase::assertionEnded(AssertionStats const &) { - return false; - } - -} // end namespace Catch -// end catch_reporter_bases.cpp -// start catch_reporter_compact.cpp - -namespace { - -#ifdef CATCH_PLATFORM_MAC - const char* failedString() { return "FAILED"; } - const char* passedString() { return "PASSED"; } -#else - const char* failedString() { return "failed"; } - const char* passedString() { return "passed"; } -#endif - - // Colour::LightGrey - Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } - - std::string bothOrAll( std::size_t count ) { - return count == 1 ? std::string() : - count == 2 ? "both " : "all " ; - } - -} // anon namespace - -namespace Catch { -namespace { -// Colour, message variants: -// - white: No tests ran. -// - red: Failed [both/all] N test cases, failed [both/all] M assertions. -// - white: Passed [both/all] N test cases (no assertions). -// - red: Failed N tests cases, failed M assertions. -// - green: Passed [both/all] N tests cases with M assertions. -void printTotals(std::ostream& out, const Totals& totals) { - if (totals.testCases.total() == 0) { - out << "No tests ran."; - } else if (totals.testCases.failed == totals.testCases.total()) { - Colour colour(Colour::ResultError); - const std::string qualify_assertions_failed = - totals.assertions.failed == totals.assertions.total() ? - bothOrAll(totals.assertions.failed) : std::string(); - out << - "Failed " << bothOrAll(totals.testCases.failed) - << pluralise(totals.testCases.failed, "test case") << ", " - "failed " << qualify_assertions_failed << - pluralise(totals.assertions.failed, "assertion") << '.'; - } else if (totals.assertions.total() == 0) { - out << - "Passed " << bothOrAll(totals.testCases.total()) - << pluralise(totals.testCases.total(), "test case") - << " (no assertions)."; - } else if (totals.assertions.failed) { - Colour colour(Colour::ResultError); - out << - "Failed " << pluralise(totals.testCases.failed, "test case") << ", " - "failed " << pluralise(totals.assertions.failed, "assertion") << '.'; - } else { - Colour colour(Colour::ResultSuccess); - out << - "Passed " << bothOrAll(totals.testCases.passed) - << pluralise(totals.testCases.passed, "test case") << - " with " << pluralise(totals.assertions.passed, "assertion") << '.'; - } -} - -// Implementation of CompactReporter formatting -class AssertionPrinter { -public: - AssertionPrinter& operator= (AssertionPrinter const&) = delete; - AssertionPrinter(AssertionPrinter const&) = delete; - AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) - : stream(_stream) - , result(_stats.assertionResult) - , messages(_stats.infoMessages) - , itMessage(_stats.infoMessages.begin()) - , printInfoMessages(_printInfoMessages) {} - - void print() { - printSourceInfo(); - - itMessage = messages.begin(); - - switch (result.getResultType()) { - case ResultWas::Ok: - printResultType(Colour::ResultSuccess, passedString()); - printOriginalExpression(); - printReconstructedExpression(); - if (!result.hasExpression()) - printRemainingMessages(Colour::None); - else - printRemainingMessages(); - break; - case ResultWas::ExpressionFailed: - if (result.isOk()) - printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok")); - else - printResultType(Colour::Error, failedString()); - printOriginalExpression(); - printReconstructedExpression(); - printRemainingMessages(); - break; - case ResultWas::ThrewException: - printResultType(Colour::Error, failedString()); - printIssue("unexpected exception with message:"); - printMessage(); - printExpressionWas(); - printRemainingMessages(); - break; - case ResultWas::FatalErrorCondition: - printResultType(Colour::Error, failedString()); - printIssue("fatal error condition with message:"); - printMessage(); - printExpressionWas(); - printRemainingMessages(); - break; - case ResultWas::DidntThrowException: - printResultType(Colour::Error, failedString()); - printIssue("expected exception, got none"); - printExpressionWas(); - printRemainingMessages(); - break; - case ResultWas::Info: - printResultType(Colour::None, "info"); - printMessage(); - printRemainingMessages(); - break; - case ResultWas::Warning: - printResultType(Colour::None, "warning"); - printMessage(); - printRemainingMessages(); - break; - case ResultWas::ExplicitFailure: - printResultType(Colour::Error, failedString()); - printIssue("explicitly"); - printRemainingMessages(Colour::None); - break; - // These cases are here to prevent compiler warnings - case ResultWas::Unknown: - case ResultWas::FailureBit: - case ResultWas::Exception: - printResultType(Colour::Error, "** internal error **"); - break; - } - } - -private: - void printSourceInfo() const { - Colour colourGuard(Colour::FileName); - stream << result.getSourceInfo() << ':'; - } - - void printResultType(Colour::Code colour, std::string const& passOrFail) const { - if (!passOrFail.empty()) { - { - Colour colourGuard(colour); - stream << ' ' << passOrFail; - } - stream << ':'; - } - } - - void printIssue(std::string const& issue) const { - stream << ' ' << issue; - } - - void printExpressionWas() { - if (result.hasExpression()) { - stream << ';'; - { - Colour colour(dimColour()); - stream << " expression was:"; - } - printOriginalExpression(); - } - } - - void printOriginalExpression() const { - if (result.hasExpression()) { - stream << ' ' << result.getExpression(); - } - } - - void printReconstructedExpression() const { - if (result.hasExpandedExpression()) { - { - Colour colour(dimColour()); - stream << " for: "; - } - stream << result.getExpandedExpression(); - } - } - - void printMessage() { - if (itMessage != messages.end()) { - stream << " '" << itMessage->message << '\''; - ++itMessage; - } - } - - void printRemainingMessages(Colour::Code colour = dimColour()) { - if (itMessage == messages.end()) - return; - - // using messages.end() directly yields (or auto) compilation error: - std::vector::const_iterator itEnd = messages.end(); - const std::size_t N = static_cast(std::distance(itMessage, itEnd)); - - { - Colour colourGuard(colour); - stream << " with " << pluralise(N, "message") << ':'; - } - - for (; itMessage != itEnd; ) { - // If this assertion is a warning ignore any INFO messages - if (printInfoMessages || itMessage->type != ResultWas::Info) { - stream << " '" << itMessage->message << '\''; - if (++itMessage != itEnd) { - Colour colourGuard(dimColour()); - stream << " and"; - } - } - } - } - -private: - std::ostream& stream; - AssertionResult const& result; - std::vector messages; - std::vector::const_iterator itMessage; - bool printInfoMessages; -}; - -} // anon namespace - - std::string CompactReporter::getDescription() { - return "Reports test results on a single line, suitable for IDEs"; - } - - ReporterPreferences CompactReporter::getPreferences() const { - return m_reporterPrefs; - } - - void CompactReporter::noMatchingTestCases( std::string const& spec ) { - stream << "No test cases matched '" << spec << '\'' << std::endl; - } - - void CompactReporter::assertionStarting( AssertionInfo const& ) {} - - bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { - AssertionResult const& result = _assertionStats.assertionResult; - - bool printInfoMessages = true; - - // Drop out if result was successful and we're not printing those - if( !m_config->includeSuccessfulResults() && result.isOk() ) { - if( result.getResultType() != ResultWas::Warning ) - return false; - printInfoMessages = false; - } - - AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); - printer.print(); - - stream << std::endl; - return true; - } - - void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { - if (m_config->showDurations() == ShowDurations::Always) { - stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; - } - } - - void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { - printTotals( stream, _testRunStats.totals ); - stream << '\n' << std::endl; - StreamingReporterBase::testRunEnded( _testRunStats ); - } - - CompactReporter::~CompactReporter() {} - - CATCH_REGISTER_REPORTER( "compact", CompactReporter ) - -} // end namespace Catch -// end catch_reporter_compact.cpp -// start catch_reporter_console.cpp - -#include -#include - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch - // Note that 4062 (not all labels are handled - // and default is missing) is enabled -#endif - -namespace Catch { - -namespace { - -// Formatter impl for ConsoleReporter -class ConsoleAssertionPrinter { -public: - ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; - ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; - ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) - : stream(_stream), - stats(_stats), - result(_stats.assertionResult), - colour(Colour::None), - message(result.getMessage()), - messages(_stats.infoMessages), - printInfoMessages(_printInfoMessages) { - switch (result.getResultType()) { - case ResultWas::Ok: - colour = Colour::Success; - passOrFail = "PASSED"; - //if( result.hasMessage() ) - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; - break; - case ResultWas::ExpressionFailed: - if (result.isOk()) { - colour = Colour::Success; - passOrFail = "FAILED - but was ok"; - } else { - colour = Colour::Error; - passOrFail = "FAILED"; - } - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; - break; - case ResultWas::ThrewException: - colour = Colour::Error; - passOrFail = "FAILED"; - messageLabel = "due to unexpected exception with "; - if (_stats.infoMessages.size() == 1) - messageLabel += "message"; - if (_stats.infoMessages.size() > 1) - messageLabel += "messages"; - break; - case ResultWas::FatalErrorCondition: - colour = Colour::Error; - passOrFail = "FAILED"; - messageLabel = "due to a fatal error condition"; - break; - case ResultWas::DidntThrowException: - colour = Colour::Error; - passOrFail = "FAILED"; - messageLabel = "because no exception was thrown where one was expected"; - break; - case ResultWas::Info: - messageLabel = "info"; - break; - case ResultWas::Warning: - messageLabel = "warning"; - break; - case ResultWas::ExplicitFailure: - passOrFail = "FAILED"; - colour = Colour::Error; - if (_stats.infoMessages.size() == 1) - messageLabel = "explicitly with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "explicitly with messages"; - break; - // These cases are here to prevent compiler warnings - case ResultWas::Unknown: - case ResultWas::FailureBit: - case ResultWas::Exception: - passOrFail = "** internal error **"; - colour = Colour::Error; - break; - } - } - - void print() const { - printSourceInfo(); - if (stats.totals.assertions.total() > 0) { - printResultType(); - printOriginalExpression(); - printReconstructedExpression(); - } else { - stream << '\n'; - } - printMessage(); - } - -private: - void printResultType() const { - if (!passOrFail.empty()) { - Colour colourGuard(colour); - stream << passOrFail << ":\n"; - } - } - void printOriginalExpression() const { - if (result.hasExpression()) { - Colour colourGuard(Colour::OriginalExpression); - stream << " "; - stream << result.getExpressionInMacro(); - stream << '\n'; - } - } - void printReconstructedExpression() const { - if (result.hasExpandedExpression()) { - stream << "with expansion:\n"; - Colour colourGuard(Colour::ReconstructedExpression); - stream << Column(result.getExpandedExpression()).indent(2) << '\n'; - } - } - void printMessage() const { - if (!messageLabel.empty()) - stream << messageLabel << ':' << '\n'; - for (auto const& msg : messages) { - // If this assertion is a warning ignore any INFO messages - if (printInfoMessages || msg.type != ResultWas::Info) - stream << Column(msg.message).indent(2) << '\n'; - } - } - void printSourceInfo() const { - Colour colourGuard(Colour::FileName); - stream << result.getSourceInfo() << ": "; - } - - std::ostream& stream; - AssertionStats const& stats; - AssertionResult const& result; - Colour::Code colour; - std::string passOrFail; - std::string messageLabel; - std::string message; - std::vector messages; - bool printInfoMessages; -}; - -std::size_t makeRatio(std::size_t number, std::size_t total) { - std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0; - return (ratio == 0 && number > 0) ? 1 : ratio; -} - -std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) { - if (i > j && i > k) - return i; - else if (j > k) - return j; - else - return k; -} - -struct ColumnInfo { - enum Justification { Left, Right }; - std::string name; - int width; - Justification justification; -}; -struct ColumnBreak {}; -struct RowBreak {}; - -class Duration { - enum class Unit { - Auto, - Nanoseconds, - Microseconds, - Milliseconds, - Seconds, - Minutes - }; - static const uint64_t s_nanosecondsInAMicrosecond = 1000; - static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond; - static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; - static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; - - uint64_t m_inNanoseconds; - Unit m_units; - -public: - explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto) - : m_inNanoseconds(inNanoseconds), - m_units(units) { - if (m_units == Unit::Auto) { - if (m_inNanoseconds < s_nanosecondsInAMicrosecond) - m_units = Unit::Nanoseconds; - else if (m_inNanoseconds < s_nanosecondsInAMillisecond) - m_units = Unit::Microseconds; - else if (m_inNanoseconds < s_nanosecondsInASecond) - m_units = Unit::Milliseconds; - else if (m_inNanoseconds < s_nanosecondsInAMinute) - m_units = Unit::Seconds; - else - m_units = Unit::Minutes; - } - - } - - auto value() const -> double { - switch (m_units) { - case Unit::Microseconds: - return m_inNanoseconds / static_cast(s_nanosecondsInAMicrosecond); - case Unit::Milliseconds: - return m_inNanoseconds / static_cast(s_nanosecondsInAMillisecond); - case Unit::Seconds: - return m_inNanoseconds / static_cast(s_nanosecondsInASecond); - case Unit::Minutes: - return m_inNanoseconds / static_cast(s_nanosecondsInAMinute); - default: - return static_cast(m_inNanoseconds); - } - } - auto unitsAsString() const -> std::string { - switch (m_units) { - case Unit::Nanoseconds: - return "ns"; - case Unit::Microseconds: - return "us"; - case Unit::Milliseconds: - return "ms"; - case Unit::Seconds: - return "s"; - case Unit::Minutes: - return "m"; - default: - return "** internal error **"; - } - - } - friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& { - return os << duration.value() << " " << duration.unitsAsString(); - } -}; -} // end anon namespace - -class TablePrinter { - std::ostream& m_os; - std::vector m_columnInfos; - std::ostringstream m_oss; - int m_currentColumn = -1; - bool m_isOpen = false; - -public: - TablePrinter( std::ostream& os, std::vector columnInfos ) - : m_os( os ), - m_columnInfos( std::move( columnInfos ) ) {} - - auto columnInfos() const -> std::vector const& { - return m_columnInfos; - } - - void open() { - if (!m_isOpen) { - m_isOpen = true; - *this << RowBreak(); - for (auto const& info : m_columnInfos) - *this << info.name << ColumnBreak(); - *this << RowBreak(); - m_os << Catch::getLineOfChars<'-'>() << "\n"; - } - } - void close() { - if (m_isOpen) { - *this << RowBreak(); - m_os << std::endl; - m_isOpen = false; - } - } - - template - friend TablePrinter& operator << (TablePrinter& tp, T const& value) { - tp.m_oss << value; - return tp; - } - - friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) { - auto colStr = tp.m_oss.str(); - // This takes account of utf8 encodings - auto strSize = Catch::StringRef(colStr).numberOfCharacters(); - tp.m_oss.str(""); - tp.open(); - if (tp.m_currentColumn == static_cast(tp.m_columnInfos.size() - 1)) { - tp.m_currentColumn = -1; - tp.m_os << "\n"; - } - tp.m_currentColumn++; - - auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; - auto padding = (strSize + 2 < static_cast(colInfo.width)) - ? std::string(colInfo.width - (strSize + 2), ' ') - : std::string(); - if (colInfo.justification == ColumnInfo::Left) - tp.m_os << colStr << padding << " "; - else - tp.m_os << padding << colStr << " "; - return tp; - } - - friend TablePrinter& operator << (TablePrinter& tp, RowBreak) { - if (tp.m_currentColumn > 0) { - tp.m_os << "\n"; - tp.m_currentColumn = -1; - } - return tp; - } -}; - -ConsoleReporter::ConsoleReporter(ReporterConfig const& config) - : StreamingReporterBase(config), - m_tablePrinter(new TablePrinter(config.stream(), - { - { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left }, - { "iters", 8, ColumnInfo::Right }, - { "elapsed ns", 14, ColumnInfo::Right }, - { "average", 14, ColumnInfo::Right } - })) {} -ConsoleReporter::~ConsoleReporter() = default; - -std::string ConsoleReporter::getDescription() { - return "Reports test results as plain lines of text"; -} - -void ConsoleReporter::noMatchingTestCases(std::string const& spec) { - stream << "No test cases matched '" << spec << '\'' << std::endl; -} - -void ConsoleReporter::assertionStarting(AssertionInfo const&) {} - -bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { - AssertionResult const& result = _assertionStats.assertionResult; - - bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); - - // Drop out if result was successful but we're not printing them. - if (!includeResults && result.getResultType() != ResultWas::Warning) - return false; - - lazyPrint(); - - ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults); - printer.print(); - stream << std::endl; - return true; -} - -void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) { - m_headerPrinted = false; - StreamingReporterBase::sectionStarting(_sectionInfo); -} -void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { - m_tablePrinter->close(); - if (_sectionStats.missingAssertions) { - lazyPrint(); - Colour colour(Colour::ResultError); - if (m_sectionStack.size() > 1) - stream << "\nNo assertions in section"; - else - stream << "\nNo assertions in test case"; - stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; - } - if (m_config->showDurations() == ShowDurations::Always) { - stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; - } - if (m_headerPrinted) { - m_headerPrinted = false; - } - StreamingReporterBase::sectionEnded(_sectionStats); -} - -void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) { - lazyPrintWithoutClosingBenchmarkTable(); - - auto nameCol = Column( info.name ).width( static_cast( m_tablePrinter->columnInfos()[0].width - 2 ) ); - - bool firstLine = true; - for (auto line : nameCol) { - if (!firstLine) - (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak(); - else - firstLine = false; - - (*m_tablePrinter) << line << ColumnBreak(); - } -} -void ConsoleReporter::benchmarkEnded(BenchmarkStats const& stats) { - Duration average(stats.elapsedTimeInNanoseconds / stats.iterations); - (*m_tablePrinter) - << stats.iterations << ColumnBreak() - << stats.elapsedTimeInNanoseconds << ColumnBreak() - << average << ColumnBreak(); -} - -void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { - m_tablePrinter->close(); - StreamingReporterBase::testCaseEnded(_testCaseStats); - m_headerPrinted = false; -} -void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) { - if (currentGroupInfo.used) { - printSummaryDivider(); - stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; - printTotals(_testGroupStats.totals); - stream << '\n' << std::endl; - } - StreamingReporterBase::testGroupEnded(_testGroupStats); -} -void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { - printTotalsDivider(_testRunStats.totals); - printTotals(_testRunStats.totals); - stream << std::endl; - StreamingReporterBase::testRunEnded(_testRunStats); -} - -void ConsoleReporter::lazyPrint() { - - m_tablePrinter->close(); - lazyPrintWithoutClosingBenchmarkTable(); -} - -void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { - - if (!currentTestRunInfo.used) - lazyPrintRunInfo(); - if (!currentGroupInfo.used) - lazyPrintGroupInfo(); - - if (!m_headerPrinted) { - printTestCaseAndSectionHeader(); - m_headerPrinted = true; - } -} -void ConsoleReporter::lazyPrintRunInfo() { - stream << '\n' << getLineOfChars<'~'>() << '\n'; - Colour colour(Colour::SecondaryText); - stream << currentTestRunInfo->name - << " is a Catch v" << libraryVersion() << " host application.\n" - << "Run with -? for options\n\n"; - - if (m_config->rngSeed() != 0) - stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; - - currentTestRunInfo.used = true; -} -void ConsoleReporter::lazyPrintGroupInfo() { - if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) { - printClosedHeader("Group: " + currentGroupInfo->name); - currentGroupInfo.used = true; - } -} -void ConsoleReporter::printTestCaseAndSectionHeader() { - assert(!m_sectionStack.empty()); - printOpenHeader(currentTestCaseInfo->name); - - if (m_sectionStack.size() > 1) { - Colour colourGuard(Colour::Headers); - - auto - it = m_sectionStack.begin() + 1, // Skip first section (test case) - itEnd = m_sectionStack.end(); - for (; it != itEnd; ++it) - printHeaderString(it->name, 2); - } - - SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; - - if (!lineInfo.empty()) { - stream << getLineOfChars<'-'>() << '\n'; - Colour colourGuard(Colour::FileName); - stream << lineInfo << '\n'; - } - stream << getLineOfChars<'.'>() << '\n' << std::endl; -} - -void ConsoleReporter::printClosedHeader(std::string const& _name) { - printOpenHeader(_name); - stream << getLineOfChars<'.'>() << '\n'; -} -void ConsoleReporter::printOpenHeader(std::string const& _name) { - stream << getLineOfChars<'-'>() << '\n'; - { - Colour colourGuard(Colour::Headers); - printHeaderString(_name); - } -} - -// if string has a : in first line will set indent to follow it on -// subsequent lines -void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) { - std::size_t i = _string.find(": "); - if (i != std::string::npos) - i += 2; - else - i = 0; - stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n'; -} - -struct SummaryColumn { - - SummaryColumn( std::string _label, Colour::Code _colour ) - : label( std::move( _label ) ), - colour( _colour ) {} - SummaryColumn addRow( std::size_t count ) { - ReusableStringStream rss; - rss << count; - std::string row = rss.str(); - for (auto& oldRow : rows) { - while (oldRow.size() < row.size()) - oldRow = ' ' + oldRow; - while (oldRow.size() > row.size()) - row = ' ' + row; - } - rows.push_back(row); - return *this; - } - - std::string label; - Colour::Code colour; - std::vector rows; - -}; - -void ConsoleReporter::printTotals( Totals const& totals ) { - if (totals.testCases.total() == 0) { - stream << Colour(Colour::Warning) << "No tests ran\n"; - } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { - stream << Colour(Colour::ResultSuccess) << "All tests passed"; - stream << " (" - << pluralise(totals.assertions.passed, "assertion") << " in " - << pluralise(totals.testCases.passed, "test case") << ')' - << '\n'; - } else { - - std::vector columns; - columns.push_back(SummaryColumn("", Colour::None) - .addRow(totals.testCases.total()) - .addRow(totals.assertions.total())); - columns.push_back(SummaryColumn("passed", Colour::Success) - .addRow(totals.testCases.passed) - .addRow(totals.assertions.passed)); - columns.push_back(SummaryColumn("failed", Colour::ResultError) - .addRow(totals.testCases.failed) - .addRow(totals.assertions.failed)); - columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) - .addRow(totals.testCases.failedButOk) - .addRow(totals.assertions.failedButOk)); - - printSummaryRow("test cases", columns, 0); - printSummaryRow("assertions", columns, 1); - } -} -void ConsoleReporter::printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row) { - for (auto col : cols) { - std::string value = col.rows[row]; - if (col.label.empty()) { - stream << label << ": "; - if (value != "0") - stream << value; - else - stream << Colour(Colour::Warning) << "- none -"; - } else if (value != "0") { - stream << Colour(Colour::LightGrey) << " | "; - stream << Colour(col.colour) - << value << ' ' << col.label; - } - } - stream << '\n'; -} - -void ConsoleReporter::printTotalsDivider(Totals const& totals) { - if (totals.testCases.total() > 0) { - std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total()); - std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total()); - std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total()); - while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) - findMax(failedRatio, failedButOkRatio, passedRatio)++; - while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1) - findMax(failedRatio, failedButOkRatio, passedRatio)--; - - stream << Colour(Colour::Error) << std::string(failedRatio, '='); - stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '='); - if (totals.testCases.allPassed()) - stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '='); - else - stream << Colour(Colour::Success) << std::string(passedRatio, '='); - } else { - stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '='); - } - stream << '\n'; -} -void ConsoleReporter::printSummaryDivider() { - stream << getLineOfChars<'-'>() << '\n'; -} - -CATCH_REGISTER_REPORTER("console", ConsoleReporter) - -} // end namespace Catch - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif -// end catch_reporter_console.cpp -// start catch_reporter_junit.cpp - -#include -#include -#include -#include - -namespace Catch { - - namespace { - std::string getCurrentTimestamp() { - // Beware, this is not reentrant because of backward compatibility issues - // Also, UTC only, again because of backward compatibility (%z is C++11) - time_t rawtime; - std::time(&rawtime); - auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); - -#ifdef _MSC_VER - std::tm timeInfo = {}; - gmtime_s(&timeInfo, &rawtime); -#else - std::tm* timeInfo; - timeInfo = std::gmtime(&rawtime); -#endif - - char timeStamp[timeStampSize]; - const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; - -#ifdef _MSC_VER - std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); -#else - std::strftime(timeStamp, timeStampSize, fmt, timeInfo); -#endif - return std::string(timeStamp); - } - - std::string fileNameTag(const std::vector &tags) { - auto it = std::find_if(begin(tags), - end(tags), - [] (std::string const& tag) {return tag.front() == '#'; }); - if (it != tags.end()) - return it->substr(1); - return std::string(); - } - } // anonymous namespace - - JunitReporter::JunitReporter( ReporterConfig const& _config ) - : CumulativeReporterBase( _config ), - xml( _config.stream() ) - { - m_reporterPrefs.shouldRedirectStdOut = true; - m_reporterPrefs.shouldReportAllAssertions = true; - } - - JunitReporter::~JunitReporter() {} - - std::string JunitReporter::getDescription() { - return "Reports test results in an XML format that looks like Ant's junitreport target"; - } - - void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {} - - void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) { - CumulativeReporterBase::testRunStarting( runInfo ); - xml.startElement( "testsuites" ); - if( m_config->rngSeed() != 0 ) { - xml.startElement( "properties" ); - xml.scopedElement( "property" ) - .writeAttribute( "name", "random-seed" ) - .writeAttribute( "value", m_config->rngSeed() ); - xml.endElement(); - } - } - - void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) { - suiteTimer.start(); - stdOutForSuite.clear(); - stdErrForSuite.clear(); - unexpectedExceptions = 0; - CumulativeReporterBase::testGroupStarting( groupInfo ); - } - - void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) { - m_okToFail = testCaseInfo.okToFail(); - } - - bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { - if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) - unexpectedExceptions++; - return CumulativeReporterBase::assertionEnded( assertionStats ); - } - - void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - stdOutForSuite += testCaseStats.stdOut; - stdErrForSuite += testCaseStats.stdErr; - CumulativeReporterBase::testCaseEnded( testCaseStats ); - } - - void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - double suiteTime = suiteTimer.getElapsedSeconds(); - CumulativeReporterBase::testGroupEnded( testGroupStats ); - writeGroup( *m_testGroups.back(), suiteTime ); - } - - void JunitReporter::testRunEndedCumulative() { - xml.endElement(); - } - - void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { - XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); - TestGroupStats const& stats = groupNode.value; - xml.writeAttribute( "name", stats.groupInfo.name ); - xml.writeAttribute( "errors", unexpectedExceptions ); - xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); - xml.writeAttribute( "tests", stats.totals.assertions.total() ); - xml.writeAttribute( "hostname", "tbd" ); // !TBD - if( m_config->showDurations() == ShowDurations::Never ) - xml.writeAttribute( "time", "" ); - else - xml.writeAttribute( "time", suiteTime ); - xml.writeAttribute( "timestamp", getCurrentTimestamp() ); - - // Write test cases - for( auto const& child : groupNode.children ) - writeTestCase( *child ); - - xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false ); - xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false ); - } - - void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { - TestCaseStats const& stats = testCaseNode.value; - - // All test cases have exactly one section - which represents the - // test case itself. That section may have 0-n nested sections - assert( testCaseNode.children.size() == 1 ); - SectionNode const& rootSection = *testCaseNode.children.front(); - - std::string className = stats.testInfo.className; - - if( className.empty() ) { - className = fileNameTag(stats.testInfo.tags); - if ( className.empty() ) - className = "global"; - } - - if ( !m_config->name().empty() ) - className = m_config->name() + "." + className; - - writeSection( className, "", rootSection ); - } - - void JunitReporter::writeSection( std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode ) { - std::string name = trim( sectionNode.stats.sectionInfo.name ); - if( !rootName.empty() ) - name = rootName + '/' + name; - - if( !sectionNode.assertions.empty() || - !sectionNode.stdOut.empty() || - !sectionNode.stdErr.empty() ) { - XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); - if( className.empty() ) { - xml.writeAttribute( "classname", name ); - xml.writeAttribute( "name", "root" ); - } - else { - xml.writeAttribute( "classname", className ); - xml.writeAttribute( "name", name ); - } - xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); - - writeAssertions( sectionNode ); - - if( !sectionNode.stdOut.empty() ) - xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); - if( !sectionNode.stdErr.empty() ) - xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); - } - for( auto const& childNode : sectionNode.childSections ) - if( className.empty() ) - writeSection( name, "", *childNode ); - else - writeSection( className, name, *childNode ); - } - - void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { - for( auto const& assertion : sectionNode.assertions ) - writeAssertion( assertion ); - } - - void JunitReporter::writeAssertion( AssertionStats const& stats ) { - AssertionResult const& result = stats.assertionResult; - if( !result.isOk() ) { - std::string elementName; - switch( result.getResultType() ) { - case ResultWas::ThrewException: - case ResultWas::FatalErrorCondition: - elementName = "error"; - break; - case ResultWas::ExplicitFailure: - elementName = "failure"; - break; - case ResultWas::ExpressionFailed: - elementName = "failure"; - break; - case ResultWas::DidntThrowException: - elementName = "failure"; - break; - - // We should never see these here: - case ResultWas::Info: - case ResultWas::Warning: - case ResultWas::Ok: - case ResultWas::Unknown: - case ResultWas::FailureBit: - case ResultWas::Exception: - elementName = "internalError"; - break; - } - - XmlWriter::ScopedElement e = xml.scopedElement( elementName ); - - xml.writeAttribute( "message", result.getExpandedExpression() ); - xml.writeAttribute( "type", result.getTestMacroName() ); - - ReusableStringStream rss; - if( !result.getMessage().empty() ) - rss << result.getMessage() << '\n'; - for( auto const& msg : stats.infoMessages ) - if( msg.type == ResultWas::Info ) - rss << msg.message << '\n'; - - rss << "at " << result.getSourceInfo(); - xml.writeText( rss.str(), false ); - } - } - - CATCH_REGISTER_REPORTER( "junit", JunitReporter ) - -} // end namespace Catch -// end catch_reporter_junit.cpp -// start catch_reporter_listening.cpp - -#include - -namespace Catch { - - ListeningReporter::ListeningReporter() { - // We will assume that listeners will always want all assertions - m_preferences.shouldReportAllAssertions = true; - } - - void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { - m_listeners.push_back( std::move( listener ) ); - } - - void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { - assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); - m_reporter = std::move( reporter ); - m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; - } - - ReporterPreferences ListeningReporter::getPreferences() const { - return m_preferences; - } - - std::set ListeningReporter::getSupportedVerbosities() { - return std::set{ }; - } - - void ListeningReporter::noMatchingTestCases( std::string const& spec ) { - for ( auto const& listener : m_listeners ) { - listener->noMatchingTestCases( spec ); - } - m_reporter->noMatchingTestCases( spec ); - } - - void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { - for ( auto const& listener : m_listeners ) { - listener->benchmarkStarting( benchmarkInfo ); - } - m_reporter->benchmarkStarting( benchmarkInfo ); - } - void ListeningReporter::benchmarkEnded( BenchmarkStats const& benchmarkStats ) { - for ( auto const& listener : m_listeners ) { - listener->benchmarkEnded( benchmarkStats ); - } - m_reporter->benchmarkEnded( benchmarkStats ); - } - - void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testRunStarting( testRunInfo ); - } - m_reporter->testRunStarting( testRunInfo ); - } - - void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testGroupStarting( groupInfo ); - } - m_reporter->testGroupStarting( groupInfo ); - } - - void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testCaseStarting( testInfo ); - } - m_reporter->testCaseStarting( testInfo ); - } - - void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { - for ( auto const& listener : m_listeners ) { - listener->sectionStarting( sectionInfo ); - } - m_reporter->sectionStarting( sectionInfo ); - } - - void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { - for ( auto const& listener : m_listeners ) { - listener->assertionStarting( assertionInfo ); - } - m_reporter->assertionStarting( assertionInfo ); - } - - // The return value indicates if the messages buffer should be cleared: - bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { - for( auto const& listener : m_listeners ) { - static_cast( listener->assertionEnded( assertionStats ) ); - } - return m_reporter->assertionEnded( assertionStats ); - } - - void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { - for ( auto const& listener : m_listeners ) { - listener->sectionEnded( sectionStats ); - } - m_reporter->sectionEnded( sectionStats ); - } - - void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - for ( auto const& listener : m_listeners ) { - listener->testCaseEnded( testCaseStats ); - } - m_reporter->testCaseEnded( testCaseStats ); - } - - void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - for ( auto const& listener : m_listeners ) { - listener->testGroupEnded( testGroupStats ); - } - m_reporter->testGroupEnded( testGroupStats ); - } - - void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { - for ( auto const& listener : m_listeners ) { - listener->testRunEnded( testRunStats ); - } - m_reporter->testRunEnded( testRunStats ); - } - - void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { - for ( auto const& listener : m_listeners ) { - listener->skipTest( testInfo ); - } - m_reporter->skipTest( testInfo ); - } - - bool ListeningReporter::isMulti() const { - return true; - } - -} // end namespace Catch -// end catch_reporter_listening.cpp -// start catch_reporter_xml.cpp - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch - // Note that 4062 (not all labels are handled - // and default is missing) is enabled -#endif - -namespace Catch { - XmlReporter::XmlReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ), - m_xml(_config.stream()) - { - m_reporterPrefs.shouldRedirectStdOut = true; - m_reporterPrefs.shouldReportAllAssertions = true; - } - - XmlReporter::~XmlReporter() = default; - - std::string XmlReporter::getDescription() { - return "Reports test results as an XML document"; - } - - std::string XmlReporter::getStylesheetRef() const { - return std::string(); - } - - void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) { - m_xml - .writeAttribute( "filename", sourceInfo.file ) - .writeAttribute( "line", sourceInfo.line ); - } - - void XmlReporter::noMatchingTestCases( std::string const& s ) { - StreamingReporterBase::noMatchingTestCases( s ); - } - - void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { - StreamingReporterBase::testRunStarting( testInfo ); - std::string stylesheetRef = getStylesheetRef(); - if( !stylesheetRef.empty() ) - m_xml.writeStylesheetRef( stylesheetRef ); - m_xml.startElement( "Catch" ); - if( !m_config->name().empty() ) - m_xml.writeAttribute( "name", m_config->name() ); - if( m_config->rngSeed() != 0 ) - m_xml.scopedElement( "Randomness" ) - .writeAttribute( "seed", m_config->rngSeed() ); - } - - void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) { - StreamingReporterBase::testGroupStarting( groupInfo ); - m_xml.startElement( "Group" ) - .writeAttribute( "name", groupInfo.name ); - } - - void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { - StreamingReporterBase::testCaseStarting(testInfo); - m_xml.startElement( "TestCase" ) - .writeAttribute( "name", trim( testInfo.name ) ) - .writeAttribute( "description", testInfo.description ) - .writeAttribute( "tags", testInfo.tagsAsString() ); - - writeSourceInfo( testInfo.lineInfo ); - - if ( m_config->showDurations() == ShowDurations::Always ) - m_testCaseTimer.start(); - m_xml.ensureTagClosed(); - } - - void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) { - StreamingReporterBase::sectionStarting( sectionInfo ); - if( m_sectionDepth++ > 0 ) { - m_xml.startElement( "Section" ) - .writeAttribute( "name", trim( sectionInfo.name ) ); - writeSourceInfo( sectionInfo.lineInfo ); - m_xml.ensureTagClosed(); - } - } - - void XmlReporter::assertionStarting( AssertionInfo const& ) { } - - bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { - - AssertionResult const& result = assertionStats.assertionResult; - - bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); - - if( includeResults || result.getResultType() == ResultWas::Warning ) { - // Print any info messages in tags. - for( auto const& msg : assertionStats.infoMessages ) { - if( msg.type == ResultWas::Info && includeResults ) { - m_xml.scopedElement( "Info" ) - .writeText( msg.message ); - } else if ( msg.type == ResultWas::Warning ) { - m_xml.scopedElement( "Warning" ) - .writeText( msg.message ); - } - } - } - - // Drop out if result was successful but we're not printing them. - if( !includeResults && result.getResultType() != ResultWas::Warning ) - return true; - - // Print the expression if there is one. - if( result.hasExpression() ) { - m_xml.startElement( "Expression" ) - .writeAttribute( "success", result.succeeded() ) - .writeAttribute( "type", result.getTestMacroName() ); - - writeSourceInfo( result.getSourceInfo() ); - - m_xml.scopedElement( "Original" ) - .writeText( result.getExpression() ); - m_xml.scopedElement( "Expanded" ) - .writeText( result.getExpandedExpression() ); - } - - // And... Print a result applicable to each result type. - switch( result.getResultType() ) { - case ResultWas::ThrewException: - m_xml.startElement( "Exception" ); - writeSourceInfo( result.getSourceInfo() ); - m_xml.writeText( result.getMessage() ); - m_xml.endElement(); - break; - case ResultWas::FatalErrorCondition: - m_xml.startElement( "FatalErrorCondition" ); - writeSourceInfo( result.getSourceInfo() ); - m_xml.writeText( result.getMessage() ); - m_xml.endElement(); - break; - case ResultWas::Info: - m_xml.scopedElement( "Info" ) - .writeText( result.getMessage() ); - break; - case ResultWas::Warning: - // Warning will already have been written - break; - case ResultWas::ExplicitFailure: - m_xml.startElement( "Failure" ); - writeSourceInfo( result.getSourceInfo() ); - m_xml.writeText( result.getMessage() ); - m_xml.endElement(); - break; - default: - break; - } - - if( result.hasExpression() ) - m_xml.endElement(); - - return true; - } - - void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { - StreamingReporterBase::sectionEnded( sectionStats ); - if( --m_sectionDepth > 0 ) { - XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); - e.writeAttribute( "successes", sectionStats.assertions.passed ); - e.writeAttribute( "failures", sectionStats.assertions.failed ); - e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); - - if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); - - m_xml.endElement(); - } - } - - void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - StreamingReporterBase::testCaseEnded( testCaseStats ); - XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); - e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); - - if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); - - if( !testCaseStats.stdOut.empty() ) - m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); - if( !testCaseStats.stdErr.empty() ) - m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); - - m_xml.endElement(); - } - - void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - StreamingReporterBase::testGroupEnded( testGroupStats ); - // TODO: Check testGroupStats.aborting and act accordingly. - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) - .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) - .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); - m_xml.endElement(); - } - - void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) { - StreamingReporterBase::testRunEnded( testRunStats ); - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", testRunStats.totals.assertions.passed ) - .writeAttribute( "failures", testRunStats.totals.assertions.failed ) - .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); - m_xml.endElement(); - } - - CATCH_REGISTER_REPORTER( "xml", XmlReporter ) - -} // end namespace Catch - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif -// end catch_reporter_xml.cpp - -namespace Catch { - LeakDetector leakDetector; -} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -// end catch_impl.hpp -#endif - -#ifdef CATCH_CONFIG_MAIN -// start catch_default_main.hpp - -#ifndef __OBJC__ - -#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) -// Standard C/C++ Win32 Unicode wmain entry point -extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { -#else -// Standard C/C++ main entry point -int main (int argc, char * argv[]) { -#endif - - return Catch::Session().run( argc, argv ); -} - -#else // __OBJC__ - -// Objective-C entry point -int main (int argc, char * const argv[]) { -#if !CATCH_ARC_ENABLED - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; -#endif - - Catch::registerTestMethods(); - int result = Catch::Session().run( argc, (char**)argv ); - -#if !CATCH_ARC_ENABLED - [pool drain]; -#endif - - return result; -} - -#endif // __OBJC__ - -// end catch_default_main.hpp -#endif - -#if !defined(CATCH_CONFIG_IMPL_ONLY) - -#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED -# undef CLARA_CONFIG_MAIN -#endif - -#if !defined(CATCH_CONFIG_DISABLE) -////// -// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ -#ifdef CATCH_CONFIG_PREFIX_ALL - -#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) -#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) - -#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ ) -#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) -#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) -#endif// CATCH_CONFIG_DISABLE_MATCHERS -#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) - -#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) -#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) - -#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) -#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) -#endif // CATCH_CONFIG_DISABLE_MATCHERS -#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) - -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) - -#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) -#endif // CATCH_CONFIG_DISABLE_MATCHERS - -#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) -#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) -#define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE",__VA_ARGS__ ) - -#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) -#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) -#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) -#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) -#define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) -#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) -#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) - -#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) -#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#else -#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) -#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) -#endif - -#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) -#define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) -#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ ) -#else -#define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ ) -#define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ ) -#endif - -// "BDD-style" convenience wrappers -#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) -#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) -#define CATCH_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) -#define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) -#define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) -#define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) -#define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) -#define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) - -// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required -#else - -#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) -#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) - -#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ ) -#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) -#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) -#endif // CATCH_CONFIG_DISABLE_MATCHERS -#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) - -#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) -#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) - -#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) -#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) -#endif // CATCH_CONFIG_DISABLE_MATCHERS -#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) - -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) - -#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) -#endif // CATCH_CONFIG_DISABLE_MATCHERS - -#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) -#define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg ) -#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) -#define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE",__VA_ARGS__ ) - -#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) -#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) -#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) -#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) -#define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) -#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) -#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) -#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) -#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) -#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#else -#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) -#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) -#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) -#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) -#endif - -#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) -#define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) -#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" ) -#else -#define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ ) -#define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ ) -#endif - -#endif - -#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) - -// "BDD-style" convenience wrappers -#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) -#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) - -#define GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) -#define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) -#define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) -#define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) -#define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) -#define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) - -using Catch::Detail::Approx; - -#else // CATCH_CONFIG_DISABLE - -////// -// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ -#ifdef CATCH_CONFIG_PREFIX_ALL - -#define CATCH_REQUIRE( ... ) (void)(0) -#define CATCH_REQUIRE_FALSE( ... ) (void)(0) - -#define CATCH_REQUIRE_THROWS( ... ) (void)(0) -#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) -#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) -#endif// CATCH_CONFIG_DISABLE_MATCHERS -#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0) - -#define CATCH_CHECK( ... ) (void)(0) -#define CATCH_CHECK_FALSE( ... ) (void)(0) -#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__) -#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) -#define CATCH_CHECK_NOFAIL( ... ) (void)(0) - -#define CATCH_CHECK_THROWS( ... ) (void)(0) -#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0) -#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) -#endif // CATCH_CONFIG_DISABLE_MATCHERS -#define CATCH_CHECK_NOTHROW( ... ) (void)(0) - -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CATCH_CHECK_THAT( arg, matcher ) (void)(0) - -#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0) -#endif // CATCH_CONFIG_DISABLE_MATCHERS - -#define CATCH_INFO( msg ) (void)(0) -#define CATCH_WARN( msg ) (void)(0) -#define CATCH_CAPTURE( msg ) (void)(0) - -#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) -#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) -#define CATCH_METHOD_AS_TEST_CASE( method, ... ) -#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) -#define CATCH_SECTION( ... ) -#define CATCH_DYNAMIC_SECTION( ... ) -#define CATCH_FAIL( ... ) (void)(0) -#define CATCH_FAIL_CHECK( ... ) (void)(0) -#define CATCH_SUCCEED( ... ) (void)(0) - -#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) -#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#else -#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) ) -#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) -#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#endif - -// "BDD-style" convenience wrappers -#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) -#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) -#define CATCH_GIVEN( desc ) -#define CATCH_AND_GIVEN( desc ) -#define CATCH_WHEN( desc ) -#define CATCH_AND_WHEN( desc ) -#define CATCH_THEN( desc ) -#define CATCH_AND_THEN( desc ) - -#define CATCH_STATIC_REQUIRE( ... ) (void)(0) -#define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) - -// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required -#else - -#define REQUIRE( ... ) (void)(0) -#define REQUIRE_FALSE( ... ) (void)(0) - -#define REQUIRE_THROWS( ... ) (void)(0) -#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) -#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) -#endif // CATCH_CONFIG_DISABLE_MATCHERS -#define REQUIRE_NOTHROW( ... ) (void)(0) - -#define CHECK( ... ) (void)(0) -#define CHECK_FALSE( ... ) (void)(0) -#define CHECKED_IF( ... ) if (__VA_ARGS__) -#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) -#define CHECK_NOFAIL( ... ) (void)(0) - -#define CHECK_THROWS( ... ) (void)(0) -#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0) -#define CHECK_THROWS_WITH( expr, matcher ) (void)(0) -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) -#endif // CATCH_CONFIG_DISABLE_MATCHERS -#define CHECK_NOTHROW( ... ) (void)(0) - -#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) -#define CHECK_THAT( arg, matcher ) (void)(0) - -#define REQUIRE_THAT( arg, matcher ) (void)(0) -#endif // CATCH_CONFIG_DISABLE_MATCHERS - -#define INFO( msg ) (void)(0) -#define WARN( msg ) (void)(0) -#define CAPTURE( msg ) (void)(0) - -#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) -#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) -#define METHOD_AS_TEST_CASE( method, ... ) -#define REGISTER_TEST_CASE( Function, ... ) (void)(0) -#define SECTION( ... ) -#define DYNAMIC_SECTION( ... ) -#define FAIL( ... ) (void)(0) -#define FAIL_CHECK( ... ) (void)(0) -#define SUCCEED( ... ) (void)(0) -#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) -#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) -#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) -#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#else -#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) ) -#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) ) -#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) -#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) -#endif - -#define STATIC_REQUIRE( ... ) (void)(0) -#define STATIC_REQUIRE_FALSE( ... ) (void)(0) - -#endif - -#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) - -// "BDD-style" convenience wrappers -#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) ) -#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) - -#define GIVEN( desc ) -#define AND_GIVEN( desc ) -#define WHEN( desc ) -#define AND_WHEN( desc ) -#define THEN( desc ) -#define AND_THEN( desc ) - -using Catch::Detail::Approx; - -#endif - -#endif // ! CATCH_CONFIG_IMPL_ONLY - -// start catch_reenable_warnings.h - - -#ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(pop) -# else -# pragma clang diagnostic pop -# endif -#elif defined __GNUC__ -# pragma GCC diagnostic pop -#endif - -// end catch_reenable_warnings.h -// end catch.hpp -#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED - diff --git a/src/hyperlight_guest_bin/third_party/printf/test/test_suite.cpp b/src/hyperlight_guest_bin/third_party/printf/test/test_suite.cpp deleted file mode 100644 index c26dc7696..000000000 --- a/src/hyperlight_guest_bin/third_party/printf/test/test_suite.cpp +++ /dev/null @@ -1,1513 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// \author (c) Marco Paland (info@paland.com) -// 2017-2019, PALANDesign Hannover, Germany -// -// \license The MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// \brief printf unit tests -// -/////////////////////////////////////////////////////////////////////////////// - -// use the 'catch' test framework -#define CATCH_CONFIG_MAIN -#include "catch.hpp" - -#include -#include -#include - - -namespace test { - // use functions in own test namespace to avoid stdio conflicts - #include "../printf.h" - #include "../printf.c" -} // namespace test - - -// dummy putchar -static char printf_buffer[100]; -static size_t printf_idx = 0U; - -void test::_putchar(char character) -{ - printf_buffer[printf_idx++] = character; -} - -void _out_fct(char character, void* arg) -{ - (void)arg; - printf_buffer[printf_idx++] = character; -} - - -TEST_CASE("printf", "[]" ) { - printf_idx = 0U; - memset(printf_buffer, 0xCC, 100U); - REQUIRE(test::printf("% d", 4232) == 5); - REQUIRE(printf_buffer[5] == (char)0xCC); - printf_buffer[5] = 0; - REQUIRE(!strcmp(printf_buffer, " 4232")); -} - - -TEST_CASE("fctprintf", "[]" ) { - printf_idx = 0U; - memset(printf_buffer, 0xCC, 100U); - test::fctprintf(&_out_fct, nullptr, "This is a test of %X", 0x12EFU); - REQUIRE(!strncmp(printf_buffer, "This is a test of 12EF", 22U)); - REQUIRE(printf_buffer[22] == (char)0xCC); -} - - -TEST_CASE("snprintf", "[]" ) { - char buffer[100]; - - test::snprintf(buffer, 100U, "%d", -1000); - REQUIRE(!strcmp(buffer, "-1000")); - - test::snprintf(buffer, 3U, "%d", -1000); - REQUIRE(!strcmp(buffer, "-1")); -} - -static void vprintf_builder_1(char* buffer, ...) -{ - va_list args; - va_start(args, buffer); - test::vprintf("%d", args); - va_end(args); -} - -static void vsnprintf_builder_1(char* buffer, ...) -{ - va_list args; - va_start(args, buffer); - test::vsnprintf(buffer, 100U, "%d", args); - va_end(args); -} - -static void vsnprintf_builder_3(char* buffer, ...) -{ - va_list args; - va_start(args, buffer); - test::vsnprintf(buffer, 100U, "%d %d %s", args); - va_end(args); -} - - -TEST_CASE("vprintf", "[]" ) { - char buffer[100]; - printf_idx = 0U; - memset(printf_buffer, 0xCC, 100U); - vprintf_builder_1(buffer, 2345); - REQUIRE(printf_buffer[4] == (char)0xCC); - printf_buffer[4] = 0; - REQUIRE(!strcmp(printf_buffer, "2345")); -} - - -TEST_CASE("vsnprintf", "[]" ) { - char buffer[100]; - - vsnprintf_builder_1(buffer, -1); - REQUIRE(!strcmp(buffer, "-1")); - - vsnprintf_builder_3(buffer, 3, -1000, "test"); - REQUIRE(!strcmp(buffer, "3 -1000 test")); -} - - -TEST_CASE("space flag", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "% d", 42); - REQUIRE(!strcmp(buffer, " 42")); - - test::sprintf(buffer, "% d", -42); - REQUIRE(!strcmp(buffer, "-42")); - - test::sprintf(buffer, "% 5d", 42); - REQUIRE(!strcmp(buffer, " 42")); - - test::sprintf(buffer, "% 5d", -42); - REQUIRE(!strcmp(buffer, " -42")); - - test::sprintf(buffer, "% 15d", 42); - REQUIRE(!strcmp(buffer, " 42")); - - test::sprintf(buffer, "% 15d", -42); - REQUIRE(!strcmp(buffer, " -42")); - - test::sprintf(buffer, "% 15d", -42); - REQUIRE(!strcmp(buffer, " -42")); - - test::sprintf(buffer, "% 15.3f", -42.987); - REQUIRE(!strcmp(buffer, " -42.987")); - - test::sprintf(buffer, "% 15.3f", 42.987); - REQUIRE(!strcmp(buffer, " 42.987")); - - test::sprintf(buffer, "% s", "Hello testing"); - REQUIRE(!strcmp(buffer, "Hello testing")); - - test::sprintf(buffer, "% d", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "% d", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "% i", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "% i", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "% u", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "% u", 4294966272U); - REQUIRE(!strcmp(buffer, "4294966272")); - - test::sprintf(buffer, "% o", 511); - REQUIRE(!strcmp(buffer, "777")); - - test::sprintf(buffer, "% o", 4294966785U); - REQUIRE(!strcmp(buffer, "37777777001")); - - test::sprintf(buffer, "% x", 305441741); - REQUIRE(!strcmp(buffer, "1234abcd")); - - test::sprintf(buffer, "% x", 3989525555U); - REQUIRE(!strcmp(buffer, "edcb5433")); - - test::sprintf(buffer, "% X", 305441741); - REQUIRE(!strcmp(buffer, "1234ABCD")); - - test::sprintf(buffer, "% X", 3989525555U); - REQUIRE(!strcmp(buffer, "EDCB5433")); - - test::sprintf(buffer, "% c", 'x'); - REQUIRE(!strcmp(buffer, "x")); -} - - -TEST_CASE("+ flag", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%+d", 42); - REQUIRE(!strcmp(buffer, "+42")); - - test::sprintf(buffer, "%+d", -42); - REQUIRE(!strcmp(buffer, "-42")); - - test::sprintf(buffer, "%+5d", 42); - REQUIRE(!strcmp(buffer, " +42")); - - test::sprintf(buffer, "%+5d", -42); - REQUIRE(!strcmp(buffer, " -42")); - - test::sprintf(buffer, "%+15d", 42); - REQUIRE(!strcmp(buffer, " +42")); - - test::sprintf(buffer, "%+15d", -42); - REQUIRE(!strcmp(buffer, " -42")); - - test::sprintf(buffer, "%+s", "Hello testing"); - REQUIRE(!strcmp(buffer, "Hello testing")); - - test::sprintf(buffer, "%+d", 1024); - REQUIRE(!strcmp(buffer, "+1024")); - - test::sprintf(buffer, "%+d", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "%+i", 1024); - REQUIRE(!strcmp(buffer, "+1024")); - - test::sprintf(buffer, "%+i", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "%+u", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%+u", 4294966272U); - REQUIRE(!strcmp(buffer, "4294966272")); - - test::sprintf(buffer, "%+o", 511); - REQUIRE(!strcmp(buffer, "777")); - - test::sprintf(buffer, "%+o", 4294966785U); - REQUIRE(!strcmp(buffer, "37777777001")); - - test::sprintf(buffer, "%+x", 305441741); - REQUIRE(!strcmp(buffer, "1234abcd")); - - test::sprintf(buffer, "%+x", 3989525555U); - REQUIRE(!strcmp(buffer, "edcb5433")); - - test::sprintf(buffer, "%+X", 305441741); - REQUIRE(!strcmp(buffer, "1234ABCD")); - - test::sprintf(buffer, "%+X", 3989525555U); - REQUIRE(!strcmp(buffer, "EDCB5433")); - - test::sprintf(buffer, "%+c", 'x'); - REQUIRE(!strcmp(buffer, "x")); - - test::sprintf(buffer, "%+.0d", 0); - REQUIRE(!strcmp(buffer, "+")); -} - - -TEST_CASE("0 flag", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%0d", 42); - REQUIRE(!strcmp(buffer, "42")); - - test::sprintf(buffer, "%0ld", 42L); - REQUIRE(!strcmp(buffer, "42")); - - test::sprintf(buffer, "%0d", -42); - REQUIRE(!strcmp(buffer, "-42")); - - test::sprintf(buffer, "%05d", 42); - REQUIRE(!strcmp(buffer, "00042")); - - test::sprintf(buffer, "%05d", -42); - REQUIRE(!strcmp(buffer, "-0042")); - - test::sprintf(buffer, "%015d", 42); - REQUIRE(!strcmp(buffer, "000000000000042")); - - test::sprintf(buffer, "%015d", -42); - REQUIRE(!strcmp(buffer, "-00000000000042")); - - test::sprintf(buffer, "%015.2f", 42.1234); - REQUIRE(!strcmp(buffer, "000000000042.12")); - - test::sprintf(buffer, "%015.3f", 42.9876); - REQUIRE(!strcmp(buffer, "00000000042.988")); - - test::sprintf(buffer, "%015.5f", -42.9876); - REQUIRE(!strcmp(buffer, "-00000042.98760")); -} - - -TEST_CASE("- flag", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%-d", 42); - REQUIRE(!strcmp(buffer, "42")); - - test::sprintf(buffer, "%-d", -42); - REQUIRE(!strcmp(buffer, "-42")); - - test::sprintf(buffer, "%-5d", 42); - REQUIRE(!strcmp(buffer, "42 ")); - - test::sprintf(buffer, "%-5d", -42); - REQUIRE(!strcmp(buffer, "-42 ")); - - test::sprintf(buffer, "%-15d", 42); - REQUIRE(!strcmp(buffer, "42 ")); - - test::sprintf(buffer, "%-15d", -42); - REQUIRE(!strcmp(buffer, "-42 ")); - - test::sprintf(buffer, "%-0d", 42); - REQUIRE(!strcmp(buffer, "42")); - - test::sprintf(buffer, "%-0d", -42); - REQUIRE(!strcmp(buffer, "-42")); - - test::sprintf(buffer, "%-05d", 42); - REQUIRE(!strcmp(buffer, "42 ")); - - test::sprintf(buffer, "%-05d", -42); - REQUIRE(!strcmp(buffer, "-42 ")); - - test::sprintf(buffer, "%-015d", 42); - REQUIRE(!strcmp(buffer, "42 ")); - - test::sprintf(buffer, "%-015d", -42); - REQUIRE(!strcmp(buffer, "-42 ")); - - test::sprintf(buffer, "%0-d", 42); - REQUIRE(!strcmp(buffer, "42")); - - test::sprintf(buffer, "%0-d", -42); - REQUIRE(!strcmp(buffer, "-42")); - - test::sprintf(buffer, "%0-5d", 42); - REQUIRE(!strcmp(buffer, "42 ")); - - test::sprintf(buffer, "%0-5d", -42); - REQUIRE(!strcmp(buffer, "-42 ")); - - test::sprintf(buffer, "%0-15d", 42); - REQUIRE(!strcmp(buffer, "42 ")); - - test::sprintf(buffer, "%0-15d", -42); - REQUIRE(!strcmp(buffer, "-42 ")); - - test::sprintf(buffer, "%0-15.3e", -42.); -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - REQUIRE(!strcmp(buffer, "-4.200e+01 ")); -#else - REQUIRE(!strcmp(buffer, "e")); -#endif - - test::sprintf(buffer, "%0-15.3g", -42.); -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - REQUIRE(!strcmp(buffer, "-42.0 ")); -#else - REQUIRE(!strcmp(buffer, "g")); -#endif -} - - -TEST_CASE("# flag", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%#.0x", 0); - REQUIRE(!strcmp(buffer, "")); - test::sprintf(buffer, "%#.1x", 0); - REQUIRE(!strcmp(buffer, "0")); - test::sprintf(buffer, "%#.0llx", (long long)0); - REQUIRE(!strcmp(buffer, "")); - test::sprintf(buffer, "%#.8x", 0x614e); - REQUIRE(!strcmp(buffer, "0x0000614e")); - test::sprintf(buffer,"%#b", 6); - REQUIRE(!strcmp(buffer, "0b110")); -} - - -TEST_CASE("specifier", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "Hello testing"); - REQUIRE(!strcmp(buffer, "Hello testing")); - - test::sprintf(buffer, "%s", "Hello testing"); - REQUIRE(!strcmp(buffer, "Hello testing")); - - test::sprintf(buffer, "%d", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%d", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "%i", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%i", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "%u", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%u", 4294966272U); - REQUIRE(!strcmp(buffer, "4294966272")); - - test::sprintf(buffer, "%o", 511); - REQUIRE(!strcmp(buffer, "777")); - - test::sprintf(buffer, "%o", 4294966785U); - REQUIRE(!strcmp(buffer, "37777777001")); - - test::sprintf(buffer, "%x", 305441741); - REQUIRE(!strcmp(buffer, "1234abcd")); - - test::sprintf(buffer, "%x", 3989525555U); - REQUIRE(!strcmp(buffer, "edcb5433")); - - test::sprintf(buffer, "%X", 305441741); - REQUIRE(!strcmp(buffer, "1234ABCD")); - - test::sprintf(buffer, "%X", 3989525555U); - REQUIRE(!strcmp(buffer, "EDCB5433")); - - test::sprintf(buffer, "%%"); - REQUIRE(!strcmp(buffer, "%")); -} - - -TEST_CASE("width", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%1s", "Hello testing"); - REQUIRE(!strcmp(buffer, "Hello testing")); - - test::sprintf(buffer, "%1d", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%1d", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "%1i", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%1i", -1024); - REQUIRE(!strcmp(buffer, "-1024")); - - test::sprintf(buffer, "%1u", 1024); - REQUIRE(!strcmp(buffer, "1024")); - - test::sprintf(buffer, "%1u", 4294966272U); - REQUIRE(!strcmp(buffer, "4294966272")); - - test::sprintf(buffer, "%1o", 511); - REQUIRE(!strcmp(buffer, "777")); - - test::sprintf(buffer, "%1o", 4294966785U); - REQUIRE(!strcmp(buffer, "37777777001")); - - test::sprintf(buffer, "%1x", 305441741); - REQUIRE(!strcmp(buffer, "1234abcd")); - - test::sprintf(buffer, "%1x", 3989525555U); - REQUIRE(!strcmp(buffer, "edcb5433")); - - test::sprintf(buffer, "%1X", 305441741); - REQUIRE(!strcmp(buffer, "1234ABCD")); - - test::sprintf(buffer, "%1X", 3989525555U); - REQUIRE(!strcmp(buffer, "EDCB5433")); - - test::sprintf(buffer, "%1c", 'x'); - REQUIRE(!strcmp(buffer, "x")); -} - - -TEST_CASE("width 20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%20s", "Hello"); - REQUIRE(!strcmp(buffer, " Hello")); - - test::sprintf(buffer, "%20d", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%20d", -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%20i", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%20i", -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%20u", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%20u", 4294966272U); - REQUIRE(!strcmp(buffer, " 4294966272")); - - test::sprintf(buffer, "%20o", 511); - REQUIRE(!strcmp(buffer, " 777")); - - test::sprintf(buffer, "%20o", 4294966785U); - REQUIRE(!strcmp(buffer, " 37777777001")); - - test::sprintf(buffer, "%20x", 305441741); - REQUIRE(!strcmp(buffer, " 1234abcd")); - - test::sprintf(buffer, "%20x", 3989525555U); - REQUIRE(!strcmp(buffer, " edcb5433")); - - test::sprintf(buffer, "%20X", 305441741); - REQUIRE(!strcmp(buffer, " 1234ABCD")); - - test::sprintf(buffer, "%20X", 3989525555U); - REQUIRE(!strcmp(buffer, " EDCB5433")); - - test::sprintf(buffer, "%20c", 'x'); - REQUIRE(!strcmp(buffer, " x")); -} - - -TEST_CASE("width *20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%*s", 20, "Hello"); - REQUIRE(!strcmp(buffer, " Hello")); - - test::sprintf(buffer, "%*d", 20, 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%*d", 20, -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%*i", 20, 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%*i", 20, -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%*u", 20, 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%*u", 20, 4294966272U); - REQUIRE(!strcmp(buffer, " 4294966272")); - - test::sprintf(buffer, "%*o", 20, 511); - REQUIRE(!strcmp(buffer, " 777")); - - test::sprintf(buffer, "%*o", 20, 4294966785U); - REQUIRE(!strcmp(buffer, " 37777777001")); - - test::sprintf(buffer, "%*x", 20, 305441741); - REQUIRE(!strcmp(buffer, " 1234abcd")); - - test::sprintf(buffer, "%*x", 20, 3989525555U); - REQUIRE(!strcmp(buffer, " edcb5433")); - - test::sprintf(buffer, "%*X", 20, 305441741); - REQUIRE(!strcmp(buffer, " 1234ABCD")); - - test::sprintf(buffer, "%*X", 20, 3989525555U); - REQUIRE(!strcmp(buffer, " EDCB5433")); - - test::sprintf(buffer, "%*c", 20,'x'); - REQUIRE(!strcmp(buffer, " x")); -} - - -TEST_CASE("width -20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%-20s", "Hello"); - REQUIRE(!strcmp(buffer, "Hello ")); - - test::sprintf(buffer, "%-20d", 1024); - REQUIRE(!strcmp(buffer, "1024 ")); - - test::sprintf(buffer, "%-20d", -1024); - REQUIRE(!strcmp(buffer, "-1024 ")); - - test::sprintf(buffer, "%-20i", 1024); - REQUIRE(!strcmp(buffer, "1024 ")); - - test::sprintf(buffer, "%-20i", -1024); - REQUIRE(!strcmp(buffer, "-1024 ")); - - test::sprintf(buffer, "%-20u", 1024); - REQUIRE(!strcmp(buffer, "1024 ")); - - test::sprintf(buffer, "%-20.4f", 1024.1234); - REQUIRE(!strcmp(buffer, "1024.1234 ")); - - test::sprintf(buffer, "%-20u", 4294966272U); - REQUIRE(!strcmp(buffer, "4294966272 ")); - - test::sprintf(buffer, "%-20o", 511); - REQUIRE(!strcmp(buffer, "777 ")); - - test::sprintf(buffer, "%-20o", 4294966785U); - REQUIRE(!strcmp(buffer, "37777777001 ")); - - test::sprintf(buffer, "%-20x", 305441741); - REQUIRE(!strcmp(buffer, "1234abcd ")); - - test::sprintf(buffer, "%-20x", 3989525555U); - REQUIRE(!strcmp(buffer, "edcb5433 ")); - - test::sprintf(buffer, "%-20X", 305441741); - REQUIRE(!strcmp(buffer, "1234ABCD ")); - - test::sprintf(buffer, "%-20X", 3989525555U); - REQUIRE(!strcmp(buffer, "EDCB5433 ")); - - test::sprintf(buffer, "%-20c", 'x'); - REQUIRE(!strcmp(buffer, "x ")); - - test::sprintf(buffer, "|%5d| |%-2d| |%5d|", 9, 9, 9); - REQUIRE(!strcmp(buffer, "| 9| |9 | | 9|")); - - test::sprintf(buffer, "|%5d| |%-2d| |%5d|", 10, 10, 10); - REQUIRE(!strcmp(buffer, "| 10| |10| | 10|")); - - test::sprintf(buffer, "|%5d| |%-12d| |%5d|", 9, 9, 9); - REQUIRE(!strcmp(buffer, "| 9| |9 | | 9|")); - - test::sprintf(buffer, "|%5d| |%-12d| |%5d|", 10, 10, 10); - REQUIRE(!strcmp(buffer, "| 10| |10 | | 10|")); -} - - -TEST_CASE("width 0-20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%0-20s", "Hello"); - REQUIRE(!strcmp(buffer, "Hello ")); - - test::sprintf(buffer, "%0-20d", 1024); - REQUIRE(!strcmp(buffer, "1024 ")); - - test::sprintf(buffer, "%0-20d", -1024); - REQUIRE(!strcmp(buffer, "-1024 ")); - - test::sprintf(buffer, "%0-20i", 1024); - REQUIRE(!strcmp(buffer, "1024 ")); - - test::sprintf(buffer, "%0-20i", -1024); - REQUIRE(!strcmp(buffer, "-1024 ")); - - test::sprintf(buffer, "%0-20u", 1024); - REQUIRE(!strcmp(buffer, "1024 ")); - - test::sprintf(buffer, "%0-20u", 4294966272U); - REQUIRE(!strcmp(buffer, "4294966272 ")); - - test::sprintf(buffer, "%0-20o", 511); - REQUIRE(!strcmp(buffer, "777 ")); - - test::sprintf(buffer, "%0-20o", 4294966785U); - REQUIRE(!strcmp(buffer, "37777777001 ")); - - test::sprintf(buffer, "%0-20x", 305441741); - REQUIRE(!strcmp(buffer, "1234abcd ")); - - test::sprintf(buffer, "%0-20x", 3989525555U); - REQUIRE(!strcmp(buffer, "edcb5433 ")); - - test::sprintf(buffer, "%0-20X", 305441741); - REQUIRE(!strcmp(buffer, "1234ABCD ")); - - test::sprintf(buffer, "%0-20X", 3989525555U); - REQUIRE(!strcmp(buffer, "EDCB5433 ")); - - test::sprintf(buffer, "%0-20c", 'x'); - REQUIRE(!strcmp(buffer, "x ")); -} - - -TEST_CASE("padding 20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%020d", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%020d", -1024); - REQUIRE(!strcmp(buffer, "-0000000000000001024")); - - test::sprintf(buffer, "%020i", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%020i", -1024); - REQUIRE(!strcmp(buffer, "-0000000000000001024")); - - test::sprintf(buffer, "%020u", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%020u", 4294966272U); - REQUIRE(!strcmp(buffer, "00000000004294966272")); - - test::sprintf(buffer, "%020o", 511); - REQUIRE(!strcmp(buffer, "00000000000000000777")); - - test::sprintf(buffer, "%020o", 4294966785U); - REQUIRE(!strcmp(buffer, "00000000037777777001")); - - test::sprintf(buffer, "%020x", 305441741); - REQUIRE(!strcmp(buffer, "0000000000001234abcd")); - - test::sprintf(buffer, "%020x", 3989525555U); - REQUIRE(!strcmp(buffer, "000000000000edcb5433")); - - test::sprintf(buffer, "%020X", 305441741); - REQUIRE(!strcmp(buffer, "0000000000001234ABCD")); - - test::sprintf(buffer, "%020X", 3989525555U); - REQUIRE(!strcmp(buffer, "000000000000EDCB5433")); -} - - -TEST_CASE("padding .20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%.20d", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%.20d", -1024); - REQUIRE(!strcmp(buffer, "-00000000000000001024")); - - test::sprintf(buffer, "%.20i", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%.20i", -1024); - REQUIRE(!strcmp(buffer, "-00000000000000001024")); - - test::sprintf(buffer, "%.20u", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%.20u", 4294966272U); - REQUIRE(!strcmp(buffer, "00000000004294966272")); - - test::sprintf(buffer, "%.20o", 511); - REQUIRE(!strcmp(buffer, "00000000000000000777")); - - test::sprintf(buffer, "%.20o", 4294966785U); - REQUIRE(!strcmp(buffer, "00000000037777777001")); - - test::sprintf(buffer, "%.20x", 305441741); - REQUIRE(!strcmp(buffer, "0000000000001234abcd")); - - test::sprintf(buffer, "%.20x", 3989525555U); - REQUIRE(!strcmp(buffer, "000000000000edcb5433")); - - test::sprintf(buffer, "%.20X", 305441741); - REQUIRE(!strcmp(buffer, "0000000000001234ABCD")); - - test::sprintf(buffer, "%.20X", 3989525555U); - REQUIRE(!strcmp(buffer, "000000000000EDCB5433")); -} - - -TEST_CASE("padding #020", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%#020d", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%#020d", -1024); - REQUIRE(!strcmp(buffer, "-0000000000000001024")); - - test::sprintf(buffer, "%#020i", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%#020i", -1024); - REQUIRE(!strcmp(buffer, "-0000000000000001024")); - - test::sprintf(buffer, "%#020u", 1024); - REQUIRE(!strcmp(buffer, "00000000000000001024")); - - test::sprintf(buffer, "%#020u", 4294966272U); - REQUIRE(!strcmp(buffer, "00000000004294966272")); - - test::sprintf(buffer, "%#020o", 511); - REQUIRE(!strcmp(buffer, "00000000000000000777")); - - test::sprintf(buffer, "%#020o", 4294966785U); - REQUIRE(!strcmp(buffer, "00000000037777777001")); - - test::sprintf(buffer, "%#020x", 305441741); - REQUIRE(!strcmp(buffer, "0x00000000001234abcd")); - - test::sprintf(buffer, "%#020x", 3989525555U); - REQUIRE(!strcmp(buffer, "0x0000000000edcb5433")); - - test::sprintf(buffer, "%#020X", 305441741); - REQUIRE(!strcmp(buffer, "0X00000000001234ABCD")); - - test::sprintf(buffer, "%#020X", 3989525555U); - REQUIRE(!strcmp(buffer, "0X0000000000EDCB5433")); -} - - -TEST_CASE("padding #20", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%#20d", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%#20d", -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%#20i", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%#20i", -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%#20u", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%#20u", 4294966272U); - REQUIRE(!strcmp(buffer, " 4294966272")); - - test::sprintf(buffer, "%#20o", 511); - REQUIRE(!strcmp(buffer, " 0777")); - - test::sprintf(buffer, "%#20o", 4294966785U); - REQUIRE(!strcmp(buffer, " 037777777001")); - - test::sprintf(buffer, "%#20x", 305441741); - REQUIRE(!strcmp(buffer, " 0x1234abcd")); - - test::sprintf(buffer, "%#20x", 3989525555U); - REQUIRE(!strcmp(buffer, " 0xedcb5433")); - - test::sprintf(buffer, "%#20X", 305441741); - REQUIRE(!strcmp(buffer, " 0X1234ABCD")); - - test::sprintf(buffer, "%#20X", 3989525555U); - REQUIRE(!strcmp(buffer, " 0XEDCB5433")); -} - - -TEST_CASE("padding 20.5", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%20.5d", 1024); - REQUIRE(!strcmp(buffer, " 01024")); - - test::sprintf(buffer, "%20.5d", -1024); - REQUIRE(!strcmp(buffer, " -01024")); - - test::sprintf(buffer, "%20.5i", 1024); - REQUIRE(!strcmp(buffer, " 01024")); - - test::sprintf(buffer, "%20.5i", -1024); - REQUIRE(!strcmp(buffer, " -01024")); - - test::sprintf(buffer, "%20.5u", 1024); - REQUIRE(!strcmp(buffer, " 01024")); - - test::sprintf(buffer, "%20.5u", 4294966272U); - REQUIRE(!strcmp(buffer, " 4294966272")); - - test::sprintf(buffer, "%20.5o", 511); - REQUIRE(!strcmp(buffer, " 00777")); - - test::sprintf(buffer, "%20.5o", 4294966785U); - REQUIRE(!strcmp(buffer, " 37777777001")); - - test::sprintf(buffer, "%20.5x", 305441741); - REQUIRE(!strcmp(buffer, " 1234abcd")); - - test::sprintf(buffer, "%20.10x", 3989525555U); - REQUIRE(!strcmp(buffer, " 00edcb5433")); - - test::sprintf(buffer, "%20.5X", 305441741); - REQUIRE(!strcmp(buffer, " 1234ABCD")); - - test::sprintf(buffer, "%20.10X", 3989525555U); - REQUIRE(!strcmp(buffer, " 00EDCB5433")); -} - - -TEST_CASE("padding neg numbers", "[]" ) { - char buffer[100]; - - // space padding - test::sprintf(buffer, "% 1d", -5); - REQUIRE(!strcmp(buffer, "-5")); - - test::sprintf(buffer, "% 2d", -5); - REQUIRE(!strcmp(buffer, "-5")); - - test::sprintf(buffer, "% 3d", -5); - REQUIRE(!strcmp(buffer, " -5")); - - test::sprintf(buffer, "% 4d", -5); - REQUIRE(!strcmp(buffer, " -5")); - - // zero padding - test::sprintf(buffer, "%01d", -5); - REQUIRE(!strcmp(buffer, "-5")); - - test::sprintf(buffer, "%02d", -5); - REQUIRE(!strcmp(buffer, "-5")); - - test::sprintf(buffer, "%03d", -5); - REQUIRE(!strcmp(buffer, "-05")); - - test::sprintf(buffer, "%04d", -5); - REQUIRE(!strcmp(buffer, "-005")); -} - - -TEST_CASE("float padding neg numbers", "[]" ) { - char buffer[100]; - - // space padding - test::sprintf(buffer, "% 3.1f", -5.); - REQUIRE(!strcmp(buffer, "-5.0")); - - test::sprintf(buffer, "% 4.1f", -5.); - REQUIRE(!strcmp(buffer, "-5.0")); - - test::sprintf(buffer, "% 5.1f", -5.); - REQUIRE(!strcmp(buffer, " -5.0")); - -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - test::sprintf(buffer, "% 6.1g", -5.); - REQUIRE(!strcmp(buffer, " -5")); - - test::sprintf(buffer, "% 6.1e", -5.); - REQUIRE(!strcmp(buffer, "-5.0e+00")); - - test::sprintf(buffer, "% 10.1e", -5.); - REQUIRE(!strcmp(buffer, " -5.0e+00")); -#endif - - // zero padding - test::sprintf(buffer, "%03.1f", -5.); - REQUIRE(!strcmp(buffer, "-5.0")); - - test::sprintf(buffer, "%04.1f", -5.); - REQUIRE(!strcmp(buffer, "-5.0")); - - test::sprintf(buffer, "%05.1f", -5.); - REQUIRE(!strcmp(buffer, "-05.0")); - - // zero padding no decimal point - test::sprintf(buffer, "%01.0f", -5.); - REQUIRE(!strcmp(buffer, "-5")); - - test::sprintf(buffer, "%02.0f", -5.); - REQUIRE(!strcmp(buffer, "-5")); - - test::sprintf(buffer, "%03.0f", -5.); - REQUIRE(!strcmp(buffer, "-05")); - -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - test::sprintf(buffer, "%010.1e", -5.); - REQUIRE(!strcmp(buffer, "-005.0e+00")); - - test::sprintf(buffer, "%07.0E", -5.); - REQUIRE(!strcmp(buffer, "-05E+00")); - - test::sprintf(buffer, "%03.0g", -5.); - REQUIRE(!strcmp(buffer, "-05")); -#endif -} - -TEST_CASE("length", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%.0s", "Hello testing"); - REQUIRE(!strcmp(buffer, "")); - - test::sprintf(buffer, "%20.0s", "Hello testing"); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%.s", "Hello testing"); - REQUIRE(!strcmp(buffer, "")); - - test::sprintf(buffer, "%20.s", "Hello testing"); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%20.0d", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%20.0d", -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%20.d", 0); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%20.0i", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%20.i", -1024); - REQUIRE(!strcmp(buffer, " -1024")); - - test::sprintf(buffer, "%20.i", 0); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%20.u", 1024); - REQUIRE(!strcmp(buffer, " 1024")); - - test::sprintf(buffer, "%20.0u", 4294966272U); - REQUIRE(!strcmp(buffer, " 4294966272")); - - test::sprintf(buffer, "%20.u", 0U); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%20.o", 511); - REQUIRE(!strcmp(buffer, " 777")); - - test::sprintf(buffer, "%20.0o", 4294966785U); - REQUIRE(!strcmp(buffer, " 37777777001")); - - test::sprintf(buffer, "%20.o", 0U); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%20.x", 305441741); - REQUIRE(!strcmp(buffer, " 1234abcd")); - - test::sprintf(buffer, "%50.x", 305441741); - REQUIRE(!strcmp(buffer, " 1234abcd")); - - test::sprintf(buffer, "%50.x%10.u", 305441741, 12345); - REQUIRE(!strcmp(buffer, " 1234abcd 12345")); - - test::sprintf(buffer, "%20.0x", 3989525555U); - REQUIRE(!strcmp(buffer, " edcb5433")); - - test::sprintf(buffer, "%20.x", 0U); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%20.X", 305441741); - REQUIRE(!strcmp(buffer, " 1234ABCD")); - - test::sprintf(buffer, "%20.0X", 3989525555U); - REQUIRE(!strcmp(buffer, " EDCB5433")); - - test::sprintf(buffer, "%20.X", 0U); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%02.0u", 0U); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%02.0d", 0); - REQUIRE(!strcmp(buffer, " ")); -} - - -TEST_CASE("float", "[]" ) { - char buffer[100]; - - // test special-case floats using math.h macros - test::sprintf(buffer, "%8f", NAN); - REQUIRE(!strcmp(buffer, " nan")); - - test::sprintf(buffer, "%8f", INFINITY); - REQUIRE(!strcmp(buffer, " inf")); - - test::sprintf(buffer, "%-8f", -INFINITY); - REQUIRE(!strcmp(buffer, "-inf ")); - -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - test::sprintf(buffer, "%+8e", INFINITY); - REQUIRE(!strcmp(buffer, " +inf")); -#endif - - test::sprintf(buffer, "%.4f", 3.1415354); - REQUIRE(!strcmp(buffer, "3.1415")); - - test::sprintf(buffer, "%.3f", 30343.1415354); - REQUIRE(!strcmp(buffer, "30343.142")); - - test::sprintf(buffer, "%.0f", 34.1415354); - REQUIRE(!strcmp(buffer, "34")); - - test::sprintf(buffer, "%.0f", 1.3); - REQUIRE(!strcmp(buffer, "1")); - - test::sprintf(buffer, "%.0f", 1.55); - REQUIRE(!strcmp(buffer, "2")); - - test::sprintf(buffer, "%.1f", 1.64); - REQUIRE(!strcmp(buffer, "1.6")); - - test::sprintf(buffer, "%.2f", 42.8952); - REQUIRE(!strcmp(buffer, "42.90")); - - test::sprintf(buffer, "%.9f", 42.8952); - REQUIRE(!strcmp(buffer, "42.895200000")); - - test::sprintf(buffer, "%.10f", 42.895223); - REQUIRE(!strcmp(buffer, "42.8952230000")); - - // this testcase checks, that the precision is truncated to 9 digits. - // a perfect working float should return the whole number - test::sprintf(buffer, "%.12f", 42.89522312345678); - REQUIRE(!strcmp(buffer, "42.895223123000")); - - // this testcase checks, that the precision is truncated AND rounded to 9 digits. - // a perfect working float should return the whole number - test::sprintf(buffer, "%.12f", 42.89522387654321); - REQUIRE(!strcmp(buffer, "42.895223877000")); - - test::sprintf(buffer, "%6.2f", 42.8952); - REQUIRE(!strcmp(buffer, " 42.90")); - - test::sprintf(buffer, "%+6.2f", 42.8952); - REQUIRE(!strcmp(buffer, "+42.90")); - - test::sprintf(buffer, "%+5.1f", 42.9252); - REQUIRE(!strcmp(buffer, "+42.9")); - - test::sprintf(buffer, "%f", 42.5); - REQUIRE(!strcmp(buffer, "42.500000")); - - test::sprintf(buffer, "%.1f", 42.5); - REQUIRE(!strcmp(buffer, "42.5")); - - test::sprintf(buffer, "%f", 42167.0); - REQUIRE(!strcmp(buffer, "42167.000000")); - - test::sprintf(buffer, "%.9f", -12345.987654321); - REQUIRE(!strcmp(buffer, "-12345.987654321")); - - test::sprintf(buffer, "%.1f", 3.999); - REQUIRE(!strcmp(buffer, "4.0")); - - test::sprintf(buffer, "%.0f", 3.5); - REQUIRE(!strcmp(buffer, "4")); - - test::sprintf(buffer, "%.0f", 4.5); - REQUIRE(!strcmp(buffer, "4")); - - test::sprintf(buffer, "%.0f", 3.49); - REQUIRE(!strcmp(buffer, "3")); - - test::sprintf(buffer, "%.1f", 3.49); - REQUIRE(!strcmp(buffer, "3.5")); - - test::sprintf(buffer, "a%-5.1f", 0.5); - REQUIRE(!strcmp(buffer, "a0.5 ")); - - test::sprintf(buffer, "a%-5.1fend", 0.5); - REQUIRE(!strcmp(buffer, "a0.5 end")); - -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - test::sprintf(buffer, "%G", 12345.678); - REQUIRE(!strcmp(buffer, "12345.7")); - - test::sprintf(buffer, "%.7G", 12345.678); - REQUIRE(!strcmp(buffer, "12345.68")); - - test::sprintf(buffer, "%.5G", 123456789.); - REQUIRE(!strcmp(buffer, "1.2346E+08")); - - test::sprintf(buffer, "%.6G", 12345.); - REQUIRE(!strcmp(buffer, "12345.0")); - - test::sprintf(buffer, "%+12.4g", 123456789.); - REQUIRE(!strcmp(buffer, " +1.235e+08")); - - test::sprintf(buffer, "%.2G", 0.001234); - REQUIRE(!strcmp(buffer, "0.0012")); - - test::sprintf(buffer, "%+10.4G", 0.001234); - REQUIRE(!strcmp(buffer, " +0.001234")); - - test::sprintf(buffer, "%+012.4g", 0.00001234); - REQUIRE(!strcmp(buffer, "+001.234e-05")); - - test::sprintf(buffer, "%.3g", -1.2345e-308); - REQUIRE(!strcmp(buffer, "-1.23e-308")); - - test::sprintf(buffer, "%+.3E", 1.23e+308); - REQUIRE(!strcmp(buffer, "+1.230E+308")); -#endif - - // out of range for float: should switch to exp notation if supported, else empty - test::sprintf(buffer, "%.1f", 1E20); -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - REQUIRE(!strcmp(buffer, "1.0e+20")); -#else - REQUIRE(!strcmp(buffer, "")); -#endif - - // brute force float - bool fail = false; - std::stringstream str; - str.precision(5); - for (float i = -100000; i < 100000; i += 1) { - test::sprintf(buffer, "%.5f", i / 10000); - str.str(""); - str << std::fixed << i / 10000; - fail = fail || !!strcmp(buffer, str.str().c_str()); - } - REQUIRE(!fail); - - -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - // brute force exp - str.setf(std::ios::scientific, std::ios::floatfield); - for (float i = -1e20; i < 1e20; i += 1e15) { - test::sprintf(buffer, "%.5f", i); - str.str(""); - str << i; - fail = fail || !!strcmp(buffer, str.str().c_str()); - } - REQUIRE(!fail); -#endif -} - - -TEST_CASE("types", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%i", 0); - REQUIRE(!strcmp(buffer, "0")); - - test::sprintf(buffer, "%i", 1234); - REQUIRE(!strcmp(buffer, "1234")); - - test::sprintf(buffer, "%i", 32767); - REQUIRE(!strcmp(buffer, "32767")); - - test::sprintf(buffer, "%i", -32767); - REQUIRE(!strcmp(buffer, "-32767")); - - test::sprintf(buffer, "%li", 30L); - REQUIRE(!strcmp(buffer, "30")); - - test::sprintf(buffer, "%li", -2147483647L); - REQUIRE(!strcmp(buffer, "-2147483647")); - - test::sprintf(buffer, "%li", 2147483647L); - REQUIRE(!strcmp(buffer, "2147483647")); - - test::sprintf(buffer, "%lli", 30LL); - REQUIRE(!strcmp(buffer, "30")); - - test::sprintf(buffer, "%lli", -9223372036854775807LL); - REQUIRE(!strcmp(buffer, "-9223372036854775807")); - - test::sprintf(buffer, "%lli", 9223372036854775807LL); - REQUIRE(!strcmp(buffer, "9223372036854775807")); - - test::sprintf(buffer, "%lu", 100000L); - REQUIRE(!strcmp(buffer, "100000")); - - test::sprintf(buffer, "%lu", 0xFFFFFFFFL); - REQUIRE(!strcmp(buffer, "4294967295")); - - test::sprintf(buffer, "%llu", 281474976710656LLU); - REQUIRE(!strcmp(buffer, "281474976710656")); - - test::sprintf(buffer, "%llu", 18446744073709551615LLU); - REQUIRE(!strcmp(buffer, "18446744073709551615")); - - test::sprintf(buffer, "%zu", 2147483647UL); - REQUIRE(!strcmp(buffer, "2147483647")); - - test::sprintf(buffer, "%zd", 2147483647UL); - REQUIRE(!strcmp(buffer, "2147483647")); - - if (sizeof(size_t) == sizeof(long)) { - test::sprintf(buffer, "%zi", -2147483647L); - REQUIRE(!strcmp(buffer, "-2147483647")); - } - else { - test::sprintf(buffer, "%zi", -2147483647LL); - REQUIRE(!strcmp(buffer, "-2147483647")); - } - - test::sprintf(buffer, "%b", 60000); - REQUIRE(!strcmp(buffer, "1110101001100000")); - - test::sprintf(buffer, "%lb", 12345678L); - REQUIRE(!strcmp(buffer, "101111000110000101001110")); - - test::sprintf(buffer, "%o", 60000); - REQUIRE(!strcmp(buffer, "165140")); - - test::sprintf(buffer, "%lo", 12345678L); - REQUIRE(!strcmp(buffer, "57060516")); - - test::sprintf(buffer, "%lx", 0x12345678L); - REQUIRE(!strcmp(buffer, "12345678")); - - test::sprintf(buffer, "%llx", 0x1234567891234567LLU); - REQUIRE(!strcmp(buffer, "1234567891234567")); - - test::sprintf(buffer, "%lx", 0xabcdefabL); - REQUIRE(!strcmp(buffer, "abcdefab")); - - test::sprintf(buffer, "%lX", 0xabcdefabL); - REQUIRE(!strcmp(buffer, "ABCDEFAB")); - - test::sprintf(buffer, "%c", 'v'); - REQUIRE(!strcmp(buffer, "v")); - - test::sprintf(buffer, "%cv", 'w'); - REQUIRE(!strcmp(buffer, "wv")); - - test::sprintf(buffer, "%s", "A Test"); - REQUIRE(!strcmp(buffer, "A Test")); - - test::sprintf(buffer, "%hhu", 0xFFFFUL); - REQUIRE(!strcmp(buffer, "255")); - - test::sprintf(buffer, "%hu", 0x123456UL); - REQUIRE(!strcmp(buffer, "13398")); - - test::sprintf(buffer, "%s%hhi %hu", "Test", 10000, 0xFFFFFFFF); - REQUIRE(!strcmp(buffer, "Test16 65535")); - - test::sprintf(buffer, "%tx", &buffer[10] - &buffer[0]); - REQUIRE(!strcmp(buffer, "a")); - -// TBD - if (sizeof(intmax_t) == sizeof(long)) { - test::sprintf(buffer, "%ji", -2147483647L); - REQUIRE(!strcmp(buffer, "-2147483647")); - } - else { - test::sprintf(buffer, "%ji", -2147483647LL); - REQUIRE(!strcmp(buffer, "-2147483647")); - } -} - - -TEST_CASE("pointer", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%p", (void*)0x1234U); - if (sizeof(void*) == 4U) { - REQUIRE(!strcmp(buffer, "00001234")); - } - else { - REQUIRE(!strcmp(buffer, "0000000000001234")); - } - - test::sprintf(buffer, "%p", (void*)0x12345678U); - if (sizeof(void*) == 4U) { - REQUIRE(!strcmp(buffer, "12345678")); - } - else { - REQUIRE(!strcmp(buffer, "0000000012345678")); - } - - test::sprintf(buffer, "%p-%p", (void*)0x12345678U, (void*)0x7EDCBA98U); - if (sizeof(void*) == 4U) { - REQUIRE(!strcmp(buffer, "12345678-7EDCBA98")); - } - else { - REQUIRE(!strcmp(buffer, "0000000012345678-000000007EDCBA98")); - } - - if (sizeof(uintptr_t) == sizeof(uint64_t)) { - test::sprintf(buffer, "%p", (void*)(uintptr_t)0xFFFFFFFFU); - REQUIRE(!strcmp(buffer, "00000000FFFFFFFF")); - } - else { - test::sprintf(buffer, "%p", (void*)(uintptr_t)0xFFFFFFFFU); - REQUIRE(!strcmp(buffer, "FFFFFFFF")); - } -} - - -TEST_CASE("unknown flag", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%kmarco", 42, 37); - REQUIRE(!strcmp(buffer, "kmarco")); -} - - -TEST_CASE("string length", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%.4s", "This is a test"); - REQUIRE(!strcmp(buffer, "This")); - - test::sprintf(buffer, "%.4s", "test"); - REQUIRE(!strcmp(buffer, "test")); - - test::sprintf(buffer, "%.7s", "123"); - REQUIRE(!strcmp(buffer, "123")); - - test::sprintf(buffer, "%.7s", ""); - REQUIRE(!strcmp(buffer, "")); - - test::sprintf(buffer, "%.4s%.2s", "123456", "abcdef"); - REQUIRE(!strcmp(buffer, "1234ab")); - - test::sprintf(buffer, "%.4.2s", "123456"); - REQUIRE(!strcmp(buffer, ".2s")); - - test::sprintf(buffer, "%.*s", 3, "123456"); - REQUIRE(!strcmp(buffer, "123")); -} - - -TEST_CASE("buffer length", "[]" ) { - char buffer[100]; - int ret; - - ret = test::snprintf(nullptr, 10, "%s", "Test"); - REQUIRE(ret == 4); - ret = test::snprintf(nullptr, 0, "%s", "Test"); - REQUIRE(ret == 4); - - buffer[0] = (char)0xA5; - ret = test::snprintf(buffer, 0, "%s", "Test"); - REQUIRE(buffer[0] == (char)0xA5); - REQUIRE(ret == 4); - - buffer[0] = (char)0xCC; - test::snprintf(buffer, 1, "%s", "Test"); - REQUIRE(buffer[0] == '\0'); - - test::snprintf(buffer, 2, "%s", "Hello"); - REQUIRE(!strcmp(buffer, "H")); -} - - -TEST_CASE("ret value", "[]" ) { - char buffer[100] ; - int ret; - - ret = test::snprintf(buffer, 6, "0%s", "1234"); - REQUIRE(!strcmp(buffer, "01234")); - REQUIRE(ret == 5); - - ret = test::snprintf(buffer, 6, "0%s", "12345"); - REQUIRE(!strcmp(buffer, "01234")); - REQUIRE(ret == 6); // '5' is truncated - - ret = test::snprintf(buffer, 6, "0%s", "1234567"); - REQUIRE(!strcmp(buffer, "01234")); - REQUIRE(ret == 8); // '567' are truncated - - ret = test::snprintf(buffer, 10, "hello, world"); - REQUIRE(ret == 12); - - ret = test::snprintf(buffer, 3, "%d", 10000); - REQUIRE(ret == 5); - REQUIRE(strlen(buffer) == 2U); - REQUIRE(buffer[0] == '1'); - REQUIRE(buffer[1] == '0'); - REQUIRE(buffer[2] == '\0'); -} - - -TEST_CASE("misc", "[]" ) { - char buffer[100]; - - test::sprintf(buffer, "%u%u%ctest%d %s", 5, 3000, 'a', -20, "bit"); - REQUIRE(!strcmp(buffer, "53000atest-20 bit")); - - test::sprintf(buffer, "%.*f", 2, 0.33333333); - REQUIRE(!strcmp(buffer, "0.33")); - - test::sprintf(buffer, "%.*d", -1, 1); - REQUIRE(!strcmp(buffer, "1")); - - test::sprintf(buffer, "%.3s", "foobar"); - REQUIRE(!strcmp(buffer, "foo")); - - test::sprintf(buffer, "% .0d", 0); - REQUIRE(!strcmp(buffer, " ")); - - test::sprintf(buffer, "%10.5d", 4); - REQUIRE(!strcmp(buffer, " 00004")); - - test::sprintf(buffer, "%*sx", -3, "hi"); - REQUIRE(!strcmp(buffer, "hi x")); - -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - test::sprintf(buffer, "%.*g", 2, 0.33333333); - REQUIRE(!strcmp(buffer, "0.33")); - - test::sprintf(buffer, "%.*e", 2, 0.33333333); - REQUIRE(!strcmp(buffer, "3.33e-01")); -#endif -} diff --git a/src/tests/c_guests/c_callbackguest/main.c b/src/tests/c_guests/c_callbackguest/main.c index e4fa2a678..47318d9d3 100644 --- a/src/tests/c_guests/c_callbackguest/main.c +++ b/src/tests/c_guests/c_callbackguest/main.c @@ -1,11 +1,9 @@ // Included from hyperlight_guest_capi/include #include "hyperlight_guest.h" -// Included from hyperlight_guest_bin/third_party/libc +// Included from hyperlight_guest_bin/third_party/picolibc #include "stdint.h" #include "stdio.h" #include "string.h" -// Included from hyperlight_guest_bin/third_party/printf -#include "printf.h" int print_output(const char *message) { int res = printf("%s", message); diff --git a/src/tests/c_guests/c_simpleguest/main.c b/src/tests/c_guests/c_simpleguest/main.c index b7a9a596f..ba0fe651d 100644 --- a/src/tests/c_guests/c_simpleguest/main.c +++ b/src/tests/c_guests/c_simpleguest/main.c @@ -1,16 +1,22 @@ // Included from hyperlight_guest_capi/include #include "hyperlight_guest.h" -// Included from hyperlight_guest_bin/third_party/libc +// Included from hyperlight_guest_bin/third_party/picolibc #include "stdint.h" #include "string.h" #include "stdlib.h" #include "assert.h" -// Included from hyperlight_guest_bin/third_party/printf -#include "printf.h" +#include "stdio.h" #define GUEST_STACK_SIZE (65536) // default stack size #define MAX_BUFFER_SIZE (1024) +#define printf_f(fmt, ...) \ + ({ \ + int _r = printf(fmt, ##__VA_ARGS__); \ + fflush(stdout); \ + _r; \ + }) + static char big_array[1024 * 1024] = {0}; const char *echo(const char *str) { return str; } @@ -29,7 +35,7 @@ hl_Vec *set_byte_array_to_zero(const hl_FunctionCall* params) { } int print_output(const char *message) { - int res = printf("%s", message); + int res = printf_f("%s", message); return res; } @@ -108,20 +114,20 @@ int malloc_and_free(int32_t size) { } int print_two_args(const char *arg1, int32_t arg2) { - int result = printf("Message: arg1:%s arg2:%d.", arg1, arg2); + int result = printf_f("Message: arg1:%s arg2:%d.", arg1, arg2); return result; } int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d.", arg1, arg2, arg3); + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld.", arg1, arg2, arg3); return result; } int print_four_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s.", arg1, arg2, + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s.", arg1, arg2, arg3, arg4); return result; @@ -129,7 +135,7 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { int print_five_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4, const char *arg5) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s.", arg1, + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s.", arg1, arg2, arg3, arg4, arg5); return result; @@ -138,7 +144,7 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { int print_six_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4, const char *arg5, bool arg6) { int result = - printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s arg6:%s.", arg1, + printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s arg6:%s.", arg1, arg2, arg3, arg4, arg5, arg6 ? "true" : "false"); return result; @@ -147,8 +153,8 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { int print_seven_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4, const char *arg5, bool arg6, bool arg7) { - int result = printf( - "Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s arg6:%s arg7:%s.", arg1, + int result = printf_f( + "Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s arg6:%s arg7:%s.", arg1, arg2, arg3, arg4, arg5, arg6 ? "true" : "false", arg7 ? "true" : "false"); return result; @@ -157,7 +163,7 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { int print_eight_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4, const char *arg5, bool arg6, bool arg7, uint32_t arg8) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s " + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s " "arg6:%s arg7:%s arg8:%d.", arg1, arg2, arg3, arg4, arg5, arg6 ? "true" : "false", arg7 ? "true" : "false", arg8); @@ -168,8 +174,8 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { int print_nine_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4, const char *arg5, bool arg6, bool arg7, uint32_t arg8, uint64_t arg9) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s " - "arg6:%s arg7:%s arg8:%d arg9:%d.", + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s " + "arg6:%s arg7:%s arg8:%d arg9:%lu.", arg1, arg2, arg3, arg4, arg5, arg6 ? "true" : "false", arg7 ? "true" : "false", arg8, arg9); @@ -179,8 +185,8 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { int print_ten_args(const char *arg1, int32_t arg2, int64_t arg3, const char *arg4, const char *arg5, bool arg6, bool arg7, uint32_t arg8, uint64_t arg9, int32_t arg10) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s " - "arg6:%s arg7:%s arg8:%d arg9:%d arg10:%d.", + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s " + "arg6:%s arg7:%s arg8:%d arg9:%lu arg10:%d.", arg1, arg2, arg3, arg4, arg5, arg6 ? "true" : "false", arg7 ? "true" : "false", arg8, arg9, arg10); @@ -191,8 +197,8 @@ int print_three_args(const char *arg1, int32_t arg2, int64_t arg3) { const char *arg4, const char *arg5, bool arg6, bool arg7, uint32_t arg8, uint64_t arg9, int32_t arg10, float arg11) { - int result = printf("Message: arg1:%s arg2:%d arg3:%d arg4:%s arg5:%s " - "arg6:%s arg7:%s arg8:%d arg9:%d arg10:%d arg11:%.3f.", + int result = printf_f("Message: arg1:%s arg2:%d arg3:%ld arg4:%s arg5:%s " + "arg6:%s arg7:%s arg8:%d arg9:%lu arg10:%d arg11:%.3f.", arg1, arg2, arg3, arg4, arg5, arg6 ? "true" : "false", arg7 ? "true" : "false", arg8, arg9, arg10, arg11); diff --git a/src/tests/rust_guests/callbackguest/Cargo.lock b/src/tests/rust_guests/callbackguest/Cargo.lock index c899d36c5..4eaf62ddb 100644 --- a/src/tests/rust_guests/callbackguest/Cargo.lock +++ b/src/tests/rust_guests/callbackguest/Cargo.lock @@ -95,6 +95,7 @@ dependencies = [ name = "hyperlight-guest-bin" version = "0.9.0" dependencies = [ + "anyhow", "buddy_system_allocator", "cc", "cfg-if", diff --git a/src/tests/rust_guests/dummyguest/Cargo.lock b/src/tests/rust_guests/dummyguest/Cargo.lock index e93ad50ef..6f2acd321 100644 --- a/src/tests/rust_guests/dummyguest/Cargo.lock +++ b/src/tests/rust_guests/dummyguest/Cargo.lock @@ -93,6 +93,7 @@ dependencies = [ name = "hyperlight-guest-bin" version = "0.9.0" dependencies = [ + "anyhow", "buddy_system_allocator", "cc", "cfg-if", @@ -140,9 +141,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.27" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "memchr" diff --git a/src/tests/rust_guests/simpleguest/Cargo.lock b/src/tests/rust_guests/simpleguest/Cargo.lock index 9081da46b..82460df36 100644 --- a/src/tests/rust_guests/simpleguest/Cargo.lock +++ b/src/tests/rust_guests/simpleguest/Cargo.lock @@ -85,6 +85,7 @@ dependencies = [ name = "hyperlight-guest-bin" version = "0.9.0" dependencies = [ + "anyhow", "buddy_system_allocator", "cc", "cfg-if", diff --git a/src/tests/rust_guests/simpleguest/Cargo.toml b/src/tests/rust_guests/simpleguest/Cargo.toml index 34925b9fc..bce87beb9 100644 --- a/src/tests/rust_guests/simpleguest/Cargo.toml +++ b/src/tests/rust_guests/simpleguest/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] hyperlight-guest = { path = "../../../hyperlight_guest" } -hyperlight-guest-bin = { path = "../../../hyperlight_guest_bin" } +hyperlight-guest-bin = { path = "../../../hyperlight_guest_bin", default-features = false } hyperlight-common = { path = "../../../hyperlight_common", default-features = false } hyperlight-guest-tracing = { path = "../../../hyperlight_guest_tracing" } log = {version = "0.4", default-features = false } diff --git a/src/tests/rust_guests/witguest/Cargo.lock b/src/tests/rust_guests/witguest/Cargo.lock index 8bf176fa6..5a95fb348 100644 --- a/src/tests/rust_guests/witguest/Cargo.lock +++ b/src/tests/rust_guests/witguest/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.20" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", "anstyle-parse", @@ -43,18 +43,18 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" dependencies = [ "anstyle", "once_cell_polyfill", @@ -69,15 +69,15 @@ checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] name = "autocfg" -version = "1.5.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" -version = "2.9.3" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "buddy_system_allocator" @@ -90,18 +90,18 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.34" +version = "1.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc" +checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951" dependencies = [ "shlex", ] [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "colorchoice" @@ -168,9 +168,9 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "hashbrown" -version = "0.15.5" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" dependencies = [ "foldhash", "serde", @@ -228,6 +228,7 @@ dependencies = [ name = "hyperlight-guest-bin" version = "0.9.0" dependencies = [ + "anyhow", "buddy_system_allocator", "cc", "cfg-if", @@ -259,9 +260,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown", @@ -291,9 +292,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jiff" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +checksum = "a194df1107f33c79f4f93d02c80798520551949d59dfad22b6157048a88cca93" dependencies = [ "jiff-static", "log", @@ -304,9 +305,9 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +checksum = "6c6e1db7ed32c6c71b759497fae34bf7933636f75a251b9e736555da426f6442" dependencies = [ "proc-macro2", "quote", @@ -315,9 +316,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.13" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -325,15 +326,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.27" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell_polyfill" @@ -343,9 +344,9 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" [[package]] name = "portable-atomic-util" @@ -386,9 +387,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.2" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -398,9 +399,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.10" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -409,9 +410,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc_version" @@ -462,9 +463,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.143" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -521,9 +522,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "wasmparser" -version = "0.238.0" +version = "0.238.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ad4ca2ecb86b79ea410cd970985665de1d05774b7107b214bc5852b1bcbad7" +checksum = "3fa99c8328024423875ae4a55345cfde8f0371327fb2d0f33b0f52a06fc44408" dependencies = [ "bitflags", "hashbrown", @@ -532,28 +533,21 @@ dependencies = [ "serde", ] -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-sys" -version = "0.60.2" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.53.3" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows-link", "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", @@ -566,51 +560,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.53.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "witguest" diff --git a/typos.toml b/typos.toml index c05ec808d..c0eb6d8ce 100644 --- a/typos.toml +++ b/typos.toml @@ -8,3 +8,4 @@ extend-exclude = ["**/*.patch", "src/hyperlight_guest_bin/third_party/**/*", "NO # typ is used for field name as type is a reserved keyword typ="typ" mmaped="mmapped" +finitel="finitel"