2020-09-10 15:44:10 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace efi {
|
|
|
|
|
|
|
|
template <int TNum, int TDenom = 1>
|
2021-05-20 17:00:32 -07:00
|
|
|
struct ratio {
|
2020-09-10 15:44:10 -07:00
|
|
|
static constexpr int num = TNum;
|
|
|
|
static constexpr int den = TDenom;
|
|
|
|
|
2021-03-19 05:39:08 -07:00
|
|
|
// A ratio type representing the reciprocal of this type.
|
|
|
|
using recip = ratio<den, num>;
|
|
|
|
|
2021-05-20 17:00:32 -07:00
|
|
|
static constexpr float asFloat() {
|
2020-09-10 15:44:10 -07:00
|
|
|
return (float)num / den;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace efi
|