Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: Anybody know what this is doing?
Home

[Freeciv-Dev] Re: Anybody know what this is doing?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Ineacho <ineacho@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Anybody know what this is doing?
From: Raimar Falke <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 5 Apr 2004 12:32:04 +0200

On Mon, Apr 05, 2004 at 07:02:39AM -0300, Ineacho wrote:
> Can anyone tell me what this statement is doing?
> 
>  
> 
> (1u << ((bit) & 0x7))

bit is masked so that only the three lowest bit are "active". This
limits the range to [0..7]. The "1u << n" (shift 1u n positions to the
left) creates a number which has only one bit set and this bit is at
position "n".

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Like the ad says, at 300 dpi you can tell she's wearing a
  swimsuit. At 600 dpi you can tell it's wet. At 1200 dpi you
  can tell it's painted on. I suppose at 2400 dpi you can tell
  if the paint is giving her a rash."
    -- Joshua R. Poulson


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