From: Kevin Ryde <user42@zip.com.au>
Subject: Re: doco on bitwise logicals
Date: Sat, 10 May 2003 11:10:39 +1000 [thread overview]
Message-ID: <873cjntxm8.fsf@zip.com.au> (raw)
In-Reply-To: <87y91lrmp3.fsf@zip.com.au> (Kevin Ryde's message of "Tue, 06 May 2003 09:35:52 +1000")
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
next prev parent reply other threads:[~2003-05-10 1:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-04 0:56 doco on bitwise logicals Kevin Ryde
2003-05-04 5:35 ` Rob Browning
2003-05-05 23:35 ` Kevin Ryde
2003-05-10 1:10 ` Kevin Ryde [this message]
2003-05-10 3:58 ` Kevin Ryde
2003-05-05 23:31 ` Kevin Ryde
2003-05-06 1:23 ` Rob Browning
2003-05-06 2:02 ` Kevin Ryde
2003-05-08 1:07 ` Kevin Ryde
2003-05-09 23:12 ` Rob Browning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873cjntxm8.fsf@zip.com.au \
--to=user42@zip.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).