diff options
author | dzwdz | 2022-05-05 23:31:10 +0200 |
---|---|---|
committer | dzwdz | 2022-05-05 23:31:10 +0200 |
commit | d8c330821aa3ae1d441cdf3aed64d457d0ed0cd9 (patch) | |
tree | 2e762e97e6484b12fd456ca27d8d6d23c6bf4f24 /src/kernel/util.h | |
parent | 5418a2e1bbc26660bb8579c57fa19e4a04c34200 (diff) |
kernel/driver: clean up the ps2/serial drivers
Diffstat (limited to 'src/kernel/util.h')
-rw-r--r-- | src/kernel/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/kernel/util.h b/src/kernel/util.h index 0e57d67..59af755 100644 --- a/src/kernel/util.h +++ b/src/kernel/util.h @@ -19,3 +19,9 @@ static inline int32_t capped_cast32(uint32_t u) { return (int32_t)min(u, (uint32_t)INT32_MAX); } + +static inline int clamp(int lo, int i, int hi) { + if (i < lo) return lo; + if (i > hi) return hi; + return i; +} |