[Top][All Lists]

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

Re: logical shift operators in guile?

From: Andy Wingo
Subject: Re: logical shift operators in guile?
Date: Thu, 10 Jun 2010 00:45:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

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.

> While searching for those, I realized that what I was trying to do was
> represent small sets of booleans as the bits of an integer... and that
> somthing similar could be done in a more scheme-like fashion with
> bitvectors.
> But is there any way to copy the contents of bitvector a to another
> bitvector b of the same size, short of iterating over the elements?

There does not seem to be, though perhaps I am overlooking something.
There is array-copy!, but that is not implemented in the most efficient
way for contiguous uniform vectors like bitvectors. Would you like to
submit a patch to add bitvector-copy and/or bitvector-copy! ?

For my eye there's something still not right as far as bitvectors'
implementation. I guess I would prefer something with a bytevector as a
backing store... But that's a topic for another day.



reply via email to

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