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>
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user