Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2006 09:16:12 +0100
From:      Mathieu Prevot <freebsd-amd64@club-internet.fr>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        freebsd-hackers@freebsd.org, freebsd-amd64@freebsd.org
Subject:   Re: Creating real bool type for simulation in physics
Message-ID:  <20060314081612.GA55608@scienceclue.ath.cx>
In-Reply-To: <20060313171341.GA7636@dan.emsphone.com>
References:  <20060313161740.GA56875@scienceclue.ath.cx> <20060313171341.GA7636@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 13, 2006 at 11:13:41AM -0600, Dan Nelson wrote:
> In the last episode (Mar 13), Mathieu Prevot said:
> > I use freebsd/amd64 (RELENG_6) for simulation in physics. I am
> > working on the Ising model: an assembly of spins (micromagnets) which
> > interact and which are in one of two states (up or down). Until now I
> > use char to define the state of each spin (-1 or 1), however, I
> > remarked that most time is spent on memory I/O.  Most of bits are
> > unused.
> > 
> > I think that if I can use just one bit per spin, I can have something
> > much faster. I need advices on how to use it. I guess I can't define
> > a new type with a 1/8 byte height (or one bit), yes ? What variable
> > (int, char...) do you recommend to use for a sempron 64 bits. I think
> > I'll need to define new operators (opaque operators, built with bit
> > operators) to switch my spins or use directly the following: & | ^ ~
> > ...
> 
> Take a look at the "bitstring" functions, which let you allocate an
> array of "bits" and manipulate them individually.  They're documented
> in the bitstring manpage.

Thank you.
bitstring functions (macros) are based on char (8bits) type.
This is not ANSI or POSIX, I will include /usr/src/sys/sys/bitstring.h
in my program for portability.
vi (nvi), and bind9 also use these macros, but are a bit different.

--
Mathieu P

http://scienceclue.ath.cx



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060314081612.GA55608>