mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Fix Unit::isSecond, Unit::isMeter and Unit::isKilogram: the
EmptyPrefix is not unique, we can't only compare pointers
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
||||
m_symbol(symbol),
|
||||
m_exponent(exponent)
|
||||
{}
|
||||
inline bool operator==(const Prefix& p) const { return m_exponent == p.m_exponent && strcmp(m_symbol, p.m_symbol) == 0; }
|
||||
const char * symbol() const { return m_symbol; }
|
||||
int8_t exponent() const { return m_exponent; }
|
||||
int serialize(char * buffer, int bufferSize) const;
|
||||
|
||||
@@ -392,16 +392,16 @@ Expression Unit::removeUnit(Expression * unit) {
|
||||
}
|
||||
|
||||
bool Unit::isSecond() const {
|
||||
return node()->dimension() == TimeDimension && node()->representative() == SecondRepresentative && node()->prefix() == &EmptyPrefix;
|
||||
return node()->dimension() == TimeDimension && node()->representative() == SecondRepresentative && *(node()->prefix()) == EmptyPrefix;
|
||||
}
|
||||
|
||||
bool Unit::isMeter() const {
|
||||
return node()->dimension() == DistanceDimension && node()->representative() == MeterRepresentative && node()->prefix() == &EmptyPrefix;
|
||||
return node()->dimension() == DistanceDimension && node()->representative() == MeterRepresentative && *(node()->prefix()) == EmptyPrefix;
|
||||
}
|
||||
|
||||
|
||||
bool Unit::isKilogram() const {
|
||||
return node()->dimension() == MassDimension && node()->representative() == KilogramRepresentative && node()->prefix() == &KiloPrefix;
|
||||
return node()->dimension() == MassDimension && node()->representative() == KilogramRepresentative && *(node()->prefix()) == KiloPrefix;
|
||||
}
|
||||
|
||||
bool Unit::IsISSpeed(Expression & e) {
|
||||
|
||||
Reference in New Issue
Block a user