summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-29 08:14:19 -0600
committerGitHub <noreply@github.com>2021-01-29 15:14:19 +0100
commit296cf9657cdf50141b6115a58fc38e3bc5aa0626 (patch)
tree04d856d7fe1193ed4aa275250630248576fb3c15
parentf09d97d6d37520e41aa295e43b6901ce49132aac (diff)
downloadNim-296cf9657cdf50141b6115a58fc38e3bc5aa0626.tar.gz
add lost functions (#16843)
-rw-r--r--lib/std/jsbigints.nim8
-rw-r--r--tests/stdlib/tjsbigints.nim2
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/jsbigints.nim b/lib/std/jsbigints.nim
index edef6844f..b62528abd 100644
--- a/lib/std/jsbigints.nim
+++ b/lib/std/jsbigints.nim
@@ -105,6 +105,14 @@ func `**`*(x, y: JsBigInt): JsBigInt {.importjs: "((#) $1 #)".} =
   # pending https://github.com/nim-lang/Nim/pull/15940, simplify to:
   # doAssertRaises: discard big"2" ** big"-1" # raises foreign `RangeError`
 
+func `and`*(x, y: JsBigInt): JsBigInt {.importjs: "(# & #)".} =
+  runnableExamples:
+    doAssert (big"555" and big"2") == big"2"
+
+func `or`*(x, y: JsBigInt): JsBigInt {.importjs: "(# | #)".} =
+  runnableExamples:
+    doAssert (big"555" or big"2") == big"555"
+
 func `xor`*(x, y: JsBigInt): JsBigInt {.importjs: "(# ^ #)".} =
   runnableExamples:
     doAssert (big"555" xor big"2") == big"553"
diff --git a/tests/stdlib/tjsbigints.nim b/tests/stdlib/tjsbigints.nim
index 764b03be9..34c5ddfbf 100644
--- a/tests/stdlib/tjsbigints.nim
+++ b/tests/stdlib/tjsbigints.nim
@@ -11,6 +11,8 @@ var big3: JsBigInt = big"2"
 
 doAssert big3 == big"2"
 doAssert (big3 xor big2) == big"664"
+doAssert (big"555" and big"2") == big"2"
+doAssert (big"555" or big"2") == big"555"
 doAssert (big1 mod big2) == big"613"
 doAssert -big1 == big"-2147483647"
 doAssert big1 div big2 == big"3224449"