arturo icon indicating copy to clipboard operation
arturo copied to clipboard

[VM/values/operators] [`^^`] Verify for Web builds

Open github-actions[bot] opened this issue 1 year ago • 0 comments

[VM/values/operators] [^^] Verify for Web builds we should also check whether big integers work too! (the same applies to its in-place equivalent)

https://github.com/arturo-lang/arturo/blob/04e57a1a8d6bcaf8fdb4003e0893ca35cc4ee90e/src/vm/values/operators.nim#L1291

            discard invalidOperation("or")

# TODO(VM/values/operators) [`^^`] Verify for Web builds
#  we should also check whether big integers work too!
#  (the same applies to its in-place equivalent)
#  labels: unit-test, web, :integer

proc `^^`*(x: Value, y: Value): Value =
    ## perform binary-XOR between given values and return the result
    
    let pair = getValuePair()
    case pair:
        of Integer    || Integer        :   return normalIntegerXor(x.i, y.i)
        of Integer    || BigInteger     :   (when defined(GMP): return newInteger(toBig(x.i) xor y.bi))
        of BigInteger || Integer        :   (when defined(GMP): return newInteger(x.bi xor toBig(y.i)))
        of BigInteger || BigInteger     :   (when defined(GMP): return newInteger(x.bi xor y.bi))
        of Integer    || Binary         :   return newBinary(numberToBinary(x.i) xor y.n)

        of Binary     || Integer        :   return newBinary(x.n xor numberToBinary(y.i))

d880cbc29bc024c46cb595062e3d5571468053f8

github-actions[bot] avatar Jan 19 '24 17:01 github-actions[bot]