Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestBitLen (0.21 sec)

  1. src/go/constant/value_test.go

    	}
    }
    
    var bitLenTests = []struct {
    	val  int64
    	want int
    }{
    	{0, 0},
    	{1, 1},
    	{-16, 5},
    	{1 << 61, 62},
    	{1 << 62, 63},
    	{-1 << 62, 63},
    	{-1 << 63, 64},
    }
    
    func TestBitLen(t *testing.T) {
    	for _, test := range bitLenTests {
    		if got := BitLen(MakeInt64(test.val)); got != test.want {
    			t.Errorf("%v: got %v, want %v", test.val, got, test.want)
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 15.6K bytes
    - Viewed (0)
  2. src/math/big/int_test.go

    	{"0xabc", 12},
    	{"0x8000", 16},
    	{"0x80000000", 32},
    	{"0x800000000000", 48},
    	{"0x8000000000000000", 64},
    	{"0x80000000000000000000", 80},
    	{"-0x4000000000000000000000", 87},
    }
    
    func TestBitLen(t *testing.T) {
    	for i, test := range bitLenTests {
    		x, ok := new(Int).SetString(test.in, 0)
    		if !ok {
    			t.Errorf("#%d test input invalid: %s", i, test.in)
    			continue
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 58.5K bytes
    - Viewed (0)
Back to top