Skip to content

Commit

Permalink
minitscript: make it more integrable
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Jan 2, 2025
1 parent 29e428d commit 17b106f
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/minitscript/minitscript/MinitScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -3420,27 +3420,6 @@ class minitscript::minitscript::MinitScript {
return result2;
}

/**
* Decode operator
* @param arguments arguments
* @param operatorValueIdx operator value index
* @param defaultOperatorString default operator string
* @return operator string
*/
inline static const string decodeOperator(const span<MinitScript::Variable>& arguments, int operatorValueIdx, const string& defaultOperatorString) {
//
int64_t operatorValue;
if (MinitScript::getIntegerValue(arguments, operatorValueIdx, operatorValue) == false) return defaultOperatorString;
//
string result;
auto c1 = (operatorValue & 255);
auto c2 = ((operatorValue >> 8) & 255);
if (c1 != 0ll) result+= (char)c1;
if (c2 != 0ll) result+= (char)c2;
//
return result;
}

/**
* Initialize native mini script
*/
Expand Down Expand Up @@ -4479,6 +4458,27 @@ class minitscript::minitscript::MinitScript {
return result;
}

/**
* Decode operator
* @param arguments arguments
* @param operatorValueIdx operator value index
* @param defaultOperatorString default operator string
* @return operator string
*/
inline static const string decodeOperator(const span<MinitScript::Variable>& arguments, int operatorValueIdx, const string& defaultOperatorString) {
//
int64_t operatorValue;
if (MinitScript::getIntegerValue(arguments, operatorValueIdx, operatorValue) == false) return defaultOperatorString;
//
string result;
auto c1 = (operatorValue & 255);
auto c2 = ((operatorValue >> 8) & 255);
if (c1 != 0ll) result+= (char)c1;
if (c2 != 0ll) result+= (char)c2;
//
return result;
}

/**
* @return error message
*/
Expand Down

0 comments on commit 17b106f

Please sign in to comment.