Resolved uninitialized return value warnings #685
This commit is contained in:
parent
7733266417
commit
25e7bef346
@ -669,39 +669,20 @@ namespace detail
|
|||||||
T biggestVal = sqrt(fourBiggestSquaredMinus1 + static_cast<T>(1)) * static_cast<T>(0.5);
|
T biggestVal = sqrt(fourBiggestSquaredMinus1 + static_cast<T>(1)) * static_cast<T>(0.5);
|
||||||
T mult = static_cast<T>(0.25) / biggestVal;
|
T mult = static_cast<T>(0.25) / biggestVal;
|
||||||
|
|
||||||
tquat<T, Q> Result;
|
|
||||||
switch(biggestIndex)
|
switch(biggestIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
Result.w = biggestVal;
|
return tquat<T, Q>(biggestVal, (m[1][2] - m[2][1]) * mult, (m[2][0] - m[0][2]) * mult, (m[0][1] - m[1][0]) * mult);
|
||||||
Result.x = (m[1][2] - m[2][1]) * mult;
|
|
||||||
Result.y = (m[2][0] - m[0][2]) * mult;
|
|
||||||
Result.z = (m[0][1] - m[1][0]) * mult;
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
Result.w = (m[1][2] - m[2][1]) * mult;
|
return tquat<T, Q>((m[1][2] - m[2][1]) * mult, biggestVal, (m[0][1] + m[1][0]) * mult, (m[2][0] + m[0][2]) * mult);
|
||||||
Result.x = biggestVal;
|
|
||||||
Result.y = (m[0][1] + m[1][0]) * mult;
|
|
||||||
Result.z = (m[2][0] + m[0][2]) * mult;
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
Result.w = (m[2][0] - m[0][2]) * mult;
|
return tquat<T, Q>((m[2][0] - m[0][2]) * mult, (m[0][1] + m[1][0]) * mult, biggestVal, (m[1][2] + m[2][1]) * mult);
|
||||||
Result.x = (m[0][1] + m[1][0]) * mult;
|
|
||||||
Result.y = biggestVal;
|
|
||||||
Result.z = (m[1][2] + m[2][1]) * mult;
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
Result.w = (m[0][1] - m[1][0]) * mult;
|
return tquat<T, Q>((m[0][1] - m[1][0]) * mult, (m[2][0] + m[0][2]) * mult, (m[1][2] + m[2][1]) * mult, biggestVal);
|
||||||
Result.x = (m[2][0] + m[0][2]) * mult;
|
default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
|
||||||
Result.y = (m[1][2] + m[2][1]) * mult;
|
|
||||||
Result.z = biggestVal;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
|
|
||||||
assert(false);
|
assert(false);
|
||||||
break;
|
return tquat<T, Q>(1, 0, 0, 0);
|
||||||
}
|
}
|
||||||
return Result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user