| 106 | } |
| 107 | |
| 108 | void MathLib::value::promote(const MathLib::value &v) |
| 109 | { |
| 110 | if (isInt() && v.isInt()) { |
| 111 | if (mType < v.mType) { |
| 112 | mType = v.mType; |
| 113 | mIsUnsigned = v.mIsUnsigned; |
| 114 | } else if (mType == v.mType) { |
| 115 | mIsUnsigned |= v.mIsUnsigned; |
| 116 | } |
| 117 | } else if (!isFloat()) { |
| 118 | mIsUnsigned = false; |
| 119 | mDoubleValue = static_cast<double>(mIntValue); |
| 120 | mType = MathLib::value::Type::FLOAT; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | |
| 125 | MathLib::value MathLib::value::calc(char op, const MathLib::value &v1, const MathLib::value &v2) |