Added a function for memory size alignment

This commit is contained in:
Eduard Urbach 2025-04-15 11:08:33 +02:00
parent 19a8154e06
commit 80aa833a9b
No known key found for this signature in database
GPG key ID: C874F672B1AF20C0
5 changed files with 44 additions and 0 deletions

11
lib/math/math.q Normal file
View file

@ -0,0 +1,11 @@
align2(x uint64) -> uint64 {
x -= 1
x |= x >> 1
x |= x >> 2
x |= x >> 4
x |= x >> 8
x |= x >> 16
x |= x >> 32
x += 1
return x
}