code: func (n *G2) Marshal() []byte {
  	// Each value is a 256-bit number.
  	const numBytes = 256 / 8
  
  	if n.p.IsInfinity() {
  		return make([]byte, numBytes*4)
  	}
  
  	n.p.MakeAffine(nil)
  
  	xxBytes := new(big.Int).Mod(n.p.x.x, P).Bytes()
  	xyBytes := new(big.Int).Mod(n.p.x.y, P).Bytes()
  	yxBytes := new(big.Int).Mod(n.p.y.x, P).Bytes()
  	yyBytes := new(big.Int).Mod(n.p.y.y, P).Bytes()
  
  	ret := make([]byte, numBytes*4)
  	copy(ret[1*numBytes-len(xxBytes):], xxBytes)
  	copy(ret[2*numBytes-len(xyBytes):], xyBytes)
  	copy(ret[3*numBytes-len(yxBytes):], yxBytes)
  	copy(ret[4*numBytes-len(yyBytes):], yyBytes)
  
  	return ret
  }
docs: // Marshal converts n into a byte slice.