⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbl_float.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 3 页
字号:
#define Dbl_setinfinity(dbl_valueA,dbl_valueB,sign)		\    Dallp1(dbl_valueA) = ((unsigned int)sign << 31) | 		\	(DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH)));	\    Dmantissap2(dbl_valueB) = 0#define Dbl_sethigh4bits(dbl_value, extsign) Deposit_dhigh4p1(dbl_value,extsign)#define Dbl_set_sign(dbl_value,sign) Deposit_dsign(dbl_value,sign)#define Dbl_invert_sign(dbl_value) Deposit_dsign(dbl_value,~Dsign(dbl_value))#define Dbl_setone_sign(dbl_value) Deposit_dsign(dbl_value,1)#define Dbl_setone_lowmantissap2(dbl_value) Deposit_dlowp2(dbl_value,1)#define Dbl_setzero_sign(dbl_value) Dallp1(dbl_value) &= 0x7fffffff#define Dbl_setzero_exponent(dbl_value) 		\    Dallp1(dbl_value) &= 0x800fffff#define Dbl_setzero_mantissa(dbl_valueA,dbl_valueB)	\    Dallp1(dbl_valueA) &= 0xfff00000; 			\    Dallp2(dbl_valueB) = 0#define Dbl_setzero_mantissap1(dbl_value) Dallp1(dbl_value) &= 0xfff00000#define Dbl_setzero_mantissap2(dbl_value) Dallp2(dbl_value) = 0#define Dbl_setzero_exponentmantissa(dbl_valueA,dbl_valueB)	\    Dallp1(dbl_valueA) &= 0x80000000;		\    Dallp2(dbl_valueB) = 0#define Dbl_setzero_exponentmantissap1(dbl_valueA)	\    Dallp1(dbl_valueA) &= 0x80000000#define Dbl_setzero(dbl_valueA,dbl_valueB) \    Dallp1(dbl_valueA) = 0; Dallp2(dbl_valueB) = 0#define Dbl_setzerop1(dbl_value) Dallp1(dbl_value) = 0#define Dbl_setzerop2(dbl_value) Dallp2(dbl_value) = 0#define Dbl_setnegativezero(dbl_value) \    Dallp1(dbl_value) = (unsigned int)1 << 31; Dallp2(dbl_value) = 0#define Dbl_setnegativezerop1(dbl_value) Dallp1(dbl_value) = (unsigned int)1<<31/* Use the following macro for both overflow & underflow conditions */#define ovfl -#define unfl +#define Dbl_setwrapped_exponent(dbl_value,exponent,op) \    Deposit_dexponent(dbl_value,(exponent op DBL_WRAP))#define Dbl_setlargestpositive(dbl_valueA,dbl_valueB) 			\    Dallp1(dbl_valueA) = ((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \			| ((1<<(32-(1+DBL_EXP_LENGTH))) - 1 );		\    Dallp2(dbl_valueB) = 0xFFFFFFFF#define Dbl_setlargestnegative(dbl_valueA,dbl_valueB) 			\    Dallp1(dbl_valueA) = ((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \			| ((1<<(32-(1+DBL_EXP_LENGTH))) - 1 )		\			| ((unsigned int)1<<31);			\    Dallp2(dbl_valueB) = 0xFFFFFFFF#define Dbl_setlargest_exponentmantissa(dbl_valueA,dbl_valueB)		\    Deposit_dexponentmantissap1(dbl_valueA,				\	(((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH)))		\			| ((1<<(32-(1+DBL_EXP_LENGTH))) - 1 )));	\    Dallp2(dbl_valueB) = 0xFFFFFFFF#define Dbl_setnegativeinfinity(dbl_valueA,dbl_valueB) 			\    Dallp1(dbl_valueA) = ((1<<DBL_EXP_LENGTH) | DBL_INFINITY_EXPONENT) 	\			 << (32-(1+DBL_EXP_LENGTH)) ; 			\    Dallp2(dbl_valueB) = 0#define Dbl_setlargest(dbl_valueA,dbl_valueB,sign)			\    Dallp1(dbl_valueA) = ((unsigned int)sign << 31) |			\         ((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) |	 	\	 ((1 << (32-(1+DBL_EXP_LENGTH))) - 1 );				\    Dallp2(dbl_valueB) = 0xFFFFFFFF    /* The high bit is always zero so arithmetic or logical shifts will work. */#define Dbl_right_align(srcdstA,srcdstB,shift,extent)			\    if( shift >= 32 ) 							\	{								\	/* Big shift requires examining the portion shift off 		\	the end to properly set inexact.  */				\	if(shift < 64)							\	    {								\	    if(shift > 32)						\		{							\	        Variable_shift_double(Dallp1(srcdstA),Dallp2(srcdstB),	\		 shift-32, Extall(extent));				\	        if(Dallp2(srcdstB) << 64 - (shift)) Ext_setone_low(extent); \	        }							\	    else Extall(extent) = Dallp2(srcdstB);			\	    Dallp2(srcdstB) = Dallp1(srcdstA) >> (shift - 32);		\	    }								\	else								\	    {								\	    Extall(extent) = Dallp1(srcdstA);				\	    if(Dallp2(srcdstB)) Ext_setone_low(extent);			\	    Dallp2(srcdstB) = 0;					\	    }								\	Dallp1(srcdstA) = 0;						\	}								\    else								\	{								\	/* Small alignment is simpler.  Extension is easily set. */	\	if (shift > 0)							\	    {								\	    Extall(extent) = Dallp2(srcdstB) << 32 - (shift);		\	    Variable_shift_double(Dallp1(srcdstA),Dallp2(srcdstB),shift, \	     Dallp2(srcdstB));						\	    Dallp1(srcdstA) >>= shift;					\	    }								\	else Extall(extent) = 0;					\	}/*  * Here we need to shift the result right to correct for an overshift * (due to the exponent becoming negative) during normalization. */#define Dbl_fix_overshift(srcdstA,srcdstB,shift,extent)			\	    Extall(extent) = Dallp2(srcdstB) << 32 - (shift);		\	    Dallp2(srcdstB) = (Dallp1(srcdstA) << 32 - (shift)) |	\		(Dallp2(srcdstB) >> (shift));				\	    Dallp1(srcdstA) = Dallp1(srcdstA) >> shift#define Dbl_hiddenhigh3mantissa(dbl_value) Dhiddenhigh3mantissa(dbl_value)#define Dbl_hidden(dbl_value) Dhidden(dbl_value)#define Dbl_lowmantissap2(dbl_value) Dlowp2(dbl_value)/* The left argument is never smaller than the right argument */#define Dbl_subtract(lefta,leftb,righta,rightb,resulta,resultb)			\    if( Dallp2(rightb) > Dallp2(leftb) ) Dallp1(lefta)--;	\    Dallp2(resultb) = Dallp2(leftb) - Dallp2(rightb);		\    Dallp1(resulta) = Dallp1(lefta) - Dallp1(righta)/* Subtract right augmented with extension from left augmented with zeros and * store into result and extension. */#define Dbl_subtract_withextension(lefta,leftb,righta,rightb,extent,resulta,resultb)	\    Dbl_subtract(lefta,leftb,righta,rightb,resulta,resultb);		\    if( (Extall(extent) = 0-Extall(extent)) )				\        {								\        if((Dallp2(resultb)--) == 0) Dallp1(resulta)--;			\        }#define Dbl_addition(lefta,leftb,righta,rightb,resulta,resultb)		\    /* If the sum of the low words is less than either source, then	\     * an overflow into the next word occurred. */			\    Dallp1(resulta) = Dallp1(lefta) + Dallp1(righta);			\    if((Dallp2(resultb) = Dallp2(leftb) + Dallp2(rightb)) < Dallp2(rightb)) \	Dallp1(resulta)++#define Dbl_xortointp1(left,right,result)			\    result = Dallp1(left) XOR Dallp1(right)#define Dbl_xorfromintp1(left,right,result)			\    Dallp1(result) = left XOR Dallp1(right)#define Dbl_swap_lower(left,right)				\    Dallp2(left)  = Dallp2(left) XOR Dallp2(right);		\    Dallp2(right) = Dallp2(left) XOR Dallp2(right);		\    Dallp2(left)  = Dallp2(left) XOR Dallp2(right)/* Need to Initialize */#define Dbl_makequietnan(desta,destb)					\    Dallp1(desta) = ((DBL_EMAX+DBL_BIAS)+1)<< (32-(1+DBL_EXP_LENGTH))	\                 | (1<<(32-(1+DBL_EXP_LENGTH+2)));			\    Dallp2(destb) = 0#define Dbl_makesignalingnan(desta,destb)				\    Dallp1(desta) = ((DBL_EMAX+DBL_BIAS)+1)<< (32-(1+DBL_EXP_LENGTH))	\                 | (1<<(32-(1+DBL_EXP_LENGTH+1)));			\    Dallp2(destb) = 0#define Dbl_normalize(dbl_opndA,dbl_opndB,exponent)			\	while(Dbl_iszero_hiddenhigh7mantissa(dbl_opndA)) {		\		Dbl_leftshiftby8(dbl_opndA,dbl_opndB);			\		exponent -= 8;						\	}								\	if(Dbl_iszero_hiddenhigh3mantissa(dbl_opndA)) {			\		Dbl_leftshiftby4(dbl_opndA,dbl_opndB);			\		exponent -= 4;						\	}								\	while(Dbl_iszero_hidden(dbl_opndA)) {				\		Dbl_leftshiftby1(dbl_opndA,dbl_opndB);			\		exponent -= 1;						\	}#define Twoword_add(src1dstA,src1dstB,src2A,src2B)		\	/* 							\	 * want this macro to generate:				\	 *	ADD	src1dstB,src2B,src1dstB;		\	 *	ADDC	src1dstA,src2A,src1dstA;		\	 */							\	if ((src1dstB) + (src2B) < (src1dstB)) Dallp1(src1dstA)++; \	Dallp1(src1dstA) += (src2A);				\	Dallp2(src1dstB) += (src2B)#define Twoword_subtract(src1dstA,src1dstB,src2A,src2B)		\	/* 							\	 * want this macro to generate:				\	 *	SUB	src1dstB,src2B,src1dstB;		\	 *	SUBB	src1dstA,src2A,src1dstA;		\	 */							\	if ((src1dstB) < (src2B)) Dallp1(src1dstA)--;		\	Dallp1(src1dstA) -= (src2A);				\	Dallp2(src1dstB) -= (src2B)#define Dbl_setoverflow(resultA,resultB)				\	/* set result to infinity or largest number */			\	switch (Rounding_mode()) {					\		case ROUNDPLUS:						\			if (Dbl_isone_sign(resultA)) {			\				Dbl_setlargestnegative(resultA,resultB); \			}						\			else {						\				Dbl_setinfinitypositive(resultA,resultB); \			}						\			break;						\		case ROUNDMINUS:					\			if (Dbl_iszero_sign(resultA)) {			\				Dbl_setlargestpositive(resultA,resultB); \			}						\			else {						\				Dbl_setinfinitynegative(resultA,resultB); \			}						\			break;						\		case ROUNDNEAREST:					\			Dbl_setinfinity_exponentmantissa(resultA,resultB); \			break;						\		case ROUNDZERO:						\			Dbl_setlargest_exponentmantissa(resultA,resultB); \	}#define Dbl_denormalize(opndp1,opndp2,exponent,guard,sticky,inexact)	\    Dbl_clear_signexponent_set_hidden(opndp1);				\    if (exponent >= (1-DBL_P)) {					\	if (exponent >= -31) {						\	    guard = (Dallp2(opndp2) >> -exponent) & 1;			\	    if (exponent < 0) sticky |= Dallp2(opndp2) << (32+exponent); \	    if (exponent > -31) {					\		Variable_shift_double(opndp1,opndp2,1-exponent,opndp2);	\		Dallp1(opndp1) >>= 1-exponent;				\	    }								\	    else {							\		Dallp2(opndp2) = Dallp1(opndp1);			\		Dbl_setzerop1(opndp1);					\	    }								\	}								\	else {								\	    guard = (Dallp1(opndp1) >> -32-exponent) & 1;		\	    if (exponent == -32) sticky |= Dallp2(opndp2);		\	    else sticky |= (Dallp2(opndp2) | Dallp1(opndp1) << 64+exponent); \	    Dallp2(opndp2) = Dallp1(opndp1) >> -31-exponent;		\	    Dbl_setzerop1(opndp1);					\	}								\	inexact = guard | sticky;					\    }									\    else {								\	guard = 0;							\	sticky |= (Dallp1(opndp1) | Dallp2(opndp2));			\	Dbl_setzero(opndp1,opndp2);					\	inexact = sticky;						\    }/*  * The fused multiply add instructions requires a double extended format, * with 106 bits of mantissa. */#define DBLEXT_THRESHOLD 106#define Dblext_setzero(valA,valB,valC,valD)	\    Dextallp1(valA) = 0; Dextallp2(valB) = 0;	\    Dextallp3(valC) = 0; Dextallp4(valD) = 0#define Dblext_isnotzero_mantissap3(valC) (Dextallp3(valC)!=0)#define Dblext_isnotzero_mantissap4(valD) (Dextallp3(valD)!=0)#define Dblext_isone_lowp2(val) (Dextlowp2(val)!=0)#define Dblext_isone_highp3(val) (Dexthighp3(val)!=0)#define Dblext_isnotzero_low31p3(val) (Dextlow31p3(val)!=0)#define Dblext_iszero(valA,valB,valC,valD) (Dextallp1(valA)==0 && \    Dextallp2(valB)==0 && Dextallp3(valC)==0 && Dextallp4(valD)==0)#define Dblext_copy(srca,srcb,srcc,srcd,desta,destb,destc,destd) \    Dextallp1(desta) = Dextallp4(srca);	\    Dextallp2(destb) = Dextallp4(srcb);	\    Dextallp3(destc) = Dextallp4(srcc);	\    Dextallp4(destd) = Dextallp4(srcd)#define Dblext_swap_lower(leftp2,leftp3,leftp4,rightp2,rightp3,rightp4)  \    Dextallp2(leftp2)  = Dextallp2(leftp2) XOR Dextallp2(rightp2);  \    Dextallp2(rightp2) = Dextallp2(leftp2) XOR Dextallp2(rightp2);  \    Dextallp2(leftp2)  = Dextallp2(leftp2) XOR Dextallp2(rightp2);  \    Dextallp3(leftp3)  = Dextallp3(leftp3) XOR Dextallp3(rightp3);  \    Dextallp3(rightp3) = Dextallp3(leftp3) XOR Dextallp3(rightp3);  \    Dextallp3(leftp3)  = Dextallp3(leftp3) XOR Dextallp3(rightp3);  \    Dextallp4(leftp4)  = Dextallp4(leftp4) XOR Dextallp4(rightp4);  \    Dextallp4(rightp4) = Dextallp4(leftp4) XOR Dextallp4(rightp4);  \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -