Apparently Windows does not handle 'long' the same as Unix.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-08-18 10:30:58 +02:00
parent 86d6d5a9cb
commit 2d4d3d8856
12 changed files with 37 additions and 37 deletions

View File

@@ -37,7 +37,7 @@ namespace Porygon::Evaluation {
}
EvalValue *CreateIntegerEvalValue(long l) {
EvalValue *CreateIntegerEvalValue(int64_t l) {
return new IntegerEvalValue(l);
}

View File

@@ -37,7 +37,7 @@ namespace Porygon::Evaluation {
virtual EvalValue* Clone() const = 0;
[[nodiscard]]
virtual long EvaluateInteger() const {
virtual int64_t EvaluateInteger() const {
throw EvaluationException("Can't evaluate this EvalValue as integer.");
}

View File

@@ -9,10 +9,10 @@ namespace Porygon::Evaluation{
class EvalValueHelper{
public:
inline static EvalValue* Create(unsigned char i){
return new IntegerEvalValue((long)i);
return new IntegerEvalValue((int64_t )i);
}
inline static EvalValue* Create(signed char i){
return new IntegerEvalValue((long)i);
return new IntegerEvalValue((int64_t )i);
}
inline static EvalValue* Create(short int i){
return new IntegerEvalValue(i);
@@ -26,10 +26,10 @@ namespace Porygon::Evaluation{
inline static EvalValue* Create(unsigned int i){
return new IntegerEvalValue(i);
}
inline static EvalValue* Create(signed long l){
inline static EvalValue* Create(int64_t l){
return new IntegerEvalValue(l);
}
inline static EvalValue* Create(unsigned long l){
inline static EvalValue* Create(uint64_t l){
return new IntegerEvalValue(l);
}

View File

@@ -10,7 +10,7 @@ namespace Porygon::Evaluation {
class NumericEvalValue : public EvalValue {
[[nodiscard]]
virtual long GetIntegerValue() const = 0;
virtual int64_t GetIntegerValue() const = 0;
[[nodiscard]]
virtual double GetFloatValue() const = 0;
@@ -44,10 +44,10 @@ namespace Porygon::Evaluation {
};
class IntegerEvalValue : public NumericEvalValue {
const long _value;
const int64_t _value;
[[nodiscard]]
long GetIntegerValue() const final { return _value; }
int64_t GetIntegerValue() const final { return _value; }
[[nodiscard]]
double GetFloatValue() const final {
@@ -55,7 +55,7 @@ namespace Porygon::Evaluation {
}
public:
explicit IntegerEvalValue(long value) : _value(value) {
explicit IntegerEvalValue(int64_t value) : _value(value) {
}
[[nodiscard]]
@@ -64,7 +64,7 @@ namespace Porygon::Evaluation {
}
[[nodiscard]]
inline long EvaluateInteger() const final {
inline int64_t EvaluateInteger() const final {
return _value;
}
@@ -85,7 +85,7 @@ namespace Porygon::Evaluation {
[[nodiscard]]
inline std::size_t GetHashCode() const final {
return std::hash<long>{}(_value);
return std::hash<int64_t >{}(_value);
}
[[nodiscard]]
@@ -104,8 +104,8 @@ namespace Porygon::Evaluation {
const double _value;
[[nodiscard]]
inline long GetIntegerValue() const final {
throw EvaluationException("Attempting to retrieve float from int eval value.");
inline int64_t GetIntegerValue() const final {
return _value;
}
[[nodiscard]]
@@ -128,8 +128,8 @@ namespace Porygon::Evaluation {
}
[[nodiscard]]
inline long EvaluateInteger() const final {
return static_cast<long>(_value);
inline int64_t EvaluateInteger() const final {
return static_cast<int64_t >(_value);
}
[[nodiscard]]
@@ -168,13 +168,13 @@ namespace Porygon::Evaluation {
auto rightVal = right->EvaluateInteger();
switch (operation) {
case Binder::BoundBinaryOperation::Addition:
return new IntegerEvalValue((long) _value + rightVal);
return new IntegerEvalValue((int64_t ) _value + rightVal);
case Binder::BoundBinaryOperation::Subtraction:
return new IntegerEvalValue((long) _value - rightVal);
return new IntegerEvalValue((int64_t ) _value - rightVal);
case Binder::BoundBinaryOperation::Multiplication:
return new IntegerEvalValue((long) _value * rightVal);
return new IntegerEvalValue((int64_t ) _value * rightVal);
case Binder::BoundBinaryOperation::Division:
return new IntegerEvalValue((long) _value / rightVal);
return new IntegerEvalValue((int64_t ) _value / rightVal);
case Binder::BoundBinaryOperation::LessThan:
return new BooleanEvalValue(_value < rightVal);
case Binder::BoundBinaryOperation::LessThanEquals:

View File

@@ -140,9 +140,9 @@ namespace Porygon::Evaluation {
}
void Evaluator::EvaluateNumericalForStatement(const BoundNumericalForStatement *statement) {
long start = this->EvaluateExpression(statement -> GetStart()) -> EvaluateInteger();
long end = this->EvaluateExpression(statement -> GetEnd()) -> EvaluateInteger();
long step = 1;
int64_t start = this->EvaluateExpression(statement -> GetStart()) -> EvaluateInteger();
int64_t end = this->EvaluateExpression(statement -> GetEnd()) -> EvaluateInteger();
int64_t step = 1;
auto stepExp = statement -> GetStep();
if (stepExp != nullptr){
step = this -> EvaluateExpression(stepExp) -> EvaluateInteger();
@@ -152,7 +152,7 @@ namespace Porygon::Evaluation {
auto block = (BoundBlockStatement*)statement -> GetBlock();
auto statements = *block -> GetStatements();
if (step >= 0){
for (long i = start; i <= end; i += step){
for (int64_t i = start; i <= end; i += step){
this -> _evaluationScope -> SetVariable(identifier, new IntegerEvalValue(i));
for (auto s: statements) {
this->EvaluateStatement(s);
@@ -163,7 +163,7 @@ namespace Porygon::Evaluation {
break;
}
} else{
for (long i = start; i >= end; i += step){
for (int64_t i = start; i >= end; i += step){
this -> _evaluationScope -> SetVariable(identifier, new IntegerEvalValue(i));
for (auto s: statements) {
this->EvaluateStatement(s);

View File

@@ -11,7 +11,7 @@ namespace Porygon::Evaluation{
class NumericalKeyIterator : public Iterator{
const shared_ptr<vector<EvalValuePointer>> _vec;
const size_t _size;
long _position = 0;
size_t _position = 0;
public:
explicit NumericalKeyIterator(const NumericalTableEvalValue* table)
: _vec(table->GetTable()), _size(_vec->size() + 1){}