Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for compact (0.24 sec)

  1. src/bytes/buffer_test.go

    	}
    	c, err := b.ReadByte()
    	if err != nil {
    		t.Fatalf("ReadByte: %v", err)
    	}
    	if c != 'm' {
    		t.Errorf("ReadByte = %q; want %q", c, 'm')
    	}
    }
    
    // Tests that we occasionally compact. Issue 5154.
    func TestBufferGrowth(t *testing.T) {
    	var b Buffer
    	buf := make([]byte, 1024)
    	b.Write(buf[0:1])
    	var cap0 int
    	for i := 0; i < 5<<10; i++ {
    		b.Write(buf)
    		b.Read(buf)
    		if i == 0 {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 13:31:36 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  2. src/bytes/example_test.go

    }
    
    func ExampleCompare() {
    	// Interpret Compare's result by comparing it to zero.
    	var a, b []byte
    	if bytes.Compare(a, b) < 0 {
    		// a less b
    	}
    	if bytes.Compare(a, b) <= 0 {
    		// a less or equal b
    	}
    	if bytes.Compare(a, b) > 0 {
    		// a greater b
    	}
    	if bytes.Compare(a, b) >= 0 {
    		// a greater or equal b
    	}
    
    	// Prefer Equal to Compare for equality comparisons.
    	if bytes.Equal(a, b) {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  3. src/archive/zip/reader.go

    			break
    		}
    		if err != nil {
    			return err
    		}
    		f.headerOffset += r.baseOffset
    		r.File = append(r.File, f)
    	}
    	if uint16(len(r.File)) != uint16(end.directoryRecords) { // only compare 16 bits here
    		// Return the readDirectoryHeader error if we read
    		// the wrong number of directory entries.
    		return err
    	}
    	if zipinsecurepath.Value() == "0" {
    		for _, f := range r.File {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 27.7K bytes
    - Viewed (0)
  4. src/bytes/bytes_test.go

    			for i := 0; i < n; i++ {
    				x[i] = 'a'
    			}
    
    			for i := 0; i < n; i++ {
    				y[i] = 'a'
    			}
    
    			b.ResetTimer()
    			for i := 0; i < b.N; i++ {
    				Compare(x, y)
    			}
    		})
    	}
    }
    
    func BenchmarkIndexAnyASCII(b *testing.B) {
    	x := Repeat([]byte{'#'}, 2048) // Never matches set
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Jan 24 16:07:25 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  5. src/bytes/bytes.go

    	return string(a) == string(b)
    }
    
    // Compare returns an integer comparing two byte slices lexicographically.
    // The result will be 0 if a == b, -1 if a < b, and +1 if a > b.
    // A nil argument is equivalent to an empty slice.
    func Compare(a, b []byte) int {
    	return bytealg.Compare(a, b)
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Feb 19 19:51:15 GMT 2024
    - 33.8K bytes
    - Viewed (0)
  6. src/arena/arena.go

    best used in bulk, on the order of MiB of memory allocated on each use.
    
    Note that by allowing for this limited form of manual memory allocation
    that use-after-free bugs are possible with regular Go values. This package
    limits the impact of these use-after-free bugs by preventing reuse of freed
    memory regions until the garbage collector is able to determine that it is
    safe. Typically, a use-after-free bug will result in a fault and a helpful
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Oct 12 20:23:36 GMT 2022
    - 4.3K bytes
    - Viewed (0)
  7. src/cmd/cgo/internal/test/issue1435.go

    					break
    				}
    				if filter == "Groups:" && strings.HasPrefix(line, "Groups:\t") {
    					// https://github.com/golang/go/issues/46145
    					// Containers don't reliably output this line in sorted order so manually sort and compare that.
    					a := strings.Split(line[8:], " ")
    					sort.Strings(a)
    					got := strings.Join(a, " ")
    					if got == expected[8:] {
    						foundAThread = true
    						break
    					}
    
    				}
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Jul 28 21:31:41 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  8. src/bytes/buffer.go

    // included to match [bufio.Writer]'s WriteRune. The buffer is grown as needed;
    // if it becomes too large, WriteRune will panic with [ErrTooLarge].
    func (b *Buffer) WriteRune(r rune) (n int, err error) {
    	// Compare as uint32 to correctly handle negative runes.
    	if uint32(r) < utf8.RuneSelf {
    		b.WriteByte(byte(r))
    		return 1, nil
    	}
    	b.lastRead = opInvalid
    	m, ok := b.tryGrowByReslice(utf8.UTFMax)
    	if !ok {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 17:10:31 GMT 2023
    - 15.7K bytes
    - Viewed (0)
  9. src/cmd/asm/internal/asm/asm.go

    			break
    		}
    		if p.arch.Family == sys.S390X {
    			// 3-operand jumps.
    			target = &a[2]
    			prog.From = a[0]
    			if a[1].Reg != 0 {
    				// Compare two registers and jump.
    				prog.Reg = p.getRegister(prog, op, &a[1])
    			} else {
    				// Compare register with immediate and jump.
    				prog.AddRestSource(a[1])
    			}
    			break
    		}
    		if p.arch.Family == sys.ARM64 {
    			// Special 3-operand jumps.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Feb 21 14:34:57 GMT 2024
    - 25.3K bytes
    - Viewed (0)
  10. src/bytes/compare_test.go

    			copy(shiftedB, tt.b)
    			cmp := Compare(tt.a, shiftedB)
    			if cmp != tt.i {
    				t.Errorf(`Compare(%q, %q), offset %d = %v; want %v`, tt.a, tt.b, offset, cmp, tt.i)
    			}
    		}
    	}
    }
    
    func TestCompareIdenticalSlice(t *testing.T) {
    	var b = []byte("Hello Gophers!")
    	if Compare(b, b) != 0 {
    		t.Error("b != b")
    	}
    	if Compare(b, b[:1]) != 1 {
    		t.Error("b > b[:1] failed")
    	}
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Jul 13 23:11:42 GMT 2023
    - 6.8K bytes
    - Viewed (0)
Back to top