This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: [PATCH] Simplify mips16 conversion to even address


On Sat, Mar 06, 2004 at 11:36:51AM +0000, Richard Sandiford wrote:
> Fred Fish <fnf@ninemoons.com> writes:
> > +  if (sym->st_other == STO_MIPS16)
> > +    sym->st_value &= ~1;
> 
> This isn't 64-bit clean, is it?

No, it's OK.  `1' is an int.  ~1 is too, == -2.  -2 is sign extended
when promoting to larger integer types.  ~0x1 would be a different
story, because hex constants are unsigned.

I know a lot of my code uses `~(bfd_vma) 1', but that's because I'm
paranoid..  (I also have run into some old C compilers that didn't
sign extend, but with binutils now requiring an ISO C compiler I
think we're safe.)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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