Changeset 96184 in vbox
- Timestamp:
- Aug 13, 2022 12:56:07 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/nocrt/math.h
r96098 r96184 81 81 #endif 82 82 83 #if defined(__MATH_BUILTIN_CONSTANTS) \ 83 #ifndef IPRT_NOCRT_WITHOUT_MATH_CONSTANTS 84 85 # if defined(__MATH_BUILTIN_CONSTANTS) \ 84 86 || (RT_MSC_PREREQ(RT_MSC_VER_VC140) && defined(__cplusplus)) /** @todo when was this added exactly? 2015, 2017 & 2019 has it for C++. */ 85 # define HUGE_VAL __builtin_huge_val()86 # else87 # define HUGE_VAL (RT_NOCRT(__infinity).__ud)88 # endif87 # define HUGE_VAL __builtin_huge_val() 88 # else 89 # define HUGE_VAL (RT_NOCRT(__infinity).__ud) 90 # endif 89 91 90 92 /* 91 93 * XOPEN/SVID 92 94 */ 93 # if 1/* __BSD_VISIBLE || __XSI_VISIBLE*/94 # define M_E 2.7182818284590452354 /* e */95 # define M_LOG2E 1.4426950408889634074 /* log 2e */96 # define M_LOG10E 0.43429448190325182765 /* log 10e */97 # define M_LN2 0.69314718055994530942 /* log e2 */98 # define M_LN10 2.30258509299404568402 /* log e10 */99 # define M_PI 3.14159265358979323846 /* pi */100 # define M_PI_2 1.57079632679489661923 /* pi/2 */101 # define M_PI_4 0.78539816339744830962 /* pi/4 */102 # define M_1_PI 0.31830988618379067154 /* 1/pi */103 # define M_2_PI 0.63661977236758134308 /* 2/pi */104 # define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */105 # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */106 # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */107 108 # define MAXFLOAT ((float)3.40282346638528860e+38)95 # if 1/* __BSD_VISIBLE || __XSI_VISIBLE*/ 96 # define M_E 2.7182818284590452354 /* e */ 97 # define M_LOG2E 1.4426950408889634074 /* log 2e */ 98 # define M_LOG10E 0.43429448190325182765 /* log 10e */ 99 # define M_LN2 0.69314718055994530942 /* log e2 */ 100 # define M_LN10 2.30258509299404568402 /* log e10 */ 101 # define M_PI 3.14159265358979323846 /* pi */ 102 # define M_PI_2 1.57079632679489661923 /* pi/2 */ 103 # define M_PI_4 0.78539816339744830962 /* pi/4 */ 104 # define M_1_PI 0.31830988618379067154 /* 1/pi */ 105 # define M_2_PI 0.63661977236758134308 /* 2/pi */ 106 # define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ 107 # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ 108 # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 109 110 # define MAXFLOAT ((float)3.40282346638528860e+38) 109 111 extern int RT_NOCRT(signgam); 110 # endif /* __BSD_VISIBLE || __XSI_VISIBLE */111 112 # if 1/* __BSD_VISIBLE*/113 # if 0112 # endif /* __BSD_VISIBLE || __XSI_VISIBLE */ 113 114 # if 1/* __BSD_VISIBLE*/ 115 # if 0 114 116 /* Old value from 4.4BSD-Lite math.h; this is probably better. */ 115 #define HUGE HUGE_VAL 116 #else 117 #define HUGE MAXFLOAT 118 #endif 119 #endif /* __BSD_VISIBLE */ 117 # define HUGE HUGE_VAL 118 # else 119 # define HUGE MAXFLOAT 120 # endif 121 # endif /* __BSD_VISIBLE */ 122 123 #endif /* !IPRT_NOCRT_WITHOUT_MATH_CONSTANTS */ 120 124 121 125 /* … … 430 434 #endif /* __ISO_C_VISIBLE >= 1999 */ 431 435 432 #if 1/*def __USE_GNU*/436 #ifndef IPRT_NOCRT_WITHOUT_MATH_CONSTANTS /*def __USE_GNU*/ 433 437 /* 434 438 * In GLIBC there are long variants of the XOPEN/SVID constant 435 439 * block some pages ago. We need this to get the math tests going. 436 440 */ 437 # define M_El 2.7182818284590452353602874713526625L438 # define M_LOG2El 1.4426950408889634073599246810018921L439 # define M_LOG10El 0.4342944819032518276511289189166051L440 # define M_LN2l 0.6931471805599453094172321214581766L441 # define M_LN10l 2.3025850929940456840179914546843642L442 # define M_PIl 3.1415926535897932384626433832795029L443 # define M_PI_2l 1.5707963267948966192313216916397514L444 # define M_PI_4l 0.7853981633974483096156608458198757L445 # define M_1_PIl 0.3183098861837906715377675267450287L446 # define M_2_PIl 0.6366197723675813430755350534900574L447 # define M_2_SQRTPIl 1.1283791670955125738961589031215452L448 # define M_SQRT2l 1.4142135623730950488016887242096981L449 # define M_SQRT1_2l 0.7071067811865475244008443621048490L450 #endif 441 # define M_El 2.7182818284590452353602874713526625L 442 # define M_LOG2El 1.4426950408889634073599246810018921L 443 # define M_LOG10El 0.4342944819032518276511289189166051L 444 # define M_LN2l 0.6931471805599453094172321214581766L 445 # define M_LN10l 2.3025850929940456840179914546843642L 446 # define M_PIl 3.1415926535897932384626433832795029L 447 # define M_PI_2l 1.5707963267948966192313216916397514L 448 # define M_PI_4l 0.7853981633974483096156608458198757L 449 # define M_1_PIl 0.3183098861837906715377675267450287L 450 # define M_2_PIl 0.6366197723675813430755350534900574L 451 # define M_2_SQRTPIl 1.1283791670955125738961589031215452L 452 # define M_SQRT2l 1.4142135623730950488016887242096981L 453 # define M_SQRT1_2l 0.7071067811865475244008443621048490L 454 #endif /* !IPRT_NOCRT_WITHOUT_MATH_CONSTANTS */ 451 455 452 456 #if 1/*def __USE_GNU*/ … … 479 483 480 484 /* bird 2022-08-03: moved this block down so we can prototype isnan & isinf without runnning into the macro forms. */ 481 #if 1/* __ISO_C_VISIBLE >= 1999*/482 # define FP_ILOGB0 (-__INT_MAX)483 # define FP_ILOGBNAN __INT_MAX484 485 # ifdef __MATH_BUILTIN_CONSTANTS486 # define HUGE_VALF __builtin_huge_valf()487 # define HUGE_VALL __builtin_huge_vall()488 # define INFINITY __builtin_inf()489 # define NAN __builtin_nan("")490 # elif RT_MSC_PREREQ(RT_MSC_VER_VC140) && defined(__cplusplus)485 #ifndef IPRT_NOCRT_WITHOUT_MATH_CONSTANTS /* __ISO_C_VISIBLE >= 1999*/ 486 # define FP_ILOGB0 (-__INT_MAX) 487 # define FP_ILOGBNAN __INT_MAX 488 489 # ifdef __MATH_BUILTIN_CONSTANTS 490 # define HUGE_VALF __builtin_huge_valf() 491 # define HUGE_VALL __builtin_huge_vall() 492 # define INFINITY __builtin_inf() 493 # define NAN __builtin_nan("") 494 # elif RT_MSC_PREREQ(RT_MSC_VER_VC140) && defined(__cplusplus) 491 495 /** @todo When were these introduced exactly? 2015, 2017 & 2019 has them. 492 496 * However, they only work in C++ even if the c1.dll includes the strings. Oh, well. */ 493 # define HUGE_VALF __builtin_huge_valf()494 # define HUGE_VALL __builtin_huge_val()495 # define INFINITY __builtin_huge_val()496 # define NAN __builtin_nan("0") /* same as we use in climits */497 # else498 # define HUGE_VALF (float)HUGE_VAL499 # define HUGE_VALL (long double)HUGE_VAL500 # define INFINITY HUGE_VALF501 # define NAN (__nanf.__uf)502 # endif /* __MATH_BUILTIN_CONSTANTS */503 504 # ifndef IPRT_NO_CRT505 # define MATH_ERRNO 1506 # endif507 # define MATH_ERREXCEPT 2508 # define math_errhandling MATH_ERREXCEPT497 # define HUGE_VALF __builtin_huge_valf() 498 # define HUGE_VALL __builtin_huge_val() 499 # define INFINITY __builtin_huge_val() 500 # define NAN __builtin_nan("0") /* same as we use in climits */ 501 # else 502 # define HUGE_VALF (float)HUGE_VAL 503 # define HUGE_VALL (long double)HUGE_VAL 504 # define INFINITY HUGE_VALF 505 # define NAN (__nanf.__uf) 506 # endif /* __MATH_BUILTIN_CONSTANTS */ 507 508 # ifndef IPRT_NO_CRT 509 # define MATH_ERRNO 1 510 # endif 511 # define MATH_ERREXCEPT 2 512 # define math_errhandling MATH_ERREXCEPT 509 513 510 514 /* XXX We need a <machine/math.h>. */ 511 # if defined(__ia64__) || defined(__sparc64__)512 # define FP_FAST_FMA513 # endif514 # ifdef __ia64__515 # define FP_FAST_FMAL516 # endif517 # define FP_FAST_FMAF515 # if defined(__ia64__) || defined(__sparc64__) 516 # define FP_FAST_FMA 517 # endif 518 # ifdef __ia64__ 519 # define FP_FAST_FMAL 520 # endif 521 # define FP_FAST_FMAF 518 522 519 523 /* Symbolic constants to classify floating point numbers. */ 520 # define FP_INFINITE 0x01521 # define FP_NAN 0x02522 # define FP_NORMAL 0x04523 # define FP_SUBNORMAL 0x08524 # define FP_ZERO 0x10525 # define fpclassify(x) \524 # define FP_INFINITE 0x01 525 # define FP_NAN 0x02 526 # define FP_NORMAL 0x04 527 # define FP_SUBNORMAL 0x08 528 # define FP_ZERO 0x10 529 # define fpclassify(x) \ 526 530 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__fpclassifyf)(x) \ 527 531 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__fpclassifyd)(x) \ 528 532 : RT_NOCRT(__fpclassifyl)(x)) 529 533 530 # define isfinite(x) \534 # define isfinite(x) \ 531 535 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__isfinitef)(x) \ 532 536 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__isfinite)(x) \ 533 537 : RT_NOCRT(__isfinitel)(x)) 534 # define isinf(x) \538 # define isinf(x) \ 535 539 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__isinff)(x) \ 536 540 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(isinf)(x) \ 537 541 : RT_NOCRT(__isinfl)(x)) 538 # define isnan(x) \542 # define isnan(x) \ 539 543 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(isnanf)(x) \ 540 544 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(isnan)(x) \ 541 545 : RT_NOCRT(__isnanl)(x)) 542 # define isnormal(x) \546 # define isnormal(x) \ 543 547 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__isnormalf)(x) \ 544 548 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__isnormal)(x) \ 545 549 : RT_NOCRT(__isnormall)(x)) 546 550 547 # ifdef __MATH_BUILTIN_RELOPS548 # define isgreater(x, y) __builtin_isgreater((x), (y))549 # define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))550 # define isless(x, y) __builtin_isless((x), (y))551 # define islessequal(x, y) __builtin_islessequal((x), (y))552 # define islessgreater(x, y) __builtin_islessgreater((x), (y))553 # define isunordered(x, y) __builtin_isunordered((x), (y))554 # else555 # define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))556 # define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))557 # define isless(x, y) (!isunordered((x), (y)) && (x) < (y))558 # define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))559 # define islessgreater(x, y) (!isunordered((x), (y)) && \551 # ifdef __MATH_BUILTIN_RELOPS 552 # define isgreater(x, y) __builtin_isgreater((x), (y)) 553 # define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y)) 554 # define isless(x, y) __builtin_isless((x), (y)) 555 # define islessequal(x, y) __builtin_islessequal((x), (y)) 556 # define islessgreater(x, y) __builtin_islessgreater((x), (y)) 557 # define isunordered(x, y) __builtin_isunordered((x), (y)) 558 # else 559 # define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y)) 560 # define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y)) 561 # define isless(x, y) (!isunordered((x), (y)) && (x) < (y)) 562 # define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y)) 563 # define islessgreater(x, y) (!isunordered((x), (y)) && \ 560 564 ((x) > (y) || (y) > (x))) 561 # define isunordered(x, y) (isnan(x) || isnan(y))562 # endif /* __MATH_BUILTIN_RELOPS */563 564 # define signbit(x) \565 # define isunordered(x, y) (isnan(x) || isnan(y)) 566 # endif /* __MATH_BUILTIN_RELOPS */ 567 568 # define signbit(x) \ 565 569 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__signbitf)(x) \ 566 570 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__signbit)(x) \ … … 569 573 typedef double double_t; 570 574 typedef float float_t; 571 #endif /* __ISO_C_VISIBLE >= 1999 */575 #endif /* !IPRT_NOCRT_WITHOUT_MATH_CONSTANTS */ /* __ISO_C_VISIBLE >= 1999 */ 572 576 573 577 -
trunk/include/iprt/nocrt/stdlib.h
r96147 r96184 85 85 } 86 86 87 int RT_NOCRT(abs)(int) ;88 long RT_NOCRT(labs)(long) ;89 long long RT_NOCRT(llabs)(long long) ;90 int RT_NOCRT(rand)(void) ;91 void RT_NOCRT(srand)(unsigned) ;92 long RT_NOCRT(strtol)(const char *psz, char **ppszNext, int iBase) ;93 long long RT_NOCRT(strtoll)(const char *psz, char **ppszNext, int iBase) ;94 unsigned long RT_NOCRT(strtoul)(const char *psz, char **ppszNext, int iBase) ;95 unsigned long long RT_NOCRT(strtoull)(const char *psz, char **ppszNext, int iBase) ;96 int RT_NOCRT(atoi)(const char *psz) ;97 double RT_NOCRT(strtod)(const char *psz, char **ppszNext) ;98 double RT_NOCRT(atof)(const char *psz) ;87 int RT_NOCRT(abs)(int) RT_NOEXCEPT; 88 long RT_NOCRT(labs)(long) RT_NOEXCEPT; 89 long long RT_NOCRT(llabs)(long long) RT_NOEXCEPT; 90 int RT_NOCRT(rand)(void) RT_NOEXCEPT; 91 void RT_NOCRT(srand)(unsigned) RT_NOEXCEPT; 92 long RT_NOCRT(strtol)(const char *psz, char **ppszNext, int iBase) RT_NOEXCEPT; 93 long long RT_NOCRT(strtoll)(const char *psz, char **ppszNext, int iBase) RT_NOEXCEPT; 94 unsigned long RT_NOCRT(strtoul)(const char *psz, char **ppszNext, int iBase) RT_NOEXCEPT; 95 unsigned long long RT_NOCRT(strtoull)(const char *psz, char **ppszNext, int iBase) RT_NOEXCEPT; 96 int RT_NOCRT(atoi)(const char *psz) RT_NOEXCEPT; 97 double RT_NOCRT(strtod)(const char *psz, char **ppszNext) RT_NOEXCEPT; 98 double RT_NOCRT(atof)(const char *psz) RT_NOEXCEPT; 99 99 void *RT_NOCRT(bsearch)(const void *pvKey, const void *pvBase, size_t cEntries, size_t cbEntry, 100 100 int (*pfnCompare)(const void *pvKey, const void *pvEntry)); -
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r94971 r96184 197 197 endif 198 198 199 if1of ($(KBUILD_TARGET_ARCH), x86 amd64) 200 PROGRAMS += \ 201 tstNoCrt-1 202 if1of ($(KBUILD_TARGET), win) 203 PROGRAMS += \ 204 tstRTNoCrt-2 205 endif 206 endif 207 199 208 if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_ONLY_VALIDATIONKIT) # Not needed for the Validation Kit (yet). 200 209 PROGRAMS += \ … … 202 211 tstLdr-3 \ 203 212 tstLdr-4 \ 204 tstNoCrt-1 \205 213 tstTSC 206 214 if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win" … … 573 581 ../common/string/strlen.asm 574 582 583 tstRTNoCrt-2_TEMPLATE = VBOXR3TSTEXE 584 tstRTNoCrt-2_DEFS = RT_WITHOUT_NOCRT_WRAPPER_ALIASES 585 tstRTNoCrt-2_INCS = ../include 586 tstRTNoCrt-2_SDKS = VBOX_SOFTFLOAT 587 tstRTNoCrt-2_SOURCES = \ 588 tstRTNoCrt-2.cpp \ 589 \ 590 ../common/math/copysign.cpp \ 591 ../common/math/copysignf.cpp \ 592 ../common/math/copysignl.cpp \ 593 ../common/math/fma.cpp \ 594 ../common/math/fmaf.cpp \ 595 ../common/math/fmax.cpp \ 596 ../common/math/fmaxf.cpp \ 597 ../common/math/fmaxl.cpp \ 598 ../common/math/fmin.cpp \ 599 ../common/math/fminf.cpp \ 600 ../common/math/fminl.cpp \ 601 ../common/math/isinf.cpp \ 602 ../common/math/isnan.cpp \ 603 ../common/math/isnanf.cpp \ 604 ../common/math/llround.cpp \ 605 ../common/math/llroundf.cpp \ 606 ../common/math/lround.cpp \ 607 ../common/math/lroundf.cpp \ 608 ../common/math/nocrt-abs.cpp \ 609 ../common/math/nocrt-labs.cpp \ 610 ../common/math/nocrt-llabs.cpp \ 611 ../common/math/round.cpp \ 612 ../common/math/roundf.cpp \ 613 ../common/math/__fpclassifyd.cpp \ 614 ../common/math/__fpclassifyf.cpp \ 615 ../common/math/__fpclassifyl.cpp \ 616 ../common/math/__isfinite.cpp \ 617 ../common/math/__isfinitef.cpp \ 618 ../common/math/__isfinitel.cpp \ 619 ../common/math/__isinff.cpp \ 620 ../common/math/__isinfl.cpp \ 621 ../common/math/__isnanl.cpp \ 622 ../common/math/__isnormal.cpp \ 623 ../common/math/__isnormalf.cpp \ 624 ../common/math/__isnormall.cpp \ 625 ../common/math/__signbit.cpp \ 626 ../common/math/__signbitf.cpp \ 627 ../common/math/__signbitl.cpp 628 629 if1of ($(KBUILD_TARGET_ARCH), x86 amd64) 630 tstRTNoCrt-2_SOURCES += \ 631 ../common/math/atan.asm \ 632 ../common/math/atan2.asm \ 633 ../common/math/atan2f.asm \ 634 ../common/math/atanf.asm \ 635 ../common/math/ceil.asm \ 636 ../common/math/ceilf.asm \ 637 ../common/math/cos.asm \ 638 ../common/math/cosf.asm \ 639 ../common/math/cosl.asm \ 640 ../common/math/exp2.asm \ 641 ../common/math/exp2f.asm \ 642 ../common/math/fabs.asm \ 643 ../common/math/fabsf.asm \ 644 ../common/math/floor.asm \ 645 ../common/math/floorf.asm \ 646 ../common/math/fma-asm.asm \ 647 ../common/math/fmaf-asm.asm \ 648 ../common/math/ldexp.asm \ 649 ../common/math/ldexpf.asm \ 650 ../common/math/llrint.asm \ 651 ../common/math/llrintf.asm \ 652 ../common/math/log.asm \ 653 ../common/math/logf.asm \ 654 ../common/math/lrint.asm \ 655 ../common/math/lrintf.asm \ 656 ../common/math/remainder.asm \ 657 ../common/math/remainderf.asm \ 658 ../common/math/rint.asm \ 659 ../common/math/rintf.asm \ 660 ../common/math/sin.asm \ 661 ../common/math/sinf.asm \ 662 ../common/math/sqrt.asm \ 663 ../common/math/sqrtf.asm \ 664 ../common/math/tan.asm \ 665 ../common/math/tanf.asm \ 666 ../common/math/trunc.asm \ 667 ../common/math/truncf.asm 668 endif 669 575 670 tstRTNtPath-1_TEMPLATE = VBOXR3TSTEXE 576 671 tstRTNtPath-1_SOURCES = tstRTNtPath-1.cpp
Note:
See TracChangeset
for help on using the changeset viewer.