Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for PutVarint (2.28 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/encoding/binary/example_test.go

    	// 7f
    	// 8001
    	// ff01
    	// 8002
    }
    
    func ExamplePutVarint() {
    	buf := make([]byte, binary.MaxVarintLen64)
    
    	for _, x := range []int64{-65, -64, -2, -1, 0, 1, 2, 63, 64} {
    		n := binary.PutVarint(buf, x)
    		fmt.Printf("%x\n", buf[:n])
    	}
    	// Output:
    	// 8101
    	// 7f
    	// 03
    	// 01
    	// 00
    	// 02
    	// 04
    	// 7e
    	// 8001
    }
    
    func ExampleUvarint() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 3.2K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. src/cmd/internal/obj/pcln.go

    		if started {
    			pcdelta := (p.Pc - pc) / int64(ctxt.Arch.MinLC)
    			n := binary.PutUvarint(buf, uint64(pcdelta))
    			dst = append(dst, buf[:n]...)
    			pc = p.Pc
    		}
    
    		delta := val - oldval
    		n := binary.PutVarint(buf, int64(delta))
    		dst = append(dst, buf[:n]...)
    		oldval = val
    		started = true
    		val = valfunc(ctxt, func_, val, p, 1, arg)
    	}
    
    	if started {
    		if dbg {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 31 20:45:15 UTC 2022
    - 11.8K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"LittleEndian", Var, 0},
    		{"MaxVarintLen16", Const, 0},
    		{"MaxVarintLen32", Const, 0},
    		{"MaxVarintLen64", Const, 0},
    		{"NativeEndian", Var, 21},
    		{"PutUvarint", Func, 0},
    		{"PutVarint", Func, 0},
    		{"Read", Func, 0},
    		{"ReadUvarint", Func, 0},
    		{"ReadVarint", Func, 0},
    		{"Size", Func, 0},
    		{"Uvarint", Func, 0},
    		{"Varint", Func, 0},
    		{"Write", Func, 0},
    	},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
  7. api/go1.txt

    pkg encoding/binary, const MaxVarintLen32 ideal-int
    pkg encoding/binary, const MaxVarintLen64 ideal-int
    pkg encoding/binary, func PutUvarint([]uint8, uint64) int
    pkg encoding/binary, func PutVarint([]uint8, int64) int
    pkg encoding/binary, func Read(io.Reader, ByteOrder, interface{}) error
    pkg encoding/binary, func ReadUvarint(io.ByteReader) (uint64, error)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 14 18:58:28 UTC 2013
    - 1.7M bytes
    - Viewed (0)
Back to top