mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 08:30:58 +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);
|
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
|
#define BMAX_PATH 256
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue