From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: Re: doco on bitwise logicals Date: Sat, 10 May 2003 11:10:39 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <873cjntxm8.fsf@zip.com.au> References: <87vfwrjzqr.fsf@zip.com.au> <87n0i3w9xf.fsf@raven.i.defaultvalue.org> <87y91lrmp3.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1052529515 29991 80.91.224.249 (10 May 2003 01:18:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 10 May 2003 01:18:35 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat May 10 03:18:34 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19EJ0U-0007na-00 for ; Sat, 10 May 2003 03:18:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19EJ0O-0007xy-01 for guile-devel@m.gmane.org; Fri, 09 May 2003 21:18:28 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19EJ06-0007w0-00 for guile-devel@gnu.org; Fri, 09 May 2003 21:18:10 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19EJ02-0007rv-00 for guile-devel@gnu.org; Fri, 09 May 2003 21:18:09 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19EJ00-0007fO-00 for guile-devel@gnu.org; Fri, 09 May 2003 21:18:04 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h4A1I0Pc017766 for ; Sat, 10 May 2003 11:18:00 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h4A1I0Qg002374 for ; Sat, 10 May 2003 11:18:00 +1000 (EST) Original-Received: from localhost (ppp60.dyn228.pacific.net.au [203.143.228.60]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h4A1HwYZ021148 for ; Sat, 10 May 2003 11:17:59 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19EIsq-0005ZQ-00; Sat, 10 May 2003 11:10:40 +1000 Original-To: guile-devel@gnu.org In-Reply-To: <87y91lrmp3.fsf@zip.com.au> (Kevin Ryde's message of "Tue, 06 May 2003 09:35:52 +1000") User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2315 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2315 I made this change, but with some tweaks to what I posted for ash: - Scheme Procedure: ash n cnt - C Function: scm_ash (n, cnt) Return N shifted left by CNT bits, or shifted right if CNT is negative. This is an "arithmetic" shift. This is effectively a multiplication by 2^CNT, and when CNT is negative it's a division, rounded towards negative infinity. (Note that this is not the same rounding as `quotient' does.) With N viewed as an infinite precision twos complement, `ash' means a left shift introducing zero bits, or a right shift dropping bits. (number->string (ash #b1 3) 2) => "1000" (number->string (ash #b1010 -1) 2) => "101" ;; -23 is bits ...11101001, -6 is bits ...111010 (ash -23 -2) => -6 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel