code: func newVarInt(i int) []byte {
  
  	if i < 0 {
  		return nil
  	}
  
  	if i < 0x80 {
  		b := make([]byte, 1)
  		b[0] = byte(i)
  		return b
  	}
  
  	if i < 0x4000 {
  		b := make([]byte, 2)
  		b[0] = byte(i>>8 | 0x80)
  		b[1] = byte(i & 0xff)
  		return b
  	}
  
  	if i < 0x200000 {
  		b := make([]byte, 3)
  		b[0] = byte(i>>16 | 0xc0)
  		b[1] = byte(i >> 8 & 0xff)
  		b[2] = byte(i & 0xff)
  		return b
  	}
  
  	if i < 0x10000000 {
  		b := make([]byte, 4)
  		b[0] = byte(i>>24 | 0xe0)
  		b[1] = byte(i>>16 | 0xff)
  		b[2] = byte(i >> 8 & 0xff)
  		b[3] = byte(i & 0xff)
  		return b
  	}
  
  	return nil
  }
docs: // newVarInt produces a variable integer from an int.
  // Only positive integers are accepted.