aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/align.h
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system/align.h
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'util/system/align.h')
-rw-r--r--util/system/align.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/util/system/align.h b/util/system/align.h
index 0261b6848e..ea0bbc5b46 100644
--- a/util/system/align.h
+++ b/util/system/align.h
@@ -5,45 +5,45 @@
#include <util/generic/bitops.h>
template <class T>
-static inline T AlignDown(T len, T align) noexcept {
+static inline T AlignDown(T len, T align) noexcept {
Y_ASSERT(IsPowerOf2(align)); // align should be power of 2
return len & ~(align - 1);
}
template <class T>
-static inline T AlignUp(T len, T align) noexcept {
+static inline T AlignUp(T len, T align) noexcept {
const T alignedResult = AlignDown(len + (align - 1), align);
Y_ASSERT(alignedResult >= len); // check for overflow
return alignedResult;
}
template <class T>
-static inline T AlignUpSpace(T len, T align) noexcept {
+static inline T AlignUpSpace(T len, T align) noexcept {
Y_ASSERT(IsPowerOf2(align)); // align should be power of 2
return ((T)0 - len) & (align - 1); // AlignUp(len, align) - len;
}
template <class T>
-static inline T* AlignUp(T* ptr, size_t align) noexcept {
+static inline T* AlignUp(T* ptr, size_t align) noexcept {
return (T*)AlignUp((uintptr_t)ptr, align);
}
template <class T>
-static inline T* AlignDown(T* ptr, size_t align) noexcept {
+static inline T* AlignDown(T* ptr, size_t align) noexcept {
return (T*)AlignDown((uintptr_t)ptr, align);
}
template <class T>
-static inline T AlignUp(T t) noexcept {
+static inline T AlignUp(T t) noexcept {
return AlignUp(t, (size_t)PLATFORM_DATA_ALIGN);
}
template <class T>
-static inline T AlignDown(T t) noexcept {
+static inline T AlignDown(T t) noexcept {
return AlignDown(t, (size_t)PLATFORM_DATA_ALIGN);
}
template <class T>
-static inline T Align(T t) noexcept {
+static inline T Align(T t) noexcept {
return AlignUp(t);
}