🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2710

Re: A bug in ARP 1.3?

#2710
From: guineau
Date: Wed, 13 Dec 1989 19:17
37 lines
1619 bytes
> What does the following line mean?
>
>     Wait(1 << Window->UserPort->mp_SigBit)
>
> I know it causes my program to wait for a response in the IDCMP port,
> but how exactly does this work?
>
> ->  means structure member notation for pointers
>
> <<  means shift left, a bitwise operator, which can also be enterpreted
>    as multiplication by 2
>
> So, why should shifting the mp_SigBit member of the window's UserPort
>  One bit position to the left magically cause my application to wake up 
> from a sleeping condition and recognize the presence of an incoming message?


It doesn't. The   << (and >>)  C operators mean 

	a << b

Shift a left by b bit positions.  (shift right for >> )

So  Wait(1 << Window->UserPort->mp_SigBit)

means shift a 1 left to the position corresponding to the signal number.
So for example
an  mp_SigBit of 3 coresponds to a bit mask of  binary  1000 (i.e. bit
position 3).

Wait needs a bit mask, while mp_SigBit is the signal number.

>                                 -Paul Castonguay


John Guineau
Technical Details
Message-ID: <6865@shlump.nac.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!decuac!shlump.nac.dec.com!wjg.enet.dec.com!guineau
References: <148@bucsb.UUCP> <14752@boulder.Colorado.EDU> <3598@jhunix.HCF.JHU.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!decuac!shlump.nac.dec.com!wjg.enet.dec.com!guineau
From: guineau@wjg.enet.dec.com
Newsgroups: comp.sys.amiga.tech
Subject: Re: A bug in ARP 1.3?
Message-ID: <6865@shlump.nac.dec.com>
Date: 13 Dec 89 19:17:09 GMT
References: <148@bucsb.UUCP> <14752@boulder.Colorado.EDU> <3598@jhunix.HCF.JHU.EDU>
Sender: newsdaemon@shlump.nac.dec.com
Reply-To: guineau@wjg.enet.dec.com ()
Distribution: na
Organization: Digital Equipment Corporation
Lines: 37