MCPcopy
hub / github.com/skip2/go-qrcode / string

Method string

reedsolomon/gf_poly.go:162–185  ·  view source on GitHub ↗
(useIndexForm bool)

Source from the content-addressed store, hash-verified

160}
161
162func (e gfPoly) string(useIndexForm bool) string {
163 var str string
164 numTerms := e.numTerms()
165
166 for i := numTerms - 1; i >= 0; i-- {
167 if e.term[i] > 0 {
168 if len(str) > 0 {
169 str += " + "
170 }
171
172 if !useIndexForm {
173 str += fmt.Sprintf("%dx^%d", e.term[i], i)
174 } else {
175 str += fmt.Sprintf("a^%dx^%d", gfLogTable[e.term[i]], i)
176 }
177 }
178 }
179
180 if len(str) == 0 {
181 str = "0"
182 }
183
184 return str
185}
186
187// equals returns true if e == other.
188func (e gfPoly) equals(other gfPoly) bool {

Callers 5

TestGeneratorPolyFunction · 0.45
TestGFPolyAddFunction · 0.45
TestGFPolyequalsFunction · 0.45
TestGFPolyMultiplyFunction · 0.45
TestGFPolyRemainderFunction · 0.45

Calls 1

numTermsMethod · 0.95

Tested by 5

TestGeneratorPolyFunction · 0.36
TestGFPolyAddFunction · 0.36
TestGFPolyequalsFunction · 0.36
TestGFPolyMultiplyFunction · 0.36
TestGFPolyRemainderFunction · 0.36