C
Casey Hawthorne
I thought that array bounds checking needed two comparisons; however,
I see bounds checking can be done with one comparison:
n - number of array items -- indexed from 0 to n-1
to see if 0 <= i < n do the following comparison
if (i < n) then inbounds;
where '<' is an unsigned '<'
from "Hacker's Delight" Henry S. Warren, Jr. page 51
I see bounds checking can be done with one comparison:
n - number of array items -- indexed from 0 to n-1
to see if 0 <= i < n do the following comparison
if (i < n) then inbounds;
where '<' is an unsigned '<'
from "Hacker's Delight" Henry S. Warren, Jr. page 51