mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Clamp macros for floats
git-svn-id: https://svn.eduke32.com/eduke32@4431 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e760d590be
commit
82f5a3f39c
1 changed files with 12 additions and 0 deletions
|
@ -524,6 +524,18 @@ CLAMP_DECL int32_t clamp2(int32_t in, int32_t min, int32_t max)
|
|||
return in >= max ? max : (in <= min ? min : in);
|
||||
}
|
||||
|
||||
// Clamp <in> to [<min>..<max>]. The case in <= min is handled first.
|
||||
CLAMP_DECL float fclamp(float in, float min, float max)
|
||||
{
|
||||
return in <= min ? min : (in >= max ? max : in);
|
||||
}
|
||||
|
||||
// Clamp <in> to [<min>..<max>]. The case in >= max is handled first.
|
||||
CLAMP_DECL float fclamp2(float in, float min, float max)
|
||||
{
|
||||
return in >= max ? max : (in <= min ? min : in);
|
||||
}
|
||||
|
||||
#define BMAX_PATH 256
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue