Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for SetBytes (0.16 sec)

  1. src/bytes/compare_test.go

    			b.Fatal("b1 != b2")
    		}
    	}
    	b.SetBytes(int64(len(b1)))
    }
    
    func BenchmarkCompareBytesBigIdentical(b *testing.B) {
    	b.StopTimer()
    	b1 := make([]byte, 0, 1<<20)
    	for len(b1) < 1<<20 {
    		b1 = append(b1, "Hello Gophers!"...)
    	}
    	b2 := b1
    	b.StartTimer()
    	for i := 0; i < b.N; i++ {
    		if Compare(b1, b2) != 0 {
    			b.Fatal("b1 != b2")
    		}
    	}
    	b.SetBytes(int64(len(b1)))
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Jul 13 23:11:42 GMT 2023
    - 6.8K bytes
    - Viewed (0)
  2. misc/cgo/gmp/gmp.go

    }
    
    // Set sets z = x and returns z.
    func (z *Int) Set(x *Int) *Int {
    	z.doinit()
    	C.mpz_set(&z.i[0], &x.i[0])
    	return z
    }
    
    // SetBytes interprets b as the bytes of a big-endian integer
    // and sets z to that value.
    func (z *Int) SetBytes(b []byte) *Int {
    	z.doinit()
    	if len(b) == 0 {
    		z.SetInt64(0)
    	} else {
    		C.mpz_import(&z.i[0], C.size_t(len(b)), 1, 1, 1, 0, unsafe.Pointer(&b[0]))
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Apr 11 16:34:30 GMT 2022
    - 9.5K bytes
    - Viewed (0)
Back to top