1
0

y_stringhash.inc 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810
  1. /**--------------------------------------------------------------------------**\
  2. ========================================
  3. y_stringhash - Fast string comparisons
  4. ========================================
  5. Description:
  6. Allows you to hash strings at compile time to use them in a switch.
  7. Legal:
  8. Version: MPL 1.1
  9. The contents of this file are subject to the Mozilla Public License Version
  10. 1.1 (the "License"); you may not use this file except in compliance with
  11. the License. You may obtain a copy of the License at
  12. http://www.mozilla.org/MPL/
  13. Software distributed under the License is distributed on an "AS IS" basis,
  14. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  15. for the specific language governing rights and limitations under the
  16. License.
  17. The Original Code is the YSI stringhash include.
  18. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  19. Portions created by the Initial Developer are Copyright (C) 2011
  20. the Initial Developer. All Rights Reserved.
  21. Contributors:
  22. ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice
  23. Thanks:
  24. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  25. ZeeX - Very productive conversations.
  26. koolk - IsPlayerinAreaEx code.
  27. TheAlpha - Danish translation.
  28. breadfish - German translation.
  29. Fireburn - Dutch translation.
  30. yom - French translation.
  31. 50p - Polish translation.
  32. Zamaroht - Spanish translation.
  33. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
  34. for me to strive to better.
  35. Pixels^ - Running XScripters where the idea was born.
  36. Matite - Pestering me to release it and using it.
  37. Very special thanks to:
  38. Thiadmer - PAWN, whose limits continue to amaze me!
  39. Kye/Kalcor - SA:MP.
  40. SA:MP Team past, present and future - SA:MP.
  41. Version:
  42. 2.0
  43. Changelog:
  44. 06/03/11:
  45. Changed the order of some letters to better support numbers in _I.
  46. 01/03/11:
  47. Rewrote compile-time hashes to not require commas.
  48. 25/10/10:
  49. Updated comments.
  50. Added to YSI 1.0.
  51. Added FNV1 and FNV1a hashes to avoid collisions.
  52. 19/08/10:
  53. First version.
  54. Functions:
  55. stock:
  56. YHash - Generate a string hash at run time.
  57. Definitions:
  58. _H - Generate a string hash at compile time.
  59. _I - Generate a case insensitive string hash at compile time.
  60. </remarks>
  61. \**--------------------------------------------------------------------------**/
  62. #include "internal\y_version"
  63. #include "y_debug"
  64. // Note: H_a, H_b, H_c, H_d, H_f and H_g are defined here, H_e in y_amx, H_z in
  65. // y_masteronce, H_u in y_users, H_y in y_timers.
  66. // ===================
  67. // Determine version
  68. // ===================
  69. // Entry.
  70. #define _H (_:_H_1:_H_0
  71. #define _I (_:_H_3:_H_2
  72. // Old.
  73. #define _H_0(%0) HASH@bernstein(%0))
  74. #define _H_2(%0) HASHi@bernstein(%0))
  75. // New.
  76. #define _H_1:_H_0<%0> H_Pb:@Ba:H_Nba(%0)<-1|||
  77. #define _H_3:_H_2<%0> @Ca:H_Nca(%0)<-1|||
  78. // Entry.
  79. #define _H@b (_:_H0@b:_H1@b
  80. #define _I@b (_:_H2@b:_H3@b
  81. // Old.
  82. #define _H0@b:_H1@b(%0) HASH@bernstein(%0))
  83. #define _H2@b:_H3@b(%0) HASHi@bernstein(%0))
  84. // New.
  85. #define _H1@b<%0> @Ba:H_Nba(%0)<-1|||
  86. #define _H3@b<%0> @Ca:H_Nca(%0)<-1|||
  87. // Entry.
  88. #define _H@f (_:_H0@f:_H1@f
  89. #define _I@f (_:_H2@f:_H3@f
  90. // Old.
  91. #define _H0@f:_H1@f(%0) HASH@fnv1(%0))
  92. #define _H2@f:_H3@f(%0) HASHi@fnv1(%0))
  93. // New.
  94. #define _H1@f<%0> @Ga:H_Nga(%0)<2166136261|||
  95. #define _H3@f<%0> @Fa:H_Nfa(%0)<2166136261|||
  96. // Entry.
  97. #define _H@a (_:_H0@a:_H1@a
  98. #define _I@a (_:_H2@a:_H3@a
  99. // Old.
  100. #define _H0@a:_H1@a(%0) HASH@fnv1a(%0))
  101. #define _H2@a:_H3@a(%0) HASHi@fnv1a(%0))
  102. // New.
  103. #define _H1@a<%0> @Aa:H_Naa(%0)<2166136261|||
  104. #define _H3@a<%0> @Da:H_Nda(%0)<2166136261|||
  105. // Entry.
  106. #define HASH (_:_H_4:_H_5
  107. #define HASHi (_:_H_6:_H_7
  108. // Old.
  109. #define _H_4:_H_5(%0,%1) HASH@%0(%1))
  110. #define _H_6:_H_7(%0,%1) HASHi@%0(%1))
  111. // New.
  112. #define _H_5:%0<%1> HASh@%0(%1)
  113. #define _H_7:%0<%1> HAShi@%0(%1)
  114. #define HASh@bernstein(%0) @Ba:H_Nba(%0)<-1|||
  115. #define HAShi@bernstein(%0) @Ca:H_Nca(%0)<-1|||
  116. #define HASh@fnv1(%0) @Ga:H_Nga(%0)<2166136261|||
  117. #define HAShi@fnv1(%0) @Fa:H_Nfa(%0)<2166136261|||
  118. #define HASh@fnv1a(%0) @Aa:H_Naa(%0)<2166136261|||
  119. #define HAShi@fnv1a(%0) @Da:H_Nda(%0)<2166136261|||
  120. // =============
  121. // New version
  122. // =============
  123. // ================
  124. // Bernstein hash
  125. // ================
  126. // ================
  127. // Case sensitive
  128. // ================
  129. #define hb:H_Sb(%0,%1£%2,%9,%3)[%4]{%5}<%6<%7||| hb:H_Sb(%0%1£,%2,%9,%3)[%4]{%5<%6}<%7|||
  130. #define H_Sb(%0,%1,%9,%3)[%4]{%5}<%6||| @B%9:H_Nb%9(%0%1£%3)%5<%4<%6|||
  131. #define H_Eb:H_Rb<%0<%1||| (%0_:H_Eb:H_Rb<%1|||)
  132. #define H_Rb<%1||| (%1))
  133. #define H_Db(%1,%9,%2,%8) hb:H_Sb(,%1,%9,%2)[%8+33*]{}
  134. // Test for the current character.
  135. #define @Ba:H_Nba(%1a%0) H_Db(%1,a,%0,97)
  136. #define @Bb:H_Nbb(%1b%0) H_Db(%1,b,%0,98)
  137. #define @Bc:H_Nbc(%1c%0) H_Db(%1,c,%0,99)
  138. #define @Bd:H_Nbd(%1d%0) H_Db(%1,d,%0,100)
  139. #define @Be:H_Nbe(%1e%0) H_Db(%1,e,%0,101)
  140. #define @Bf:H_Nbf(%1f%0) H_Db(%1,f,%0,102)
  141. #define @Bg:H_Nbg(%1g%0) H_Db(%1,g,%0,103)
  142. #define @Bh:H_Nbh(%1h%0) H_Db(%1,h,%0,104)
  143. #define @Bi:H_Nbi(%1i%0) H_Db(%1,i,%0,105)
  144. #define @Bj:H_Nbj(%1j%0) H_Db(%1,j,%0,106)
  145. #define @Bk:H_Nbk(%1k%0) H_Db(%1,k,%0,107)
  146. #define @Bl:H_Nbl(%1l%0) H_Db(%1,l,%0,108)
  147. #define @Bm:H_Nbm(%1m%0) H_Db(%1,m,%0,109)
  148. #define @Bn:H_Nbn(%1n%0) H_Db(%1,n,%0,110)
  149. #define @Bo:H_Nbo(%1o%0) H_Db(%1,o,%0,111)
  150. #define @Bp:H_Nbp(%1p%0) H_Db(%1,p,%0,112)
  151. #define @Bq:H_Nbq(%1q%0) H_Db(%1,q,%0,113)
  152. #define @Br:H_Nbr(%1r%0) H_Db(%1,r,%0,114)
  153. #define @Bs:H_Nbs(%1s%0) H_Db(%1,s,%0,115)
  154. #define @Bt:H_Nbt(%1t%0) H_Db(%1,t,%0,116)
  155. #define @Bu:H_Nbu(%1u%0) H_Db(%1,u,%0,117)
  156. #define @Bv:H_Nbv(%1v%0) H_Db(%1,v,%0,118)
  157. #define @Bw:H_Nbw(%1w%0) H_Db(%1,w,%0,119)
  158. #define @Bx:H_Nbx(%1x%0) H_Db(%1,x,%0,120)
  159. #define @By:H_Nby(%1y%0) H_Db(%1,y,%0,121)
  160. #define @Bz:H_Nbz(%1z%0) H_Db(%1,z,%0,122)
  161. #define @BA:H_NbA(%1A%0) H_Db(%1,A,%0,65)
  162. #define @BB:H_NbB(%1B%0) H_Db(%1,B,%0,66)
  163. #define @BC:H_NbC(%1C%0) H_Db(%1,C,%0,67)
  164. #define @BD:H_NbD(%1D%0) H_Db(%1,D,%0,68)
  165. #define @BE:H_NbE(%1E%0) H_Db(%1,E,%0,69)
  166. #define @BF:H_NbF(%1F%0) H_Db(%1,F,%0,70)
  167. #define @BG:H_NbG(%1G%0) H_Db(%1,G,%0,71)
  168. #define @BH:H_NbH(%1H%0) H_Db(%1,H,%0,72)
  169. #define @BI:H_NbI(%1I%0) H_Db(%1,I,%0,73)
  170. #define @BJ:H_NbJ(%1J%0) H_Db(%1,J,%0,74)
  171. #define @BK:H_NbK(%1K%0) H_Db(%1,K,%0,75)
  172. #define @BL:H_NbL(%1L%0) H_Db(%1,L,%0,76)
  173. #define @BM:H_NbM(%1M%0) H_Db(%1,M,%0,77)
  174. #define @BN:H_NbN(%1N%0) H_Db(%1,N,%0,78)
  175. #define @BO:H_NbO(%1O%0) H_Db(%1,O,%0,79)
  176. #define @BP:H_NbP(%1P%0) H_Db(%1,P,%0,80)
  177. #define @BQ:H_NbQ(%1Q%0) H_Db(%1,Q,%0,81)
  178. #define @BR:H_NbR(%1R%0) H_Db(%1,R,%0,82)
  179. #define @BS:H_NbS(%1S%0) H_Db(%1,S,%0,83)
  180. #define @BT:H_NbT(%1T%0) H_Db(%1,T,%0,84)
  181. #define @BU:H_NbU(%1U%0) H_Db(%1,U,%0,85)
  182. #define @BV:H_NbV(%1V%0) H_Db(%1,V,%0,86)
  183. #define @BW:H_NbW(%1W%0) H_Db(%1,W,%0,87)
  184. #define @BX:H_NbX(%1X%0) H_Db(%1,X,%0,88)
  185. #define @BY:H_NbY(%1Y%0) H_Db(%1,Y,%0,89)
  186. #define @BZ:H_NbZ(%1Z%0) H_Db(%1,Z,%0,90)
  187. #define @B0:H_Nb0(%10%0) H_Db(%1,0,%0,48)
  188. #define @B1:H_Nb1(%11%0) H_Db(%1,1,%0,49)
  189. #define @B2:H_Nb2(%12%0) H_Db(%1,2,%0,50)
  190. #define @B3:H_Nb3(%13%0) H_Db(%1,3,%0,51)
  191. #define @B4:H_Nb4(%14%0) H_Db(%1,4,%0,52)
  192. #define @B5:H_Nb5(%15%0) H_Db(%1,5,%0,53)
  193. #define @B6:H_Nb6(%16%0) H_Db(%1,6,%0,54)
  194. #define @B7:H_Nb7(%17%0) H_Db(%1,7,%0,55)
  195. #define @B8:H_Nb8(%18%0) H_Db(%1,8,%0,56)
  196. #define @B9:H_Nb9(%19%0) H_Db(%1,9,%0,57)
  197. #define @B_:H_Nb_(%1_%0) H_Db(%1,_,%0,95)
  198. //#define hb@:H_Sb(@%0,%1) H_Db(%0)
  199. // Find the next character to test.
  200. #define H_Nba(%0) @Bb:H_Nbb(%0)
  201. #define H_Nbb(%0) @Bc:H_Nbc(%0)
  202. #define H_Nbc(%0) @Bd:H_Nbd(%0)
  203. #define H_Nbd(%0) @Be:H_Nbe(%0)
  204. #define H_Nbe(%0) @Bf:H_Nbf(%0)
  205. #define H_Nbf(%0) @Bg:H_Nbg(%0)
  206. #define H_Nbg(%0) @Bh:H_Nbh(%0)
  207. #define H_Nbh(%0) @Bi:H_Nbi(%0)
  208. #define H_Nbi(%0) @Bj:H_Nbj(%0)
  209. #define H_Nbj(%0) @Bk:H_Nbk(%0)
  210. #define H_Nbk(%0) @Bl:H_Nbl(%0)
  211. #define H_Nbl(%0) @Bm:H_Nbm(%0)
  212. #define H_Nbm(%0) @Bn:H_Nbn(%0)
  213. #define H_Nbn(%0) @Bo:H_Nbo(%0)
  214. #define H_Nbo(%0) @Bp:H_Nbp(%0)
  215. #define H_Nbp(%0) @Bq:H_Nbq(%0)
  216. #define H_Nbq(%0) @Br:H_Nbr(%0)
  217. #define H_Nbr(%0) @Bs:H_Nbs(%0)
  218. #define H_Nbs(%0) @Bt:H_Nbt(%0)
  219. #define H_Nbt(%0) @Bu:H_Nbu(%0)
  220. #define H_Nbu(%0) @Bv:H_Nbv(%0)
  221. #define H_Nbv(%0) @Bw:H_Nbw(%0)
  222. #define H_Nbw(%0) @Bx:H_Nbx(%0)
  223. #define H_Nbx(%0) @By:H_Nby(%0)
  224. #define H_Nby(%0) @Bz:H_Nbz(%0)
  225. #define H_Nbz(%0) @B0:H_Nb0(%0)
  226. #define H_NbA(%0) @BB:H_NbB(%0)
  227. #define H_NbB(%0) @BC:H_NbC(%0)
  228. #define H_NbC(%0) @BD:H_NbD(%0)
  229. #define H_NbD(%0) @BE:H_NbE(%0)
  230. #define H_NbE(%0) @BF:H_NbF(%0)
  231. #define H_NbF(%0) @BG:H_NbG(%0)
  232. #define H_NbG(%0) @BH:H_NbH(%0)
  233. #define H_NbH(%0) @BI:H_NbI(%0)
  234. #define H_NbI(%0) @BJ:H_NbJ(%0)
  235. #define H_NbJ(%0) @BK:H_NbK(%0)
  236. #define H_NbK(%0) @BL:H_NbL(%0)
  237. #define H_NbL(%0) @BM:H_NbM(%0)
  238. #define H_NbM(%0) @BN:H_NbN(%0)
  239. #define H_NbN(%0) @BO:H_NbO(%0)
  240. #define H_NbO(%0) @BP:H_NbP(%0)
  241. #define H_NbP(%0) @BQ:H_NbQ(%0)
  242. #define H_NbQ(%0) @BR:H_NbR(%0)
  243. #define H_NbR(%0) @BS:H_NbS(%0)
  244. #define H_NbS(%0) @BT:H_NbT(%0)
  245. #define H_NbT(%0) @BU:H_NbU(%0)
  246. #define H_NbU(%0) @BV:H_NbV(%0)
  247. #define H_NbV(%0) @BW:H_NbW(%0)
  248. #define H_NbW(%0) @BX:H_NbX(%0)
  249. #define H_NbX(%0) @BY:H_NbY(%0)
  250. #define H_NbY(%0) @BZ:H_NbZ(%0)
  251. #define H_NbZ(%0) H_Eb:H_Rb
  252. #define H_Nb0(%0) @B1:H_Nb1(%0)
  253. #define H_Nb1(%0) @B2:H_Nb2(%0)
  254. #define H_Nb2(%0) @B3:H_Nb3(%0)
  255. #define H_Nb3(%0) @B4:H_Nb4(%0)
  256. #define H_Nb4(%0) @B5:H_Nb5(%0)
  257. #define H_Nb5(%0) @B6:H_Nb6(%0)
  258. #define H_Nb6(%0) @B7:H_Nb7(%0)
  259. #define H_Nb7(%0) @B8:H_Nb8(%0)
  260. #define H_Nb8(%0) @B9:H_Nb9(%0)
  261. #define H_Nb9(%0) @B_:H_Nb_(%0)
  262. #define H_Nb_(%0) @BA:H_NbA(%0)
  263. // ==================
  264. // Case insensitive
  265. // ==================
  266. #define hc:H_Sc(%0,%1£%2,%9,%3)[%4]{%5}<%6<%7||| hc:H_Sc(%0%1£,%2,%9,%3)[%4]{%5<%6}<%7|||
  267. #define H_Sc(%0,%1,%9,%3)[%4]{%5}<%6||| @C%9:H_Nc%9(%0%1£%3)%5<%4<%6|||
  268. #define H_Ec:H_Rc<%0<%1||| (%0_:H_Ec:H_Rc<%1|||)
  269. #define H_Rc<%1||| (%1))
  270. #define H_Dc(%1,%9,%2,%8) hc:H_Sc(,%1,%9,%2)[%8+33*]{}
  271. // Test for the current character.
  272. #define @Ca:H_Nca(%1a%0) H_Dc(%1,a,%0,65)
  273. #define @Cb:H_Ncb(%1b%0) H_Dc(%1,b,%0,66)
  274. #define @Cc:H_Ncc(%1c%0) H_Dc(%1,c,%0,67)
  275. #define @Cd:H_Ncd(%1d%0) H_Dc(%1,d,%0,68)
  276. #define @Ce:H_Nce(%1e%0) H_Dc(%1,e,%0,69)
  277. #define @Cf:H_Ncf(%1f%0) H_Dc(%1,f,%0,70)
  278. #define @Cg:H_Ncg(%1g%0) H_Dc(%1,g,%0,71)
  279. #define @Ch:H_Nch(%1h%0) H_Dc(%1,h,%0,72)
  280. #define @Ci:H_Nci(%1i%0) H_Dc(%1,i,%0,73)
  281. #define @Cj:H_Ncj(%1j%0) H_Dc(%1,j,%0,74)
  282. #define @Ck:H_Nck(%1k%0) H_Dc(%1,k,%0,75)
  283. #define @Cl:H_Ncl(%1l%0) H_Dc(%1,l,%0,76)
  284. #define @Cm:H_Ncm(%1m%0) H_Dc(%1,m,%0,77)
  285. #define @Cn:H_Ncn(%1n%0) H_Dc(%1,n,%0,78)
  286. #define @Co:H_Nco(%1o%0) H_Dc(%1,o,%0,79)
  287. #define @Cp:H_Ncp(%1p%0) H_Dc(%1,p,%0,80)
  288. #define @Cq:H_Ncq(%1q%0) H_Dc(%1,q,%0,81)
  289. #define @Cr:H_Ncr(%1r%0) H_Dc(%1,r,%0,82)
  290. #define @Cs:H_Ncs(%1s%0) H_Dc(%1,s,%0,83)
  291. #define @Ct:H_Nct(%1t%0) H_Dc(%1,t,%0,84)
  292. #define @Cu:H_Ncu(%1u%0) H_Dc(%1,u,%0,85)
  293. #define @Cv:H_Ncv(%1v%0) H_Dc(%1,v,%0,86)
  294. #define @Cw:H_Ncw(%1w%0) H_Dc(%1,w,%0,87)
  295. #define @Cx:H_Ncx(%1x%0) H_Dc(%1,x,%0,88)
  296. #define @Cy:H_Ncy(%1y%0) H_Dc(%1,y,%0,89)
  297. #define @Cz:H_Ncz(%1z%0) H_Dc(%1,z,%0,90)
  298. #define @CA:H_NcA(%1A%0) H_Dc(%1,A,%0,65)
  299. #define @CB:H_NcB(%1B%0) H_Dc(%1,B,%0,66)
  300. #define @CC:H_NcC(%1C%0) H_Dc(%1,C,%0,67)
  301. #define @CD:H_NcD(%1D%0) H_Dc(%1,D,%0,68)
  302. #define @CE:H_NcE(%1E%0) H_Dc(%1,E,%0,69)
  303. #define @CF:H_NcF(%1F%0) H_Dc(%1,F,%0,70)
  304. #define @CG:H_NcG(%1G%0) H_Dc(%1,G,%0,71)
  305. #define @CH:H_NcH(%1H%0) H_Dc(%1,H,%0,72)
  306. #define @CI:H_NcI(%1I%0) H_Dc(%1,I,%0,73)
  307. #define @CJ:H_NcJ(%1J%0) H_Dc(%1,J,%0,74)
  308. #define @CK:H_NcK(%1K%0) H_Dc(%1,K,%0,75)
  309. #define @CL:H_NcL(%1L%0) H_Dc(%1,L,%0,76)
  310. #define @CM:H_NcM(%1M%0) H_Dc(%1,M,%0,77)
  311. #define @CN:H_NcN(%1N%0) H_Dc(%1,N,%0,78)
  312. #define @CO:H_NcO(%1O%0) H_Dc(%1,O,%0,79)
  313. #define @CP:H_NcP(%1P%0) H_Dc(%1,P,%0,80)
  314. #define @CQ:H_NcQ(%1Q%0) H_Dc(%1,Q,%0,81)
  315. #define @CR:H_NcR(%1R%0) H_Dc(%1,R,%0,82)
  316. #define @CS:H_NcS(%1S%0) H_Dc(%1,S,%0,83)
  317. #define @CT:H_NcT(%1T%0) H_Dc(%1,T,%0,84)
  318. #define @CU:H_NcU(%1U%0) H_Dc(%1,U,%0,85)
  319. #define @CV:H_NcV(%1V%0) H_Dc(%1,V,%0,86)
  320. #define @CW:H_NcW(%1W%0) H_Dc(%1,W,%0,87)
  321. #define @CX:H_NcX(%1X%0) H_Dc(%1,X,%0,88)
  322. #define @CY:H_NcY(%1Y%0) H_Dc(%1,Y,%0,89)
  323. #define @CZ:H_NcZ(%1Z%0) H_Dc(%1,Z,%0,90)
  324. #define @C0:H_Nc0(%10%0) H_Dc(%1,0,%0,48)
  325. #define @C1:H_Nc1(%11%0) H_Dc(%1,1,%0,49)
  326. #define @C2:H_Nc2(%12%0) H_Dc(%1,2,%0,50)
  327. #define @C3:H_Nc3(%13%0) H_Dc(%1,3,%0,51)
  328. #define @C4:H_Nc4(%14%0) H_Dc(%1,4,%0,52)
  329. #define @C5:H_Nc5(%15%0) H_Dc(%1,5,%0,53)
  330. #define @C6:H_Nc6(%16%0) H_Dc(%1,6,%0,54)
  331. #define @C7:H_Nc7(%17%0) H_Dc(%1,7,%0,55)
  332. #define @C8:H_Nc8(%18%0) H_Dc(%1,8,%0,56)
  333. #define @C9:H_Nc9(%19%0) H_Dc(%1,9,%0,57)
  334. #define @C_:H_Nc_(%1_%0) H_Dc(%1,_,%0,95)
  335. //#define hc@:H_Sc(@%0,%1) H_Dc(%0)
  336. // Find the next character to test.
  337. #define H_Nca(%0) @Cb:H_Ncb(%0)
  338. #define H_Ncb(%0) @Cc:H_Ncc(%0)
  339. #define H_Ncc(%0) @Cd:H_Ncd(%0)
  340. #define H_Ncd(%0) @Ce:H_Nce(%0)
  341. #define H_Nce(%0) @Cf:H_Ncf(%0)
  342. #define H_Ncf(%0) @Cg:H_Ncg(%0)
  343. #define H_Ncg(%0) @Ch:H_Nch(%0)
  344. #define H_Nch(%0) @Ci:H_Nci(%0)
  345. #define H_Nci(%0) @Cj:H_Ncj(%0)
  346. #define H_Ncj(%0) @Ck:H_Nck(%0)
  347. #define H_Nck(%0) @Cl:H_Ncl(%0)
  348. #define H_Ncl(%0) @Cm:H_Ncm(%0)
  349. #define H_Ncm(%0) @Cn:H_Ncn(%0)
  350. #define H_Ncn(%0) @Co:H_Nco(%0)
  351. #define H_Nco(%0) @Cp:H_Ncp(%0)
  352. #define H_Ncp(%0) @Cq:H_Ncq(%0)
  353. #define H_Ncq(%0) @Cr:H_Ncr(%0)
  354. #define H_Ncr(%0) @Cs:H_Ncs(%0)
  355. #define H_Ncs(%0) @Ct:H_Nct(%0)
  356. #define H_Nct(%0) @Cu:H_Ncu(%0)
  357. #define H_Ncu(%0) @Cv:H_Ncv(%0)
  358. #define H_Ncv(%0) @Cw:H_Ncw(%0)
  359. #define H_Ncw(%0) @Cx:H_Ncx(%0)
  360. #define H_Ncx(%0) @Cy:H_Ncy(%0)
  361. #define H_Ncy(%0) @Cz:H_Ncz(%0)
  362. #define H_Ncz(%0) @C0:H_Nc0(%0)
  363. #define H_NcA(%0) @CB:H_NcB(%0)
  364. #define H_NcB(%0) @CC:H_NcC(%0)
  365. #define H_NcC(%0) @CD:H_NcD(%0)
  366. #define H_NcD(%0) @CE:H_NcE(%0)
  367. #define H_NcE(%0) @CF:H_NcF(%0)
  368. #define H_NcF(%0) @CG:H_NcG(%0)
  369. #define H_NcG(%0) @CH:H_NcH(%0)
  370. #define H_NcH(%0) @CI:H_NcI(%0)
  371. #define H_NcI(%0) @CJ:H_NcJ(%0)
  372. #define H_NcJ(%0) @CK:H_NcK(%0)
  373. #define H_NcK(%0) @CL:H_NcL(%0)
  374. #define H_NcL(%0) @CM:H_NcM(%0)
  375. #define H_NcM(%0) @CN:H_NcN(%0)
  376. #define H_NcN(%0) @CO:H_NcO(%0)
  377. #define H_NcO(%0) @CP:H_NcP(%0)
  378. #define H_NcP(%0) @CQ:H_NcQ(%0)
  379. #define H_NcQ(%0) @CR:H_NcR(%0)
  380. #define H_NcR(%0) @CS:H_NcS(%0)
  381. #define H_NcS(%0) @CT:H_NcT(%0)
  382. #define H_NcT(%0) @CU:H_NcU(%0)
  383. #define H_NcU(%0) @CV:H_NcV(%0)
  384. #define H_NcV(%0) @CW:H_NcW(%0)
  385. #define H_NcW(%0) @CX:H_NcX(%0)
  386. #define H_NcX(%0) @CY:H_NcY(%0)
  387. #define H_NcY(%0) @CZ:H_NcZ(%0)
  388. #define H_NcZ(%0) H_EC:H_RC
  389. #define H_Nc0(%0) @C1:H_Nc1(%0)
  390. #define H_Nc1(%0) @C2:H_Nc2(%0)
  391. #define H_Nc2(%0) @C3:H_Nc3(%0)
  392. #define H_Nc3(%0) @C4:H_Nc4(%0)
  393. #define H_Nc4(%0) @C5:H_Nc5(%0)
  394. #define H_Nc5(%0) @C6:H_Nc6(%0)
  395. #define H_Nc6(%0) @C7:H_Nc7(%0)
  396. #define H_Nc7(%0) @C8:H_Nc8(%0)
  397. #define H_Nc8(%0) @C9:H_Nc9(%0)
  398. #define H_Nc9(%0) @C_:H_Nc_(%0)
  399. #define H_Nc_(%0) @CA:H_NcA(%0)
  400. // ===========
  401. // FNV1 hash
  402. // ===========
  403. // ================
  404. // Case sensitive
  405. // ================
  406. #define hg:H_Sg(%0,%1£%2,%9,%3)[%4]{%5}<%6<%7||| hg:H_Sg(%0%1£,%2,%9,%3)[%4]{%5<%6}<%7|||
  407. #define H_Sg(%0,%1,%9,%3)[%4]{%5}<%6||| @G%9:H_Ng%9(%0%1£%3)%5<%4<%6|||
  408. #define H_Eg:H_Rg<%0<%1||| (%0_:H_Eg:H_Rg<%1|||)
  409. #define H_Rg<%1||| (%1))
  410. #define H_Dg(%1,%9,%2,%8) hg:H_Sg(,%1,%9,%2)[%8^16777619*]{}
  411. // Test for the current character.
  412. #define @Ga:H_Nga(%1a%0) H_Dg(%1,a,%0,97)
  413. #define @Gb:H_Ngb(%1b%0) H_Dg(%1,b,%0,98)
  414. #define @Gc:H_Ngc(%1c%0) H_Dg(%1,c,%0,99)
  415. #define @Gd:H_Ngd(%1d%0) H_Dg(%1,d,%0,100)
  416. #define @Ge:H_Nge(%1e%0) H_Dg(%1,e,%0,101)
  417. #define @Gf:H_Ngf(%1f%0) H_Dg(%1,f,%0,102)
  418. #define @Gg:H_Ngg(%1g%0) H_Dg(%1,g,%0,103)
  419. #define @Gh:H_Ngh(%1h%0) H_Dg(%1,h,%0,104)
  420. #define @Gi:H_Ngi(%1i%0) H_Dg(%1,i,%0,105)
  421. #define @Gj:H_Ngj(%1j%0) H_Dg(%1,j,%0,106)
  422. #define @Gk:H_Ngk(%1k%0) H_Dg(%1,k,%0,107)
  423. #define @Gl:H_Ngl(%1l%0) H_Dg(%1,l,%0,108)
  424. #define @Gm:H_Ngm(%1m%0) H_Dg(%1,m,%0,109)
  425. #define @Gn:H_Ngn(%1n%0) H_Dg(%1,n,%0,110)
  426. #define @Go:H_Ngo(%1o%0) H_Dg(%1,o,%0,111)
  427. #define @Gp:H_Ngp(%1p%0) H_Dg(%1,p,%0,112)
  428. #define @Gq:H_Ngq(%1q%0) H_Dg(%1,q,%0,113)
  429. #define @Gr:H_Ngr(%1r%0) H_Dg(%1,r,%0,114)
  430. #define @Gs:H_Ngs(%1s%0) H_Dg(%1,s,%0,115)
  431. #define @Gt:H_Ngt(%1t%0) H_Dg(%1,t,%0,116)
  432. #define @Gu:H_Ngu(%1u%0) H_Dg(%1,u,%0,117)
  433. #define @Gv:H_Ngv(%1v%0) H_Dg(%1,v,%0,118)
  434. #define @Gw:H_Ngw(%1w%0) H_Dg(%1,w,%0,119)
  435. #define @Gx:H_Ngx(%1x%0) H_Dg(%1,x,%0,120)
  436. #define @Gy:H_Ngy(%1y%0) H_Dg(%1,y,%0,121)
  437. #define @Gz:H_Ngz(%1z%0) H_Dg(%1,z,%0,122)
  438. #define @GA:H_NgA(%1A%0) H_Dg(%1,A,%0,65)
  439. #define @GB:H_NgB(%1B%0) H_Dg(%1,B,%0,66)
  440. #define @GC:H_NgC(%1C%0) H_Dg(%1,C,%0,67)
  441. #define @GD:H_NgD(%1D%0) H_Dg(%1,D,%0,68)
  442. #define @GE:H_NgE(%1E%0) H_Dg(%1,E,%0,69)
  443. #define @GF:H_NgF(%1F%0) H_Dg(%1,F,%0,70)
  444. #define @GG:H_NgG(%1G%0) H_Dg(%1,G,%0,71)
  445. #define @GH:H_NgH(%1H%0) H_Dg(%1,H,%0,72)
  446. #define @GI:H_NgI(%1I%0) H_Dg(%1,I,%0,73)
  447. #define @GJ:H_NgJ(%1J%0) H_Dg(%1,J,%0,74)
  448. #define @GK:H_NgK(%1K%0) H_Dg(%1,K,%0,75)
  449. #define @GL:H_NgL(%1L%0) H_Dg(%1,L,%0,76)
  450. #define @GM:H_NgM(%1M%0) H_Dg(%1,M,%0,77)
  451. #define @GN:H_NgN(%1N%0) H_Dg(%1,N,%0,78)
  452. #define @GO:H_NgO(%1O%0) H_Dg(%1,O,%0,79)
  453. #define @GP:H_NgP(%1P%0) H_Dg(%1,P,%0,80)
  454. #define @GQ:H_NgQ(%1Q%0) H_Dg(%1,Q,%0,81)
  455. #define @GR:H_NgR(%1R%0) H_Dg(%1,R,%0,82)
  456. #define @GS:H_NgS(%1S%0) H_Dg(%1,S,%0,83)
  457. #define @GT:H_NgT(%1T%0) H_Dg(%1,T,%0,84)
  458. #define @GU:H_NgU(%1U%0) H_Dg(%1,U,%0,85)
  459. #define @GV:H_NgV(%1V%0) H_Dg(%1,V,%0,86)
  460. #define @GW:H_NgW(%1W%0) H_Dg(%1,W,%0,87)
  461. #define @GX:H_NgX(%1X%0) H_Dg(%1,X,%0,88)
  462. #define @GY:H_NgY(%1Y%0) H_Dg(%1,Y,%0,89)
  463. #define @GZ:H_NgZ(%1Z%0) H_Dg(%1,Z,%0,90)
  464. #define @G0:H_Ng0(%10%0) H_Dg(%1,0,%0,48)
  465. #define @G1:H_Ng1(%11%0) H_Dg(%1,1,%0,49)
  466. #define @G2:H_Ng2(%12%0) H_Dg(%1,2,%0,50)
  467. #define @G3:H_Ng3(%13%0) H_Dg(%1,3,%0,51)
  468. #define @G4:H_Ng4(%14%0) H_Dg(%1,4,%0,52)
  469. #define @G5:H_Ng5(%15%0) H_Dg(%1,5,%0,53)
  470. #define @G6:H_Ng6(%16%0) H_Dg(%1,6,%0,54)
  471. #define @G7:H_Ng7(%17%0) H_Dg(%1,7,%0,55)
  472. #define @G8:H_Ng8(%18%0) H_Dg(%1,8,%0,56)
  473. #define @G9:H_Ng9(%19%0) H_Dg(%1,9,%0,57)
  474. #define @G_:H_Ng_(%1_%0) H_Dg(%1,_,%0,95)
  475. //#define hg@:H_Sg(@%0,%1) H_Dg(%0)
  476. // Find the next character to test.
  477. #define H_Nga(%0) @Gb:H_Ngb(%0)
  478. #define H_Ngb(%0) @Gc:H_Ngc(%0)
  479. #define H_Ngc(%0) @Gd:H_Ngd(%0)
  480. #define H_Ngd(%0) @Ge:H_Nge(%0)
  481. #define H_Nge(%0) @Gf:H_Ngf(%0)
  482. #define H_Ngf(%0) @Gg:H_Ngg(%0)
  483. #define H_Ngg(%0) @Gh:H_Ngh(%0)
  484. #define H_Ngh(%0) @Gi:H_Ngi(%0)
  485. #define H_Ngi(%0) @Gj:H_Ngj(%0)
  486. #define H_Ngj(%0) @Gk:H_Ngk(%0)
  487. #define H_Ngk(%0) @Gl:H_Ngl(%0)
  488. #define H_Ngl(%0) @Gm:H_Ngm(%0)
  489. #define H_Ngm(%0) @Gn:H_Ngn(%0)
  490. #define H_Ngn(%0) @Go:H_Ngo(%0)
  491. #define H_Ngo(%0) @Gp:H_Ngp(%0)
  492. #define H_Ngp(%0) @Gq:H_Ngq(%0)
  493. #define H_Ngq(%0) @Gr:H_Ngr(%0)
  494. #define H_Ngr(%0) @Gs:H_Ngs(%0)
  495. #define H_Ngs(%0) @Gt:H_Ngt(%0)
  496. #define H_Ngt(%0) @Gu:H_Ngu(%0)
  497. #define H_Ngu(%0) @Gv:H_Ngv(%0)
  498. #define H_Ngv(%0) @Gw:H_Ngw(%0)
  499. #define H_Ngw(%0) @Gx:H_Ngx(%0)
  500. #define H_Ngx(%0) @Gy:H_Ngy(%0)
  501. #define H_Ngy(%0) @Gz:H_Ngz(%0)
  502. #define H_Ngz(%0) @G0:H_Ng0(%0)
  503. #define H_NgA(%0) @GB:H_NgB(%0)
  504. #define H_NgB(%0) @GC:H_NgC(%0)
  505. #define H_NgC(%0) @GD:H_NgD(%0)
  506. #define H_NgD(%0) @GE:H_NgE(%0)
  507. #define H_NgE(%0) @GF:H_NgF(%0)
  508. #define H_NgF(%0) @GG:H_NgG(%0)
  509. #define H_NgG(%0) @GH:H_NgH(%0)
  510. #define H_NgH(%0) @GI:H_NgI(%0)
  511. #define H_NgI(%0) @GJ:H_NgJ(%0)
  512. #define H_NgJ(%0) @GK:H_NgK(%0)
  513. #define H_NgK(%0) @GL:H_NgL(%0)
  514. #define H_NgL(%0) @GM:H_NgM(%0)
  515. #define H_NgM(%0) @GN:H_NgN(%0)
  516. #define H_NgN(%0) @GO:H_NgO(%0)
  517. #define H_NgO(%0) @GP:H_NgP(%0)
  518. #define H_NgP(%0) @GQ:H_NgQ(%0)
  519. #define H_NgQ(%0) @GR:H_NgR(%0)
  520. #define H_NgR(%0) @GS:H_NgS(%0)
  521. #define H_NgS(%0) @GT:H_NgT(%0)
  522. #define H_NgT(%0) @GU:H_NgU(%0)
  523. #define H_NgU(%0) @GV:H_NgV(%0)
  524. #define H_NgV(%0) @GW:H_NgW(%0)
  525. #define H_NgW(%0) @GX:H_NgX(%0)
  526. #define H_NgX(%0) @GY:H_NgY(%0)
  527. #define H_NgY(%0) @GZ:H_NgZ(%0)
  528. #define H_NgZ(%0) H_Eg:H_Rg
  529. #define H_Ng0(%0) @G1:H_Ng1(%0)
  530. #define H_Ng1(%0) @G2:H_Ng2(%0)
  531. #define H_Ng2(%0) @G3:H_Ng3(%0)
  532. #define H_Ng3(%0) @G4:H_Ng4(%0)
  533. #define H_Ng4(%0) @G5:H_Ng5(%0)
  534. #define H_Ng5(%0) @G6:H_Ng6(%0)
  535. #define H_Ng6(%0) @G7:H_Ng7(%0)
  536. #define H_Ng7(%0) @G8:H_Ng8(%0)
  537. #define H_Ng8(%0) @G9:H_Ng9(%0)
  538. #define H_Ng9(%0) @G_:H_Ng_(%0)
  539. #define H_Ng_(%0) @GA:H_NgA(%0)
  540. // ==================
  541. // Case insensitive
  542. // ==================
  543. #define hf:H_Sf(%0,%1£%2,%9,%3)[%4]{%5}<%6<%7||| hf:H_Sf(%0%1£,%2,%9,%3)[%4]{%5<%6}<%7|||
  544. #define H_Sf(%0,%1,%9,%3)[%4]{%5}<%6||| @F%9:H_Nf%9(%0%1£%3)%5<%4<%6|||
  545. #define H_Ef:H_Rf<%0<%1||| (%0_:H_Ef:H_Rf<%1|||)
  546. #define H_Rf<%1||| (%1))
  547. #define H_Df(%1,%9,%2,%8) hf:H_Sf(,%1,%9,%2)[%8^16777619*]{}
  548. // Test for the current character.
  549. #define @Fa:H_Nfa(%1a%0) H_Df(%1,a,%0,65)
  550. #define @Fb:H_Nfb(%1b%0) H_Df(%1,b,%0,66)
  551. #define @Fc:H_Nfc(%1c%0) H_Df(%1,c,%0,67)
  552. #define @Fd:H_Nfd(%1d%0) H_Df(%1,d,%0,68)
  553. #define @Fe:H_Nfe(%1e%0) H_Df(%1,e,%0,69)
  554. #define @Ff:H_Nff(%1f%0) H_Df(%1,f,%0,70)
  555. #define @Fg:H_Nfg(%1g%0) H_Df(%1,g,%0,71)
  556. #define @Fh:H_Nfh(%1h%0) H_Df(%1,h,%0,72)
  557. #define @Fi:H_Nfi(%1i%0) H_Df(%1,i,%0,73)
  558. #define @Fj:H_Nfj(%1j%0) H_Df(%1,j,%0,74)
  559. #define @Fk:H_Nfk(%1k%0) H_Df(%1,k,%0,75)
  560. #define @Fl:H_Nfl(%1l%0) H_Df(%1,l,%0,76)
  561. #define @Fm:H_Nfm(%1m%0) H_Df(%1,m,%0,77)
  562. #define @Fn:H_Nfn(%1n%0) H_Df(%1,n,%0,78)
  563. #define @Fo:H_Nfo(%1o%0) H_Df(%1,o,%0,79)
  564. #define @Fp:H_Nfp(%1p%0) H_Df(%1,p,%0,80)
  565. #define @Fq:H_Nfq(%1q%0) H_Df(%1,q,%0,81)
  566. #define @Fr:H_Nfr(%1r%0) H_Df(%1,r,%0,82)
  567. #define @Fs:H_Nfs(%1s%0) H_Df(%1,s,%0,83)
  568. #define @Ft:H_Nft(%1t%0) H_Df(%1,t,%0,84)
  569. #define @Fu:H_Nfu(%1u%0) H_Df(%1,u,%0,85)
  570. #define @Fv:H_Nfv(%1v%0) H_Df(%1,v,%0,86)
  571. #define @Fw:H_Nfw(%1w%0) H_Df(%1,w,%0,87)
  572. #define @Fx:H_Nfx(%1x%0) H_Df(%1,x,%0,88)
  573. #define @Fy:H_Nfy(%1y%0) H_Df(%1,y,%0,89)
  574. #define @Fz:H_Nfz(%1z%0) H_Df(%1,z,%0,90)
  575. #define @FA:H_NfA(%1A%0) H_Df(%1,A,%0,65)
  576. #define @FB:H_NfB(%1B%0) H_Df(%1,B,%0,66)
  577. #define @FC:H_NfC(%1C%0) H_Df(%1,C,%0,67)
  578. #define @FD:H_NfD(%1D%0) H_Df(%1,D,%0,68)
  579. #define @FE:H_NfE(%1E%0) H_Df(%1,E,%0,69)
  580. #define @FF:H_NfF(%1F%0) H_Df(%1,F,%0,70)
  581. #define @FG:H_NfG(%1G%0) H_Df(%1,G,%0,71)
  582. #define @FH:H_NfH(%1H%0) H_Df(%1,H,%0,72)
  583. #define @FI:H_NfI(%1I%0) H_Df(%1,I,%0,73)
  584. #define @FJ:H_NfJ(%1J%0) H_Df(%1,J,%0,74)
  585. #define @FK:H_NfK(%1K%0) H_Df(%1,K,%0,75)
  586. #define @FL:H_NfL(%1L%0) H_Df(%1,L,%0,76)
  587. #define @FM:H_NfM(%1M%0) H_Df(%1,M,%0,77)
  588. #define @FN:H_NfN(%1N%0) H_Df(%1,N,%0,78)
  589. #define @FO:H_NfO(%1O%0) H_Df(%1,O,%0,79)
  590. #define @FP:H_NfP(%1P%0) H_Df(%1,P,%0,80)
  591. #define @FQ:H_NfQ(%1Q%0) H_Df(%1,Q,%0,81)
  592. #define @FR:H_NfR(%1R%0) H_Df(%1,R,%0,82)
  593. #define @FS:H_NfS(%1S%0) H_Df(%1,S,%0,83)
  594. #define @FT:H_NfT(%1T%0) H_Df(%1,T,%0,84)
  595. #define @FU:H_NfU(%1U%0) H_Df(%1,U,%0,85)
  596. #define @FV:H_NfV(%1V%0) H_Df(%1,V,%0,86)
  597. #define @FW:H_NfW(%1W%0) H_Df(%1,W,%0,87)
  598. #define @FX:H_NfX(%1X%0) H_Df(%1,X,%0,88)
  599. #define @FY:H_NfY(%1Y%0) H_Df(%1,Y,%0,89)
  600. #define @FZ:H_NfZ(%1Z%0) H_Df(%1,Z,%0,90)
  601. #define @F0:H_Nf0(%10%0) H_Df(%1,0,%0,48)
  602. #define @F1:H_Nf1(%11%0) H_Df(%1,1,%0,49)
  603. #define @F2:H_Nf2(%12%0) H_Df(%1,2,%0,50)
  604. #define @F3:H_Nf3(%13%0) H_Df(%1,3,%0,51)
  605. #define @F4:H_Nf4(%14%0) H_Df(%1,4,%0,52)
  606. #define @F5:H_Nf5(%15%0) H_Df(%1,5,%0,53)
  607. #define @F6:H_Nf6(%16%0) H_Df(%1,6,%0,54)
  608. #define @F7:H_Nf7(%17%0) H_Df(%1,7,%0,55)
  609. #define @F8:H_Nf8(%18%0) H_Df(%1,8,%0,56)
  610. #define @F9:H_Nf9(%19%0) H_Df(%1,9,%0,57)
  611. #define @F_:H_Nf_(%1_%0) H_Df(%1,_,%0,95)
  612. //#define hf@:H_Sf(@%0,%1) H_Df(%0)
  613. // Find the next character to test.
  614. #define H_Nfa(%0) @Fb:H_Nfb(%0)
  615. #define H_Nfb(%0) @Fc:H_Nfc(%0)
  616. #define H_Nfc(%0) @Fd:H_Nfd(%0)
  617. #define H_Nfd(%0) @Fe:H_Nfe(%0)
  618. #define H_Nfe(%0) @Ff:H_Nff(%0)
  619. #define H_Nff(%0) @Fg:H_Nfg(%0)
  620. #define H_Nfg(%0) @Fh:H_Nfh(%0)
  621. #define H_Nfh(%0) @Fi:H_Nfi(%0)
  622. #define H_Nfi(%0) @Fj:H_Nfj(%0)
  623. #define H_Nfj(%0) @Fk:H_Nfk(%0)
  624. #define H_Nfk(%0) @Fl:H_Nfl(%0)
  625. #define H_Nfl(%0) @Fm:H_Nfm(%0)
  626. #define H_Nfm(%0) @Fn:H_Nfn(%0)
  627. #define H_Nfn(%0) @Fo:H_Nfo(%0)
  628. #define H_Nfo(%0) @Fp:H_Nfp(%0)
  629. #define H_Nfp(%0) @Fq:H_Nfq(%0)
  630. #define H_Nfq(%0) @Fr:H_Nfr(%0)
  631. #define H_Nfr(%0) @Fs:H_Nfs(%0)
  632. #define H_Nfs(%0) @Ft:H_Nft(%0)
  633. #define H_Nft(%0) @Fu:H_Nfu(%0)
  634. #define H_Nfu(%0) @Fv:H_Nfv(%0)
  635. #define H_Nfv(%0) @Fw:H_Nfw(%0)
  636. #define H_Nfw(%0) @Fx:H_Nfx(%0)
  637. #define H_Nfx(%0) @Fy:H_Nfy(%0)
  638. #define H_Nfy(%0) @Fz:H_Nfz(%0)
  639. #define H_Nfz(%0) @F0:H_Nf0(%0)
  640. #define H_NfA(%0) @FB:H_NfB(%0)
  641. #define H_NfB(%0) @FC:H_NfC(%0)
  642. #define H_NfC(%0) @FD:H_NfD(%0)
  643. #define H_NfD(%0) @FE:H_NfE(%0)
  644. #define H_NfE(%0) @FF:H_NfF(%0)
  645. #define H_NfF(%0) @FG:H_NfG(%0)
  646. #define H_NfG(%0) @FH:H_NfH(%0)
  647. #define H_NfH(%0) @FI:H_NfI(%0)
  648. #define H_NfI(%0) @FJ:H_NfJ(%0)
  649. #define H_NfJ(%0) @FK:H_NfK(%0)
  650. #define H_NfK(%0) @FL:H_NfL(%0)
  651. #define H_NfL(%0) @FM:H_NfM(%0)
  652. #define H_NfM(%0) @FN:H_NfN(%0)
  653. #define H_NfN(%0) @FO:H_NfO(%0)
  654. #define H_NfO(%0) @FP:H_NfP(%0)
  655. #define H_NfP(%0) @FQ:H_NfQ(%0)
  656. #define H_NfQ(%0) @FR:H_NfR(%0)
  657. #define H_NfR(%0) @FS:H_NfS(%0)
  658. #define H_NfS(%0) @FT:H_NfT(%0)
  659. #define H_NfT(%0) @FU:H_NfU(%0)
  660. #define H_NfU(%0) @FV:H_NfV(%0)
  661. #define H_NfV(%0) @FW:H_NfW(%0)
  662. #define H_NfW(%0) @FX:H_NfX(%0)
  663. #define H_NfX(%0) @FY:H_NfY(%0)
  664. #define H_NfY(%0) @FZ:H_NfZ(%0)
  665. #define H_NfZ(%0) H_Ef:H_Rf
  666. #define H_Nf0(%0) @F1:H_Nf1(%0)
  667. #define H_Nf1(%0) @F2:H_Nf2(%0)
  668. #define H_Nf2(%0) @F3:H_Nf3(%0)
  669. #define H_Nf3(%0) @F4:H_Nf4(%0)
  670. #define H_Nf4(%0) @F5:H_Nf5(%0)
  671. #define H_Nf5(%0) @F6:H_Nf6(%0)
  672. #define H_Nf6(%0) @F7:H_Nf7(%0)
  673. #define H_Nf7(%0) @F8:H_Nf8(%0)
  674. #define H_Nf8(%0) @F9:H_Nf9(%0)
  675. #define H_Nf9(%0) @F_:H_Nf_(%0)
  676. #define H_Nf_(%0) @FA:H_NfA(%0)
  677. // ============
  678. // FNV1a hash
  679. // ============
  680. // ================
  681. // Case sensitive
  682. // ================
  683. #define ha:H_Sa(%0,%1£%2,%9,%3)[%4]{%5}<%6<%7||| ha:H_Sa(%0%1£,%2,%9,%3)[%4]{%5<%6}<%7|||
  684. #define H_Sa(%0,%1,%9,%3)[%4]{%5}<%6||| @A%9:H_Na%9(%0%1£%3)%5<%4<%6|||
  685. #define H_Ea:H_Ra<%0<%1||| (%0_:H_Ea:H_Ra<%1|||)
  686. #define H_Ra<%1||| (%1))
  687. #define H_Da(%1,%9,%2,%8) ha:H_Sa(,%1,%9,%2)[%8^16777619*]{}
  688. // Test for the current character.
  689. #define @Aa:H_Naa(%1a%0) H_Da(%1,a,%0,97)
  690. #define @Ab:H_Nab(%1b%0) H_Da(%1,b,%0,98)
  691. #define @Ac:H_Nac(%1c%0) H_Da(%1,c,%0,99)
  692. #define @Ad:H_Nad(%1d%0) H_Da(%1,d,%0,100)
  693. #define @Ae:H_Nae(%1e%0) H_Da(%1,e,%0,101)
  694. #define @Af:H_Naf(%1f%0) H_Da(%1,f,%0,102)
  695. #define @Ag:H_Nag(%1g%0) H_Da(%1,g,%0,103)
  696. #define @Ah:H_Nah(%1h%0) H_Da(%1,h,%0,104)
  697. #define @Ai:H_Nai(%1i%0) H_Da(%1,i,%0,105)
  698. #define @Aj:H_Naj(%1j%0) H_Da(%1,j,%0,106)
  699. #define @Ak:H_Nak(%1k%0) H_Da(%1,k,%0,107)
  700. #define @Al:H_Nal(%1l%0) H_Da(%1,l,%0,108)
  701. #define @Am:H_Nam(%1m%0) H_Da(%1,m,%0,109)
  702. #define @An:H_Nan(%1n%0) H_Da(%1,n,%0,110)
  703. #define @Ao:H_Nao(%1o%0) H_Da(%1,o,%0,111)
  704. #define @Ap:H_Nap(%1p%0) H_Da(%1,p,%0,112)
  705. #define @Aq:H_Naq(%1q%0) H_Da(%1,q,%0,113)
  706. #define @Ar:H_Nar(%1r%0) H_Da(%1,r,%0,114)
  707. #define @As:H_Nas(%1s%0) H_Da(%1,s,%0,115)
  708. #define @At:H_Nat(%1t%0) H_Da(%1,t,%0,116)
  709. #define @Au:H_Nau(%1u%0) H_Da(%1,u,%0,117)
  710. #define @Av:H_Nav(%1v%0) H_Da(%1,v,%0,118)
  711. #define @Aw:H_Naw(%1w%0) H_Da(%1,w,%0,119)
  712. #define @Ax:H_Nax(%1x%0) H_Da(%1,x,%0,120)
  713. #define @Ay:H_Nay(%1y%0) H_Da(%1,y,%0,121)
  714. #define @Az:H_Naz(%1z%0) H_Da(%1,z,%0,122)
  715. #define @AA:H_NaA(%1A%0) H_Da(%1,A,%0,65)
  716. #define @AB:H_NaB(%1B%0) H_Da(%1,B,%0,66)
  717. #define @AC:H_NaC(%1C%0) H_Da(%1,C,%0,67)
  718. #define @AD:H_NaD(%1D%0) H_Da(%1,D,%0,68)
  719. #define @AE:H_NaE(%1E%0) H_Da(%1,E,%0,69)
  720. #define @AF:H_NaF(%1F%0) H_Da(%1,F,%0,70)
  721. #define @AG:H_NaG(%1G%0) H_Da(%1,G,%0,71)
  722. #define @AH:H_NaH(%1H%0) H_Da(%1,H,%0,72)
  723. #define @AI:H_NaI(%1I%0) H_Da(%1,I,%0,73)
  724. #define @AJ:H_NaJ(%1J%0) H_Da(%1,J,%0,74)
  725. #define @AK:H_NaK(%1K%0) H_Da(%1,K,%0,75)
  726. #define @AL:H_NaL(%1L%0) H_Da(%1,L,%0,76)
  727. #define @AM:H_NaM(%1M%0) H_Da(%1,M,%0,77)
  728. #define @AN:H_NaN(%1N%0) H_Da(%1,N,%0,78)
  729. #define @AO:H_NaO(%1O%0) H_Da(%1,O,%0,79)
  730. #define @AP:H_NaP(%1P%0) H_Da(%1,P,%0,80)
  731. #define @AQ:H_NaQ(%1Q%0) H_Da(%1,Q,%0,81)
  732. #define @AR:H_NaR(%1R%0) H_Da(%1,R,%0,82)
  733. #define @AS:H_NaS(%1S%0) H_Da(%1,S,%0,83)
  734. #define @AT:H_NaT(%1T%0) H_Da(%1,T,%0,84)
  735. #define @AU:H_NaU(%1U%0) H_Da(%1,U,%0,85)
  736. #define @AV:H_NaV(%1V%0) H_Da(%1,V,%0,86)
  737. #define @AW:H_NaW(%1W%0) H_Da(%1,W,%0,87)
  738. #define @AX:H_NaX(%1X%0) H_Da(%1,X,%0,88)
  739. #define @AY:H_NaY(%1Y%0) H_Da(%1,Y,%0,89)
  740. #define @AZ:H_NaZ(%1Z%0) H_Da(%1,Z,%0,90)
  741. #define @A0:H_Na0(%10%0) H_Da(%1,0,%0,48)
  742. #define @A1:H_Na1(%11%0) H_Da(%1,1,%0,49)
  743. #define @A2:H_Na2(%12%0) H_Da(%1,2,%0,50)
  744. #define @A3:H_Na3(%13%0) H_Da(%1,3,%0,51)
  745. #define @A4:H_Na4(%14%0) H_Da(%1,4,%0,52)
  746. #define @A5:H_Na5(%15%0) H_Da(%1,5,%0,53)
  747. #define @A6:H_Na6(%16%0) H_Da(%1,6,%0,54)
  748. #define @A7:H_Na7(%17%0) H_Da(%1,7,%0,55)
  749. #define @A8:H_Na8(%18%0) H_Da(%1,8,%0,56)
  750. #define @A9:H_Na9(%19%0) H_Da(%1,9,%0,57)
  751. #define @A_:H_Na_(%1_%0) H_Da(%1,_,%0,95)
  752. //#define ha@:H_Sa(@%0,%1) H_Da(%0)
  753. // Find the next character to test.
  754. #define H_Naa(%0) @Ab:H_Nab(%0)
  755. #define H_Nab(%0) @Ac:H_Nac(%0)
  756. #define H_Nac(%0) @Ad:H_Nad(%0)
  757. #define H_Nad(%0) @Ae:H_Nae(%0)
  758. #define H_Nae(%0) @Af:H_Naf(%0)
  759. #define H_Naf(%0) @Ag:H_Nag(%0)
  760. #define H_Nag(%0) @Ah:H_Nah(%0)
  761. #define H_Nah(%0) @Ai:H_Nai(%0)
  762. #define H_Nai(%0) @Aj:H_Naj(%0)
  763. #define H_Naj(%0) @Ak:H_Nak(%0)
  764. #define H_Nak(%0) @Al:H_Nal(%0)
  765. #define H_Nal(%0) @Am:H_Nam(%0)
  766. #define H_Nam(%0) @An:H_Nan(%0)
  767. #define H_Nan(%0) @Ao:H_Nao(%0)
  768. #define H_Nao(%0) @Ap:H_Nap(%0)
  769. #define H_Nap(%0) @Aq:H_Naq(%0)
  770. #define H_Naq(%0) @Ar:H_Nar(%0)
  771. #define H_Nar(%0) @As:H_Nas(%0)
  772. #define H_Nas(%0) @At:H_Nat(%0)
  773. #define H_Nat(%0) @Au:H_Nau(%0)
  774. #define H_Nau(%0) @Av:H_Nav(%0)
  775. #define H_Nav(%0) @Aw:H_Naw(%0)
  776. #define H_Naw(%0) @Ax:H_Nax(%0)
  777. #define H_Nax(%0) @Ay:H_Nay(%0)
  778. #define H_Nay(%0) @Az:H_Naz(%0)
  779. #define H_Naz(%0) @A0:H_Na0(%0)
  780. #define H_NaA(%0) @AB:H_NaB(%0)
  781. #define H_NaB(%0) @AC:H_NaC(%0)
  782. #define H_NaC(%0) @AD:H_NaD(%0)
  783. #define H_NaD(%0) @AE:H_NaE(%0)
  784. #define H_NaE(%0) @AF:H_NaF(%0)
  785. #define H_NaF(%0) @AG:H_NaG(%0)
  786. #define H_NaG(%0) @AH:H_NaH(%0)
  787. #define H_NaH(%0) @AI:H_NaI(%0)
  788. #define H_NaI(%0) @AJ:H_NaJ(%0)
  789. #define H_NaJ(%0) @AK:H_NaK(%0)
  790. #define H_NaK(%0) @AL:H_NaL(%0)
  791. #define H_NaL(%0) @AM:H_NaM(%0)
  792. #define H_NaM(%0) @AN:H_NaN(%0)
  793. #define H_NaN(%0) @AO:H_NaO(%0)
  794. #define H_NaO(%0) @AP:H_NaP(%0)
  795. #define H_NaP(%0) @AQ:H_NaQ(%0)
  796. #define H_NaQ(%0) @AR:H_NaR(%0)
  797. #define H_NaR(%0) @AS:H_NaS(%0)
  798. #define H_NaS(%0) @AT:H_NaT(%0)
  799. #define H_NaT(%0) @AU:H_NaU(%0)
  800. #define H_NaU(%0) @AV:H_NaV(%0)
  801. #define H_NaV(%0) @AW:H_NaW(%0)
  802. #define H_NaW(%0) @AX:H_NaX(%0)
  803. #define H_NaX(%0) @AY:H_NaY(%0)
  804. #define H_NaY(%0) @AZ:H_NaZ(%0)
  805. #define H_NaZ(%0) H_Ea:H_Ra
  806. #define H_Na0(%0) @A1:H_Na1(%0)
  807. #define H_Na1(%0) @A2:H_Na2(%0)
  808. #define H_Na2(%0) @A3:H_Na3(%0)
  809. #define H_Na3(%0) @A4:H_Na4(%0)
  810. #define H_Na4(%0) @A5:H_Na5(%0)
  811. #define H_Na5(%0) @A6:H_Na6(%0)
  812. #define H_Na6(%0) @A7:H_Na7(%0)
  813. #define H_Na7(%0) @A8:H_Na8(%0)
  814. #define H_Na8(%0) @A9:H_Na9(%0)
  815. #define H_Na9(%0) @A_:H_Na_(%0)
  816. #define H_Na_(%0) @AA:H_NaA(%0)
  817. // ==================
  818. // Case insensitive
  819. // ==================
  820. #define hd:H_Sd(%0,%1£%2,%9,%3)[%4]{%5}<%6<%7||| hd:H_Sd(%0%1£,%2,%9,%3)[%4]{%5<%6}<%7|||
  821. #define H_Sd(%0,%1,%9,%3)[%4]{%5}<%6||| @D%9:H_Nd%9(%0%1£%3)%5<%4<%6|||
  822. #define H_Ed:H_Rd<%0<%1||| (%0_:H_Ed:H_Rd<%1|||)
  823. #define H_Rd<%1||| (%1))
  824. #define H_Dd(%1,%9,%2,%8) hd:H_Sd(,%1,%9,%2)[%8^16777619*]{}
  825. // Test for the current character.
  826. #define @Da:H_Nda(%1a%0) H_Dd(%1,a,%0,65)
  827. #define @Db:H_Ndb(%1b%0) H_Dd(%1,b,%0,66)
  828. #define @Dc:H_Ndc(%1c%0) H_Dd(%1,c,%0,67)
  829. #define @Dd:H_Ndd(%1d%0) H_Dd(%1,d,%0,68)
  830. #define @De:H_Nde(%1e%0) H_Dd(%1,e,%0,69)
  831. #define @Df:H_Ndf(%1f%0) H_Dd(%1,f,%0,70)
  832. #define @Dg:H_Ndg(%1g%0) H_Dd(%1,g,%0,71)
  833. #define @Dh:H_Ndh(%1h%0) H_Dd(%1,h,%0,72)
  834. #define @Di:H_Ndi(%1i%0) H_Dd(%1,i,%0,73)
  835. #define @Dj:H_Ndj(%1j%0) H_Dd(%1,j,%0,74)
  836. #define @Dk:H_Ndk(%1k%0) H_Dd(%1,k,%0,75)
  837. #define @Dl:H_Ndl(%1l%0) H_Dd(%1,l,%0,76)
  838. #define @Dm:H_Ndm(%1m%0) H_Dd(%1,m,%0,77)
  839. #define @Dn:H_Ndn(%1n%0) H_Dd(%1,n,%0,78)
  840. #define @Do:H_Ndo(%1o%0) H_Dd(%1,o,%0,79)
  841. #define @Dp:H_Ndp(%1p%0) H_Dd(%1,p,%0,80)
  842. #define @Dq:H_Ndq(%1q%0) H_Dd(%1,q,%0,81)
  843. #define @Dr:H_Ndr(%1r%0) H_Dd(%1,r,%0,82)
  844. #define @Ds:H_Nds(%1s%0) H_Dd(%1,s,%0,83)
  845. #define @Dt:H_Ndt(%1t%0) H_Dd(%1,t,%0,84)
  846. #define @Du:H_Ndu(%1u%0) H_Dd(%1,u,%0,85)
  847. #define @Dv:H_Ndv(%1v%0) H_Dd(%1,v,%0,86)
  848. #define @Dw:H_Ndw(%1w%0) H_Dd(%1,w,%0,87)
  849. #define @Dx:H_Ndx(%1x%0) H_Dd(%1,x,%0,88)
  850. #define @Dy:H_Ndy(%1y%0) H_Dd(%1,y,%0,89)
  851. #define @Dz:H_Ndz(%1z%0) H_Dd(%1,z,%0,90)
  852. #define @DA:H_NdA(%1A%0) H_Dd(%1,A,%0,65)
  853. #define @DB:H_NdB(%1B%0) H_Dd(%1,B,%0,66)
  854. #define @DC:H_NdC(%1C%0) H_Dd(%1,C,%0,67)
  855. #define @DD:H_NdD(%1D%0) H_Dd(%1,D,%0,68)
  856. #define @DE:H_NdE(%1E%0) H_Dd(%1,E,%0,69)
  857. #define @DF:H_NdF(%1F%0) H_Dd(%1,F,%0,70)
  858. #define @DG:H_NdG(%1G%0) H_Dd(%1,G,%0,71)
  859. #define @DH:H_NdH(%1H%0) H_Dd(%1,H,%0,72)
  860. #define @DI:H_NdI(%1I%0) H_Dd(%1,I,%0,73)
  861. #define @DJ:H_NdJ(%1J%0) H_Dd(%1,J,%0,74)
  862. #define @DK:H_NdK(%1K%0) H_Dd(%1,K,%0,75)
  863. #define @DL:H_NdL(%1L%0) H_Dd(%1,L,%0,76)
  864. #define @DM:H_NdM(%1M%0) H_Dd(%1,M,%0,77)
  865. #define @DN:H_NdN(%1N%0) H_Dd(%1,N,%0,78)
  866. #define @DO:H_NdO(%1O%0) H_Dd(%1,O,%0,79)
  867. #define @DP:H_NdP(%1P%0) H_Dd(%1,P,%0,80)
  868. #define @DQ:H_NdQ(%1Q%0) H_Dd(%1,Q,%0,81)
  869. #define @DR:H_NdR(%1R%0) H_Dd(%1,R,%0,82)
  870. #define @DS:H_NdS(%1S%0) H_Dd(%1,S,%0,83)
  871. #define @DT:H_NdT(%1T%0) H_Dd(%1,T,%0,84)
  872. #define @DU:H_NdU(%1U%0) H_Dd(%1,U,%0,85)
  873. #define @DV:H_NdV(%1V%0) H_Dd(%1,V,%0,86)
  874. #define @DW:H_NdW(%1W%0) H_Dd(%1,W,%0,87)
  875. #define @DX:H_NdX(%1X%0) H_Dd(%1,X,%0,88)
  876. #define @DY:H_NdY(%1Y%0) H_Dd(%1,Y,%0,89)
  877. #define @DZ:H_NdZ(%1Z%0) H_Dd(%1,Z,%0,90)
  878. #define @D0:H_Nd0(%10%0) H_Dd(%1,0,%0,48)
  879. #define @D1:H_Nd1(%11%0) H_Dd(%1,1,%0,49)
  880. #define @D2:H_Nd2(%12%0) H_Dd(%1,2,%0,50)
  881. #define @D3:H_Nd3(%13%0) H_Dd(%1,3,%0,51)
  882. #define @D4:H_Nd4(%14%0) H_Dd(%1,4,%0,52)
  883. #define @D5:H_Nd5(%15%0) H_Dd(%1,5,%0,53)
  884. #define @D6:H_Nd6(%16%0) H_Dd(%1,6,%0,54)
  885. #define @D7:H_Nd7(%17%0) H_Dd(%1,7,%0,55)
  886. #define @D8:H_Nd8(%18%0) H_Dd(%1,8,%0,56)
  887. #define @D9:H_Nd9(%19%0) H_Dd(%1,9,%0,57)
  888. #define @D_:H_Nd_(%1_%0) H_Dd(%1,_,%0,95)
  889. //#define hd@:H_Sd(@%0,%1) H_Dd(%0)
  890. // Find the next character to test.
  891. #define H_Nda(%0) @Db:H_Ndb(%0)
  892. #define H_Ndb(%0) @Dc:H_Ndc(%0)
  893. #define H_Ndc(%0) @Dd:H_Ndd(%0)
  894. #define H_Ndd(%0) @De:H_Nde(%0)
  895. #define H_Nde(%0) @Df:H_Ndf(%0)
  896. #define H_Ndf(%0) @Dg:H_Ndg(%0)
  897. #define H_Ndg(%0) @Dh:H_Ndh(%0)
  898. #define H_Ndh(%0) @Di:H_Ndi(%0)
  899. #define H_Ndi(%0) @Dj:H_Ndj(%0)
  900. #define H_Ndj(%0) @Dk:H_Ndk(%0)
  901. #define H_Ndk(%0) @Dl:H_Ndl(%0)
  902. #define H_Ndl(%0) @Dm:H_Ndm(%0)
  903. #define H_Ndm(%0) @Dn:H_Ndn(%0)
  904. #define H_Ndn(%0) @Do:H_Ndo(%0)
  905. #define H_Ndo(%0) @Dp:H_Ndp(%0)
  906. #define H_Ndp(%0) @Dq:H_Ndq(%0)
  907. #define H_Ndq(%0) @Dr:H_Ndr(%0)
  908. #define H_Ndr(%0) @Ds:H_Nds(%0)
  909. #define H_Nds(%0) @Dt:H_Ndt(%0)
  910. #define H_Ndt(%0) @Du:H_Ndu(%0)
  911. #define H_Ndu(%0) @Dv:H_Ndv(%0)
  912. #define H_Ndv(%0) @Dw:H_Ndw(%0)
  913. #define H_Ndw(%0) @Dx:H_Ndx(%0)
  914. #define H_Ndx(%0) @Dy:H_Ndy(%0)
  915. #define H_Ndy(%0) @Dz:H_Ndz(%0)
  916. #define H_Ndz(%0) @D0:H_Nd0(%0)
  917. #define H_NdA(%0) @DB:H_NdB(%0)
  918. #define H_NdB(%0) @DC:H_NdC(%0)
  919. #define H_NdC(%0) @DD:H_NdD(%0)
  920. #define H_NdD(%0) @DE:H_NdE(%0)
  921. #define H_NdE(%0) @DF:H_NdF(%0)
  922. #define H_NdF(%0) @DG:H_NdG(%0)
  923. #define H_NdG(%0) @DH:H_NdH(%0)
  924. #define H_NdH(%0) @DI:H_NdI(%0)
  925. #define H_NdI(%0) @DJ:H_NdJ(%0)
  926. #define H_NdJ(%0) @DK:H_NdK(%0)
  927. #define H_NdK(%0) @DL:H_NdL(%0)
  928. #define H_NdL(%0) @DM:H_NdM(%0)
  929. #define H_NdM(%0) @DN:H_NdN(%0)
  930. #define H_NdN(%0) @DO:H_NdO(%0)
  931. #define H_NdO(%0) @DP:H_NdP(%0)
  932. #define H_NdP(%0) @DQ:H_NdQ(%0)
  933. #define H_NdQ(%0) @DR:H_NdR(%0)
  934. #define H_NdR(%0) @DS:H_NdS(%0)
  935. #define H_NdS(%0) @DT:H_NdT(%0)
  936. #define H_NdT(%0) @DU:H_NdU(%0)
  937. #define H_NdU(%0) @DV:H_NdV(%0)
  938. #define H_NdV(%0) @DW:H_NdW(%0)
  939. #define H_NdW(%0) @DX:H_NdX(%0)
  940. #define H_NdX(%0) @DY:H_NdY(%0)
  941. #define H_NdY(%0) @DZ:H_NdZ(%0)
  942. #define H_NdZ(%0) H_Ed:H_Rd
  943. #define H_Nd0(%0) @D1:H_Nd1(%0)
  944. #define H_Nd1(%0) @D2:H_Nd2(%0)
  945. #define H_Nd2(%0) @D3:H_Nd3(%0)
  946. #define H_Nd3(%0) @D4:H_Nd4(%0)
  947. #define H_Nd4(%0) @D5:H_Nd5(%0)
  948. #define H_Nd5(%0) @D6:H_Nd6(%0)
  949. #define H_Nd6(%0) @D7:H_Nd7(%0)
  950. #define H_Nd7(%0) @D8:H_Nd8(%0)
  951. #define H_Nd8(%0) @D9:H_Nd9(%0)
  952. #define H_Nd9(%0) @D_:H_Nd_(%0)
  953. #define H_Nd_(%0) @DA:H_NdA(%0)
  954. // =============
  955. // Old version
  956. // =============
  957. // ================
  958. // Case sensitive
  959. // ================
  960. // These are the default values
  961. //#define HASH(%0,%1) HASH@%0(%1)
  962. /*#define _H@b HASH@bernstein
  963. #define _H@f HASH@fnv1
  964. #define _H@a HASH@fnv1a*/
  965. // ================
  966. // Bernstein hash
  967. // ================
  968. // Signify the end with two "@" symbols.
  969. #define HASH@bernstein(%0) _REHASH@b(%0,@,@)
  970. // Internal call.
  971. #define _REHASH@b(%0,%1) _HASH@b_%0(%1)
  972. // The bit that actually does the work.
  973. #define _DOHASH@b(%0,%1,%2) (_HASH@b_%1(%2)*33+%0)
  974. // Space.
  975. #define _HASH@b_(%0) _DOHASH@b(32,%0)
  976. // Numbers.
  977. #define _HASH@b_0(%0) _DOHASH@b(48,%0)
  978. #define _HASH@b_1(%0) _DOHASH@b(49,%0)
  979. #define _HASH@b_2(%0) _DOHASH@b(50,%0)
  980. #define _HASH@b_3(%0) _DOHASH@b(51,%0)
  981. #define _HASH@b_4(%0) _DOHASH@b(52,%0)
  982. #define _HASH@b_5(%0) _DOHASH@b(53,%0)
  983. #define _HASH@b_6(%0) _DOHASH@b(54,%0)
  984. #define _HASH@b_7(%0) _DOHASH@b(55,%0)
  985. #define _HASH@b_8(%0) _DOHASH@b(56,%0)
  986. #define _HASH@b_9(%0) _DOHASH@b(57,%0)
  987. // Upper case letters.
  988. #define _HASH@b_A(%0) _DOHASH@b(65,%0)
  989. #define _HASH@b_B(%0) _DOHASH@b(66,%0)
  990. #define _HASH@b_C(%0) _DOHASH@b(67,%0)
  991. #define _HASH@b_D(%0) _DOHASH@b(68,%0)
  992. #define _HASH@b_E(%0) _DOHASH@b(69,%0)
  993. #define _HASH@b_F(%0) _DOHASH@b(70,%0)
  994. #define _HASH@b_G(%0) _DOHASH@b(71,%0)
  995. #define _HASH@b_H(%0) _DOHASH@b(72,%0)
  996. #define _HASH@b_I(%0) _DOHASH@b(73,%0)
  997. #define _HASH@b_J(%0) _DOHASH@b(74,%0)
  998. #define _HASH@b_K(%0) _DOHASH@b(75,%0)
  999. #define _HASH@b_L(%0) _DOHASH@b(76,%0)
  1000. #define _HASH@b_M(%0) _DOHASH@b(77,%0)
  1001. #define _HASH@b_N(%0) _DOHASH@b(78,%0)
  1002. #define _HASH@b_O(%0) _DOHASH@b(79,%0)
  1003. #define _HASH@b_P(%0) _DOHASH@b(80,%0)
  1004. #define _HASH@b_Q(%0) _DOHASH@b(81,%0)
  1005. #define _HASH@b_R(%0) _DOHASH@b(82,%0)
  1006. #define _HASH@b_S(%0) _DOHASH@b(83,%0)
  1007. #define _HASH@b_T(%0) _DOHASH@b(84,%0)
  1008. #define _HASH@b_U(%0) _DOHASH@b(85,%0)
  1009. #define _HASH@b_V(%0) _DOHASH@b(86,%0)
  1010. #define _HASH@b_W(%0) _DOHASH@b(87,%0)
  1011. #define _HASH@b_X(%0) _DOHASH@b(88,%0)
  1012. #define _HASH@b_Y(%0) _DOHASH@b(89,%0)
  1013. #define _HASH@b_Z(%0) _DOHASH@b(90,%0)
  1014. // Underscore.
  1015. #define _HASH@b__(%0) _DOHASH@b(95,%0)
  1016. // Lower case letters.
  1017. #define _HASH@b_a(%0) _DOHASH@b(97,%0)
  1018. #define _HASH@b_b(%0) _DOHASH@b(98,%0)
  1019. #define _HASH@b_c(%0) _DOHASH@b(99,%0)
  1020. #define _HASH@b_d(%0) _DOHASH@b(100,%0)
  1021. #define _HASH@b_e(%0) _DOHASH@b(101,%0)
  1022. #define _HASH@b_f(%0) _DOHASH@b(102,%0)
  1023. #define _HASH@b_g(%0) _DOHASH@b(103,%0)
  1024. #define _HASH@b_h(%0) _DOHASH@b(104,%0)
  1025. #define _HASH@b_i(%0) _DOHASH@b(105,%0)
  1026. #define _HASH@b_j(%0) _DOHASH@b(106,%0)
  1027. #define _HASH@b_k(%0) _DOHASH@b(107,%0)
  1028. #define _HASH@b_l(%0) _DOHASH@b(108,%0)
  1029. #define _HASH@b_m(%0) _DOHASH@b(109,%0)
  1030. #define _HASH@b_n(%0) _DOHASH@b(110,%0)
  1031. #define _HASH@b_o(%0) _DOHASH@b(111,%0)
  1032. #define _HASH@b_p(%0) _DOHASH@b(112,%0)
  1033. #define _HASH@b_q(%0) _DOHASH@b(113,%0)
  1034. #define _HASH@b_r(%0) _DOHASH@b(114,%0)
  1035. #define _HASH@b_s(%0) _DOHASH@b(115,%0)
  1036. #define _HASH@b_t(%0) _DOHASH@b(116,%0)
  1037. #define _HASH@b_u(%0) _DOHASH@b(117,%0)
  1038. #define _HASH@b_v(%0) _DOHASH@b(118,%0)
  1039. #define _HASH@b_w(%0) _DOHASH@b(119,%0)
  1040. #define _HASH@b_x(%0) _DOHASH@b(120,%0)
  1041. #define _HASH@b_y(%0) _DOHASH@b(121,%0)
  1042. #define _HASH@b_z(%0) _DOHASH@b(122,%0)
  1043. // String end.
  1044. #define _HASH@b_@(%0) -1
  1045. // ===========
  1046. // FNV1 hash
  1047. // ===========
  1048. // Signify the end with two "@" symbols.
  1049. #define HASH@fnv1(%0) _REHASH@f(%0,@,@)
  1050. // Internal call.
  1051. #define _REHASH@f(%0,%1) _HASH@f_%0(%1)
  1052. // The bit that actually does the work.
  1053. #define _DOHASH@f(%0,%1,%2) (_HASH@f_%1(%2)*16777619^%0)
  1054. // Space.
  1055. #define _HASH@f_(%0) _DOHASH@f(32,%0)
  1056. // Numbers.
  1057. #define _HASH@f_0(%0) _DOHASH@f(48,%0)
  1058. #define _HASH@f_1(%0) _DOHASH@f(49,%0)
  1059. #define _HASH@f_2(%0) _DOHASH@f(50,%0)
  1060. #define _HASH@f_3(%0) _DOHASH@f(51,%0)
  1061. #define _HASH@f_4(%0) _DOHASH@f(52,%0)
  1062. #define _HASH@f_5(%0) _DOHASH@f(53,%0)
  1063. #define _HASH@f_6(%0) _DOHASH@f(54,%0)
  1064. #define _HASH@f_7(%0) _DOHASH@f(55,%0)
  1065. #define _HASH@f_8(%0) _DOHASH@f(56,%0)
  1066. #define _HASH@f_9(%0) _DOHASH@f(57,%0)
  1067. // Upper case letters.
  1068. #define _HASH@f_A(%0) _DOHASH@f(65,%0)
  1069. #define _HASH@f_B(%0) _DOHASH@f(66,%0)
  1070. #define _HASH@f_C(%0) _DOHASH@f(67,%0)
  1071. #define _HASH@f_D(%0) _DOHASH@f(68,%0)
  1072. #define _HASH@f_E(%0) _DOHASH@f(69,%0)
  1073. #define _HASH@f_F(%0) _DOHASH@f(70,%0)
  1074. #define _HASH@f_G(%0) _DOHASH@f(71,%0)
  1075. #define _HASH@f_H(%0) _DOHASH@f(72,%0)
  1076. #define _HASH@f_I(%0) _DOHASH@f(73,%0)
  1077. #define _HASH@f_J(%0) _DOHASH@f(74,%0)
  1078. #define _HASH@f_K(%0) _DOHASH@f(75,%0)
  1079. #define _HASH@f_L(%0) _DOHASH@f(76,%0)
  1080. #define _HASH@f_M(%0) _DOHASH@f(77,%0)
  1081. #define _HASH@f_N(%0) _DOHASH@f(78,%0)
  1082. #define _HASH@f_O(%0) _DOHASH@f(79,%0)
  1083. #define _HASH@f_P(%0) _DOHASH@f(80,%0)
  1084. #define _HASH@f_Q(%0) _DOHASH@f(81,%0)
  1085. #define _HASH@f_R(%0) _DOHASH@f(82,%0)
  1086. #define _HASH@f_S(%0) _DOHASH@f(83,%0)
  1087. #define _HASH@f_T(%0) _DOHASH@f(84,%0)
  1088. #define _HASH@f_U(%0) _DOHASH@f(85,%0)
  1089. #define _HASH@f_V(%0) _DOHASH@f(86,%0)
  1090. #define _HASH@f_W(%0) _DOHASH@f(87,%0)
  1091. #define _HASH@f_X(%0) _DOHASH@f(88,%0)
  1092. #define _HASH@f_Y(%0) _DOHASH@f(89,%0)
  1093. #define _HASH@f_Z(%0) _DOHASH@f(90,%0)
  1094. // Underscore.
  1095. #define _HASH@f__(%0) _DOHASH@f(95,%0)
  1096. // Lower case letters.
  1097. #define _HASH@f_a(%0) _DOHASH@f(97,%0)
  1098. #define _HASH@f_b(%0) _DOHASH@f(98,%0)
  1099. #define _HASH@f_c(%0) _DOHASH@f(99,%0)
  1100. #define _HASH@f_d(%0) _DOHASH@f(100,%0)
  1101. #define _HASH@f_e(%0) _DOHASH@f(101,%0)
  1102. #define _HASH@f_f(%0) _DOHASH@f(102,%0)
  1103. #define _HASH@f_g(%0) _DOHASH@f(103,%0)
  1104. #define _HASH@f_h(%0) _DOHASH@f(104,%0)
  1105. #define _HASH@f_i(%0) _DOHASH@f(105,%0)
  1106. #define _HASH@f_j(%0) _DOHASH@f(106,%0)
  1107. #define _HASH@f_k(%0) _DOHASH@f(107,%0)
  1108. #define _HASH@f_l(%0) _DOHASH@f(108,%0)
  1109. #define _HASH@f_m(%0) _DOHASH@f(109,%0)
  1110. #define _HASH@f_n(%0) _DOHASH@f(110,%0)
  1111. #define _HASH@f_o(%0) _DOHASH@f(111,%0)
  1112. #define _HASH@f_p(%0) _DOHASH@f(112,%0)
  1113. #define _HASH@f_q(%0) _DOHASH@f(113,%0)
  1114. #define _HASH@f_r(%0) _DOHASH@f(114,%0)
  1115. #define _HASH@f_s(%0) _DOHASH@f(115,%0)
  1116. #define _HASH@f_t(%0) _DOHASH@f(116,%0)
  1117. #define _HASH@f_u(%0) _DOHASH@f(117,%0)
  1118. #define _HASH@f_v(%0) _DOHASH@f(118,%0)
  1119. #define _HASH@f_w(%0) _DOHASH@f(119,%0)
  1120. #define _HASH@f_x(%0) _DOHASH@f(120,%0)
  1121. #define _HASH@f_y(%0) _DOHASH@f(121,%0)
  1122. #define _HASH@f_z(%0) _DOHASH@f(122,%0)
  1123. // String end.
  1124. #define _HASH@f_@(%0) 2166136261
  1125. // ============
  1126. // FNV1a hash
  1127. // ============
  1128. // Signify the end with two "@" symbols.
  1129. #define HASH@fnv1a(%0) _REHASH@a(%0,@,@)
  1130. // Internal call.
  1131. #define _REHASH@a(%0,%1) _HASH@a_%0(%1)
  1132. // The bit that actually does the work.
  1133. #define _DOHASH@a(%0,%1,%2) ((_HASH@a_%1(%2)^%0)*16777619)
  1134. // Space.
  1135. #define _HASH@a_(%0) _DOHASH@a(32,%0)
  1136. // Numbers.
  1137. #define _HASH@a_0(%0) _DOHASH@a(48,%0)
  1138. #define _HASH@a_1(%0) _DOHASH@a(49,%0)
  1139. #define _HASH@a_2(%0) _DOHASH@a(50,%0)
  1140. #define _HASH@a_3(%0) _DOHASH@a(51,%0)
  1141. #define _HASH@a_4(%0) _DOHASH@a(52,%0)
  1142. #define _HASH@a_5(%0) _DOHASH@a(53,%0)
  1143. #define _HASH@a_6(%0) _DOHASH@a(54,%0)
  1144. #define _HASH@a_7(%0) _DOHASH@a(55,%0)
  1145. #define _HASH@a_8(%0) _DOHASH@a(56,%0)
  1146. #define _HASH@a_9(%0) _DOHASH@a(57,%0)
  1147. // Upper case letters.
  1148. #define _HASH@a_A(%0) _DOHASH@a(65,%0)
  1149. #define _HASH@a_B(%0) _DOHASH@a(66,%0)
  1150. #define _HASH@a_C(%0) _DOHASH@a(67,%0)
  1151. #define _HASH@a_D(%0) _DOHASH@a(68,%0)
  1152. #define _HASH@a_E(%0) _DOHASH@a(69,%0)
  1153. #define _HASH@a_F(%0) _DOHASH@a(70,%0)
  1154. #define _HASH@a_G(%0) _DOHASH@a(71,%0)
  1155. #define _HASH@a_H(%0) _DOHASH@a(72,%0)
  1156. #define _HASH@a_I(%0) _DOHASH@a(73,%0)
  1157. #define _HASH@a_J(%0) _DOHASH@a(74,%0)
  1158. #define _HASH@a_K(%0) _DOHASH@a(75,%0)
  1159. #define _HASH@a_L(%0) _DOHASH@a(76,%0)
  1160. #define _HASH@a_M(%0) _DOHASH@a(77,%0)
  1161. #define _HASH@a_N(%0) _DOHASH@a(78,%0)
  1162. #define _HASH@a_O(%0) _DOHASH@a(79,%0)
  1163. #define _HASH@a_P(%0) _DOHASH@a(80,%0)
  1164. #define _HASH@a_Q(%0) _DOHASH@a(81,%0)
  1165. #define _HASH@a_R(%0) _DOHASH@a(82,%0)
  1166. #define _HASH@a_S(%0) _DOHASH@a(83,%0)
  1167. #define _HASH@a_T(%0) _DOHASH@a(84,%0)
  1168. #define _HASH@a_U(%0) _DOHASH@a(85,%0)
  1169. #define _HASH@a_V(%0) _DOHASH@a(86,%0)
  1170. #define _HASH@a_W(%0) _DOHASH@a(87,%0)
  1171. #define _HASH@a_X(%0) _DOHASH@a(88,%0)
  1172. #define _HASH@a_Y(%0) _DOHASH@a(89,%0)
  1173. #define _HASH@a_Z(%0) _DOHASH@a(90,%0)
  1174. // Underscore.
  1175. #define _HASH@a__(%0) _DOHASH@a(95,%0)
  1176. // Lower case letters.
  1177. #define _HASH@a_a(%0) _DOHASH@a(97,%0)
  1178. #define _HASH@a_b(%0) _DOHASH@a(98,%0)
  1179. #define _HASH@a_c(%0) _DOHASH@a(99,%0)
  1180. #define _HASH@a_d(%0) _DOHASH@a(100,%0)
  1181. #define _HASH@a_e(%0) _DOHASH@a(101,%0)
  1182. #define _HASH@a_f(%0) _DOHASH@a(102,%0)
  1183. #define _HASH@a_g(%0) _DOHASH@a(103,%0)
  1184. #define _HASH@a_h(%0) _DOHASH@a(104,%0)
  1185. #define _HASH@a_i(%0) _DOHASH@a(105,%0)
  1186. #define _HASH@a_j(%0) _DOHASH@a(106,%0)
  1187. #define _HASH@a_k(%0) _DOHASH@a(107,%0)
  1188. #define _HASH@a_l(%0) _DOHASH@a(108,%0)
  1189. #define _HASH@a_m(%0) _DOHASH@a(109,%0)
  1190. #define _HASH@a_n(%0) _DOHASH@a(110,%0)
  1191. #define _HASH@a_o(%0) _DOHASH@a(111,%0)
  1192. #define _HASH@a_p(%0) _DOHASH@a(112,%0)
  1193. #define _HASH@a_q(%0) _DOHASH@a(113,%0)
  1194. #define _HASH@a_r(%0) _DOHASH@a(114,%0)
  1195. #define _HASH@a_s(%0) _DOHASH@a(115,%0)
  1196. #define _HASH@a_t(%0) _DOHASH@a(116,%0)
  1197. #define _HASH@a_u(%0) _DOHASH@a(117,%0)
  1198. #define _HASH@a_v(%0) _DOHASH@a(118,%0)
  1199. #define _HASH@a_w(%0) _DOHASH@a(119,%0)
  1200. #define _HASH@a_x(%0) _DOHASH@a(120,%0)
  1201. #define _HASH@a_y(%0) _DOHASH@a(121,%0)
  1202. #define _HASH@a_z(%0) _DOHASH@a(122,%0)
  1203. // String end.
  1204. #define _HASH@a_@(%0) 2166136261
  1205. // ==================
  1206. // Case insensitive
  1207. // ==================
  1208. // These are the default values
  1209. //#define HASHi(%0,%1) HASHi@%0(%1)
  1210. //#define _I(%0) _REHASib(%0,@,@)
  1211. /*#define _I@b HASHi@bernstein
  1212. #define _I@f HASHi@fnv1
  1213. #define _I@a HASHi@fnv1a*/
  1214. // ================
  1215. // Bernstein hash
  1216. // ================
  1217. // Signify the end with two "@" symbols.
  1218. #define HASHi@bernstein(%0) _REHASH@ib(%0,@,@)
  1219. // Internal call.
  1220. #define _REHASH@ib(%0,%1) _HASH@ib_%0(%1)
  1221. // The bit that actually does the work.
  1222. #define _DOHASH@ib(%0,%1,%2) (_HASH@ib_%1(%2)*33+%0)
  1223. // Space.
  1224. #define _HASH@ib_(%0) _DOHASH@ib(32,%0)
  1225. // Numbers.
  1226. #define _HASH@ib_0(%0) _DOHASH@ib(48,%0)
  1227. #define _HASH@ib_1(%0) _DOHASH@ib(49,%0)
  1228. #define _HASH@ib_2(%0) _DOHASH@ib(50,%0)
  1229. #define _HASH@ib_3(%0) _DOHASH@ib(51,%0)
  1230. #define _HASH@ib_4(%0) _DOHASH@ib(52,%0)
  1231. #define _HASH@ib_5(%0) _DOHASH@ib(53,%0)
  1232. #define _HASH@ib_6(%0) _DOHASH@ib(54,%0)
  1233. #define _HASH@ib_7(%0) _DOHASH@ib(55,%0)
  1234. #define _HASH@ib_8(%0) _DOHASH@ib(56,%0)
  1235. #define _HASH@ib_9(%0) _DOHASH@ib(57,%0)
  1236. // Upper case letters.
  1237. #define _HASH@ib_A(%0) _DOHASH@ib(65,%0)
  1238. #define _HASH@ib_B(%0) _DOHASH@ib(66,%0)
  1239. #define _HASH@ib_C(%0) _DOHASH@ib(67,%0)
  1240. #define _HASH@ib_D(%0) _DOHASH@ib(68,%0)
  1241. #define _HASH@ib_E(%0) _DOHASH@ib(69,%0)
  1242. #define _HASH@ib_F(%0) _DOHASH@ib(70,%0)
  1243. #define _HASH@ib_G(%0) _DOHASH@ib(71,%0)
  1244. #define _HASH@ib_H(%0) _DOHASH@ib(72,%0)
  1245. #define _HASH@ib_I(%0) _DOHASH@ib(73,%0)
  1246. #define _HASH@ib_J(%0) _DOHASH@ib(74,%0)
  1247. #define _HASH@ib_K(%0) _DOHASH@ib(75,%0)
  1248. #define _HASH@ib_L(%0) _DOHASH@ib(76,%0)
  1249. #define _HASH@ib_M(%0) _DOHASH@ib(77,%0)
  1250. #define _HASH@ib_N(%0) _DOHASH@ib(78,%0)
  1251. #define _HASH@ib_O(%0) _DOHASH@ib(79,%0)
  1252. #define _HASH@ib_P(%0) _DOHASH@ib(80,%0)
  1253. #define _HASH@ib_Q(%0) _DOHASH@ib(81,%0)
  1254. #define _HASH@ib_R(%0) _DOHASH@ib(82,%0)
  1255. #define _HASH@ib_S(%0) _DOHASH@ib(83,%0)
  1256. #define _HASH@ib_T(%0) _DOHASH@ib(84,%0)
  1257. #define _HASH@ib_U(%0) _DOHASH@ib(85,%0)
  1258. #define _HASH@ib_V(%0) _DOHASH@ib(86,%0)
  1259. #define _HASH@ib_W(%0) _DOHASH@ib(87,%0)
  1260. #define _HASH@ib_X(%0) _DOHASH@ib(88,%0)
  1261. #define _HASH@ib_Y(%0) _DOHASH@ib(89,%0)
  1262. #define _HASH@ib_Z(%0) _DOHASH@ib(90,%0)
  1263. // Underscore.
  1264. #define _HASH@ib__(%0) _DOHASH@ib(95,%0)
  1265. // Lower case letters.
  1266. #define _HASH@ib_a(%0) _DOHASH@ib(65,%0)
  1267. #define _HASH@ib_b(%0) _DOHASH@ib(66,%0)
  1268. #define _HASH@ib_c(%0) _DOHASH@ib(67,%0)
  1269. #define _HASH@ib_d(%0) _DOHASH@ib(68,%0)
  1270. #define _HASH@ib_e(%0) _DOHASH@ib(69,%0)
  1271. #define _HASH@ib_f(%0) _DOHASH@ib(70,%0)
  1272. #define _HASH@ib_g(%0) _DOHASH@ib(71,%0)
  1273. #define _HASH@ib_h(%0) _DOHASH@ib(72,%0)
  1274. #define _HASH@ib_i(%0) _DOHASH@ib(73,%0)
  1275. #define _HASH@ib_j(%0) _DOHASH@ib(74,%0)
  1276. #define _HASH@ib_k(%0) _DOHASH@ib(75,%0)
  1277. #define _HASH@ib_l(%0) _DOHASH@ib(76,%0)
  1278. #define _HASH@ib_m(%0) _DOHASH@ib(77,%0)
  1279. #define _HASH@ib_n(%0) _DOHASH@ib(78,%0)
  1280. #define _HASH@ib_o(%0) _DOHASH@ib(79,%0)
  1281. #define _HASH@ib_p(%0) _DOHASH@ib(80,%0)
  1282. #define _HASH@ib_q(%0) _DOHASH@ib(81,%0)
  1283. #define _HASH@ib_r(%0) _DOHASH@ib(82,%0)
  1284. #define _HASH@ib_s(%0) _DOHASH@ib(83,%0)
  1285. #define _HASH@ib_t(%0) _DOHASH@ib(84,%0)
  1286. #define _HASH@ib_u(%0) _DOHASH@ib(85,%0)
  1287. #define _HASH@ib_v(%0) _DOHASH@ib(86,%0)
  1288. #define _HASH@ib_w(%0) _DOHASH@ib(87,%0)
  1289. #define _HASH@ib_x(%0) _DOHASH@ib(88,%0)
  1290. #define _HASH@ib_y(%0) _DOHASH@ib(89,%0)
  1291. #define _HASH@ib_z(%0) _DOHASH@ib(90,%0)
  1292. // String end.
  1293. #define _HASH@ib_@(%0) -1
  1294. // ===========
  1295. // FNV1 hash
  1296. // ===========
  1297. // Signify the end with two "@" symbols.
  1298. #define HASHi@fnv1(%0) _REHASH@if(%0,@,@)
  1299. // Internal call.
  1300. #define _REHASH@if(%0,%1) _HASH@if_%0(%1)
  1301. // The bit that actually does the work.
  1302. #define _DOHASH@if(%0,%1,%2) (_HASH@if_%1(%2)*16777619^%0)
  1303. // Space.
  1304. #define _HASH@if_(%0) _DOHASH@if(32,%0)
  1305. // Numbers.
  1306. #define _HASH@if_0(%0) _DOHASH@if(48,%0)
  1307. #define _HASH@if_1(%0) _DOHASH@if(49,%0)
  1308. #define _HASH@if_2(%0) _DOHASH@if(50,%0)
  1309. #define _HASH@if_3(%0) _DOHASH@if(51,%0)
  1310. #define _HASH@if_4(%0) _DOHASH@if(52,%0)
  1311. #define _HASH@if_5(%0) _DOHASH@if(53,%0)
  1312. #define _HASH@if_6(%0) _DOHASH@if(54,%0)
  1313. #define _HASH@if_7(%0) _DOHASH@if(55,%0)
  1314. #define _HASH@if_8(%0) _DOHASH@if(56,%0)
  1315. #define _HASH@if_9(%0) _DOHASH@if(57,%0)
  1316. // Upper case letters.
  1317. #define _HASH@if_A(%0) _DOHASH@if(65,%0)
  1318. #define _HASH@if_B(%0) _DOHASH@if(66,%0)
  1319. #define _HASH@if_C(%0) _DOHASH@if(67,%0)
  1320. #define _HASH@if_D(%0) _DOHASH@if(68,%0)
  1321. #define _HASH@if_E(%0) _DOHASH@if(69,%0)
  1322. #define _HASH@if_F(%0) _DOHASH@if(70,%0)
  1323. #define _HASH@if_G(%0) _DOHASH@if(71,%0)
  1324. #define _HASH@if_H(%0) _DOHASH@if(72,%0)
  1325. #define _HASH@if_I(%0) _DOHASH@if(73,%0)
  1326. #define _HASH@if_J(%0) _DOHASH@if(74,%0)
  1327. #define _HASH@if_K(%0) _DOHASH@if(75,%0)
  1328. #define _HASH@if_L(%0) _DOHASH@if(76,%0)
  1329. #define _HASH@if_M(%0) _DOHASH@if(77,%0)
  1330. #define _HASH@if_N(%0) _DOHASH@if(78,%0)
  1331. #define _HASH@if_O(%0) _DOHASH@if(79,%0)
  1332. #define _HASH@if_P(%0) _DOHASH@if(80,%0)
  1333. #define _HASH@if_Q(%0) _DOHASH@if(81,%0)
  1334. #define _HASH@if_R(%0) _DOHASH@if(82,%0)
  1335. #define _HASH@if_S(%0) _DOHASH@if(83,%0)
  1336. #define _HASH@if_T(%0) _DOHASH@if(84,%0)
  1337. #define _HASH@if_U(%0) _DOHASH@if(85,%0)
  1338. #define _HASH@if_V(%0) _DOHASH@if(86,%0)
  1339. #define _HASH@if_W(%0) _DOHASH@if(87,%0)
  1340. #define _HASH@if_X(%0) _DOHASH@if(88,%0)
  1341. #define _HASH@if_Y(%0) _DOHASH@if(89,%0)
  1342. #define _HASH@if_Z(%0) _DOHASH@if(90,%0)
  1343. // Underscore.
  1344. #define _HASH@if__(%0) _DOHASH@if(95,%0)
  1345. // Lower case letters.
  1346. #define _HASH@if_a(%0) _DOHASH@if(65,%0)
  1347. #define _HASH@if_b(%0) _DOHASH@if(66,%0)
  1348. #define _HASH@if_c(%0) _DOHASH@if(67,%0)
  1349. #define _HASH@if_d(%0) _DOHASH@if(68,%0)
  1350. #define _HASH@if_e(%0) _DOHASH@if(69,%0)
  1351. #define _HASH@if_f(%0) _DOHASH@if(70,%0)
  1352. #define _HASH@if_g(%0) _DOHASH@if(71,%0)
  1353. #define _HASH@if_h(%0) _DOHASH@if(72,%0)
  1354. #define _HASH@if_i(%0) _DOHASH@if(73,%0)
  1355. #define _HASH@if_j(%0) _DOHASH@if(74,%0)
  1356. #define _HASH@if_k(%0) _DOHASH@if(75,%0)
  1357. #define _HASH@if_l(%0) _DOHASH@if(76,%0)
  1358. #define _HASH@if_m(%0) _DOHASH@if(77,%0)
  1359. #define _HASH@if_n(%0) _DOHASH@if(78,%0)
  1360. #define _HASH@if_o(%0) _DOHASH@if(79,%0)
  1361. #define _HASH@if_p(%0) _DOHASH@if(80,%0)
  1362. #define _HASH@if_q(%0) _DOHASH@if(81,%0)
  1363. #define _HASH@if_r(%0) _DOHASH@if(82,%0)
  1364. #define _HASH@if_s(%0) _DOHASH@if(83,%0)
  1365. #define _HASH@if_t(%0) _DOHASH@if(84,%0)
  1366. #define _HASH@if_u(%0) _DOHASH@if(85,%0)
  1367. #define _HASH@if_v(%0) _DOHASH@if(86,%0)
  1368. #define _HASH@if_w(%0) _DOHASH@if(87,%0)
  1369. #define _HASH@if_x(%0) _DOHASH@if(88,%0)
  1370. #define _HASH@if_y(%0) _DOHASH@if(89,%0)
  1371. #define _HASH@if_z(%0) _DOHASH@if(90,%0)
  1372. // String end.
  1373. #define _HASH@if_@(%0) 2166136261
  1374. // ============
  1375. // FNV1a hash
  1376. // ============
  1377. // Signify the end with two "@" symbols.
  1378. #define HASHi@fnv1a(%0) _REHASH@ia(%0,@,@)
  1379. // Internal call.
  1380. #define _REHASH@ia(%0,%1) _HASH@ia_%0(%1)
  1381. // The bit that actually does the work.
  1382. #define _DOHASH@ia(%0,%1,%2) ((_HASH@ia_%1(%2)^%0)*16777619)
  1383. // Space.
  1384. #define _HASH@ia_(%0) _DOHASH@ia(32,%0)
  1385. // Numbers.
  1386. #define _HASH@ia_0(%0) _DOHASH@ia(48,%0)
  1387. #define _HASH@ia_1(%0) _DOHASH@ia(49,%0)
  1388. #define _HASH@ia_2(%0) _DOHASH@ia(50,%0)
  1389. #define _HASH@ia_3(%0) _DOHASH@ia(51,%0)
  1390. #define _HASH@ia_4(%0) _DOHASH@ia(52,%0)
  1391. #define _HASH@ia_5(%0) _DOHASH@ia(53,%0)
  1392. #define _HASH@ia_6(%0) _DOHASH@ia(54,%0)
  1393. #define _HASH@ia_7(%0) _DOHASH@ia(55,%0)
  1394. #define _HASH@ia_8(%0) _DOHASH@ia(56,%0)
  1395. #define _HASH@ia_9(%0) _DOHASH@ia(57,%0)
  1396. // Upper case letters.
  1397. #define _HASH@ia_A(%0) _DOHASH@ia(65,%0)
  1398. #define _HASH@ia_B(%0) _DOHASH@ia(66,%0)
  1399. #define _HASH@ia_C(%0) _DOHASH@ia(67,%0)
  1400. #define _HASH@ia_D(%0) _DOHASH@ia(68,%0)
  1401. #define _HASH@ia_E(%0) _DOHASH@ia(69,%0)
  1402. #define _HASH@ia_F(%0) _DOHASH@ia(70,%0)
  1403. #define _HASH@ia_G(%0) _DOHASH@ia(71,%0)
  1404. #define _HASH@ia_H(%0) _DOHASH@ia(72,%0)
  1405. #define _HASH@ia_I(%0) _DOHASH@ia(73,%0)
  1406. #define _HASH@ia_J(%0) _DOHASH@ia(74,%0)
  1407. #define _HASH@ia_K(%0) _DOHASH@ia(75,%0)
  1408. #define _HASH@ia_L(%0) _DOHASH@ia(76,%0)
  1409. #define _HASH@ia_M(%0) _DOHASH@ia(77,%0)
  1410. #define _HASH@ia_N(%0) _DOHASH@ia(78,%0)
  1411. #define _HASH@ia_O(%0) _DOHASH@ia(79,%0)
  1412. #define _HASH@ia_P(%0) _DOHASH@ia(80,%0)
  1413. #define _HASH@ia_Q(%0) _DOHASH@ia(81,%0)
  1414. #define _HASH@ia_R(%0) _DOHASH@ia(82,%0)
  1415. #define _HASH@ia_S(%0) _DOHASH@ia(83,%0)
  1416. #define _HASH@ia_T(%0) _DOHASH@ia(84,%0)
  1417. #define _HASH@ia_U(%0) _DOHASH@ia(85,%0)
  1418. #define _HASH@ia_V(%0) _DOHASH@ia(86,%0)
  1419. #define _HASH@ia_W(%0) _DOHASH@ia(87,%0)
  1420. #define _HASH@ia_X(%0) _DOHASH@ia(88,%0)
  1421. #define _HASH@ia_Y(%0) _DOHASH@ia(89,%0)
  1422. #define _HASH@ia_Z(%0) _DOHASH@ia(90,%0)
  1423. // Underscore.
  1424. #define _HASH@ia__(%0) _DOHASH@ia(95,%0)
  1425. // Lower case letters.
  1426. #define _HASH@ia_a(%0) _DOHASH@ia(65,%0)
  1427. #define _HASH@ia_b(%0) _DOHASH@ia(66,%0)
  1428. #define _HASH@ia_c(%0) _DOHASH@ia(67,%0)
  1429. #define _HASH@ia_d(%0) _DOHASH@ia(68,%0)
  1430. #define _HASH@ia_e(%0) _DOHASH@ia(69,%0)
  1431. #define _HASH@ia_f(%0) _DOHASH@ia(70,%0)
  1432. #define _HASH@ia_g(%0) _DOHASH@ia(71,%0)
  1433. #define _HASH@ia_h(%0) _DOHASH@ia(72,%0)
  1434. #define _HASH@ia_i(%0) _DOHASH@ia(73,%0)
  1435. #define _HASH@ia_j(%0) _DOHASH@ia(74,%0)
  1436. #define _HASH@ia_k(%0) _DOHASH@ia(75,%0)
  1437. #define _HASH@ia_l(%0) _DOHASH@ia(76,%0)
  1438. #define _HASH@ia_m(%0) _DOHASH@ia(77,%0)
  1439. #define _HASH@ia_n(%0) _DOHASH@ia(78,%0)
  1440. #define _HASH@ia_o(%0) _DOHASH@ia(79,%0)
  1441. #define _HASH@ia_p(%0) _DOHASH@ia(80,%0)
  1442. #define _HASH@ia_q(%0) _DOHASH@ia(81,%0)
  1443. #define _HASH@ia_r(%0) _DOHASH@ia(82,%0)
  1444. #define _HASH@ia_s(%0) _DOHASH@ia(83,%0)
  1445. #define _HASH@ia_t(%0) _DOHASH@ia(84,%0)
  1446. #define _HASH@ia_u(%0) _DOHASH@ia(85,%0)
  1447. #define _HASH@ia_v(%0) _DOHASH@ia(86,%0)
  1448. #define _HASH@ia_w(%0) _DOHASH@ia(87,%0)
  1449. #define _HASH@ia_x(%0) _DOHASH@ia(88,%0)
  1450. #define _HASH@ia_y(%0) _DOHASH@ia(89,%0)
  1451. #define _HASH@ia_z(%0) _DOHASH@ia(90,%0)
  1452. // String end.
  1453. #define _HASH@ia_@(%0) 2166136261
  1454. // ============
  1455. // Other code
  1456. // ============
  1457. enum e_HASH_TYPE
  1458. {
  1459. hash_bernstein,
  1460. hash_fnv1,
  1461. hash_fnv1a
  1462. }
  1463. /**--------------------------------------------------------------------------**\
  1464. <summary>Hash</summary>
  1465. <param name="str">The string to hash.</param>
  1466. <param name="sensitive">Wether the hash is case sensitive or not.</param>
  1467. <returns>
  1468. The reverse Bernstein hash of the string.
  1469. </returns>
  1470. <remarks>
  1471. Based on Bernstein hash, but backwards to match the macros. The only
  1472. characters which can be used in the compile time version of this code are:
  1473. a-z, A-Z, 0-9, _ and space.
  1474. native Hash(str[]);
  1475. </remarks>
  1476. \**--------------------------------------------------------------------------**/
  1477. stock YHash(const str[], bool:sensitive = true, e_HASH_TYPE:type = hash_bernstein, len = -1, pack = false)
  1478. {
  1479. P:3("YHash called: \"%s\", %i, %i, %i, %i", str, _:sensitive, _:type, len, pack);
  1480. pack = str[0] > 255;
  1481. if (len == -1)
  1482. {
  1483. len = strlen(str);
  1484. }
  1485. if (pack)
  1486. {
  1487. switch (type)
  1488. {
  1489. case hash_bernstein:
  1490. {
  1491. new
  1492. hash = -1;
  1493. if (sensitive)
  1494. {
  1495. while (len--)
  1496. {
  1497. hash = hash * 33 + str{len};
  1498. }
  1499. }
  1500. else
  1501. {
  1502. while (len--)
  1503. {
  1504. new
  1505. ch = str{len};
  1506. if ('a' <= ch <= 'z')
  1507. {
  1508. ch &= ~0x20;
  1509. }
  1510. hash = hash * 33 + ch;
  1511. }
  1512. }
  1513. return hash;
  1514. }
  1515. case hash_fnv1:
  1516. {
  1517. new
  1518. hash = 2166136261;
  1519. if (sensitive)
  1520. {
  1521. while (len--)
  1522. {
  1523. hash = hash * 16777619 ^ str{len};
  1524. }
  1525. }
  1526. else
  1527. {
  1528. while (len--)
  1529. {
  1530. new
  1531. ch = str{len};
  1532. if ('a' <= ch <= 'z')
  1533. {
  1534. ch &= ~0x20;
  1535. }
  1536. hash = hash * 16777619 ^ ch;
  1537. }
  1538. }
  1539. return hash;
  1540. }
  1541. case hash_fnv1a:
  1542. {
  1543. new
  1544. hash = 2166136261;
  1545. if (sensitive)
  1546. {
  1547. while (len--)
  1548. {
  1549. hash = (hash ^ str{len}) * 16777619;
  1550. }
  1551. }
  1552. else
  1553. {
  1554. while (len--)
  1555. {
  1556. new
  1557. ch = str{len};
  1558. if ('a' <= ch <= 'z')
  1559. {
  1560. ch &= ~0x20;
  1561. }
  1562. hash = (hash ^ ch) * 16777619;
  1563. }
  1564. }
  1565. return hash;
  1566. }
  1567. }
  1568. }
  1569. else
  1570. {
  1571. switch (type)
  1572. {
  1573. case hash_bernstein:
  1574. {
  1575. new
  1576. hash = -1;
  1577. if (sensitive)
  1578. {
  1579. while (len--)
  1580. {
  1581. hash = hash * 33 + str[len];
  1582. }
  1583. }
  1584. else
  1585. {
  1586. while (len--)
  1587. {
  1588. new
  1589. ch = str[len];
  1590. if ('a' <= ch <= 'z')
  1591. {
  1592. ch &= ~0x20;
  1593. }
  1594. hash = hash * 33 + ch;
  1595. }
  1596. }
  1597. return hash;
  1598. }
  1599. case hash_fnv1:
  1600. {
  1601. new
  1602. hash = 2166136261;
  1603. if (sensitive)
  1604. {
  1605. while (len--)
  1606. {
  1607. hash = hash * 16777619 ^ str[len];
  1608. }
  1609. }
  1610. else
  1611. {
  1612. while (len--)
  1613. {
  1614. new
  1615. ch = str[len];
  1616. if ('a' <= ch <= 'z')
  1617. {
  1618. ch &= ~0x20;
  1619. }
  1620. hash = hash * 16777619 ^ ch;
  1621. }
  1622. }
  1623. return hash;
  1624. }
  1625. case hash_fnv1a:
  1626. {
  1627. new
  1628. hash = 2166136261;
  1629. if (sensitive)
  1630. {
  1631. while (len--)
  1632. {
  1633. hash = (hash ^ str[len]) * 16777619;
  1634. }
  1635. }
  1636. else
  1637. {
  1638. while (len--)
  1639. {
  1640. new
  1641. ch = str[len];
  1642. if ('a' <= ch <= 'z')
  1643. {
  1644. ch &= ~0x20;
  1645. }
  1646. hash = (hash ^ ch) * 16777619;
  1647. }
  1648. }
  1649. return hash;
  1650. }
  1651. }
  1652. }
  1653. return -1;
  1654. }