The MASM Forum

General => The Campus => Topic started by: daydreamer on January 04, 2014, 03:57:30 AM

Title: fistp stores integer p or rounded float?
Post by: daydreamer on January 04, 2014, 03:57:30 AM
?..or i need to set fp flags right to get integer part?
Title: Re: fistp stores integer p or rounded float?
Post by: qWord on January 04, 2014, 04:10:09 AM
Quote from: daydreamer2 on January 04, 2014, 03:57:30 AMi need to set fp flags right to get integer part?
yes, you need to set the rounding mode. The default value (FINIT) is "round to nearest". There is also the SSE3 instruction FISTTP, which always truncates (ignores the current rounding mode). Furthermore, using cvttsd2si or cvttss2si (SSE2) might be also an option.