📄 x-cvsweb-markup(47)
字号:
#define _FP_UNPACK_RAW_2(fs, X, val) \ do { \ union _FP_UNION_##fs _flo; _flo.flt = (val); \ \ X##_f0 = _flo.bits.frac0; \ X##_f1 = _flo.bits.frac1; \ X##_e = _flo.bits.exp; \ X##_s = _flo.bits.sign; \ } while (0)#define _FP_UNPACK_RAW_2_P(fs, X, val) \ do { \ union _FP_UNION_##fs *_flo = \ (union _FP_UNION_##fs *)(val); \ \ X##_f0 = _flo->bits.frac0; \ X##_f1 = _flo->bits.frac1; \ X##_e = _flo->bits.exp; \ X##_s = _flo->bits.sign; \ } while (0)/* * Repack the raw bits of a native fp value. */#define _FP_PACK_RAW_2(fs, val, X) \ do { \ union _FP_UNION_##fs _flo; \ \ _flo.bits.frac0 = X##_f0; \ _flo.bits.frac1 = X##_f1; \ _flo.bits.exp = X##_e; \ _flo.bits.sign = X##_s; \ \ (val) = _flo.flt; \ } while (0)#define _FP_PACK_RAW_2_P(fs, val, X) \ do { \ union _FP_UNION_##fs *_flo = \ (union _FP_UNION_##fs *)(val); \ \ _flo->bits.frac0 = X##_f0; \ _flo->bits.frac1 = X##_f1; \ _flo->bits.exp = X##_e; \ _flo->bits.sign = X##_s; \ } while (0)/* * Multiplication algorithms: *//* Given a 1W * 1W => 2W primitive, do the extended multiplication. */#define _FP_MUL_MEAT_2_wide(wfracbits, R, X, Y, doit) \ do { \ _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \ \ doit(_FP_FRAC_WORD_4(_z,1), _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \ doit(_b_f1, _b_f0, X##_f0, Y##_f1); \ doit(_c_f1, _c_f0, X##_f1, Y##_f0); \ doit(_FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2), X##_f1, Y##_f1); \ \ __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \ _FP_FRAC_WORD_4(_z,1), 0, _b_f1, _b_f0, \ _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \ _FP_FRAC_WORD_4(_z,1)); \ __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \ _FP_FRAC_WORD_4(_z,1), 0, _c_f1, _c_f0, \ _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \ _FP_FRAC_WORD_4(_z,1)); \ \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \ R##_f0 = _FP_FRAC_WORD_4(_z,0); \ R##_f1 = _FP_FRAC_WORD_4(_z,1); \ } while (0)/* Given a 1W * 1W => 2W primitive, do the extended multiplication. Do only 3 multiplications instead of four. This one is for machines where multiplication is much more expensive than subtraction. */#define _FP_MUL_MEAT_2_wide_3mul(wfracbits, R, X, Y, doit) \ do { \ _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \ _FP_W_TYPE _d; \ int _c1, _c2; \ \ _b_f0 = X##_f0 + X##_f1; \ _c1 = _b_f0 < X##_f0; \ _b_f1 = Y##_f0 + Y##_f1; \ _c2 = _b_f1 < Y##_f0; \ doit(_d, _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -