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

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

View File

@ -76,9 +76,9 @@ namespace Porygon::Binder {
};
class BoundLiteralIntegerExpression : public BoundExpression {
const long _value;
const int64_t _value;
public:
BoundLiteralIntegerExpression(long value, unsigned int start, unsigned int length)
BoundLiteralIntegerExpression(int64_t value, unsigned int start, unsigned int length)
: BoundExpression(start, length, make_shared<NumericScriptType>(true, false)),
_value(value) {
}
@ -89,7 +89,7 @@ namespace Porygon::Binder {
}
[[nodiscard]]
inline long GetValue() const {
inline int64_t GetValue() const {
return _value;
}
};

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){}

View File

@ -154,7 +154,7 @@ namespace Porygon::Parser {
}
Token *Lexer::LexNumber(char16_t c) {
long int_value = CharToInt(c);
int64_t int_value = CharToInt(c);
double float_value = 0;
short decimal_index = 0;
bool has_point = false;

View File

@ -66,7 +66,7 @@ namespace Porygon::Parser {
};
class LiteralIntegerExpression : public ParsedExpression {
const long _value;
const int64_t _value;
public:
inline const ParsedExpressionKind GetKind() const final {
return ParsedExpressionKind::LiteralInteger;
@ -77,7 +77,7 @@ namespace Porygon::Parser {
_value(token->GetValue()) {
}
inline const long GetValue() const {
inline const int64_t GetValue() const {
return _value;
}
};

View File

@ -50,10 +50,10 @@ namespace Porygon::Parser {
};
class IntegerToken : public Token {
const long _value;
const int64_t _value;
public:
explicit IntegerToken(long value, unsigned int position, unsigned int length)
explicit IntegerToken(int64_t value, unsigned int position, unsigned int length)
: Token(position, length),
_value(value) {
}
@ -62,7 +62,7 @@ namespace Porygon::Parser {
return TokenKind::Integer;
}
[[nodiscard]] inline long GetValue() const {
[[nodiscard]] inline int64_t GetValue() const {
return _value;
}
};

View File

@ -10,7 +10,7 @@ namespace Porygon::Utilities {
_rng.seed(new_seed);
}
static inline long Get() {
static inline int64_t Get() {
return _rng.operator()();
}
};

View File

@ -13,7 +13,7 @@ namespace Porygon::Utilities{
private:
static std::wstring_convert<std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::little_endian>, char16_t> to_16;
public:
inline static std::u16string IntToString(long const &i) {
inline static std::u16string IntToString(int64_t const &i) {
return to_16.from_bytes(std::to_string(i));
}
inline static std::u16string FloatToString(double const &i) {