Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for BinarySearchFunc (0.11 sec)

  1. src/archive/zip/reader.go

    func (r *Reader) openReadDir(dir string) []fileListEntry {
    	files := r.fileList
    	i, _ := slices.BinarySearchFunc(files, dir, func(a fileListEntry, dir string) int {
    		idir, _, _ := split(a.name)
    		if dir != idir {
    			return strings.Compare(idir, dir)
    		}
    		// find the first entry with dir
    		return +1
    	})
    	j, _ := slices.BinarySearchFunc(files, dir, func(a fileListEntry, dir string) int {
    		jdir, _, _ := split(a.name)
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Sat Aug 03 01:05:29 UTC 2024
    - 28.1K bytes
    - Viewed (0)
  2. src/bytes/example_test.go

    		// a not equal b
    	}
    }
    
    func ExampleCompare_search() {
    	// Binary search to find a matching byte slice.
    	var needle []byte
    	var haystack [][]byte // Assume sorted
    	_, found := slices.BinarySearchFunc(haystack, needle, bytes.Compare)
    	if found {
    		// Found it!
    	}
    }
    
    func ExampleContains() {
    	fmt.Println(bytes.Contains([]byte("seafood"), []byte("foo")))
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  3. src/archive/zip/zip_test.go

    	for i, l := 1, len(a); i < l; i *= 2 {
    		copy(a[i:], a[:i])
    	}
    }
    
    func (r *rleBuffer) ReadAt(p []byte, off int64) (n int, err error) {
    	if len(p) == 0 {
    		return
    	}
    	skipParts, _ := slices.BinarySearchFunc(r.buf, off, func(rb repeatedByte, off int64) int {
    		return cmp.Compare(rb.off+rb.n, off)
    	})
    	parts := r.buf[skipParts:]
    	if len(parts) > 0 {
    		skipBytes := off - parts[0].off
    		for _, part := range parts {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 19.6K bytes
    - Viewed (0)
Back to top