code cleanup

This commit is contained in:
boombuler 2013-12-12 21:55:30 +01:00
parent a4e3d9eecf
commit e754f1b44c
2 changed files with 0 additions and 72 deletions

View File

@ -264,114 +264,78 @@ func drawFormatInfo(vi *versionInfo, usedMask int, set func(int, int, bool)) {
switch usedMask { switch usedMask {
case 0: case 0:
formatInfo = []bool{true, true, true, false, true, true, true, true, true, false, false, false, true, false, false} formatInfo = []bool{true, true, true, false, true, true, true, true, true, false, false, false, true, false, false}
break
case 1: case 1:
formatInfo = []bool{true, true, true, false, false, true, false, true, true, true, true, false, false, true, true} formatInfo = []bool{true, true, true, false, false, true, false, true, true, true, true, false, false, true, true}
break
case 2: case 2:
formatInfo = []bool{true, true, true, true, true, false, true, true, false, true, false, true, false, true, false} formatInfo = []bool{true, true, true, true, true, false, true, true, false, true, false, true, false, true, false}
break
case 3: case 3:
formatInfo = []bool{true, true, true, true, false, false, false, true, false, false, true, true, true, false, true} formatInfo = []bool{true, true, true, true, false, false, false, true, false, false, true, true, true, false, true}
break
case 4: case 4:
formatInfo = []bool{true, true, false, false, true, true, false, false, false, true, false, true, true, true, true} formatInfo = []bool{true, true, false, false, true, true, false, false, false, true, false, true, true, true, true}
break
case 5: case 5:
formatInfo = []bool{true, true, false, false, false, true, true, false, false, false, true, true, false, false, false} formatInfo = []bool{true, true, false, false, false, true, true, false, false, false, true, true, false, false, false}
break
case 6: case 6:
formatInfo = []bool{true, true, false, true, true, false, false, false, true, false, false, false, false, false, true} formatInfo = []bool{true, true, false, true, true, false, false, false, true, false, false, false, false, false, true}
break
case 7: case 7:
formatInfo = []bool{true, true, false, true, false, false, true, false, true, true, true, false, true, true, false} formatInfo = []bool{true, true, false, true, false, false, true, false, true, true, true, false, true, true, false}
break
} }
break
case M: case M:
switch usedMask { switch usedMask {
case 0: case 0:
formatInfo = []bool{true, false, true, false, true, false, false, false, false, false, true, false, false, true, false} formatInfo = []bool{true, false, true, false, true, false, false, false, false, false, true, false, false, true, false}
break
case 1: case 1:
formatInfo = []bool{true, false, true, false, false, false, true, false, false, true, false, false, true, false, true} formatInfo = []bool{true, false, true, false, false, false, true, false, false, true, false, false, true, false, true}
break
case 2: case 2:
formatInfo = []bool{true, false, true, true, true, true, false, false, true, true, true, true, true, false, false} formatInfo = []bool{true, false, true, true, true, true, false, false, true, true, true, true, true, false, false}
break
case 3: case 3:
formatInfo = []bool{true, false, true, true, false, true, true, false, true, false, false, true, false, true, true} formatInfo = []bool{true, false, true, true, false, true, true, false, true, false, false, true, false, true, true}
break
case 4: case 4:
formatInfo = []bool{true, false, false, false, true, false, true, true, true, true, true, true, false, false, true} formatInfo = []bool{true, false, false, false, true, false, true, true, true, true, true, true, false, false, true}
break
case 5: case 5:
formatInfo = []bool{true, false, false, false, false, false, false, true, true, false, false, true, true, true, false} formatInfo = []bool{true, false, false, false, false, false, false, true, true, false, false, true, true, true, false}
break
case 6: case 6:
formatInfo = []bool{true, false, false, true, true, true, true, true, false, false, true, false, true, true, true} formatInfo = []bool{true, false, false, true, true, true, true, true, false, false, true, false, true, true, true}
break
case 7: case 7:
formatInfo = []bool{true, false, false, true, false, true, false, true, false, true, false, false, false, false, false} formatInfo = []bool{true, false, false, true, false, true, false, true, false, true, false, false, false, false, false}
break
} }
break
case Q: case Q:
switch usedMask { switch usedMask {
case 0: case 0:
formatInfo = []bool{false, true, true, false, true, false, true, false, true, false, true, true, true, true, true} formatInfo = []bool{false, true, true, false, true, false, true, false, true, false, true, true, true, true, true}
break
case 1: case 1:
formatInfo = []bool{false, true, true, false, false, false, false, false, true, true, false, true, false, false, false} formatInfo = []bool{false, true, true, false, false, false, false, false, true, true, false, true, false, false, false}
break
case 2: case 2:
formatInfo = []bool{false, true, true, true, true, true, true, false, false, true, true, false, false, false, true} formatInfo = []bool{false, true, true, true, true, true, true, false, false, true, true, false, false, false, true}
break
case 3: case 3:
formatInfo = []bool{false, true, true, true, false, true, false, false, false, false, false, false, true, true, false} formatInfo = []bool{false, true, true, true, false, true, false, false, false, false, false, false, true, true, false}
break
case 4: case 4:
formatInfo = []bool{false, true, false, false, true, false, false, true, false, true, true, false, true, false, false} formatInfo = []bool{false, true, false, false, true, false, false, true, false, true, true, false, true, false, false}
break
case 5: case 5:
formatInfo = []bool{false, true, false, false, false, false, true, true, false, false, false, false, false, true, true} formatInfo = []bool{false, true, false, false, false, false, true, true, false, false, false, false, false, true, true}
break
case 6: case 6:
formatInfo = []bool{false, true, false, true, true, true, false, true, true, false, true, true, false, true, false} formatInfo = []bool{false, true, false, true, true, true, false, true, true, false, true, true, false, true, false}
break
case 7: case 7:
formatInfo = []bool{false, true, false, true, false, true, true, true, true, true, false, true, true, false, true} formatInfo = []bool{false, true, false, true, false, true, true, true, true, true, false, true, true, false, true}
break
} }
break
case H: case H:
switch usedMask { switch usedMask {
case 0: case 0:
formatInfo = []bool{false, false, true, false, true, true, false, true, false, false, false, true, false, false, true} formatInfo = []bool{false, false, true, false, true, true, false, true, false, false, false, true, false, false, true}
break
case 1: case 1:
formatInfo = []bool{false, false, true, false, false, true, true, true, false, true, true, true, true, true, false} formatInfo = []bool{false, false, true, false, false, true, true, true, false, true, true, true, true, true, false}
break
case 2: case 2:
formatInfo = []bool{false, false, true, true, true, false, false, true, true, true, false, false, true, true, true} formatInfo = []bool{false, false, true, true, true, false, false, true, true, true, false, false, true, true, true}
break
case 3: case 3:
formatInfo = []bool{false, false, true, true, false, false, true, true, true, false, true, false, false, false, false} formatInfo = []bool{false, false, true, true, false, false, true, true, true, false, true, false, false, false, false}
break
case 4: case 4:
formatInfo = []bool{false, false, false, false, true, true, true, false, true, true, false, false, false, true, false} formatInfo = []bool{false, false, false, false, true, true, true, false, true, true, false, false, false, true, false}
break
case 5: case 5:
formatInfo = []bool{false, false, false, false, false, true, false, false, true, false, true, false, true, false, true} formatInfo = []bool{false, false, false, false, false, true, false, false, true, false, true, false, true, false, true}
break
case 6: case 6:
formatInfo = []bool{false, false, false, true, true, false, true, false, false, false, false, true, true, false, false} formatInfo = []bool{false, false, false, true, true, false, true, false, false, false, false, true, true, false, false}
break
case 7: case 7:
formatInfo = []bool{false, false, false, true, false, false, false, false, false, true, true, true, false, true, true} formatInfo = []bool{false, false, false, true, false, false, false, false, false, true, true, true, false, true, true}
break
} }
break
} }
if usedMask == -1 { if usedMask == -1 {
@ -420,106 +384,72 @@ func drawVersionInfo(vi *versionInfo, set func(int, int, bool)) {
switch vi.Version { switch vi.Version {
case 7: case 7:
versionInfoBits = []bool{false, false, false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false} versionInfoBits = []bool{false, false, false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false}
break
case 8: case 8:
versionInfoBits = []bool{false, false, true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false} versionInfoBits = []bool{false, false, true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false}
break
case 9: case 9:
versionInfoBits = []bool{false, false, true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true} versionInfoBits = []bool{false, false, true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true}
break
case 10: case 10:
versionInfoBits = []bool{false, false, true, false, true, false, false, true, false, false, true, true, false, true, false, false, true, true} versionInfoBits = []bool{false, false, true, false, true, false, false, true, false, false, true, true, false, true, false, false, true, true}
break
case 11: case 11:
versionInfoBits = []bool{false, false, true, false, true, true, true, false, true, true, true, true, true, true, false, true, true, false} versionInfoBits = []bool{false, false, true, false, true, true, true, false, true, true, true, true, true, true, false, true, true, false}
break
case 12: case 12:
versionInfoBits = []bool{false, false, true, true, false, false, false, true, true, true, false, true, true, false, false, false, true, false} versionInfoBits = []bool{false, false, true, true, false, false, false, true, true, true, false, true, true, false, false, false, true, false}
break
case 13: case 13:
versionInfoBits = []bool{false, false, true, true, false, true, true, false, false, false, false, true, false, false, false, true, true, true} versionInfoBits = []bool{false, false, true, true, false, true, true, false, false, false, false, true, false, false, false, true, true, true}
break
case 14: case 14:
versionInfoBits = []bool{false, false, true, true, true, false, false, true, true, false, false, false, false, false, true, true, false, true} versionInfoBits = []bool{false, false, true, true, true, false, false, true, true, false, false, false, false, false, true, true, false, true}
break
case 15: case 15:
versionInfoBits = []bool{false, false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false, false} versionInfoBits = []bool{false, false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false, false}
break
case 16: case 16:
versionInfoBits = []bool{false, true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false, false} versionInfoBits = []bool{false, true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false, false}
break
case 17: case 17:
versionInfoBits = []bool{false, true, false, false, false, true, false, true, false, false, false, true, false, true, true, true, false, true} versionInfoBits = []bool{false, true, false, false, false, true, false, true, false, false, false, true, false, true, true, true, false, true}
break
case 18: case 18:
versionInfoBits = []bool{false, true, false, false, true, false, true, false, true, false, false, false, false, true, false, true, true, true} versionInfoBits = []bool{false, true, false, false, true, false, true, false, true, false, false, false, false, true, false, true, true, true}
break
case 19: case 19:
versionInfoBits = []bool{false, true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true, false} versionInfoBits = []bool{false, true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true, false}
break
case 20: case 20:
versionInfoBits = []bool{false, true, false, true, false, false, true, false, false, true, true, false, true, false, false, true, true, false} versionInfoBits = []bool{false, true, false, true, false, false, true, false, false, true, true, false, true, false, false, true, true, false}
break
case 21: case 21:
versionInfoBits = []bool{false, true, false, true, false, true, false, true, true, false, true, false, false, false, false, false, true, true} versionInfoBits = []bool{false, true, false, true, false, true, false, true, true, false, true, false, false, false, false, false, true, true}
break
case 22: case 22:
versionInfoBits = []bool{false, true, false, true, true, false, true, false, false, false, true, true, false, false, true, false, false, true} versionInfoBits = []bool{false, true, false, true, true, false, true, false, false, false, true, true, false, false, true, false, false, true}
break
case 23: case 23:
versionInfoBits = []bool{false, true, false, true, true, true, false, true, true, true, true, true, true, false, true, true, false, false} versionInfoBits = []bool{false, true, false, true, true, true, false, true, true, true, true, true, true, false, true, true, false, false}
break
case 24: case 24:
versionInfoBits = []bool{false, true, true, false, false, false, true, true, true, false, true, true, false, false, false, true, false, false} versionInfoBits = []bool{false, true, true, false, false, false, true, true, true, false, true, true, false, false, false, true, false, false}
break
case 25: case 25:
versionInfoBits = []bool{false, true, true, false, false, true, false, false, false, true, true, true, true, false, false, false, false, true} versionInfoBits = []bool{false, true, true, false, false, true, false, false, false, true, true, true, true, false, false, false, false, true}
break
case 26: case 26:
versionInfoBits = []bool{false, true, true, false, true, false, true, true, true, true, true, false, true, false, true, false, true, true} versionInfoBits = []bool{false, true, true, false, true, false, true, true, true, true, true, false, true, false, true, false, true, true}
break
case 27: case 27:
versionInfoBits = []bool{false, true, true, false, true, true, false, false, false, false, true, false, false, false, true, true, true, false} versionInfoBits = []bool{false, true, true, false, true, true, false, false, false, false, true, false, false, false, true, true, true, false}
break
case 28: case 28:
versionInfoBits = []bool{false, true, true, true, false, false, true, true, false, false, false, false, false, true, true, false, true, false} versionInfoBits = []bool{false, true, true, true, false, false, true, true, false, false, false, false, false, true, true, false, true, false}
break
case 29: case 29:
versionInfoBits = []bool{false, true, true, true, false, true, false, false, true, true, false, false, true, true, true, true, true, true} versionInfoBits = []bool{false, true, true, true, false, true, false, false, true, true, false, false, true, true, true, true, true, true}
break
case 30: case 30:
versionInfoBits = []bool{false, true, true, true, true, false, true, true, false, true, false, true, true, true, false, true, false, true} versionInfoBits = []bool{false, true, true, true, true, false, true, true, false, true, false, true, true, true, false, true, false, true}
break
case 31: case 31:
versionInfoBits = []bool{false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false, false, false} versionInfoBits = []bool{false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false, false, false}
break
case 32: case 32:
versionInfoBits = []bool{true, false, false, false, false, false, true, false, false, true, true, true, false, true, false, true, false, true} versionInfoBits = []bool{true, false, false, false, false, false, true, false, false, true, true, true, false, true, false, true, false, true}
break
case 33: case 33:
versionInfoBits = []bool{true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false, false, false} versionInfoBits = []bool{true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false, false, false}
break
case 34: case 34:
versionInfoBits = []bool{true, false, false, false, true, false, true, false, false, false, true, false, true, true, true, false, true, false} versionInfoBits = []bool{true, false, false, false, true, false, true, false, false, false, true, false, true, true, true, false, true, false}
break
case 35: case 35:
versionInfoBits = []bool{true, false, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true} versionInfoBits = []bool{true, false, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true}
break
case 36: case 36:
versionInfoBits = []bool{true, false, false, true, false, false, true, false, true, true, false, false, false, false, true, false, true, true} versionInfoBits = []bool{true, false, false, true, false, false, true, false, true, true, false, false, false, false, true, false, true, true}
break
case 37: case 37:
versionInfoBits = []bool{true, false, false, true, false, true, false, true, false, false, false, false, true, false, true, true, true, false} versionInfoBits = []bool{true, false, false, true, false, true, false, true, false, false, false, false, true, false, true, true, true, false}
break
case 38: case 38:
versionInfoBits = []bool{true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true, false, false} versionInfoBits = []bool{true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true, false, false}
break
case 39: case 39:
versionInfoBits = []bool{true, false, false, true, true, true, false, true, false, true, false, true, false, false, false, false, false, true} versionInfoBits = []bool{true, false, false, true, true, true, false, true, false, true, false, true, false, false, false, false, false, true}
break
case 40: case 40:
versionInfoBits = []bool{true, false, true, false, false, false, true, true, false, false, false, true, true, false, true, false, false, true} versionInfoBits = []bool{true, false, true, false, false, false, true, true, false, false, false, true, true, false, true, false, false, true}
break
} }
if len(versionInfoBits) > 0 { if len(versionInfoBits) > 0 {

View File

@ -12,10 +12,8 @@ func encodeNumeric(content string, ecl ErrorCorrectionLevel) (*barcode.BitList,
switch len(content) % 3 { switch len(content) % 3 {
case 1: case 1:
contentBitCount += 4 contentBitCount += 4
break
case 2: case 2:
contentBitCount += 7 contentBitCount += 7
break
} }
vi := findSmallestVersionInfo(ecl, numericMode, contentBitCount) vi := findSmallestVersionInfo(ecl, numericMode, contentBitCount)
if vi == nil { if vi == nil {