This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: WinCE support in LD
- To: cgf at cygnus dot com, dj at delorie dot com, ian at zembu dot com
- Subject: Re: WinCE support in LD
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 23 Feb 2000 18:07:43 -0800
- CC: binutils at sourceware dot cygnus dot com
Hi Guys,
: >The intention was to have a switch statement that had cases that
: >depended on two values, instead of the default of one value.
: >It's the equivalent of this:
: >
: > if (bits==16 && shift==16) ...
: > else if (bits==26 && shift==2) ...
: >
: >What I'd like to see in C is this option:
: >
: > switch (bits,shift) {
: > case 16,16 : ...
: > case 26,2 : ...
: > }
How about I change it to use amacro like this:
#define BITS_AND_SHIFT(bits, shift) (bits * 1000 | shift)
switch BITS_AND_SHIFT (relocs[i]->howto->bitsize,
relocs[i]->howto->rightshift)
{
case BITS_AND_SHIFT (32, 0):
reloc_data[total_relocs].type = 3;
total_relocs++;
break;
case BITS_AND_SHIFT (16, 0):
reloc_data[total_relocs].type = 2;
total_relocs++;
break;
case BITS_AND_SHIFT (16, 16):
reloc_data[total_relocs].type = 4;
/* FIXME: we can't know the symbol's right value yet,
but we probably can safely assume that CE will relocate
us in 64k blocks, so leaving it zero is safe */
reloc_data[total_relocs].extra = 0;
total_relocs++;
break;
case BITS_AND_SHIFT (26, 2):
reloc_data[total_relocs].type = 5;
total_relocs++;
break;
Cheers
Nick