unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: <dsmich@roadrunner.com>
To: steve tell <tell@telltronics.org>, Andy Wingo <wingo@pobox.com>
Cc: Guile Mailing List <guile-user@gnu.org>
Subject: Re: logical shift operators in guile?
Date: Thu, 10 Jun 2010 3:38:21 +0000	[thread overview]
Message-ID: <20100610033821.G4TBM.141609.root@cdptpa-web20-z02> (raw)
In-Reply-To: <m3bpbjq0zi.fsf@pobox.com>


---- Andy Wingo <wingo@pobox.com> wrote: 
> Hi Steve,
> 
> On Wed 09 Jun 2010 06:04, steve tell <tell@telltronics.org> writes:
> 
> > Does guile (1.8.x, or any version) have the integer logical shift
> > operators, like C's << and >> ?
> 
> We have ash (arithmetic shift) but not lsh (logical shift). I admit I am
> somewhat ignorant regarding when you would prefer lsh over ash. If it is
> important (as it probably is) we should add lsh.

It depends on what you do with the sign bit when shifting to the right on 2's complement.

Logical shift fills with 0's and arithmetic shift fills with the sign bit.

The "logical" functions in guile do work on bignums.  No need mess with anything else.

-Dale




  reply	other threads:[~2010-06-10  3:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09  4:04 logical shift operators in guile? steve tell
2010-06-09 22:45 ` Andy Wingo
2010-06-10  3:38   ` dsmich [this message]
2010-06-10 12:32 ` Thien-Thi Nguyen

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=20100610033821.G4TBM.141609.root@cdptpa-web20-z02 \
    --to=dsmich@roadrunner.com \
    --cc=guile-user@gnu.org \
    --cc=tell@telltronics.org \
    --cc=wingo@pobox.com \
    /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).