[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#327351: Fixed in local cvs.parisc-linux.org, sorry for not submitting upstream.



On Wed, Sep 21, 2005 at 12:46:48PM -0400, Carlos O'Donell wrote:
> int
> fesetround (int round)
> {
>   struct { unsigned int sw[2]; } s;
> 
>   /* Get the current status word. */
>   __asm__ ("fstd %%fr0,0(%1)" : "=m" (s) : "r" (&s) : "%r0");
>   s.sw[0] &= ~FE_DOWNWARD;
>   s.sw[0] |= round & FE_DOWNWARD;
>   __asm__ ("fldd 0(%0),%%fr0" : : "r" (&s), "m" (s) : "%r0");
> 
>   return 0;
> }
> ---
> 
> Comments:
> - Please do not return 1 if the rounding mode is invalid.
>   Try as hard as possible to set something reasonable.
> - Use a struct where possible for two integers since GCC
>   will generally have an easier time following the memory.
> - These are double word stores, so you need sw[2].

Er... how can comment #1 possibly be correct?  The documentation's
clear: fesetround should return 1 if it could not set the requested
rounding mode.

-- 
Daniel Jacobowitz
CodeSourcery, LLC



Reply to: