guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: logical shift operators in guile?


From: dsmich
Subject: Re: logical shift operators in guile?
Date: Thu, 10 Jun 2010 3:38:21 +0000

---- Andy Wingo <address@hidden> wrote: 
> Hi Steve,
> 
> On Wed 09 Jun 2010 06:04, steve tell <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]