diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2020-07-13 15:05:23 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2020-08-03 11:16:16 +0200 |
commit | d405d1fd5e791b3ebc45dc980be2fce9ac0f3529 (patch) | |
tree | 3bc5e3d5849c1f8dba012b7ced7bf3570e26a41a /src | |
parent | 4383252d9315b3a282d220f30ac1a5594cd66d7c (diff) |
libcamera: utils: Add alignUp and alignDown functions
Add to libcamera utils library two functions to round up or down a
value to an alignment and add a test in test/utils.cpp for the two
new functions.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/utils.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index 0567328f..615df46a 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -444,6 +444,22 @@ std::string libcameraSourcePath() return path + "/"; } +/** + * \fn alignDown(unsigned int value, unsigned int alignment) + * \brief Align \a value down to \a alignment + * \param[in] value The value to align + * \param[in] alignment The alignment + * \return The value rounded down to the nearest multiple of \a alignment + */ + +/** + * \fn alignUp(unsigned int value, unsigned int alignment) + * \brief Align \a value up to \a alignment + * \param[in] value The value to align + * \param[in] alignment The alignment + * \return The value rounded up to the nearest multiple of \a alignment + */ + } /* namespace utils */ } /* namespace libcamera */ |