Skip to content

Commit c8ef400

Browse files
committed
gs1-cc: Lazy initialisation for pwr928 table
1 parent 1d875f3 commit c8ef400

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

src/gs1-cc.ps.src

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ begin
9191
/gs1-cc.lalphanumeric -3 def
9292
/gs1-cc.liso646 -4 def
9393

94-
/gs1-cc.latevars dup 8 dict def load /init {
94+
/gs1-cc.latevars dup 16 dict def load /init {
9595

9696
currentglobal
9797
true setglobal
@@ -142,6 +142,25 @@ begin
142142
//gs1-cc.lalphanumeric (00100)
143143
>> readonly def
144144

145+
%
146+
% Powers of 2 in base-928 representation for CC-A encoding
147+
%
148+
/pwr928 [
149+
//gs1-cc.pwr928init
150+
68 {7 array} repeat
151+
] def
152+
1 1 68 {
153+
/j exch def
154+
/v 0 def
155+
6 -1 1 {
156+
/i exch def
157+
/v pwr928 j 1 sub get i get 2 mul v 928 idiv add def
158+
pwr928 j get i v 928 mod put
159+
} for
160+
pwr928 j get 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put
161+
} for
162+
/pwr928 pwr928 readonly def
163+
145164
/init { //gs1-cc.latevars {def} forall } def
146165

147166
end
@@ -631,21 +650,6 @@ begin
631650
pad aload pop
632651
] def
633652

634-
/pwr928 [
635-
//gs1-cc.pwr928init
636-
68 {7 array} repeat
637-
] def
638-
1 1 68 {
639-
/j exch def
640-
/v 0 def
641-
6 -1 1 {
642-
/i exch def
643-
/v pwr928 j 1 sub get i get 2 mul v 928 idiv add def
644-
pwr928 j get i v 928 mod put
645-
} for
646-
pwr928 j get 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put
647-
} for
648-
649653
ccversion (a) eq {
650654
/cws [ 28 {0} repeat ] def
651655
/b 0 def /c 0 def

0 commit comments

Comments
 (0)