Here's an alternative code I've been distributing in Asphyre package:

Code:
function NextPowerOfTwo(Value: Integer): Integer;
begin
 Result:= 1;
 asm
  xor ecx, ecx
  bsr ecx, Value
  inc ecx
  shl Result, cl
 end;
end;
Code:
function CeilPowerOfTwo(Value: Integer): Integer;
asm
 mov ecx, eax
 xor eax, eax
 dec ecx
 bsr ecx, ecx
 cmovz ecx, eax
 setnz al
 inc eax
 shl eax, cl
end;