Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 108 for asSlice (0.09 sec)

  1. pkg/slices/slices.go

    }
    
    // SortFunc sorts the slice x in ascending order as determined by the less function.
    // This sort is not guaranteed to be stable.
    // The slice is modified in place but returned.
    func SortFunc[E any](x []E, less func(a, b E) int) []E {
    	if len(x) <= 1 {
    		return x
    	}
    	slices.SortFunc(x, less)
    	return x
    }
    
    // SortStableFunc sorts the slice x while keeping the original order of equal element.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 15 06:28:11 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/sys/unix/sysvshm_unix.go

    	// Retrieve the size of the shared memory to enable slice creation
    	var info SysvShmDesc
    
    	_, err := SysvShmCtl(id, IPC_STAT, &info)
    	if err != nil {
    		// release the shared memory if we can't find the size
    
    		// ignoring error from shmdt as there's nothing sensible to return here
    		shmdt(addr)
    		return nil, err
    	}
    
    	// Use unsafe to convert addr into a []byte.
    	b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), int(info.Segsz))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 16:12:58 UTC 2024
    - 1.4K bytes
    - Viewed (0)
  3. src/syscall/dir_plan9.go

    // returning the remaining slice of b..
    func pstring(b []byte, s string) []byte {
    	b = pbit16(b, uint16(len(s)))
    	n := copy(b, s)
    	return b[n:]
    }
    
    // gbit8 reads an 8-bit number from b and returns it with the remaining slice of b.
    func gbit8(b []byte) (uint8, []byte) {
    	return uint8(b[0]), b[1:]
    }
    
    // gbit16 reads a 16-bit number in little-endian order from b and returns it with the remaining slice of b.
    //
    //go:nosplit
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:32:38 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  4. src/slices/sort_benchmark_test.go

    					return n
    				}
    				return cmp.Compare(a.n, b.n)
    			}
    			// Presort the slice so all benchmark iterations are identical.
    			slices.SortFunc(structs, cmpFunc)
    			b.ResetTimer()
    			for i := 0; i < b.N; i++ {
    				// Sort the slice twice because slices.SortFunc modifies the slice in place.
    				slices.SortFunc(structs, func(a, b *myStruct) int { return cmpFunc(b, a) })
    				slices.SortFunc(structs, cmpFunc)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 23:39:07 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  5. src/reflect/deepequal.go

    // or if they point to deeply equal values.
    //
    // Slice values are deeply equal when all of the following are true:
    // they are both nil or both non-nil, they have the same length,
    // and either they point to the same initial entry of the same underlying array
    // (that is, &x[0] == &y[0]) or their corresponding elements (up to length) are deeply equal.
    // Note that a non-nil empty slice and a nil slice (for example, []byte{} and []byte(nil))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:30 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  6. pkg/proxy/kubemark/hollow_proxy.go

    func (*FakeProxier) OnServiceSynced()                                                 {}
    func (*FakeProxier) OnEndpointSliceAdd(slice *discoveryv1.EndpointSlice)              {}
    func (*FakeProxier) OnEndpointSliceUpdate(oldSlice, slice *discoveryv1.EndpointSlice) {}
    func (*FakeProxier) OnEndpointSliceDelete(slice *discoveryv1.EndpointSlice)           {}
    func (*FakeProxier) OnEndpointSlicesSynced()                                          {}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 22 05:08:41 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  7. test/typeparam/builtins.go

    	_ = make(M1, 10)
    
    	_ = make(chan int)
    	_ = make(m1C0)
    	_ = make(C1)
    	_ = make(C1, 10)
    }
    
    // len/cap
    
    type Slice[T any] interface {
    	[]T
    }
    
    func c1[T any, S Slice[T]]() {
    	x := make(S, 5, 10)
    	_ = len(x)
    	_ = cap(x)
    }
    
    // append
    
    func a1[T any, S Slice[T]]() {
    	x := make(S, 5)
    	y := make(S, 2)
    	var z T
    	_ = append(x, y...)
    	_ = append(x, z)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 09:04:48 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  8. plugin/pkg/auth/authorizer/node/graph_populator.go

    	slice, ok := obj.(*resourcev1alpha2.ResourceSlice)
    	if !ok {
    		klog.Infof("unexpected type %T", obj)
    		return
    	}
    	g.graph.AddResourceSlice(slice.Name, slice.NodeName)
    }
    
    func (g *graphPopulator) deleteResourceSlice(obj interface{}) {
    	if tombstone, ok := obj.(cache.DeletedFinalStateUnknown); ok {
    		obj = tombstone.Obj
    	}
    	slice, ok := obj.(*resourcev1alpha2.ResourceSlice)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 21:22:55 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  9. src/crypto/aes/aes_gcm.go

    }
    
    func (g *gcmAsm) Overhead() int {
    	return g.tagSize
    }
    
    // sliceForAppend takes a slice and a requested number of bytes. It returns a
    // slice with the contents of the given slice followed by that many bytes and a
    // second slice that aliases into it and contains only the extra bytes. If the
    // original slice has sufficient capacity then no allocation is performed.
    func sliceForAppend(in []byte, n int) (head, tail []byte) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 27 18:23:49 UTC 2024
    - 5.4K bytes
    - Viewed (0)
  10. src/index/suffixarray/suffixarray.go

    	} else {
    		// re-use existing buffers
    		x.data = x.data[0:n]
    		x.sa = x.sa.slice(0, n)
    	}
    
    	// read data
    	if _, err := io.ReadFull(r, x.data); err != nil {
    		return err
    	}
    
    	// read index
    	sa := x.sa
    	for sa.len() > 0 {
    		n, err := readSlice(r, buf, sa)
    		if err != nil {
    			return err
    		}
    		sa = sa.slice(n, sa.len())
    	}
    	return nil
    }
    
    // Write writes the index x to w.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 9.5K bytes
    - Viewed (0)
Back to top