ref: 5de3c303dc818498a0c294440dbdf5890e6831f8
parent: 820585fb7338092fa5b5001b81ad45b06376939d
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Jul 18 18:04:25 EDT 2019
Fix bigand/bigor: Thanks, Mike
--- a/lib/std/bigint.myr
+++ b/lib/std/bigint.myr
@@ -772,7 +772,13 @@
}
const bigand = {a, b
- for var i = 0; i < min(a.dig.len, b.dig.len); i++
+ if a.dig.len > b.dig.len
+ slzgrow(&b.dig, a.dig.len)
+ ;;
+ if b.dig.len > a.dig.len
+ slzgrow(&a.dig, b.dig.len)
+ ;;
+ for var i = 0; i < a.dig.len; i++
a.dig[i] &= b.dig[i]
;;
-> trim(a)
@@ -780,7 +786,7 @@
const bigor = {a, b
slzgrow(&a.dig, max(a.dig.len, b.dig.len))
- for var i = 0; i < a.dig.len; i++
+ for var i = 0; i < min(a.dig.len, b.dig.len); i++
a.dig[i] |= b.dig[i]
;;
-> trim(a)