- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for NewInt (0.1 sec)
-
misc/cgo/gmp/pi.go
//go:build ignore package main import ( big "." "fmt" "runtime" ) var ( tmp1 = big.NewInt(0) tmp2 = big.NewInt(0) numer = big.NewInt(1) accum = big.NewInt(0) denom = big.NewInt(1) ten = big.NewInt(10) ) func extractDigit() int64 { if big.CmpInt(numer, accum) > 0 { return -1 } tmp1.Lsh(numer, 1).Add(tmp1, numer).Add(tmp1, accum)
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Apr 10 22:32:35 UTC 2023 - 1.3K bytes - Viewed (0) -
misc/cgo/gmp/fib.go
// Keep the fibbers in dedicated operating system // threads, so that this program tests coordination // between pthreads and not just goroutines. runtime.LockOSThread() i := big.NewInt(n) if n == 0 { c <- i } for { j := <-c out <- j.String() i.Add(i, j) c <- i } } func main() { c := make(chan *big.Int) out := make(chan string) go fibber(c, out, 0)
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Apr 10 22:32:35 UTC 2023 - 919 bytes - Viewed (0) -
misc/cgo/gmp/gmp.go
*/ // An Int represents a signed multi-precision integer. // The zero value for an Int represents the value 0. type Int struct { i C.mpz_t init bool } // NewInt returns a new Int initialized to x. func NewInt(x int64) *Int { return new(Int).SetInt64(x) } // Int promises that the zero value is a 0, but in gmp // the zero value is a crash. To bridge the gap, the
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Apr 11 16:34:30 UTC 2022 - 9.5K bytes - Viewed (0) -
cmd/test-utils_test.go
if err != nil { return nil, nil, fmt.Errorf("failed to generate private key: %w", err) } notBefore := time.Now() notAfter := notBefore.Add(validFor) serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) serialNumber, err := crand.Int(crand.Reader, serialNumberLimit) if err != nil { return nil, nil, fmt.Errorf("failed to generate serial number: %w", err) } template := x509.Certificate{
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Tue Oct 01 22:13:18 UTC 2024 - 77K bytes - Viewed (0)