arturo-lang / arturo

Simple, expressive & portable programming language for efficient scripting
http://arturo-lang.io
MIT License
716 stars 32 forks source link

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

Open github-actions[bot] opened 9 months ago

github-actions[bot] commented 9 months ago

[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#L1207

            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

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.