Lines Matching +full:a +full:- +full:8
10 removed include of stdint - config.h takes care of platform independence.
15 -------------------------------------------------------------------------------
18 These are functions for producing 32-bit hashes for hash table lookup.
26 little-endian machines. Intel and AMD are little-endian machines.
28 hashlittle() except it returns two 32-bit hashes for the price of one.
31 If you want to find a hash of, say, exactly 7 integers, do
32 a = i1; b = i2; c = i3;
33 mix(a,b,c);
34 a += i4; b += i5; c += i6;
35 mix(a,b,c);
36 a += i7;
37 final(a,b,c);
38 then use c as the hash value. If you have a variable length array of
39 4-byte integers to hash, use hashword(). If you have a byte array (like
40 a character string), use hashlittle(). If you have several byte arrays, or
41 a mix of things, see the comments above hashlittle().
43 Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
44 then mix those integers. This is fast (you can do a lot more thorough
47 -------------------------------------------------------------------------------
86 * My best guess at if you are big-endian or little-endian. This may
117 #define hashmask(n) (hashsize(n)-1)
118 #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
130 -------------------------------------------------------------------------------
131 mix -- mix 3 32-bit values reversibly.
133 This is reversible, so any information in (a,b,c) before mix() is
134 still in (a,b,c) after mix().
136 If four pairs of (a,b,c) inputs are run through mix(), or through
141 of top bits of (a,b,c), or in any combination of bottom bits of
142 (a,b,c).
143 * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
144 the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
145 is commonly produced by subtraction) look like a single 1-bit
148 all zero plus a counter that starts at zero.
150 Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
152 4 6 8 16 19 4
156 for "differ" defined as + with a one-bit base and a two-bit delta. I
160 This does not achieve avalanche. There are input bits of (a,b,c)
161 that fail to affect some output bits of (a,b,c), especially of a. The
165 This allows some parallelism. Read-after-writes are good at doubling
171 -------------------------------------------------------------------------------
173 #define mix(a,b,c) \ argument
175 a -= c; a ^= rot(c, 4); c += b; \
176 b -= a; b ^= rot(a, 6); a += c; \
177 c -= b; c ^= rot(b, 8); b += a; \
178 a -= c; a ^= rot(c,16); c += b; \
179 b -= a; b ^= rot(a,19); a += c; \
180 c -= b; c ^= rot(b, 4); b += a; \
184 -------------------------------------------------------------------------------
185 final -- final mixing of 3 32-bit values (a,b,c) into c
187 Pairs of (a,b,c) values differing in only a few bits will usually
190 of top bits of (a,b,c), or in any combination of bottom bits of
191 (a,b,c).
192 * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
193 the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
194 is commonly produced by subtraction) look like a single 1-bit
197 all zero plus a counter that starts at zero.
203 4 8 15 26 3 22 24
204 10 8 15 26 3 22 24
205 11 8 15 26 3 22 24
206 -------------------------------------------------------------------------------
208 #define final(a,b,c) \ argument
210 c ^= b; c -= rot(b,14); \
211 a ^= c; a -= rot(c,11); \
212 b ^= a; b -= rot(a,25); \
213 c ^= b; c -= rot(b,16); \
214 a ^= c; a -= rot(c,4); \
215 b ^= a; b -= rot(a,14); \
216 c ^= b; c -= rot(b,24); \
220 --------------------------------------------------------------------
222 -- that the key be an array of uint32_t's, and
223 -- that the length be the number of uint32_t's in the key
225 The function hashword() is identical to hashlittle() on little-endian
226 machines, and identical to hashbig() on big-endian machines,
230 --------------------------------------------------------------------
237 uint32_t a,b,c; in hashword() local
240 a = b = c = raninit + (((uint32_t)length)<<2) + initval; in hashword()
242 /*------------------------------------------------- handle most of the key */ in hashword()
245 a += k[0]; in hashword()
248 mix(a,b,c); in hashword()
249 length -= 3; in hashword()
253 /*------------------------------------------- handle the last 3 uint32_t's */ in hashword()
262 case 1 : a+=k[0]; in hashword()
263 final(a,b,c); in hashword()
269 /*------------------------------------------------------ report the result */ in hashword()
277 --------------------------------------------------------------------
278 hashword2() -- same as hashword(), but take two seeds and return two
279 32-bit values. pc and pb must both be nonnull, and *pc and *pb must
282 --------------------------------------------------------------------
290 uint32_t a,b,c; in hashword2() local
293 a = b = c = raninit + ((uint32_t)(length<<2)) + *pc; in hashword2()
296 /*------------------------------------------------- handle most of the key */ in hashword2()
299 a += k[0]; in hashword2()
302 mix(a,b,c); in hashword2()
303 length -= 3; in hashword2()
307 /*------------------------------------------- handle the last 3 uint32_t's */ in hashword2()
316 case 1 : a+=k[0]; in hashword2()
317 final(a,b,c); in hashword2()
323 /*------------------------------------------------------ report the result */ in hashword2()
330 -------------------------------------------------------------------------------
331 hashlittle() -- hash a variable-length key into a 32-bit value
332 k : the key (the unaligned variable-length array of bytes)
334 initval : can be any 4-byte value
335 Returns a 32-bit value. Every bit of the key affects every bit of
340 mod a prime (mod is sooo slow!). If you need less than 32 bits,
341 use a bitmask. For example, if you need only 10 bits, do
353 -------------------------------------------------------------------------------
358 uint32_t a,b,c; /* internal state */ in hashlittle() local
362 a = b = c = raninit + ((uint32_t)length) + initval; in hashlittle()
366 const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ in hashlittle()
371 /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ in hashlittle()
374 a += k[0]; in hashlittle()
377 mix(a,b,c); in hashlittle()
378 length -= 12; in hashlittle()
382 /*----------------------------- handle the last (probably partial) block */ in hashlittle()
386 * string is aligned, the masked-off tail is in the same word as the in hashlittle()
396 case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; in hashlittle()
397 case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; in hashlittle()
398 case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; in hashlittle()
399 case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; in hashlittle()
400 case 8 : b+=k[1]; a+=k[0]; break; in hashlittle()
401 case 7 : b+=k[1]&0xffffff; a+=k[0]; break; in hashlittle()
402 case 6 : b+=k[1]&0xffff; a+=k[0]; break; in hashlittle()
403 case 5 : b+=k[1]&0xff; a+=k[0]; break; in hashlittle()
404 case 4 : a+=k[0]; break; in hashlittle()
405 case 3 : a+=k[0]&0xffffff; break; in hashlittle()
406 case 2 : a+=k[0]&0xffff; break; in hashlittle()
407 case 1 : a+=k[0]&0xff; break; in hashlittle()
416 case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; in hashlittle()
420 case 10: c+=((uint32_t)k8[9])<<8; in hashlittle()
423 case 9 : c+=k8[8]; in hashlittle()
426 case 8 : b+=k[1]; a+=k[0]; break; in hashlittle()
430 case 6 : b+=((uint32_t)k8[5])<<8; in hashlittle()
436 case 4 : a+=k[0]; break; in hashlittle()
437 case 3 : a+=((uint32_t)k8[2])<<16; in hashlittle()
440 case 2 : a+=((uint32_t)k8[1])<<8; in hashlittle()
443 case 1 : a+=k8[0]; break; in hashlittle()
450 const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ in hashlittle()
453 /*--------------- all but last block: aligned reads and different mixing */ in hashlittle()
456 a += k[0] + (((uint32_t)k[1])<<16); in hashlittle()
459 mix(a,b,c); in hashlittle()
460 length -= 12; in hashlittle()
464 /*----------------------------- handle the last (probably partial) block */ in hashlittle()
470 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle()
477 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle()
479 case 9 : c+=k8[8]; in hashlittle()
482 case 8 : b+=k[2]+(((uint32_t)k[3])<<16); in hashlittle()
483 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle()
489 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle()
494 case 4 : a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle()
496 case 3 : a+=((uint32_t)k8[2])<<16; in hashlittle()
499 case 2 : a+=k[0]; in hashlittle()
501 case 1 : a+=k8[0]; in hashlittle()
506 } else { /* need to read the key one byte at a time */ in hashlittle()
509 /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ in hashlittle()
512 a += k[0]; in hashlittle()
513 a += ((uint32_t)k[1])<<8; in hashlittle()
514 a += ((uint32_t)k[2])<<16; in hashlittle()
515 a += ((uint32_t)k[3])<<24; in hashlittle()
517 b += ((uint32_t)k[5])<<8; in hashlittle()
520 c += k[8]; in hashlittle()
521 c += ((uint32_t)k[9])<<8; in hashlittle()
524 mix(a,b,c); in hashlittle()
525 length -= 12; in hashlittle()
529 /*-------------------------------- last block: affect all 32 bits of (c) */ in hashlittle()
538 case 10: c+=((uint32_t)k[9])<<8; in hashlittle()
541 case 9 : c+=k[8]; in hashlittle()
544 case 8 : b+=((uint32_t)k[7])<<24; in hashlittle()
550 case 6 : b+=((uint32_t)k[5])<<8; in hashlittle()
556 case 4 : a+=((uint32_t)k[3])<<24; in hashlittle()
559 case 3 : a+=((uint32_t)k[2])<<16; in hashlittle()
562 case 2 : a+=((uint32_t)k[1])<<8; in hashlittle()
565 case 1 : a+=k[0]; in hashlittle()
571 final(a,b,c); in hashlittle()
578 * hashlittle2: return 2 32-bit hash values
580 * This is identical to hashlittle(), except it returns two 32-bit hash
582 * lookup with 2^^64 buckets, or if you want a second hash if you're not
583 * happy with the first, or if you want a probably-unique 64-bit ID for
585 * a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)".
593 uint32_t a,b,c; /* internal state */ in hashlittle2() local
597 a = b = c = raninit + ((uint32_t)length) + *pc; in hashlittle2()
602 const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ in hashlittle2()
607 /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ in hashlittle2()
610 a += k[0]; in hashlittle2()
613 mix(a,b,c); in hashlittle2()
614 length -= 12; in hashlittle2()
618 /*----------------------------- handle the last (probably partial) block */ in hashlittle2()
622 * string is aligned, the masked-off tail is in the same word as the in hashlittle2()
632 case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; in hashlittle2()
633 case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; in hashlittle2()
634 case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; in hashlittle2()
635 case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; in hashlittle2()
636 case 8 : b+=k[1]; a+=k[0]; break; in hashlittle2()
637 case 7 : b+=k[1]&0xffffff; a+=k[0]; break; in hashlittle2()
638 case 6 : b+=k[1]&0xffff; a+=k[0]; break; in hashlittle2()
639 case 5 : b+=k[1]&0xff; a+=k[0]; break; in hashlittle2()
640 case 4 : a+=k[0]; break; in hashlittle2()
641 case 3 : a+=k[0]&0xffffff; break; in hashlittle2()
642 case 2 : a+=k[0]&0xffff; break; in hashlittle2()
643 case 1 : a+=k[0]&0xff; break; in hashlittle2()
652 case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; in hashlittle2()
656 case 10: c+=((uint32_t)k8[9])<<8; in hashlittle2()
659 case 9 : c+=k8[8]; in hashlittle2()
662 case 8 : b+=k[1]; a+=k[0]; break; in hashlittle2()
666 case 6 : b+=((uint32_t)k8[5])<<8; in hashlittle2()
672 case 4 : a+=k[0]; break; in hashlittle2()
673 case 3 : a+=((uint32_t)k8[2])<<16; in hashlittle2()
676 case 2 : a+=((uint32_t)k8[1])<<8; in hashlittle2()
679 case 1 : a+=k8[0]; break; in hashlittle2()
686 const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ in hashlittle2()
689 /*--------------- all but last block: aligned reads and different mixing */ in hashlittle2()
692 a += k[0] + (((uint32_t)k[1])<<16); in hashlittle2()
695 mix(a,b,c); in hashlittle2()
696 length -= 12; in hashlittle2()
700 /*----------------------------- handle the last (probably partial) block */ in hashlittle2()
706 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle2()
713 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle2()
715 case 9 : c+=k8[8]; in hashlittle2()
718 case 8 : b+=k[2]+(((uint32_t)k[3])<<16); in hashlittle2()
719 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle2()
725 a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle2()
730 case 4 : a+=k[0]+(((uint32_t)k[1])<<16); in hashlittle2()
732 case 3 : a+=((uint32_t)k8[2])<<16; in hashlittle2()
735 case 2 : a+=k[0]; in hashlittle2()
737 case 1 : a+=k8[0]; in hashlittle2()
742 } else { /* need to read the key one byte at a time */ in hashlittle2()
745 /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ in hashlittle2()
748 a += k[0]; in hashlittle2()
749 a += ((uint32_t)k[1])<<8; in hashlittle2()
750 a += ((uint32_t)k[2])<<16; in hashlittle2()
751 a += ((uint32_t)k[3])<<24; in hashlittle2()
753 b += ((uint32_t)k[5])<<8; in hashlittle2()
756 c += k[8]; in hashlittle2()
757 c += ((uint32_t)k[9])<<8; in hashlittle2()
760 mix(a,b,c); in hashlittle2()
761 length -= 12; in hashlittle2()
765 /*-------------------------------- last block: affect all 32 bits of (c) */ in hashlittle2()
774 case 10: c+=((uint32_t)k[9])<<8; in hashlittle2()
777 case 9 : c+=k[8]; in hashlittle2()
780 case 8 : b+=((uint32_t)k[7])<<24; in hashlittle2()
786 case 6 : b+=((uint32_t)k[5])<<8; in hashlittle2()
792 case 4 : a+=((uint32_t)k[3])<<24; in hashlittle2()
795 case 3 : a+=((uint32_t)k[2])<<16; in hashlittle2()
798 case 2 : a+=((uint32_t)k[1])<<8; in hashlittle2()
801 case 1 : a+=k[0]; in hashlittle2()
807 final(a,b,c); in hashlittle2()
817 * This is the same as hashword() on big-endian machines. It is different
819 * big-endian byte ordering.
823 uint32_t a,b,c;
827 a = b = c = raninit + ((uint32_t)length) + initval;
831 const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
836 /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
839 a += k[0];
842 mix(a,b,c);
843 length -= 12;
847 /*----------------------------- handle the last (probably partial) block */
849 * "k[2]<<8" actually reads beyond the end of the string, but
861 case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
862 case 11: c+=k[2]&0xffffff00; b+=k[1]; a+=k[0]; break;
863 case 10: c+=k[2]&0xffff0000; b+=k[1]; a+=k[0]; break;
864 case 9 : c+=k[2]&0xff000000; b+=k[1]; a+=k[0]; break;
865 case 8 : b+=k[1]; a+=k[0]; break;
866 case 7 : b+=k[1]&0xffffff00; a+=k[0]; break;
867 case 6 : b+=k[1]&0xffff0000; a+=k[0]; break;
868 case 5 : b+=k[1]&0xff000000; a+=k[0]; break;
869 case 4 : a+=k[0]; break;
870 case 3 : a+=k[0]&0xffffff00; break;
871 case 2 : a+=k[0]&0xffff0000; break;
872 case 1 : a+=k[0]&0xff000000; break;
881 case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
882 case 11: c+=((uint32_t)k8[10])<<8;
888 case 9 : c+=((uint32_t)k8[8])<<24;
891 case 8 : b+=k[1]; a+=k[0]; break;
892 case 7 : b+=((uint32_t)k8[6])<<8;
901 case 4 : a+=k[0]; break;
902 case 3 : a+=((uint32_t)k8[2])<<8;
905 case 2 : a+=((uint32_t)k8[1])<<16;
908 case 1 : a+=((uint32_t)k8[0])<<24; break;
914 } else { /* need to read the key one byte at a time */
917 /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
920 a += ((uint32_t)k[0])<<24;
921 a += ((uint32_t)k[1])<<16;
922 a += ((uint32_t)k[2])<<8;
923 a += ((uint32_t)k[3]);
926 b += ((uint32_t)k[6])<<8;
928 c += ((uint32_t)k[8])<<24;
930 c += ((uint32_t)k[10])<<8;
932 mix(a,b,c);
933 length -= 12;
937 /*-------------------------------- last block: affect all 32 bits of (c) */
943 case 11: c+=((uint32_t)k[10])<<8;
949 case 9 : c+=((uint32_t)k[8])<<24;
952 case 8 : b+=k[7];
955 case 7 : b+=((uint32_t)k[6])<<8;
964 case 4 : a+=k[3];
967 case 3 : a+=((uint32_t)k[2])<<8;
970 case 2 : a+=((uint32_t)k[1])<<16;
973 case 1 : a+=((uint32_t)k[0])<<24;
979 final(a,b,c);
993 time_t a,z; in driver1() local
995 time(&a); in driver1()
1002 if (z-a > 0) printf("time %d %.8x\n", z-a, h); in driver1()
1012 uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1]; in driver2() local
1022 for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */ in driver2()
1024 for (j=0; j<8; ++j) /*------------------------ for each input bit, */ in driver2()
1026 for (m=1; m<8; ++m) /*------------ for several possible initvals, */ in driver2()
1031 /*---- check that every output bit is affected by that input bit */ in driver2()
1036 for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;} in driver2()
1037 /* have a and b be two keys differing in only one bit */ in driver2()
1038 a[i] ^= (k<<j); in driver2()
1039 a[i] ^= (k>>(8-j)); in driver2()
1040 c[0] = hashlittle(a, hlen, m); in driver2()
1042 b[i] ^= ((k+1)>>(8-j)); in driver2()
1061 printf("%.8x %.8x %.8x %.8x %.8x %.8x ", in driver2()
1095 printf("%.8x %.8x %.8x\n", in driver3()
1096 hashword((const uint32_t *)q, (sizeof(q)-1)/4, 13), in driver3()
1097 hashword((const uint32_t *)q, (sizeof(q)-5)/4, 13), in driver3()
1098 hashword((const uint32_t *)q, (sizeof(q)-9)/4, 13)); in driver3()
1100 printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", in driver3()
1101 hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), in driver3()
1102 hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), in driver3()
1103 hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), in driver3()
1104 hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), in driver3()
1105 hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), in driver3()
1106 hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); in driver3()
1108 printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", in driver3()
1109 hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), in driver3()
1110 hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), in driver3()
1111 hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), in driver3()
1112 hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), in driver3()
1113 hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), in driver3()
1114 hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); in driver3()
1116 printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", in driver3()
1117 hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), in driver3()
1118 hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), in driver3()
1119 hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), in driver3()
1120 hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), in driver3()
1121 hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), in driver3()
1122 hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); in driver3()
1124 printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", in driver3()
1125 hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), in driver3()
1126 hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), in driver3()
1127 hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), in driver3()
1128 hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), in driver3()
1129 hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), in driver3()
1130 hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); in driver3()
1148 for (h=0, b=buf+1; h<8; ++h, ++b) in driver3()
1158 *(b-1)=(uint8_t)~0; in driver3()
1163 printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y, in driver3()
1180 for (i=0, h=0; i<8; ++i) in driver4()
1183 printf("%2ld 0-byte strings, hash is %.8x\n", i, h); in driver4()