mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
clamping.h - add documentation
This commit is contained in:
parent
a8982cd9ee
commit
d36a6fc895
@ -25,6 +25,16 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clamp_float:
|
||||||
|
* @val : initial value
|
||||||
|
* @lower : lower limit that value should be clamped against
|
||||||
|
* @upper : upper limit that value should be clamped against
|
||||||
|
*
|
||||||
|
* Clamps a floating point value.
|
||||||
|
*
|
||||||
|
* Returns: a clamped value of initial float value @val.
|
||||||
|
*/
|
||||||
static inline float clamp_float(float val, float lower, float upper)
|
static inline float clamp_float(float val, float lower, float upper)
|
||||||
{
|
{
|
||||||
if (val < lower)
|
if (val < lower)
|
||||||
@ -34,6 +44,14 @@ static inline float clamp_float(float val, float lower, float upper)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clamp_8bit:
|
||||||
|
* @val : initial value
|
||||||
|
*
|
||||||
|
* Clamps an unsigned 8-bit value.
|
||||||
|
*
|
||||||
|
* Returns: a clamped value of initial unsigned 8-bit value @val.
|
||||||
|
*/
|
||||||
static inline uint8_t clamp_8bit(int val)
|
static inline uint8_t clamp_8bit(int val)
|
||||||
{
|
{
|
||||||
if (val > 255)
|
if (val > 255)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user