aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/align.h
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /util/system/align.h
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 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 ea0bbc5b46..0261b6848e 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);
}