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 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]