PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Utility
libsimpletools
source
constrainInt.c
1
/*
2
* @file constrainInt.c
3
*
4
* @author Andy Lindsay
5
*
6
* @version 1.1.8
7
*
8
* @copyright Copyright (C) Parallax, Inc. 2018. See end of file for
9
* terms of use (MIT License).
10
*
11
* @brief constrainInt function source, see simpletools.h for documentation.
12
*
13
* @detail Please submit bug reports, suggestions, and improvements to
14
* this code to editor@parallax.com.
15
*/
16
17
18
19
#include "
simpletools.h
"
20
21
int
constrainInt
(
int
value,
int
min,
int
max)
22
{
23
if
(min > max)
24
{
25
int
temp = min;
26
min = max;
27
max = temp;
28
}
29
if
(value < min) value = min;
30
if
(value > max) value = max;
31
return
value;
32
}
33
34
35
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
constrainInt
int constrainInt(int value, int min, int max)
Constrains an integer value to a range from a minimum value to a maximum value. If the value is above...
Definition:
constrainInt.c:21
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17