1
2 lalr_hash_: proc (s, m) returns (fixed bin);
3 dcl addr builtin;
4 dcl bool builtin;
5 dcl divide builtin;
6 dcl i fixed bin;
7 dcl k fixed bin;
8 dcl length builtin;
9 dcl m fixed bin parameter;
10 dcl min builtin;
11 dcl mod builtin;
12 dcl s char (*) parameter;
13 dcl substr builtin;
14 dcl t char (400) aligned;
15 dcl v fixed bin (35) based (addr (t));
16 dcl w (100) bit (36) aligned based (addr (t));
17 substr (t, 1, min (length (s) + 3, length (t))) = s;
18 k = divide (min (length (s) + 3, length (t)), 4, 17, 0);
19 do i = 2 repeat i + 1 while (i <= k);
20 w (1) = bool (w (1), w (i), "0110"b);
21 end;
22 return (mod (v, m));
23 end lalr_hash_;