code: func NewField(poly, α int) *Field {
  	if poly < 0x100 || poly >= 0x200 || reducible(poly) {
  		panic("gf256: invalid polynomial: " + strconv.Itoa(poly))
  	}
  
  	var f Field
  	x := 1
  	for i := 0; i < 255; i++ {
  		if x == 1 && i != 0 {
  			panic("gf256: invalid generator " + strconv.Itoa(α) +
  				" for polynomial " + strconv.Itoa(poly))
  		}
  		f.exp[i] = byte(x)
  		f.exp[i+255] = byte(x)
  		f.log[x] = byte(i)
  		x = mul(x, α, poly)
  	}
  	f.log[0] = 255
  	for i := 0; i < 255; i++ {
  		if f.log[f.exp[i]] != byte(i) {
  			panic("bad log")
  		}
  		if f.log[f.exp[i+255]] != byte(i) {
  			panic("bad log")
  		}
  	}
  	for i := 1; i < 256; i++ {
  		if f.exp[f.log[i]] != byte(i) {
  			panic("bad log")
  		}
  	}
  
  	return &f
  }
docs: // NewField returns a new field corresponding to the polynomial poly
  // and generator α.  The Reed-Solomon encoding in QR codes uses
  // polynomial 0x11d with generator 2.
  //
  // The choice of generator α only affects the Exp and Log operations.