diff options
| author | 3gg <3gg@shellblade.net> | 2026-03-06 13:30:59 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2026-03-06 13:30:59 -0800 |
| commit | 30f41c02aec763d32e62351452da9ef582bc3472 (patch) | |
| tree | 6bec3f65bfdcbf7f1a631da21a6d613bef5db2fa /contrib/SDL-3.2.8/src/libm/s_modf.c | |
| parent | 452ff21ca02e315c64ceeb3f21c1ea357aeb1bc8 (diff) | |
Move contrib libraries to contrib repo
Diffstat (limited to 'contrib/SDL-3.2.8/src/libm/s_modf.c')
| -rw-r--r-- | contrib/SDL-3.2.8/src/libm/s_modf.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/contrib/SDL-3.2.8/src/libm/s_modf.c b/contrib/SDL-3.2.8/src/libm/s_modf.c deleted file mode 100644 index 55f83ba..0000000 --- a/contrib/SDL-3.2.8/src/libm/s_modf.c +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | #include "SDL_internal.h" | ||
| 2 | /* | ||
| 3 | * ==================================================== | ||
| 4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | ||
| 5 | * | ||
| 6 | * Developed at SunPro, a Sun Microsystems, Inc. business. | ||
| 7 | * Permission to use, copy, modify, and distribute this | ||
| 8 | * software is freely granted, provided that this notice | ||
| 9 | * is preserved. | ||
| 10 | * ==================================================== | ||
| 11 | */ | ||
| 12 | |||
| 13 | /* | ||
| 14 | * modf(double x, double *iptr) | ||
| 15 | * return fraction part of x, and return x's integral part in *iptr. | ||
| 16 | * Method: | ||
| 17 | * Bit twiddling. | ||
| 18 | * | ||
| 19 | * Exception: | ||
| 20 | * No exception. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "math_libm.h" | ||
| 24 | #include "math_private.h" | ||
| 25 | |||
| 26 | static const double one = 1.0; | ||
| 27 | |||
| 28 | double modf(double x, double *iptr) | ||
| 29 | { | ||
| 30 | int32_t i0,i1,_j0; | ||
| 31 | u_int32_t i; | ||
| 32 | EXTRACT_WORDS(i0,i1,x); | ||
| 33 | _j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */ | ||
| 34 | if(_j0<20) { /* integer part in high x */ | ||
| 35 | if(_j0<0) { /* |x|<1 */ | ||
| 36 | INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */ | ||
| 37 | return x; | ||
| 38 | } else { | ||
| 39 | i = (0x000fffff)>>_j0; | ||
| 40 | if(((i0&i)|i1)==0) { /* x is integral */ | ||
| 41 | *iptr = x; | ||
| 42 | INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ | ||
| 43 | return x; | ||
| 44 | } else { | ||
| 45 | INSERT_WORDS(*iptr,i0&(~i),0); | ||
| 46 | return x - *iptr; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | } else if (_j0>51) { /* no fraction part */ | ||
| 50 | *iptr = x*one; | ||
| 51 | /* We must handle NaNs separately. */ | ||
| 52 | if (_j0 == 0x400 && ((i0 & 0xfffff) | i1)) | ||
| 53 | return x*one; | ||
| 54 | INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ | ||
| 55 | return x; | ||
| 56 | } else { /* fraction part in low x */ | ||
| 57 | i = ((u_int32_t)(0xffffffff))>>(_j0-20); | ||
| 58 | if((i1&i)==0) { /* x is integral */ | ||
| 59 | *iptr = x; | ||
| 60 | INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ | ||
| 61 | return x; | ||
| 62 | } else { | ||
| 63 | INSERT_WORDS(*iptr,i0,i1&(~i)); | ||
| 64 | return x - *iptr; | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } | ||
| 68 | libm_hidden_def(modf) | ||
