[NoW] Mistakes/typos in the comments

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[NoW] Mistakes/typos in the comments

Egor Skriptunoff-2
Hi!
 
This is "Nitpicking on Wednesdays".
 
 
1)
A "for"-loop consisted of FORPREP1 + FORLOOP1 needs only two internal variables.
But three registers are used, and R(A+2) is never read.

 
2)
The file lopcodes.h from Lua@Github (as of Jan 30 2019) contains descriptions of VM instructions in comments.
Some descriptions don't agree with the implementation of these instructions.
 
(first line is "currently is:", second line is "should be:")
 
OP_SHRI,/* A B C   R(A) := R(B) >> C */
OP_SHRI,/* A B sC  R(A) := R(B) >> C */
 
OP_SHLI,/* A B C   R(A) := C << R(B) */
OP_SHLI,/* A B sC  R(A) := C << R(B) */
 
OP_TESTSET,/* A B   if (not R(B) == k) then R(A) := R(B) else pc++ */
OP_TESTSET,/* A B   if (not R(B) ~= k) then R(A) := R(B) else pc++ */

Reply | Threaded
Open this post in threaded view
|

Re: [NoW] Mistakes/typos in the comments

Roberto Ierusalimschy
> 2)
> The file *lopcodes.h* from Lua@Github (as of Jan 30 2019) contains
> descriptions of VM instructions in comments.
> Some descriptions don't agree with the implementation of these
> instructions.
>
> (first line is "currently is:", second line is "should be:")
>
> OP_SHRI,/* A B C   R(A) := R(B) >> C */
> OP_SHRI,/* A B sC  R(A) := R(B) >> C */
>
> OP_SHLI,/* A B C   R(A) := C << R(B) */
> OP_SHLI,/* A B sC  R(A) := C << R(B) */
>
> OP_TESTSET,/* A B   if (not R(B) == k) then R(A) := R(B) else pc++ */
> OP_TESTSET,/* A B   if (not R(B) ~= k) then R(A) := R(B) else pc++ */

Thanks for the feedback.

-- Roberto