diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/utils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/libcamera/internal/utils.h b/include/libcamera/internal/utils.h index 8d026cc6..45cd6f12 100644 --- a/include/libcamera/internal/utils.h +++ b/include/libcamera/internal/utils.h @@ -200,6 +200,16 @@ details::StringSplitter split(const std::string &str, const std::string &delim); std::string libcameraBuildPath(); std::string libcameraSourcePath(); +constexpr unsigned int alignDown(unsigned int value, unsigned int alignment) +{ + return value / alignment * alignment; +} + +constexpr unsigned int alignUp(unsigned int value, unsigned int alignment) +{ + return (value + alignment - 1) / alignment * alignment; +} + } /* namespace utils */ } /* namespace libcamera */ |