Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 109 for buf4 (0.35 sec)

  1. src/bufio/bufio_test.go

    }
    
    func TestWriterReset(t *testing.T) {
    	var buf1, buf2, buf3, buf4, buf5 strings.Builder
    	w := NewWriter(&buf1)
    	w.WriteString("foo")
    
    	w.Reset(&buf2) // and not flushed
    	w.WriteString("bar")
    	w.Flush()
    	if buf1.String() != "" {
    		t.Errorf("buf1 = %q; want empty", buf1.String())
    	}
    	if buf2.String() != "bar" {
    		t.Errorf("buf2 = %q; want bar", buf2.String())
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 10 18:56:01 UTC 2023
    - 51.5K bytes
    - Viewed (0)
  2. test/escape2.go

    	arr    [64]byte
    	arrPtr *[64]byte
    	buf1   []byte
    	buf2   []byte
    	str1   string
    	str2   string
    }
    
    func (b *Buffer) foo() { // ERROR "b does not escape$"
    	b.buf1 = b.buf1[1:2]   // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf1\[1:2\]$"
    	b.buf1 = b.buf1[1:2:3] // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf1\[1:2:3\]$"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Dec 14 17:22:18 UTC 2023
    - 35.1K bytes
    - Viewed (0)
  3. test/escape2n.go

    	arr    [64]byte
    	arrPtr *[64]byte
    	buf1   []byte
    	buf2   []byte
    	str1   string
    	str2   string
    }
    
    func (b *Buffer) foo() { // ERROR "b does not escape$"
    	b.buf1 = b.buf1[1:2]   // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf1\[1:2\]$"
    	b.buf1 = b.buf1[1:2:3] // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf1\[1:2:3\]$"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Dec 14 17:22:18 UTC 2023
    - 35.1K bytes
    - Viewed (0)
  4. test/fixedbugs/issue7690.go

    import (
    	"bytes"
    	"regexp"
    	"runtime"
    	"strconv"
    )
    
    func main() {
    	buf1 := make([]byte, 1000)
    	buf2 := make([]byte, 1000)
    
    	runtime.Stack(buf1, false)      // CALL is last instruction on this line
    	n := runtime.Stack(buf2, false) // CALL is followed by load of result from stack
    
    	buf1 = buf1[:bytes.IndexByte(buf1, 0)]
    	buf2 = buf2[:n]
    
    	re := regexp.MustCompile(`(?m)^main\.main\(\)\n.*/issue7690.go:([0-9]+)`)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 1.2K bytes
    - Viewed (0)
  5. src/compress/flate/reader_test.go

    	doBench(b, func(b *testing.B, buf0 []byte, level, n int) {
    		b.ReportAllocs()
    		b.StopTimer()
    		b.SetBytes(int64(n))
    
    		compressed := new(bytes.Buffer)
    		w, err := NewWriter(compressed, level)
    		if err != nil {
    			b.Fatal(err)
    		}
    		for i := 0; i < n; i += len(buf0) {
    			if len(buf0) > n-i {
    				buf0 = buf0[:n-i]
    			}
    			io.Copy(w, bytes.NewReader(buf0))
    		}
    		w.Close()
    		buf1 := compressed.Bytes()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 09 19:12:23 UTC 2020
    - 2.3K bytes
    - Viewed (0)
  6. test/fixedbugs/issue4099.go

    // The noescape comment only applies to the next func,
    // which must not have a body.
    
    //go:noescape
    
    func F1([]byte)
    
    func F2([]byte)
    
    func G() {
    	var buf1 [10]byte
    	F1(buf1[:])
    
    	var buf2 [10]byte // ERROR "moved to heap: buf2"
    	F2(buf2[:])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 509 bytes
    - Viewed (0)
  7. src/compress/flate/writer_test.go

    	"runtime"
    	"testing"
    )
    
    func BenchmarkEncode(b *testing.B) {
    	doBench(b, func(b *testing.B, buf0 []byte, level, n int) {
    		b.StopTimer()
    		b.SetBytes(int64(n))
    
    		buf1 := make([]byte, n)
    		for i := 0; i < n; i += len(buf0) {
    			if len(buf0) > n-i {
    				buf0 = buf0[:n-i]
    			}
    			copy(buf1[i:], buf0)
    		}
    		buf0 = nil
    		w, err := NewWriter(io.Discard, level)
    		if err != nil {
    			b.Fatal(err)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 20 18:41:18 UTC 2020
    - 5.4K bytes
    - Viewed (0)
  8. src/compress/lzw/writer_test.go

    }
    
    func BenchmarkEncoder(b *testing.B) {
    	buf, err := os.ReadFile("../testdata/e.txt")
    	if err != nil {
    		b.Fatal(err)
    	}
    	if len(buf) == 0 {
    		b.Fatalf("test file has no data")
    	}
    
    	for e := 4; e <= 6; e++ {
    		n := int(math.Pow10(e))
    		buf0 := buf
    		buf1 := make([]byte, n)
    		for i := 0; i < n; i += len(buf0) {
    			if len(buf0) > n-i {
    				buf0 = buf0[:n-i]
    			}
    			copy(buf1[i:], buf0)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 12 11:00:47 UTC 2021
    - 5.7K bytes
    - Viewed (0)
  9. src/io/example_test.go

    	// read
    }
    
    func ExampleMultiWriter() {
    	r := strings.NewReader("some io.Reader stream to be read\n")
    
    	var buf1, buf2 strings.Builder
    	w := io.MultiWriter(&buf1, &buf2)
    
    	if _, err := io.Copy(w, r); err != nil {
    		log.Fatal(err)
    	}
    
    	fmt.Print(buf1.String())
    	fmt.Print(buf2.String())
    
    	// Output:
    	// some io.Reader stream to be read
    	// some io.Reader stream to be read
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:49:32 UTC 2022
    - 5.5K bytes
    - Viewed (0)
  10. src/unicode/utf8/example_test.go

    	}
    	for i, c := range runes {
    		buf := make([]byte, 3)
    		size := utf8.EncodeRune(buf, c)
    		fmt.Printf("%d: %d %[2]s %d\n", i, buf, size)
    	}
    	// Output:
    	// 0: [239 191 189] � 3
    	// 1: [239 191 189] � 3
    	// 2: [239 191 189] � 3
    }
    
    func ExampleFullRune() {
    	buf := []byte{228, 184, 150} // 世
    	fmt.Println(utf8.FullRune(buf))
    	fmt.Println(utf8.FullRune(buf[:2]))
    	// Output:
    	// true
    	// false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 05 21:29:18 UTC 2021
    - 3.6K bytes
    - Viewed (0)
Back to top