This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [06/12] Add femode_t functions: ia64
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Yury Norov <ynorov at caviumnetworks dot com>
- Cc: <libc-alpha at sourceware dot org>, <vapier at gentoo dot org>
- Date: Mon, 5 Sep 2016 15:24:27 +0000
- Subject: Re: [06/12] Add femode_t functions: ia64
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.20.1609022156090.4311@digraph.polyomino.org.uk> <20160903142550.GA29995@yury-N73SV>
On Sat, 3 Sep 2016, Yury Norov wrote:
> > +#define FPSR_STATUS 0x1f80UL
> > +#define FPSR_STATUS_ALL ((FPSR_STATUS << 6) | (FPSR_STATUS << 19) \
> > + | (FPSR_STATUS << 32) | (FPSR_STATUS << 45))
> > +
>
> Hi Josepf,
>
> Is it possible to #define offsets to avoid magic numbers, or drop the
> link to specification?
I think defining extra macros (which would be used only once each) for the
offsets of the four status/control fields would make the code less
readable, not more, in this case (like the recent rejected Linux kernel
patches to use symbolic names for file access modes). It's clear to
readers of the code what those offsets are meant to be (I think it's
reasonable to expect readers of ia64 floating-point code to have a general
awareness of the four status/control fields, with instructions being able
to choose which one is applied to that instruction), and anyone checking
the precise values of offsets and bit-masks has to refer to architecture
manuals, with or without macros involved.
--
Joseph S. Myers
joseph@codesourcery.com