math_private.h (226597) | math_private.h (238722) |
---|---|
1/* 2 * ==================================================== 3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 * 5 * Developed at SunPro, a Sun Microsystems, Inc. business. 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 12/* 13 * from: @(#)fdlibm.h 5.1 93/09/24 | 1/* 2 * ==================================================== 3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 * 5 * Developed at SunPro, a Sun Microsystems, Inc. business. 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 12/* 13 * from: @(#)fdlibm.h 5.1 93/09/24 |
14 * $FreeBSD: head/lib/msun/src/math_private.h 226597 2011-10-21 06:27:56Z das $ | 14 * $FreeBSD: head/lib/msun/src/math_private.h 238722 2012-07-23 19:13:55Z kargl $ |
15 */ 16 17#ifndef _MATH_PRIVATE_H_ 18#define _MATH_PRIVATE_H_ 19 20#include <sys/types.h> 21#include <machine/endian.h> 22 --- 179 unchanged lines hidden (view full) --- 202#define SET_LDBL_EXPSIGN(d,v) \ 203do { \ 204 union IEEEl2bits se_u; \ 205 se_u.e = (d); \ 206 se_u.xbits.expsign = (v); \ 207 (d) = se_u.e; \ 208} while (0) 209 | 15 */ 16 17#ifndef _MATH_PRIVATE_H_ 18#define _MATH_PRIVATE_H_ 19 20#include <sys/types.h> 21#include <machine/endian.h> 22 --- 179 unchanged lines hidden (view full) --- 202#define SET_LDBL_EXPSIGN(d,v) \ 203do { \ 204 union IEEEl2bits se_u; \ 205 se_u.e = (d); \ 206 se_u.xbits.expsign = (v); \ 207 (d) = se_u.e; \ 208} while (0) 209 |
210/* Long double constants are broken on i386. This workaround is OK always. */ 211#define LD80C(m, ex, s, v) { \ 212 /* .e = v, */ /* overwritten */ \ 213 .xbits.man = __CONCAT(m, ULL), \ 214 .xbits.expsign = (0x3fff + (ex)) | ((s) ? 0x8000 : 0), \ 215} 216 |
|
210#ifdef FLT_EVAL_METHOD 211/* 212 * Attempt to get strict C99 semantics for assignment with non-C99 compilers. 213 */ 214#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0 215#define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) 216#else 217#define STRICT_ASSIGN(type, lval, rval) do { \ 218 volatile type __lval; \ 219 \ 220 if (sizeof(type) >= sizeof(double)) \ 221 (lval) = (rval); \ 222 else { \ 223 __lval = (rval); \ 224 (lval) = __lval; \ 225 } \ 226} while (0) 227#endif | 217#ifdef FLT_EVAL_METHOD 218/* 219 * Attempt to get strict C99 semantics for assignment with non-C99 compilers. 220 */ 221#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0 222#define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) 223#else 224#define STRICT_ASSIGN(type, lval, rval) do { \ 225 volatile type __lval; \ 226 \ 227 if (sizeof(type) >= sizeof(double)) \ 228 (lval) = (rval); \ 229 else { \ 230 __lval = (rval); \ 231 (lval) = __lval; \ 232 } \ 233} while (0) 234#endif |
235#endif /* FLT_EVAL_METHOD */ 236 237/* Support switching the mode to FP_PE if necessary. */ 238#if defined(__i386__) && !defined(NO_FPSETPREC) 239#define ENTERI() \ 240 long double __retval; \ 241 fp_prec_t __oprec; \ 242 \ 243 if ((__oprec = fpgetprec()) != FP_PE) \ 244 fpsetprec(FP_PE); 245#define RETURNI(x) do { \ 246 __retval = (x); \ 247 if (__oprec != FP_PE) \ 248 fpsetprec(__oprec); \ 249 RETURNF(__retval); \ 250} while (0) 251#else 252#define ENTERI(x) 253#define RETURNI(x) RETURNF(x) |
|
228#endif 229 | 254#endif 255 |
256/* Default return statement if hack*_t() is not used. */ 257#define RETURNF(v) return (v) 258 |
|
230/* 231 * Common routine to process the arguments to nan(), nanf(), and nanl(). 232 */ 233void _scan_nan(uint32_t *__words, int __num_words, const char *__s); 234 235#ifdef _COMPLEX_H 236 237/* --- 80 unchanged lines hidden (view full) --- 318 int n; 319 320 asm("fistl %0" : "=m" (n) : "t" (x)); 321 return (n); 322} 323#define HAVE_EFFICIENT_IRINT 324#endif 325 | 259/* 260 * Common routine to process the arguments to nan(), nanf(), and nanl(). 261 */ 262void _scan_nan(uint32_t *__words, int __num_words, const char *__s); 263 264#ifdef _COMPLEX_H 265 266/* --- 80 unchanged lines hidden (view full) --- 347 int n; 348 349 asm("fistl %0" : "=m" (n) : "t" (x)); 350 return (n); 351} 352#define HAVE_EFFICIENT_IRINT 353#endif 354 |
355#if defined(__amd64__) || defined(__i386__) 356static __inline int 357irintl(long double x) 358{ 359 int n; 360 361 asm("fistl %0" : "=m" (n) : "t" (x)); 362 return (n); 363} 364#define HAVE_EFFICIENT_IRINTL 365#endif 366 |
|
326#endif /* __GNUCLIKE_ASM */ 327 328/* 329 * ieee style elementary functions 330 * 331 * We rename functions here to improve other sources' diffability 332 * against fdlibm. 333 */ --- 99 unchanged lines hidden --- | 367#endif /* __GNUCLIKE_ASM */ 368 369/* 370 * ieee style elementary functions 371 * 372 * We rename functions here to improve other sources' diffability 373 * against fdlibm. 374 */ --- 99 unchanged lines hidden --- |