diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-10-14 04:19:02 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-10-14 04:19:02 -0300 |
| commit | a0f918bf65028146709010a5447b68f26a715fa0 (patch) | |
| tree | 0126cec616d31ea063a935f5edca7cc8ce0555e2 /src/querymanager.hh | |
| parent | b1631a7952d72ce56bd10656fffedc8a7fe322ca (diff) | |
| download | querymanager-a0f918bf65028146709010a5447b68f26a715fa0.tar.gz querymanager-a0f918bf65028146709010a5447b68f26a715fa0.zip | |
more postgres helpers and a couple of queries
Diffstat (limited to 'src/querymanager.hh')
| -rw-r--r-- | src/querymanager.hh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/querymanager.hh b/src/querymanager.hh index 2b2b053..1128ab9 100644 --- a/src/querymanager.hh +++ b/src/querymanager.hh @@ -208,6 +208,18 @@ inline bool AtomicCompareExchange(AtomicInt *Ptr, int *Expected, int Desired){ # error "Atomics not implemented for compiler." #endif +// Memory Utility +//============================================================================== +inline usize AlignUp(usize Size, usize Alignment){ + ASSERT(ISPOW2(Alignment)); + return Size + ((0 - Size) & (Alignment - 1)); +} + +inline usize AlignDown(usize Size, usize Alignment){ + ASSERT(ISPOW2(Alignment)); + return Size - (Size & (Alignment - 1)); +} + // Buffer Utility //============================================================================== inline uint8 BufferRead8(const uint8 *Buffer){ |
