asm-js / validator

A reference validator for asm.js.
Apache License 2.0
1.78k stars 148 forks source link

Error in the function table lookup in readme.md #55

Closed mariusGundersen closed 10 years ago

mariusGundersen commented 11 years ago

Line 51 of the readme reads:

ftable_2[(x-2)&2](); // dynamic call of functions in table 2

Since ftable_2 has a length of 2, shouldn't the index in the above line be (x-2)&1? The only two values which can be a result of the current expression is 0 or 2, which will give the first function and undefined, since 2 is outside the range of ftable_2. So the line should read

ftable_2[(x-2)&1](); // dynamic call of functions in table 2
kripken commented 11 years ago

Yup, good catch.

sunfishcode commented 10 years ago

Fixed in 77b6caedd9f1aa8628e3d2e1a38b9eac71df95b7.

mariusGundersen commented 10 years ago

That was quick ;)