Re: QPROCT and QPRODT
"Ottonello, Santiago" <sanotto-/[email protected]> Sat, 13 Mar 2010 11:29:38 -0800 (PST)
| Newsgroups | gmane.comp.lang.as400.mi |
|---|---|
| Message-ID | <[email protected]> |
Just guessing ...but >From Wikipedia Balanced primes Primes which are the average of the previous prime and the following prime. 5, 53, 157, 173, 211, 257, 263, 373, 563, 593, 607, 653, 733, 947, 977, 1103, 1123, 1187, 1223, 1367, 1511, 1747, 1753, 1907, 2287, 2417, 2677, 2903, 2963, 3307, 3313, 3637, 3733, 4013, 4409, 4457, 4597, 4657, 4691, 4993, 5107, 5113, 5303, 5387, 5393 (A006562) First Balanced prime greater than 512 ???? So n mod 563 in (0...562) So I'm assuming the table has just 512 entries and 563 is a good approximation to obtain a perfect hash i.e. no collitions in that range. But I can be wrong, just my 2 cents. --- On Sat, 3/13/10, Gene_Gaunt-GDFlLPZ4eRKEK/[email protected] <Gene_Gaunt-GDFlLPZ4eRKEK/[email protected]> wrote: From: Gene_Gaunt-GDFlLPZ4eRKEK/[email protected] <Gene_Gaunt-GDFlLPZ4eRKEK/[email protected]> Subject: Re: [MI400] QPROCT and QPRODT To: "MI Programming on the AS400 / iSeries" <mi400-Zwy7GipZuJhWk0Htik3J/[email protected]> Date: Saturday, March 13, 2010, 6:48 PM QPROCT hashes the 8-letter MI opcodes into 563 linked lists. All those x'FFFF's you observes in the QPROCT space are linked list tombstones. The hash algorithm is remarkable: view the 8-letter opcode as two 4-byte signed integers; exclusive-OR them together; divide by 563 and keep the remainder; if the remainder is not positive, add 563. The result is a number in the range 1 to 563, which is your index into the hash anchor array. Here is MI code a disassembler can use to get your hash number: DCL DD OPCODE CHAR(8); DCL DD INDEX BIN(4); XOR INDEX, OPCODE(1:4), OPCODE(5:4); REM(SB) INDEX, 563 / NPOS(SKIP); ADDN(S) INDEX, 563; SKIP: And this begs the question: Why 563? _______________________________________________ This is the MI Programming on the AS400 / iSeries (MI400) mailing list To post a message email: MI400-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/mi400 or email: MI400-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a moment to review the archives at http://archive.midrange.com/mi400. _______________________________________________ This is the MI Programming on the AS400 / iSeries (MI400) mailing list To post a message email: MI400-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/mi400 or email: MI400-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a moment to review the archives at http://archive.midrange.com/mi400.