On Sat, 2001-09-08 at 15:28, Dan Sugalski wrote:
> At 03:14 PM 9/8/2001 -0500, Brian Wheeler wrote:
> >On Sat, 2001-09-08 at 11:00, Dan Sugalski wrote:
> > > Okay, I'm whipping together the "fancy math" section of the interpreter
> > > assembly language. I've got:
> > >
> > > sin, cos, tan : Plain ones
> > > asin, acos, atan : arc-whatevers
> > > shinh, cosh, tanh : Hyperbolic whatevers
> > > log2, log10, log : Base 2, base 10, and explicit base logarithms
> > > pow : Raise x to the y power
> > >
> > > Can anyone think of things I've forgotten? It's been a while since I've
> > > done numeric work.
> > >
> > > Dan
> > >
> >
> >While not math, per se, there are bitops (and, or, not, xor, eqv) and
> >shifts (though they can be simulated by "mul tx,ty,(2^bits)" and "div
> >tx,ty,(2^bits)")
>
> Those are next. I'm getting into the math bits first.
>
> If you want to make a list of bit operations, though, that'd be fine.
>
> >I doubt rolls would be useful :)
>
> You never know--someone might want to build an RC5 encoder/decoder in perl.
> Rolls are useful there.
>
> >Are there going to be string ops as well, or would add and mul work on
> >string registers?
>
> String ops are separate. I don't want to overload things too badly until I
> really have to.
>
> Dan
>
> --------------------------------------"it's like this"-------------------
> Dan Sugalski even samurai
> [EMAIL PROTECTED] have teddy bears and even
> teddy bears get drunk
Here's a list of bitops I came up with. I don't know how useful EQV and
IMP are, but I included them anyway.
Brian
=head2 Bitwise Operations
These ops handle manipulating bitwise data in registers. All registers
must be of the same type, PMC, integer, or number.
=over 4
=item and tx, ty, tz *
Bitwise And all bits in y with z and store the result in register x.
(x = y & z)
=item eqv tx, ty, tz *
Bitwise Equivalence all bits in y with z and store the result in
register x.
[do we really need this one? BASIC has it, but I don't know if I've
ever found a use for it. Its (p&q)|(!p&!q), I think]
=item imp tx, ty, tz *
Bitwise Implication (of) all bits in y with z and store the result in
register x. [another questionable one. Again, its a BASIC thing. The
boolean expression for it is (!p&!q)|q ]
=item not tx, ty *
Bitwise Not all bits in y and store the result in x. (x = !y)
=item or tx, ty, tz *
Bitwise Or all bits in y with z and store the result in register x.
(x = y | z)
=item rol tx, ty, tz *
Roll y left z bits and store the result in x.
[what are the valid values for z?]
=item ror tx, ty, tz *
Roll y right z bits and store the result in x.
[what are the valid values for z?]
=item shl tx, ty, tz *
Shift y left z bits and store the result in x. (x = y << z)
[what are the valid values of z?]
=item shr tx, ty ,tz *
Shift y right z bits and store the result in y. (x = y >> z)
[what are the valid values of z?]
=item xor tx, ty, tz *
Bitwise Exclusive-Or of all bits in y with z and store the result in
register x. (x = y ^ z)