Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for nextslicecap (0.14 sec)

  1. src/runtime/slice.go

    			bulkBarrierPreWriteSrcOnly(uintptr(p), uintptr(oldPtr), lenmem-et.Size_+et.PtrBytes, et)
    		}
    	}
    	memmove(p, oldPtr, lenmem)
    
    	return slice{p, newLen, newcap}
    }
    
    // nextslicecap computes the next appropriate slice length.
    func nextslicecap(newLen, oldCap int) int {
    	newcap := oldCap
    	doublecap := newcap + newcap
    	if newLen > doublecap {
    		return newLen
    	}
    
    	const threshold = 256
    	if oldCap < threshold {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/test/inl_test.go

    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 09 04:07:57 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  3. src/internal/saferio/io_test.go

    		got, err := ReadDataAt(sr, 0, 0)
    		if err != nil {
    			t.Fatal(err)
    		}
    		if len(got) > 0 {
    			t.Errorf("got %d bytes, expected 0", len(got))
    		}
    	})
    }
    
    func TestSliceCap(t *testing.T) {
    	t.Run("small", func(t *testing.T) {
    		c := SliceCap[int](10)
    		if c != 10 {
    			t.Errorf("got capacity %d, want %d", c, 10)
    		}
    	})
    
    	t.Run("large", func(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 31 00:34:05 UTC 2023
    - 3.1K bytes
    - Viewed (0)
Back to top