Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for Equals (0.2 sec)

  1. src/bytes/example_test.go

    		// 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) {
    		// a equal b
    	}
    	if !bytes.Equal(a, b) {
    		// a not equal b
    	}
    }
    
    func ExampleCompare_search() {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  2. src/bytes/bytes_test.go

    		for i := 0; i < b.N; i++ {
    			eq := Equal(buf1, buf2)
    			if !eq {
    				b.Fatal("bad equal")
    			}
    		}
    	})
    
    	sizes := []int{1, 6, 9, 15, 16, 20, 32, 4 << 10, 4 << 20, 64 << 20}
    
    	b.Run("same", func(b *testing.B) {
    		benchBytes(b, sizes, bmEqual(func(a, b []byte) bool { return Equal(a, a) }))
    	})
    
    	benchBytes(b, sizes, bmEqual(Equal))
    }
    
    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)
  3. src/cmd/asm/internal/arch/arch.go

    	instructions["JCS"] = x86.AJCS  /* carry set (CF = 1) */
    	instructions["JE"] = x86.AJEQ   /* alternate */
    	instructions["JEQ"] = x86.AJEQ  /* equal (ZF = 1) */
    	instructions["JG"] = x86.AJGT   /* alternate */
    	instructions["JGE"] = x86.AJGE  /* greater than or equal (signed) (SF = OF) */
    	instructions["JGT"] = x86.AJGT  /* greater than (signed) (ZF = 0 && SF = OF) */
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Mar 21 06:51:28 GMT 2023
    - 21.3K bytes
    - Viewed (0)
  4. src/bytes/bytes.go

    // It is analogous to the facilities of the [strings] package.
    package bytes
    
    import (
    	"internal/bytealg"
    	"unicode"
    	"unicode/utf8"
    )
    
    // Equal reports whether a and b
    // are the same length and contain the same bytes.
    // A nil argument is equivalent to an empty slice.
    func Equal(a, b []byte) bool {
    	// Neither cmd/compile nor gccgo allocates for these string conversions.
    	return string(a) == string(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)
  5. src/archive/tar/strconv.go

    	}
    
    	// Extract everything between the space and the final newline.
    	rec, nl, rem := rest[:n-1], rest[n-1:n], rest[n:]
    	if nl != "\n" {
    		return "", "", s, ErrHeader
    	}
    
    	// The first equals separates the key from the value.
    	k, v, ok = strings.Cut(rec, "=")
    	if !ok {
    		return "", "", s, ErrHeader
    	}
    
    	if !validPAXRecord(k, v) {
    		return "", "", s, ErrHeader
    	}
    	return k, v, rem, nil
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Aug 01 14:28:42 GMT 2023
    - 9K bytes
    - Viewed (0)
  6. src/archive/zip/zip_test.go

    		}
    	}
    }
    
    func TestModTime(t *testing.T) {
    	var testTime = time.Date(2009, time.November, 10, 23, 45, 58, 0, time.UTC)
    	fh := new(FileHeader)
    	fh.SetModTime(testTime)
    	outTime := fh.ModTime()
    	if !outTime.Equal(testTime) {
    		t.Errorf("times don't match: got %s, want %s", outTime, testTime)
    	}
    }
    
    func testHeaderRoundTrip(fh *FileHeader, wantUncompressedSize uint32, wantUncompressedSize64 uint64, t *testing.T) {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Mar 27 18:23:49 GMT 2024
    - 19.5K bytes
    - Viewed (0)
  7. src/builtin/builtin.go

    // argument, not a pointer to it. The specification of the result depends on
    // the type:
    //
    //	Slice: The size specifies the length. The capacity of the slice is
    //	equal to its length. A second integer argument may be provided to
    //	specify a different capacity; it must be no smaller than the
    //	length. For example, make([]int, 0, 10) allocates an underlying array
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Apr 11 20:22:45 GMT 2024
    - 12.7K bytes
    - Viewed (0)
  8. src/bytes/buffer_test.go

    			if allocs != 0 {
    				t.Errorf("allocation occurred during write")
    			}
    			// Check that buffer has correct data.
    			if !Equal(buf.Bytes()[0:startLen-readBytes], xBytes[readBytes:]) {
    				t.Errorf("bad initial data at %d %d", startLen, growLen)
    			}
    			if !Equal(buf.Bytes()[startLen-readBytes:startLen-readBytes+growLen], yBytes) {
    				t.Errorf("bad written data at %d %d", startLen, growLen)
    			}
    		}
    	}
    }
    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)
  9. src/bufio/bufio_test.go

    	l := NewReaderSize(buf, minReadBufferSize)
    	line, isPrefix, err := l.ReadLine()
    	if !isPrefix || !bytes.Equal(line, data[:minReadBufferSize]) || err != nil {
    		t.Errorf("bad result for first line: got %q want %q %v", line, data[:minReadBufferSize], err)
    	}
    	data = data[len(line):]
    	line, isPrefix, err = l.ReadLine()
    	if !isPrefix || !bytes.Equal(line, data[:minReadBufferSize]) || err != nil {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Feb 10 18:56:01 GMT 2023
    - 51.5K bytes
    - Viewed (0)
  10. src/cmd/api/api_test.go

    		name                          string
    		features, required, exception []string
    		ok                            bool   // want
    		out                           string // want
    	}{
    		{
    			name:     "equal",
    			features: []string{"A", "B", "C"},
    			required: []string{"A", "B", "C"},
    			ok:       true,
    			out:      "",
    		},
    		{
    			name:     "feature added",
    			features: []string{"A", "B", "C", "D", "E", "F"},
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Jan 04 17:31:12 GMT 2024
    - 7.1K bytes
    - Viewed (0)
Back to top