Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExamplePutUvarint (0.48 sec)

  1. src/encoding/binary/example_test.go

    	b := []byte{0xe8, 0x03, 0xd0, 0x07}
    	x1 := binary.LittleEndian.Uint16(b[0:])
    	x2 := binary.LittleEndian.Uint16(b[2:])
    	fmt.Printf("%#04x %#04x\n", x1, x2)
    	// Output:
    	// 0x03e8 0x07d0
    }
    
    func ExamplePutUvarint() {
    	buf := make([]byte, binary.MaxVarintLen64)
    
    	for _, x := range []uint64{1, 2, 127, 128, 255, 256} {
    		n := binary.PutUvarint(buf, x)
    		fmt.Printf("%x\n", buf[:n])
    	}
    	// Output:
    	// 01
    	// 02
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 3.2K bytes
    - Viewed (0)
Back to top