Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: PATCH: load_map_data macro (PR#1012)
Home

[Freeciv-Dev] Re: PATCH: load_map_data macro (PR#1012)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: PATCH: load_map_data macro (PR#1012)
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Wed, 17 Oct 2001 05:49:07 -0400
Reply-to: jdorje@xxxxxxxxxxxx

Raimar Falke wrote:
> 
> On Tue, Oct 16, 2001 at 11:20:44PM -0400, Jason Dorje Short wrote:
> > Raimar Falke wrote:

> > +/***************************************************************
> > +This returns an ascii hex value of the given half-byte of the
> > +binary integer.  See ascii_hex2bin().
> > +  example: bin2ascii_hex(0xa00, 2) == 'a'
> > +***************************************************************/
> > +#define bin2ascii_hex(value, halfbyte_wanted)       \
> > +  ('a' - 10 + (char)(((value) >> ((halfbyte_wanted) * 4)) & 0xf))
>      ('a' - 10 + (char)(x))
> 
> 0<=x<=15
> 
> For: x=0   ('a'-10+0) == 'W' WRONG
> For: x=11  ('a'-10+11) = ('a'+1) == 'b' OK
> 
> IMHO there is no correct way without evaluating "value" more than one
> or creating a local variable. So I would vote for the hex_chars
> approach.

I just wanted to see if you were paying attention :-).

Anyway, I agree.  Let's forget this new patch, and move back to the
previous one.

jason


[Prev in Thread] Current Thread [Next in Thread]