chore: add force align fn (used in arm32, turbo, and zba)

This commit is contained in:
Rekai Nyangadzayi Musuka 2024-03-11 10:36:43 -05:00
parent 78b944a98f
commit 7ebaf2854a
1 changed files with 4 additions and 0 deletions

View File

@ -90,3 +90,7 @@ pub inline fn rotr(comptime T: type, x: T, r: anytype) T {
const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).Int.bits));
return x >> ar | x << (1 +% ~ar);
}
pub inline fn alignAddr(comptime T: type, address: u32) u32 {
return address & ~@as(u32, @sizeOf(T) - 1);
}