This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [06/12] Add femode_t functions: ia64

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]