1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[util] Handle undefined ratios in simplest ratio helper

Fixes division by zero error

Closes #1280
This commit is contained in:
Joshua Ashton 2019-12-16 23:40:16 +00:00
parent 91b5105db5
commit e527b963c4

View File

@ -44,6 +44,13 @@ namespace dxvk {
inline void set(T num, T denom) { inline void set(T num, T denom) {
const T gcd = std::gcd(num, denom); const T gcd = std::gcd(num, denom);
if (gcd == 0) {
m_num = 0;
m_denom = 0;
return;
}
m_num = num / gcd; m_num = num / gcd;
m_denom = denom / gcd; m_denom = denom / gcd;
} }