fOOrth/docs/snippets/int_log2.foorth
2015-02-16 15:53:40 -05:00

7 lines
118 B
Text

// A simple integer log2
: ilog2 .to_i 2/ 0 swap
begin
dup 0> while
2/ swap 1+ swap
again
drop ;