From owner-freebsd-amd64@FreeBSD.ORG Mon Mar 13 17:13:52 2006 Return-Path: X-Original-To: freebsd-amd64@freebsd.org Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7686316A401; Mon, 13 Mar 2006 17:13:51 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id D636643D45; Mon, 13 Mar 2006 17:13:50 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.4) id k2DHDfdS074363; Mon, 13 Mar 2006 11:13:42 -0600 (CST) (envelope-from dan) Date: Mon, 13 Mar 2006 11:13:41 -0600 From: Dan Nelson To: Mathieu Prevot Message-ID: <20060313171341.GA7636@dan.emsphone.com> References: <20060313161740.GA56875@scienceclue.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060313161740.GA56875@scienceclue.ath.cx> X-OS: FreeBSD 5.5-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.11 Cc: freebsd-hackers@freebsd.org, freebsd-amd64@freebsd.org Subject: Re: Creating real bool type for simulation in physics X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Mar 2006 17:13:52 -0000 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. -- Dan Nelson dnelson@allantgroup.com