Subject:
|
Re: NQC 2.0 and some math questions
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Wed, 29 Sep 1999 01:07:29 GMT
|
Reply-To:
|
marcob@equalis/avoidspam/.it
|
Viewed:
|
2294 times
|
| |
| |
On Thu, 23 Sep 1999 00:03:43 GMT, dbaum@spambgoneenteract.com (Dave
Baum) wrote:
> A bug in the document. * and / are legal for any expressions. % is
> restricted to constants.
> I know the restrictions are confusing. The problem is that the RCX
> opcodes are somewhat incomplete. Now that I think about it, I can
> probably generate reasonable code for % from the primitives /, *, and -.
x = y % z
is equivalent to (where w is an temporary integer):
w = y / z;
x = y - z * w;
I can't think of a useful use of % just with constants.
Ciao.
Marco.
|
|
Message has 1 Reply: | | Re: NQC 2.0 and some math questions
|
| (...) That's exaclty what I was thinking of doing. Originally, the compiler had no way of allocating temp variables which is why code for % couldn't be emitted. The temp allocator is now pretty good, so I could emit the above sequence, but it just (...) (25 years ago, 30-Sep-99, to lugnet.robotics.rcx.nqc)
|
Message is in Reply To:
| | Re: NQC 2.0 and some math questions
|
| A bug in the document. * and / are legal for any expressions. % is restricted to constants. I know the restrictions are confusing. The problem is that the RCX opcodes are somewhat incomplete. Now that I think about it, I can probably generate (...) (25 years ago, 23-Sep-99, to lugnet.robotics.rcx.nqc)
|
16 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|