summaryrefslogtreecommitdiff
path: root/libc/src/__support/RPC/rpc_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/__support/RPC/rpc_util.h')
-rw-r--r--libc/src/__support/RPC/rpc_util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/src/__support/RPC/rpc_util.h b/libc/src/__support/RPC/rpc_util.h
index 224723ef20c9..c6282e40c903 100644
--- a/libc/src/__support/RPC/rpc_util.h
+++ b/libc/src/__support/RPC/rpc_util.h
@@ -49,6 +49,11 @@ LIBC_INLINE constexpr bool is_process_gpu() {
#endif
}
+/// Return \p val aligned "upwards" according to \p align.
+template <typename V, typename A> LIBC_INLINE V align_up(V val, A align) {
+ return ((val + V(align) - 1) / V(align)) * V(align);
+}
+
} // namespace rpc
} // namespace __llvm_libc