To round a number up to the next power of two if it isn't already a
power of two; From "Hacker's Delight", page 46:
: ROUND-UP ( n -- m )
1-
DUP 1 RSHIFT OR
DUP 2 RSHIFT OR
DUP 4 RSHIFT OR
DUP 8 RSHIFT OR
DUP 16 RSHIFT OR
1+ ;
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Mon Jun 09 2008 - 11:44:21 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.