[PATCH] Simplify mips16 conversion to even address

Alan Modra amodra@bigpond.net.au
Sat Mar 6 13:41:00 GMT 2004


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



More information about the Binutils mailing list