Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for slicelen (0.11 sec)

  1. test/indirect.go

    		panic("fail")
    	}
    
    	x =
    		len(a0) +
    			len(a2)
    	if x != 20 {
    		println("wrong arraylen")
    		panic("fail")
    	}
    
    	x =
    		len(b0) +
    			len(b3)
    	if x != 3 {
    		println("wrong slicelen")
    		panic("fail")
    	}
    
    	x =
    		cap(b0) +
    			cap(b3)
    	if x != 3 {
    		println("wrong slicecap")
    		panic("fail")
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 23 07:47:26 UTC 2012
    - 1.4K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/ssa/_gen/dec.rules

    (Store dst (StringMake ptr len) mem) =>
      (Store {typ.Int}
        (OffPtr <typ.IntPtr> [config.PtrSize] dst)
        len
        (Store {typ.BytePtr} dst ptr mem))
    
    // slice ops
    (SlicePtr (SliceMake ptr _ _ )) => ptr
    (SliceLen (SliceMake _ len _)) => len
    (SliceCap (SliceMake _ _ cap)) => cap
    (SlicePtrUnchecked (SliceMake ptr _ _ )) => ptr
    
    (Load <t> ptr mem) && t.IsSlice() =>
      (SliceMake
        (Load <t.Elem().PtrTo()> ptr mem)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 12 00:48:31 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  3. src/go/parser/testdata/sort.go2

    	sort.Sort(orderedSlice[Elem](s))
    }
    
    type sliceFn[Elem any] struct {
    	s []Elem
    	f func(Elem, Elem) bool
    }
    
    func (s sliceFn[Elem]) Len() int           { return len(s.s) }
    func (s sliceFn[Elem]) Less(i, j int) bool { return s.f(s.s[i], s.s[j]) }
    func (s sliceFn[Elem]) Swap(i, j int)      { s.s[i], s.s[j] = s.s[j], s.s[i] }
    
    // SliceFn sorts the slice s according to the function f.
    func SliceFn[Elem any](s []Elem, f func(Elem, Elem) bool) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 24 19:44:06 UTC 2020
    - 902 bytes
    - Viewed (0)
  4. src/runtime/symtab_test.go

    		{"arrayLit[0]", arrayLit[0], 20},
    		{"arrayLit[1]", arrayLit[1], 21},
    		{"arrayLit[2]", arrayLit[2], 21},
    		{"arrayLit[3]", arrayLit[3], 22},
    
    		{"sliceLit[0]", sliceLit[0], 24},
    		{"sliceLit[1]", sliceLit[1], 25},
    		{"sliceLit[2]", sliceLit[2], 25},
    		{"sliceLit[3]", sliceLit[3], 26},
    
    		{"mapLit[29]", mapLit[29], 29},
    		{"mapLit[30]", mapLit[30], 30},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 17 21:46:33 UTC 2022
    - 7.5K bytes
    - Viewed (0)
  5. test/typeparam/ordered.go

    	copy(s2, s)
    	_OrderedSlice(s1)
    	sorter(s2)
    	ok := true
    	if !sliceEq(s1, s2) {
    		fmt.Printf("%s: got %v, want %v", name, s1, s2)
    		ok = false
    	}
    	for i := len(s1) - 1; i > 0; i-- {
    		if s1[i] < s1[i-1] {
    			fmt.Printf("%s: element %d (%v) < element %d (%v)", name, i, s1[i], i-1, s1[i-1])
    			ok = false
    		}
    	}
    	return ok
    }
    
    func sliceEq[Elem Ordered](s1, s2 []Elem) bool {
    	for i, v1 := range s1 {
    		v2 := s2[i]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  6. test/fixedbugs/issue8017.go

    // Copyright 2014 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Issues 8017 and 8058: walk modifies nodes generated
    // by slicelit and causes an internal error afterwards
    // when gen_as_init parses it back.
    
    package main
    
    func F() {
    	var ch chan int
    	select {
    	case <-ch:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 540 bytes
    - Viewed (0)
  7. test/typeparam/sliceimp.dir/main.go

    }
    
    func TestMin() {
    	s1 := []int{1, 2, 3, -5}
    	if got, want := a.SliceMin(s1), -5; got != want {
    		panic(fmt.Sprintf("a.Min(%v) = %d, want %d", s1, got, want))
    	}
    
    	s2 := []string{"aaa", "a", "aa", "aaaa"}
    	if got, want := a.SliceMin(s2), "a"; got != want {
    		panic(fmt.Sprintf("a.Min(%v) = %q, want %q", s2, got, want))
    	}
    
    	if got, want := a.SliceMin(s2[:0]), ""; got != want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 24 02:14:15 UTC 2022
    - 4.6K bytes
    - Viewed (0)
  8. test/typeparam/sliceimp.dir/a.go

    		return zero
    	}
    	return Reduce(s[1:], s[0], Max[Elem])
    }
    
    // Min returns the minimum element in a slice of some ordered type.
    // If the slice is empty it returns the zero value of the element type.
    func SliceMin[Elem Ordered](s []Elem) Elem {
    	if len(s) == 0 {
    		var zero Elem
    		return zero
    	}
    	return Reduce(s[1:], s[0], Min[Elem])
    }
    
    // Append adds values to the end of a slice, returning a new slice.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 30 01:55:58 UTC 2021
    - 3.3K bytes
    - Viewed (0)
Back to top