Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for PutVarint (0.17 sec)

  1. src/encoding/binary/varint.go

    // as generated by [PutVarint], to buf and returns the extended buffer.
    func AppendVarint(buf []byte, x int64) []byte {
    	ux := uint64(x) << 1
    	if x < 0 {
    		ux = ^ux
    	}
    	return AppendUvarint(buf, ux)
    }
    
    // PutVarint encodes an int64 into buf and returns the number of bytes written.
    // If the buffer is too small, PutVarint will panic.
    func PutVarint(buf []byte, x int64) int {
    	ux := uint64(x) << 1
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 19:04:28 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  2. src/index/suffixarray/suffixarray.go

    		ix.sa.int64 = make([]int64, len(data))
    		text_64(data, ix.sa.int64)
    	}
    	return ix
    }
    
    // writeInt writes an int x to w using buf to buffer the write.
    func writeInt(w io.Writer, buf []byte, x int) error {
    	binary.PutVarint(buf, int64(x))
    	_, err := w.Write(buf[0:binary.MaxVarintLen64])
    	return err
    }
    
    // readInt reads an int x from r using buf to buffer the read and returns x.
    func readInt(r io.Reader, buf []byte) (int64, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  3. src/encoding/binary/varint_test.go

    	testConstant(t, 16, MaxVarintLen16)
    	testConstant(t, 32, MaxVarintLen32)
    	testConstant(t, 64, MaxVarintLen64)
    }
    
    func testVarint(t *testing.T, x int64) {
    	buf := make([]byte, MaxVarintLen64)
    	n := PutVarint(buf, x)
    	y, m := Varint(buf[0:n])
    	if x != y {
    		t.Errorf("Varint(%d): got %d", x, y)
    	}
    	if n != m {
    		t.Errorf("Varint(%d): got n = %d; want %d", x, m, n)
    	}
    
    	buf2 := []byte("prefix")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 16 23:09:19 UTC 2023
    - 5.5K bytes
    - Viewed (0)
Back to top