m1n1.utils: Add align_pot()

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2022-10-28 19:27:25 +09:00 committed by Hector Martin
parent 7b63613945
commit e4810a452d

View file

@ -13,6 +13,12 @@ align = align_up
def align_down(v, a=16384):
return v & ~(a - 1)
def align_pot(v):
out = 1
while out < v:
out *= 2
return out
def hexdump(s, sep=" "):
return sep.join(["%02x"%x for x in s])