develooper Front page | perl.perl6.internals | Postings from September 2001

Re: Math functions? (Particularly transcendental ones)

Thread Previous | Thread Next
From:
Buddha Buck
Date:
September 9, 2001 10:35
Subject:
Re: Math functions? (Particularly transcendental ones)
Message ID:
877kv85ku7.fsf@14850.com
Dan Sugalski <dan@sidhe.org> writes:

> At 07:43 PM 9/8/2001 -0700, Wizard wrote:
> >Questions regarding Bitwise operators:
> >
> > > =item rol tx, ty, tz *
> >...
> > > =item ror tx, ty, tz *
> >
> >Are these with or without carry?
> 
> That's a good question. Now that we have a list of bitwise ops, we can 
> decide how they work. What happens when you rotate/shift/bit-or a float? Or 
> a bitint/bigfloat? Or a string? Important questions, and we can hammer 
> something out now that we know what they are.

I'd like to suggest that the shift- and roll/rotate- ops take a 4th
parameter, that being the "word"-size in bits.  For Bigints and
arbitrary-length bit-vectors, the size of a "word" to rotate or shift
could be infinite, probably isn't what is wanted.

It would also make simpler such operations that might come up in some
cryptographic routines, like "rotate the upper 64 bits left 3 bits",
which would be encoded as (assuming "rotate_l dest, source, roll-amount,
wordsize")

rotate_l P1, P1, 64, 128
rotate_l P1, P1,  3,  64
rotate_r P1, P1, 64, 128

Just my 2 centums.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About