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