func (v version) formatInfo(maskPattern int) *binary.Binary {
	formatID := 0
	switch v.ECLevel {
	case ErrorCorrectionLow:
		formatID = 0x08  
	case ErrorCorrectionMedium:
		formatID = 0x00  
	case ErrorCorrectionQuart:
		formatID = 0x18  
	case ErrorCorrectionHighest:
		formatID = 0x10  
	default:
		log.Panicf("Invalid level %d", v.ECLevel)
	}
	if maskPattern < 0 || maskPattern > 7 {
		log.Panicf("Invalid maskPattern %d", maskPattern)
	}
	formatID |= maskPattern & 0x7
	result := binary.New()
	result.AppendUint32(formatBitSequence[formatID].regular, formatInfoBitsNum)
	return result
}
formatInfo returns the 15-bit Format Information value for a QR
code.
package qrcode
import (
	"errors"
	"log"
	"strconv"
	"github.com/yeqown/reedsolomon/binary"
)
type ecLevel int
const (
	ErrorCorrectionLow ecLevel = iota + 1
	ErrorCorrectionMedium
	ErrorCorrectionQuart
	ErrorCorrectionHighest
	formatInfoBitsNum = 15  
	verInfoBitsNum    = 18  
)
var (
	errMissMatchedVersion    = errors.New("could not match version! check the versionCfg.json file")
	errMissMatchedEncodeType = errors.New("could not match the encode type")
	formatBitSequence = []struct {
		regular uint32
		micro   uint32
	}{
		{0x5412, 0x4445}, {0x5125, 0x4172}, {0x5e7c, 0x4e2b}, {0x5b4b, 0x4b1c},
		{0x45f9, 0x55ae}, {0x40ce, 0x5099}, {0x4f97, 0x5fc0}, {0x4aa0, 0x5af7},
		{0x77c4, 0x6793}, {0x72f3, 0x62a4}, {0x7daa, 0x6dfd}, {0x789d, 0x68ca},
		{0x662f, 0x7678}, {0x6318, 0x734f}, {0x6c41, 0x7c16}, {0x6976, 0x7921},
		{0x1689, 0x06de}, {0x13be, 0x03e9}, {0x1ce7, 0x0cb0}, {0x19d0, 0x0987},
		{0x0762, 0x1735}, {0x0255, 0x1202}, {0x0d0c, 0x1d5b}, {0x083b, 0x186c},
		{0x355f, 0x2508}, {0x3068, 0x203f}, {0x3f31, 0x2f66}, {0x3a06, 0x2a51},
		{0x24b4, 0x34e3}, {0x2183, 0x31d4}, {0x2eda, 0x3e8d}, {0x2bed, 0x3bba},
	}
	versionBitSequence = []uint32{
		0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x07c94,
		0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, 0x0f928,
		0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, 0x177ec,
		0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, 0x1f250,
		0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, 0x27541, 0x28c69,
	}
)
func init() {
}
type capacity struct {
	Numeric      int `json:"n"`  
	AlphaNumeric int `json:"a"`  
	Byte         int `json:"b"`  
	JP           int `json:"j"`  
}
type group struct {
	NumBlocks int `json:"nbs"`
	NumDataCodewords int `json:"ndcs"`
	ECBlockwordsPerBlock int `json:"ecbs_pb"`
}
type version struct {
	Ver int `json:"ver"`
	ECLevel ecLevel `json:"eclv"`
	Cap capacity `json:"cap"`
	RemainderBits int `json:"rembits"`
	Groups []group `json:"groups"`
}
func (v version) Dimension() int {
	return v.Ver*4 + 17
}
func (v version) NumTotalCodewrods() int {
	var total int
	for _, g := range v.Groups {
		total = total + (g.NumBlocks * g.NumDataCodewords)
	}
	return total
}
func (v version) NumGroups() int {
	return len(v.Groups)
}
func (v version) TotalNumBlocks() int {
	var total int
	for _, g := range v.Groups {
		total = total + g.NumBlocks
	}
	return total
}
func (v version) verInfo() *binary.Binary {
	if v.Ver < 7 {
		return nil
	}
	result := binary.New()
	result.AppendUint32(versionBitSequence[v.Ver], verInfoBitsNum)
	return result
}