arturo-lang/arturo

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

github-actions opened this issue · 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)

# TODO(VM/values/operators) [`&&`] Verify for Web builds

            objectOperationOrNothing("pow", PowM, inplace=true)

# 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-AND between given values and return the result
    
    let pair = getValuePair()
    case pair:
        of Integer    || Integer        :   return normalIntegerAnd(x.i, y.i)
        of Integer    || BigInteger     :   (when defined(GMP): return newInteger(toBig(x.i) and y.bi))
        of BigInteger || Integer        :   (when defined(GMP): return newInteger(x.bi and toBig(y.i)))
        of BigInteger || BigInteger     :   (when defined(GMP): return newInteger(x.bi and y.bi))
        of Integer    || Binary         :   return newBinary(numberToBinary(x.i) and y.n)

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

d50e935aca3d5180228d90b6cccb1e4b72381cf4