summaryrefslogtreecommitdiffhomepage
path: root/compat/round.hpp
blob: 90a0ccb3d04959378992ff823af3f26a4fbd899d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

#include <cmath>

template<typename t>
inline int iround(const t& val)
{
    return int(std::round(val));
}

template<typename t>
inline unsigned uround(const t& val)
{
    return std::round(std::fmax(t(0), val));
}