what's the easiest way to round up to power of 2?

BlitzMax Forums/BlitzMax Programming/what's the easiest way to round up to power of 2?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Indeed, you need to rplace "square root" with "base 2 logarithm".
This would give:
Const LOG2# = 0.69314718055994529
Function BPo2:Int(v:Int)
	Return 1 Shl Int(Ceil(Log(v)/LOG2))
End Function
But this is clearly slower.