mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Fix some aliasing problems.
This commit is contained in:
parent
7ccbdc0d22
commit
36e22bed27
6 changed files with 94 additions and 52 deletions
|
|
@ -43,18 +43,26 @@ int
|
|||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach || p->dbl_fracl));
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
(u.s.dbl_frach || u.s.dbl_fracl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
!p->dbl_frach && !p->dbl_fracl);
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
!u.s.dbl_frach && !u.s.dbl_fracl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,30 +41,35 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
};
|
||||
|
||||
int
|
||||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
register struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
} *p = (struct IEEEdp *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct IEEEdp s;
|
||||
} u;
|
||||
|
||||
return(p->exp == 2047 && (p->manh || p->manl));
|
||||
u.v = d;
|
||||
return(u.s.exp == 2047 && (u.s.manh || u.s.manl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
register struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
} *p = (struct IEEEdp *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct IEEEdp s;
|
||||
} u;
|
||||
|
||||
return(p->exp == 2047 && !p->manh && !p->manl);
|
||||
u.v = d;
|
||||
return(u.s.exp == 2047 && !u.s.manh && !u.s.manl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,30 +41,35 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
};
|
||||
|
||||
int
|
||||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
register struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
} *p = (struct IEEEdp *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct IEEEdp s;
|
||||
} u;
|
||||
|
||||
return(p->exp == 2047 && (p->manh || p->manl));
|
||||
u.v = d;
|
||||
return (u.s.exp == 2047 && (u.s.manh || u.s.manl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
register struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
} *p = (struct IEEEdp *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct IEEEdp s;
|
||||
} u;
|
||||
|
||||
return(p->exp == 2047 && !p->manh && !p->manl);
|
||||
u.v = d;
|
||||
return (u.s.exp == 2047 && !u.s.manh && !u.s.manl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,18 +43,26 @@ int
|
|||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach || p->dbl_fracl));
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
(u.s.dbl_frach || u.s.dbl_fracl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
!p->dbl_frach && !p->dbl_fracl);
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
!u.s.dbl_frach && !u.s.dbl_fracl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,17 +43,25 @@ __FBSDID("$FreeBSD$");
|
|||
int
|
||||
isnan(double d)
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach || p->dbl_fracl));
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
(u.s.dbl_frach || u.s.dbl_fracl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(double d)
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
!p->dbl_frach && !p->dbl_fracl);
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
!u.s.dbl_frach && !u.s.dbl_fracl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,18 +44,26 @@ int
|
|||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach || p->dbl_fracl));
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
(u.s.dbl_frach || u.s.dbl_fracl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
!p->dbl_frach && !p->dbl_fracl);
|
||||
u.v = d;
|
||||
return (u.s.dbl_exp == DBL_EXP_INFNAN &&
|
||||
!u.s.dbl_frach && !u.s.dbl_fracl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue