Second round of bson extraction

This commit is contained in:
Jakub Nowakowski committed 2018-06-13 11:27:43 -04:00
1 parent c0e04321bb
commit d038e085a3
6 files changed
+18 -377

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package bson
import (
"errors"
"fmt"
"math/big"
)
func fromHex(hex string) (*big.Int, error) {
n, err := new(big.Int).SetString(hex, 16)
if !err {
msg := fmt.Sprintf("Cannot convert %s to int as hexadecimal", hex)
return nil, errors.New(msg)
}
return n, nil
}
func all(oks []bool) bool {
for _, ok := range oks {
if !ok {
return false
}
}
return true
}
func b(i int) *big.Int {
return big.NewInt(int64(i))
}