mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-02 00:38:26 +01:00
Changed integer storage from positive/negative to signed/unsigned
This commit is contained in:
@@ -57,16 +57,16 @@ struct Comparer<T, typename enable_if<is_integral<T>::value ||
|
||||
return arithmeticCompare(lhs, rhs);
|
||||
}
|
||||
|
||||
CompareResult visitNegativeInteger(UInt lhs) {
|
||||
return arithmeticCompareNegateLeft(lhs, rhs);
|
||||
CompareResult visitSignedInteger(Integer lhs) {
|
||||
return arithmeticCompare(lhs, rhs);
|
||||
}
|
||||
|
||||
CompareResult visitPositiveInteger(UInt lhs) {
|
||||
CompareResult visitUnsignedInteger(UInt lhs) {
|
||||
return arithmeticCompare(lhs, rhs);
|
||||
}
|
||||
|
||||
CompareResult visitBoolean(bool lhs) {
|
||||
return visitPositiveInteger(static_cast<UInt>(lhs));
|
||||
return visitUnsignedInteger(static_cast<UInt>(lhs));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -96,28 +96,6 @@ struct ArrayComparer : ComparerBase {
|
||||
}
|
||||
};
|
||||
|
||||
struct NegativeIntegerComparer : ComparerBase {
|
||||
UInt _rhs;
|
||||
|
||||
explicit NegativeIntegerComparer(UInt rhs) : _rhs(rhs) {}
|
||||
|
||||
CompareResult visitFloat(Float lhs) {
|
||||
return arithmeticCompareNegateRight(lhs, _rhs);
|
||||
}
|
||||
|
||||
CompareResult visitNegativeInteger(UInt lhs) {
|
||||
return arithmeticCompare(_rhs, lhs);
|
||||
}
|
||||
|
||||
CompareResult visitPositiveInteger(UInt) {
|
||||
return COMPARE_RESULT_GREATER;
|
||||
}
|
||||
|
||||
CompareResult visitBoolean(bool) {
|
||||
return COMPARE_RESULT_GREATER;
|
||||
}
|
||||
};
|
||||
|
||||
struct ObjectComparer : ComparerBase {
|
||||
const CollectionData *_rhs;
|
||||
|
||||
@@ -182,12 +160,12 @@ struct Comparer<T, typename enable_if<IsVisitable<T>::value>::type>
|
||||
return accept(comparer);
|
||||
}
|
||||
|
||||
CompareResult visitNegativeInteger(UInt lhs) {
|
||||
NegativeIntegerComparer comparer(lhs);
|
||||
CompareResult visitSignedInteger(Integer lhs) {
|
||||
Comparer<Integer> comparer(lhs);
|
||||
return accept(comparer);
|
||||
}
|
||||
|
||||
CompareResult visitPositiveInteger(UInt lhs) {
|
||||
CompareResult visitUnsignedInteger(UInt lhs) {
|
||||
Comparer<UInt> comparer(lhs);
|
||||
return accept(comparer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user