[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] binary numbers
From: |
Russell Standish |
Subject: |
Re: [Swarm-Support] binary numbers |
Date: |
Tue, 8 Jul 2003 21:43:00 +1000 (EST) |
Any standard integral type. unsigned would be a good choice.
Cheers
Marcello wrote:
>
> Thanks for the replies. Which kind of type should bitstring be in order
> to work with standard bit operators?
> marcello
> On Tue, 2003-07-08 at 12:45, Russell Standish wrote:
> > If the bitstrings fit into the system wordsize (32 bits on average
> > PCs), then you can use the standard bit manipulation operators of C:
> >
> > x|=1<<i - sets the ith bit of x
> > (x&1<<i)!=0 - returns the ith bit of 0
> >
> > If you have more bits than the wordsize, then you'll need to concoct a
> > BitSet object to do your work. C++ has a number of these - I'm not so
> > familiar with what's available for Obj C.
> >
> > Cheers
> >
> > Marcello wrote:
> > >
> > > Sorry if this comes a bit off the topic:
> > > Does anybody have a nice and clean way to handle binary numbers. I would
> > > like to store some information about the agent as a binary number
> > > (0100101), and have a call that returns exactly the digit I'd like.
> > > Thus, if the agent has myBin=01001, the call [agent gimmeBin: 1] returns
> > > 0, [agent gimmeBin: 2] returns 1, [agent gimmeBin: 3] returns 0, and so
> > > on. Of course, I could write gimmeBin as a sequence of if-then, but it
> > > does not sound very neat.
> > > Any hint?
> > > thanks
> > > marcello
> > > On Fri, 2003-07-04 at 15:03, Paul Johnson wrote:
> > > > au contraire!
> > > >
> > > > I have put both swarm-2.1.143 and 2.1.145 up there some time ago.
> > > >
> > > > Although the swarm link to the ftp server won't let me in now, I can
> > > > get
> > > > there from
> > > >
> > > > ftp://ftp.santafe.edu/pub/swarm/src/testing.
> > > >
> > > > Agustin Ramos Fonseca wrote:
> > > > > Thank you for your advise.
> > > > >
> > > > > I'd like to know where I can get the swarm 2.1.143.20030512 sources,
> > > > > I looked for them at
> > > > > ftp://ftp.swarm.org/pub/swarm/src/testing/
> > > > > but they aren't there.
> > > > >
> > > > > I'll try to upgrade my RH to 7.3 but I think my old PC won't support
> > > > > it
> > > > > (mainly because disk space, all rpm updates are disk consuming)
> > > > >
> > > > > I'm interested in the sources because I'm interested in modelling and
> > > > > in the inner workings of this tool. So I'll try to build the sources.
> > > > >
> > > > > Thanks again
> > > > >
> > > > > AgustÃn T.Ramos Fonseca
> > > >
> > > >
> > > > --
> > > > Paul E. Johnson email: address@hidden
> > > > Dept. of Political Science http://lark.cc.ku.edu/~pauljohn
> > > > University of Kansas Office: (785) 864-9086
> > > > Lawrence, Kansas 66045 FAX: (785) 864-5700
> > > >
> > > > _______________________________________________
> > > > Support mailing list
> > > > address@hidden
> > > > http://www.swarm.org/mailman/listinfo/support
> > > --
> > > Marcello Gallucci (Ph.D)
> > > Department of Social Psychology
> > > Free University
> > > Van der Boechorststraat 1
> > > 1081 BT Amsterdam (NL)
> > > Tel. +31(0)20 4448846
> > > Fax +31 (0)20 4448921
> > >
> > > _______________________________________________
> > > Support mailing list
> > > address@hidden
> > > http://www.swarm.org/mailman/listinfo/support
> > >
> >
> >
> >
> > ----------------------------------------------------------------------------
> > A/Prof Russell Standish Director
> > High Performance Computing Support Unit, Phone 9385 6967, 8308 3119 (mobile)
> > UNSW SYDNEY 2052 Fax 9385 6965, 0425 253119
> > (")
> > Australia address@hidden
> > Room 2075, Red Centre http://parallel.hpc.unsw.edu.au/rks
> > International prefix +612, Interstate prefix 02
> > ----------------------------------------------------------------------------
> > _______________________________________________
> > Support mailing list
> > address@hidden
> > http://www.swarm.org/mailman/listinfo/support
> --
> Marcello Gallucci (Ph.D)
> Department of Social Psychology
> Free University
> Van der Boechorststraat 1
> 1081 BT Amsterdam (NL)
> Tel. +31(0)20 4448846
> Fax +31 (0)20 4448921
>
> _______________________________________________
> Support mailing list
> address@hidden
> http://www.swarm.org/mailman/listinfo/support
>
----------------------------------------------------------------------------
A/Prof Russell Standish Director
High Performance Computing Support Unit, Phone 9385 6967, 8308 3119 (mobile)
UNSW SYDNEY 2052 Fax 9385 6965, 0425 253119 (")
Australia address@hidden
Room 2075, Red Centre http://parallel.hpc.unsw.edu.au/rks
International prefix +612, Interstate prefix 02
----------------------------------------------------------------------------
- [Swarm-Support] Error in install (RH 7.1), Agustin Ramos Fonseca, 2003/07/02
- RE: [Swarm-Support] Error in install (RH 7.1), Agustin Ramos Fonseca, 2003/07/03
- Re: [Swarm-Support] Error in install (RH 7.1), Paul Johnson, 2003/07/04
- [Swarm-Support] binary numbers, Marcello, 2003/07/08
- Re: [Swarm-Support] binary numbers, Russell Standish, 2003/07/08
- Re: [Swarm-Support] binary numbers, Marcello, 2003/07/08
- Re: [Swarm-Support] binary numbers,
Russell Standish <=
- [Swarm-Support] Selectors, Marcello, 2003/07/09
- Re: [Swarm-Support] Selectors, Paul Johnson, 2003/07/09
- Re: [Swarm-Support] Selectors, Marcello, 2003/07/09
- Re: [Swarm-Support] Selectors, Paul Johnson, 2003/07/09
- Re: [Swarm-Support] Selectors, Steve Jackson, 2003/07/09
- Re: [Swarm-Support] binary numbers, Paul Johnson, 2003/07/08