YoushouldhavereceivedacopyoftheGNULibraryGeneralPublic LicensealongwiththeGNUCLibrary;seethefileCOPYING.LIB.If not,writetotheFreeSoftwareFoundation,Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
multiplication immediately. */
#define _FP_MUL_MEAT_1_imm(wfracbits, R, X, Y) \ do { \
R##_f = X##_f * Y##_f; \ /* Normalize since we know where the msb of the multiplicands \ were(bitB),weknowthatthemsboftheoftheproductis\
at either 2B or 2B-1. */ \
_FP_FRAC_SRS_1(R, wfracbits-1, 2*wfracbits); \
} while (0)
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
#define _FP_MUL_MEAT_1_wide(wfracbits, R, X, Y, doit) \ do { \
_FP_W_TYPE _Z_f0, _Z_f1; \
doit(_Z_f1, _Z_f0, X##_f, Y##_f); \ /* Normalize since we know where the msb of the multiplicands \ were(bitB),weknowthatthemsboftheoftheproductis\
at either 2B or 2B-1. */ \
_FP_FRAC_SRS_2(_Z, wfracbits-1, 2*wfracbits); \
R##_f = _Z_f0; \
} while (0)
/* Finally, a simple widening multiply algorithm. What fun! */
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the divisionimmediately.Givethismacroeither_FP_DIV_HELP_immfor Cprimitivesor_FP_DIV_HELP_ldivfortheISOfunction.Whichyou
choose will depend on what the compiler does with divrem4. */
/* GCC's longlong.h defines a 2W / 1W => (1W,1W) primitive udiv_qrnnd thatmaybeusefulinthissituation.Thisfirstisforaprimitive thatrequiresnormalization,thesecondforonethatdoesnot.Look
for UDIV_NEEDS_NORMALIZATION to tell which your machine needs. */
#define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y) \ do { \
_FP_W_TYPE _nh, _nl, _q, _r, _y; \
\ /* Normalize Y -- i.e. make the most significant bit set. */ \
_y = Y##_f << _FP_WFRACXBITS_##fs; \
\ /* Shift X op correspondingly high, that is, up one full word. */ \ if (X##_f < Y##_f) \
{ \
R##_e--; \
_nl = 0; \
_nh = X##_f; \
} \ else \
{ \
_nl = X##_f << (_FP_W_TYPE_SIZE - 1); \
_nh = X##_f >> 1; \
} \
\
udiv_qrnnd(_q, _r, _nh, _nl, _y); \
R##_f = _q | (_r != 0); \
} while (0)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.