|
|
Message-ID: <alpine.LRH.2.02.2001250140330.29769@key0.esi.com.au>
Date: Sat, 25 Jan 2020 01:45:08 +1100 (AEDT)
From: Damian McGuckin <damianm@....com.au>
To: musl@...ts.openwall.com
Subject: Re: Considering x86-64 fenv.s to C
On Fri, 24 Jan 2020, Rich Felker wrote:
>> static inline double get_fpscr_f(void)
>> {
>> double fpscr;
>>
>> __asm__ __volatile__ ("mffs %0" : "=d"(fpscr));
>> return fpscr;
>> }
>> static inline unsigned int get_csr(void)
>> {
>> return (unsigned int) (union {double f; long i;}) {get_fpscr_f()}.i;
>> }
>> static inline void set_fpscr_f(double fpscr)
>> {
>> __asm__ __volatile__ ("mtfsf 255, %0" : : "d"(fpscr));
>> }
>> static inline void set_csr(unsigned int fpscr)
>> {
>> set_fpscr_f((union {long i; double f;}) {(long) fpscr}.f);
>> }
>
> I would drop the _f functions; they're not useful separately
They are needed for fegetenv/fesetenv. The API defines
fenv_t
as a double, even though it is interpreted as a long when you have to use
it.
Regards - Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.