Files
core_math/tjp/core/math/clamp.hpp
Timothy Prepscius 0807c0286a flatten 20260225
2026-02-25 12:36:47 -05:00

25 lines
367 B
C++
Executable File

//
// Math.hpp
// amoeba
//
// Created by Timothy Prepscius on 12/30/16.
// Copyright © 2016 Timothy Prepscius. All rights reserved.
//
#pragma once
namespace tjp::core::math {
template<typename V, typename L, typename R>
inline V clamp(const V &v, const L &l, const R &r)
{
if (v < l)
return (V)l;
if (v > r)
return (V)r;
return v;
}
} // namespace