mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 06:55:09 +00:00
share align utility
This commit is contained in:
parent
55ac4dcc1b
commit
e259f904a4
8 changed files with 47 additions and 59 deletions
14
rx/include/rx/align.hpp
Normal file
14
rx/include/rx/align.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace rx {
|
||||
inline constexpr std::uint64_t alignUp(std::uint64_t value,
|
||||
std::uint64_t alignment) {
|
||||
return (value + (alignment - 1)) & ~(alignment - 1);
|
||||
}
|
||||
inline constexpr std::uint64_t alignDown(std::uint64_t value,
|
||||
std::uint64_t alignment) {
|
||||
return value & ~(alignment - 1);
|
||||
}
|
||||
} // namespace rx
|
||||
Loading…
Add table
Add a link
Reference in a new issue