minilzo.c 209 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366
  1. /* minilzo.c -- mini subset of the LZO real-time data compression library
  2. This file is part of the LZO real-time data compression library.
  3. Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
  4. All Rights Reserved.
  5. The LZO library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of
  8. the License, or (at your option) any later version.
  9. The LZO library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with the LZO library; see the file COPYING.
  15. If not, write to the Free Software Foundation, Inc.,
  16. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. Markus F.X.J. Oberhumer
  18. <markus@oberhumer.com>
  19. http://www.oberhumer.com/opensource/lzo/
  20. */
  21. /*
  22. * NOTE:
  23. * the full LZO package can be found at
  24. * http://www.oberhumer.com/opensource/lzo/
  25. */
  26. #define __LZO_IN_MINILZO 1
  27. #if defined(LZO_CFG_FREESTANDING)
  28. # undef MINILZO_HAVE_CONFIG_H
  29. # define LZO_LIBC_FREESTANDING 1
  30. # define LZO_OS_FREESTANDING 1
  31. #endif
  32. #ifdef MINILZO_HAVE_CONFIG_H
  33. # include <config.h>
  34. #endif
  35. #include <limits.h>
  36. #include <stddef.h>
  37. #if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS)
  38. #ifndef __LZODEFS_H_INCLUDED
  39. #define __LZODEFS_H_INCLUDED 1
  40. #if defined(__CYGWIN32__) && !defined(__CYGWIN__)
  41. # define __CYGWIN__ __CYGWIN32__
  42. #endif
  43. #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE)
  44. # define _ALL_SOURCE 1
  45. #endif
  46. #if defined(__mips__) && defined(__R5900__)
  47. # if !defined(__LONG_MAX__)
  48. # define __LONG_MAX__ 9223372036854775807L
  49. # endif
  50. #endif
  51. #if 0
  52. #elif !defined(__LZO_LANG_OVERRIDE)
  53. #if (defined(__clang__) || defined(__GNUC__)) && defined(__ASSEMBLER__)
  54. # if (__ASSEMBLER__+0) <= 0
  55. # error "__ASSEMBLER__"
  56. # else
  57. # define LZO_LANG_ASSEMBLER 1
  58. # endif
  59. #elif defined(__cplusplus)
  60. # if (__cplusplus+0) <= 0
  61. # error "__cplusplus"
  62. # elif (__cplusplus < 199711L)
  63. # define LZO_LANG_CXX 1
  64. # elif defined(_MSC_VER) && defined(_MSVC_LANG) && (_MSVC_LANG+0 >= 201402L) && 1
  65. # define LZO_LANG_CXX _MSVC_LANG
  66. # else
  67. # define LZO_LANG_CXX __cplusplus
  68. # endif
  69. # define LZO_LANG_CPLUSPLUS LZO_LANG_CXX
  70. #else
  71. # if defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199409L)
  72. # define LZO_LANG_C __STDC_VERSION__
  73. # else
  74. # define LZO_LANG_C 1
  75. # endif
  76. #endif
  77. #endif
  78. #if !defined(LZO_CFG_NO_DISABLE_WUNDEF)
  79. #if defined(__ARMCC_VERSION)
  80. # pragma diag_suppress 193
  81. #elif defined(__clang__) && defined(__clang_minor__)
  82. # pragma clang diagnostic ignored "-Wundef"
  83. #elif defined(__INTEL_COMPILER)
  84. # pragma warning(disable: 193)
  85. #elif defined(__KEIL__) && defined(__C166__)
  86. # pragma warning disable = 322
  87. #elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__)
  88. # if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2))
  89. # pragma GCC diagnostic ignored "-Wundef"
  90. # endif
  91. #elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__)
  92. # if ((_MSC_VER-0) >= 1300)
  93. # pragma warning(disable: 4668)
  94. # endif
  95. #endif
  96. #endif
  97. #if 0 && defined(__POCC__) && defined(_WIN32)
  98. # if (__POCC__ >= 400)
  99. # pragma warn(disable: 2216)
  100. # endif
  101. #endif
  102. #if 0 && defined(__WATCOMC__)
  103. # if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060)
  104. # pragma warning 203 9
  105. # endif
  106. #endif
  107. #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__)
  108. # pragma option -h
  109. #endif
  110. #if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC)
  111. #ifndef _CRT_NONSTDC_NO_DEPRECATE
  112. #define _CRT_NONSTDC_NO_DEPRECATE 1
  113. #endif
  114. #ifndef _CRT_NONSTDC_NO_WARNINGS
  115. #define _CRT_NONSTDC_NO_WARNINGS 1
  116. #endif
  117. #ifndef _CRT_SECURE_NO_DEPRECATE
  118. #define _CRT_SECURE_NO_DEPRECATE 1
  119. #endif
  120. #ifndef _CRT_SECURE_NO_WARNINGS
  121. #define _CRT_SECURE_NO_WARNINGS 1
  122. #endif
  123. #endif
  124. #if 0
  125. #define LZO_0xffffUL 0xfffful
  126. #define LZO_0xffffffffUL 0xfffffffful
  127. #else
  128. #define LZO_0xffffUL 65535ul
  129. #define LZO_0xffffffffUL 4294967295ul
  130. #endif
  131. #define LZO_0xffffL LZO_0xffffUL
  132. #define LZO_0xffffffffL LZO_0xffffffffUL
  133. #if (LZO_0xffffL == LZO_0xffffffffL)
  134. # error "your preprocessor is broken 1"
  135. #endif
  136. #if (16ul * 16384ul != 262144ul)
  137. # error "your preprocessor is broken 2"
  138. #endif
  139. #if 0
  140. #if (32767 >= 4294967295ul)
  141. # error "your preprocessor is broken 3"
  142. #endif
  143. #if (65535u >= 4294967295ul)
  144. # error "your preprocessor is broken 4"
  145. #endif
  146. #endif
  147. #if defined(__COUNTER__)
  148. # ifndef LZO_CFG_USE_COUNTER
  149. # define LZO_CFG_USE_COUNTER 1
  150. # endif
  151. #else
  152. # undef LZO_CFG_USE_COUNTER
  153. #endif
  154. #if (UINT_MAX == LZO_0xffffL)
  155. #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__)
  156. # if !defined(MSDOS)
  157. # define MSDOS 1
  158. # endif
  159. # if !defined(_MSDOS)
  160. # define _MSDOS 1
  161. # endif
  162. #elif 0 && defined(__VERSION) && defined(MB_LEN_MAX)
  163. # if (__VERSION == 520) && (MB_LEN_MAX == 1)
  164. # if !defined(__AZTEC_C__)
  165. # define __AZTEC_C__ __VERSION
  166. # endif
  167. # if !defined(__DOS__)
  168. # define __DOS__ 1
  169. # endif
  170. # endif
  171. #endif
  172. #endif
  173. #if (UINT_MAX == LZO_0xffffL)
  174. #if defined(_MSC_VER) && defined(M_I86HM)
  175. # define ptrdiff_t long
  176. # define _PTRDIFF_T_DEFINED 1
  177. #endif
  178. #endif
  179. #if (UINT_MAX == LZO_0xffffL)
  180. # undef __LZO_RENAME_A
  181. # undef __LZO_RENAME_B
  182. # if defined(__AZTEC_C__) && defined(__DOS__)
  183. # define __LZO_RENAME_A 1
  184. # elif defined(_MSC_VER) && defined(MSDOS)
  185. # if (_MSC_VER < 600)
  186. # define __LZO_RENAME_A 1
  187. # elif (_MSC_VER < 700)
  188. # define __LZO_RENAME_B 1
  189. # endif
  190. # elif defined(__TSC__) && defined(__OS2__)
  191. # define __LZO_RENAME_A 1
  192. # elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410)
  193. # define __LZO_RENAME_A 1
  194. # elif defined(__PACIFIC__) && defined(DOS)
  195. # if !defined(__far)
  196. # define __far far
  197. # endif
  198. # if !defined(__near)
  199. # define __near near
  200. # endif
  201. # endif
  202. # if defined(__LZO_RENAME_A)
  203. # if !defined(__cdecl)
  204. # define __cdecl cdecl
  205. # endif
  206. # if !defined(__far)
  207. # define __far far
  208. # endif
  209. # if !defined(__huge)
  210. # define __huge huge
  211. # endif
  212. # if !defined(__near)
  213. # define __near near
  214. # endif
  215. # if !defined(__pascal)
  216. # define __pascal pascal
  217. # endif
  218. # if !defined(__huge)
  219. # define __huge huge
  220. # endif
  221. # elif defined(__LZO_RENAME_B)
  222. # if !defined(__cdecl)
  223. # define __cdecl _cdecl
  224. # endif
  225. # if !defined(__far)
  226. # define __far _far
  227. # endif
  228. # if !defined(__huge)
  229. # define __huge _huge
  230. # endif
  231. # if !defined(__near)
  232. # define __near _near
  233. # endif
  234. # if !defined(__pascal)
  235. # define __pascal _pascal
  236. # endif
  237. # elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
  238. # if !defined(__cdecl)
  239. # define __cdecl cdecl
  240. # endif
  241. # if !defined(__pascal)
  242. # define __pascal pascal
  243. # endif
  244. # endif
  245. # undef __LZO_RENAME_A
  246. # undef __LZO_RENAME_B
  247. #endif
  248. #if (UINT_MAX == LZO_0xffffL)
  249. #if defined(__AZTEC_C__) && defined(__DOS__)
  250. # define LZO_BROKEN_CDECL_ALT_SYNTAX 1
  251. #elif defined(_MSC_VER) && defined(MSDOS)
  252. # if (_MSC_VER < 600)
  253. # define LZO_BROKEN_INTEGRAL_CONSTANTS 1
  254. # endif
  255. # if (_MSC_VER < 700)
  256. # define LZO_BROKEN_INTEGRAL_PROMOTION 1
  257. # define LZO_BROKEN_SIZEOF 1
  258. # endif
  259. #elif defined(__PACIFIC__) && defined(DOS)
  260. # define LZO_BROKEN_INTEGRAL_CONSTANTS 1
  261. #elif defined(__TURBOC__) && defined(__MSDOS__)
  262. # if (__TURBOC__ < 0x0150)
  263. # define LZO_BROKEN_CDECL_ALT_SYNTAX 1
  264. # define LZO_BROKEN_INTEGRAL_CONSTANTS 1
  265. # define LZO_BROKEN_INTEGRAL_PROMOTION 1
  266. # endif
  267. # if (__TURBOC__ < 0x0200)
  268. # define LZO_BROKEN_SIZEOF 1
  269. # endif
  270. # if (__TURBOC__ < 0x0400) && defined(__cplusplus)
  271. # define LZO_BROKEN_CDECL_ALT_SYNTAX 1
  272. # endif
  273. #elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
  274. # define LZO_BROKEN_CDECL_ALT_SYNTAX 1
  275. # define LZO_BROKEN_SIZEOF 1
  276. #endif
  277. #endif
  278. #if defined(__WATCOMC__) && (__WATCOMC__ < 900)
  279. # define LZO_BROKEN_INTEGRAL_CONSTANTS 1
  280. #endif
  281. #if defined(_CRAY) && defined(_CRAY1)
  282. # define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1
  283. #endif
  284. #define LZO_PP_STRINGIZE(x) #x
  285. #define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x)
  286. #define LZO_PP_CONCAT0() /*empty*/
  287. #define LZO_PP_CONCAT1(a) a
  288. #define LZO_PP_CONCAT2(a,b) a ## b
  289. #define LZO_PP_CONCAT3(a,b,c) a ## b ## c
  290. #define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d
  291. #define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e
  292. #define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f
  293. #define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g
  294. #define LZO_PP_ECONCAT0() LZO_PP_CONCAT0()
  295. #define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a)
  296. #define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b)
  297. #define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c)
  298. #define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d)
  299. #define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e)
  300. #define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f)
  301. #define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g)
  302. #define LZO_PP_EMPTY /*empty*/
  303. #define LZO_PP_EMPTY0() /*empty*/
  304. #define LZO_PP_EMPTY1(a) /*empty*/
  305. #define LZO_PP_EMPTY2(a,b) /*empty*/
  306. #define LZO_PP_EMPTY3(a,b,c) /*empty*/
  307. #define LZO_PP_EMPTY4(a,b,c,d) /*empty*/
  308. #define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/
  309. #define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/
  310. #define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/
  311. #if 1
  312. #define LZO_CPP_STRINGIZE(x) #x
  313. #define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x)
  314. #define LZO_CPP_CONCAT2(a,b) a ## b
  315. #define LZO_CPP_CONCAT3(a,b,c) a ## b ## c
  316. #define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d
  317. #define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e
  318. #define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f
  319. #define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g
  320. #define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b)
  321. #define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c)
  322. #define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d)
  323. #define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e)
  324. #define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f)
  325. #define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g)
  326. #endif
  327. #define __LZO_MASK_GEN(o,b) (((((o) << ((b)-((b)!=0))) - (o)) << 1) + (o)*((b)!=0))
  328. #if 1 && defined(__cplusplus)
  329. # if !defined(__STDC_CONSTANT_MACROS)
  330. # define __STDC_CONSTANT_MACROS 1
  331. # endif
  332. # if !defined(__STDC_LIMIT_MACROS)
  333. # define __STDC_LIMIT_MACROS 1
  334. # endif
  335. #endif
  336. #if defined(__cplusplus)
  337. # define LZO_EXTERN_C extern "C"
  338. # define LZO_EXTERN_C_BEGIN extern "C" {
  339. # define LZO_EXTERN_C_END }
  340. #else
  341. # define LZO_EXTERN_C extern
  342. # define LZO_EXTERN_C_BEGIN /*empty*/
  343. # define LZO_EXTERN_C_END /*empty*/
  344. #endif
  345. #if !defined(__LZO_OS_OVERRIDE)
  346. #if (LZO_OS_FREESTANDING)
  347. # define LZO_INFO_OS "freestanding"
  348. #elif (LZO_OS_EMBEDDED)
  349. # define LZO_INFO_OS "embedded"
  350. #elif 1 && defined(__IAR_SYSTEMS_ICC__)
  351. # define LZO_OS_EMBEDDED 1
  352. # define LZO_INFO_OS "embedded"
  353. #elif defined(__CYGWIN__) && defined(__GNUC__)
  354. # define LZO_OS_CYGWIN 1
  355. # define LZO_INFO_OS "cygwin"
  356. #elif defined(__EMX__) && defined(__GNUC__)
  357. # define LZO_OS_EMX 1
  358. # define LZO_INFO_OS "emx"
  359. #elif defined(__BEOS__)
  360. # define LZO_OS_BEOS 1
  361. # define LZO_INFO_OS "beos"
  362. #elif defined(__Lynx__)
  363. # define LZO_OS_LYNXOS 1
  364. # define LZO_INFO_OS "lynxos"
  365. #elif defined(__OS400__)
  366. # define LZO_OS_OS400 1
  367. # define LZO_INFO_OS "os400"
  368. #elif defined(__QNX__)
  369. # define LZO_OS_QNX 1
  370. # define LZO_INFO_OS "qnx"
  371. #elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460)
  372. # define LZO_OS_DOS32 1
  373. # define LZO_INFO_OS "dos32"
  374. #elif defined(__BORLANDC__) && defined(__DPMI16__)
  375. # define LZO_OS_DOS16 1
  376. # define LZO_INFO_OS "dos16"
  377. #elif defined(__ZTC__) && defined(DOS386)
  378. # define LZO_OS_DOS32 1
  379. # define LZO_INFO_OS "dos32"
  380. #elif defined(__OS2__) || defined(__OS2V2__)
  381. # if (UINT_MAX == LZO_0xffffL)
  382. # define LZO_OS_OS216 1
  383. # define LZO_INFO_OS "os216"
  384. # elif (UINT_MAX == LZO_0xffffffffL)
  385. # define LZO_OS_OS2 1
  386. # define LZO_INFO_OS "os2"
  387. # else
  388. # error "check your limits.h header"
  389. # endif
  390. #elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64)
  391. # define LZO_OS_WIN64 1
  392. # define LZO_INFO_OS "win64"
  393. #elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__)
  394. # define LZO_OS_WIN32 1
  395. # define LZO_INFO_OS "win32"
  396. #elif defined(__MWERKS__) && defined(__INTEL__)
  397. # define LZO_OS_WIN32 1
  398. # define LZO_INFO_OS "win32"
  399. #elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
  400. # if (UINT_MAX == LZO_0xffffL)
  401. # define LZO_OS_WIN16 1
  402. # define LZO_INFO_OS "win16"
  403. # elif (UINT_MAX == LZO_0xffffffffL)
  404. # define LZO_OS_WIN32 1
  405. # define LZO_INFO_OS "win32"
  406. # else
  407. # error "check your limits.h header"
  408. # endif
  409. #elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS))
  410. # if (UINT_MAX == LZO_0xffffL)
  411. # define LZO_OS_DOS16 1
  412. # define LZO_INFO_OS "dos16"
  413. # elif (UINT_MAX == LZO_0xffffffffL)
  414. # define LZO_OS_DOS32 1
  415. # define LZO_INFO_OS "dos32"
  416. # else
  417. # error "check your limits.h header"
  418. # endif
  419. #elif defined(__WATCOMC__)
  420. # if defined(__NT__) && (UINT_MAX == LZO_0xffffL)
  421. # define LZO_OS_DOS16 1
  422. # define LZO_INFO_OS "dos16"
  423. # elif defined(__NT__) && (__WATCOMC__ < 1100)
  424. # define LZO_OS_WIN32 1
  425. # define LZO_INFO_OS "win32"
  426. # elif defined(__linux__) || defined(__LINUX__)
  427. # define LZO_OS_POSIX 1
  428. # define LZO_INFO_OS "posix"
  429. # else
  430. # error "please specify a target using the -bt compiler option"
  431. # endif
  432. #elif defined(__palmos__)
  433. # define LZO_OS_PALMOS 1
  434. # define LZO_INFO_OS "palmos"
  435. #elif defined(__TOS__) || defined(__atarist__)
  436. # define LZO_OS_TOS 1
  437. # define LZO_INFO_OS "tos"
  438. #elif defined(macintosh) && !defined(__arm__) && !defined(__i386__) && !defined(__ppc__) && !defined(__x64_64__)
  439. # define LZO_OS_MACCLASSIC 1
  440. # define LZO_INFO_OS "macclassic"
  441. #elif defined(__VMS)
  442. # define LZO_OS_VMS 1
  443. # define LZO_INFO_OS "vms"
  444. #elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)
  445. # define LZO_OS_CONSOLE 1
  446. # define LZO_OS_CONSOLE_PS2 1
  447. # define LZO_INFO_OS "console"
  448. # define LZO_INFO_OS_CONSOLE "ps2"
  449. #elif defined(__mips__) && defined(__psp__)
  450. # define LZO_OS_CONSOLE 1
  451. # define LZO_OS_CONSOLE_PSP 1
  452. # define LZO_INFO_OS "console"
  453. # define LZO_INFO_OS_CONSOLE "psp"
  454. #else
  455. # define LZO_OS_POSIX 1
  456. # define LZO_INFO_OS "posix"
  457. #endif
  458. #if (LZO_OS_POSIX)
  459. # if defined(_AIX) || defined(__AIX__) || defined(__aix__)
  460. # define LZO_OS_POSIX_AIX 1
  461. # define LZO_INFO_OS_POSIX "aix"
  462. # elif defined(__FreeBSD__)
  463. # define LZO_OS_POSIX_FREEBSD 1
  464. # define LZO_INFO_OS_POSIX "freebsd"
  465. # elif defined(__hpux__) || defined(__hpux)
  466. # define LZO_OS_POSIX_HPUX 1
  467. # define LZO_INFO_OS_POSIX "hpux"
  468. # elif defined(__INTERIX)
  469. # define LZO_OS_POSIX_INTERIX 1
  470. # define LZO_INFO_OS_POSIX "interix"
  471. # elif defined(__IRIX__) || defined(__irix__)
  472. # define LZO_OS_POSIX_IRIX 1
  473. # define LZO_INFO_OS_POSIX "irix"
  474. # elif defined(__linux__) || defined(__linux) || defined(__LINUX__)
  475. # define LZO_OS_POSIX_LINUX 1
  476. # define LZO_INFO_OS_POSIX "linux"
  477. # elif defined(__APPLE__) && defined(__MACH__)
  478. # if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000)
  479. # define LZO_OS_POSIX_DARWIN 1040
  480. # define LZO_INFO_OS_POSIX "darwin_iphone"
  481. # elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040)
  482. # define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
  483. # define LZO_INFO_OS_POSIX "darwin"
  484. # else
  485. # define LZO_OS_POSIX_DARWIN 1
  486. # define LZO_INFO_OS_POSIX "darwin"
  487. # endif
  488. # define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN
  489. # elif defined(__minix__) || defined(__minix)
  490. # define LZO_OS_POSIX_MINIX 1
  491. # define LZO_INFO_OS_POSIX "minix"
  492. # elif defined(__NetBSD__)
  493. # define LZO_OS_POSIX_NETBSD 1
  494. # define LZO_INFO_OS_POSIX "netbsd"
  495. # elif defined(__OpenBSD__)
  496. # define LZO_OS_POSIX_OPENBSD 1
  497. # define LZO_INFO_OS_POSIX "openbsd"
  498. # elif defined(__osf__)
  499. # define LZO_OS_POSIX_OSF 1
  500. # define LZO_INFO_OS_POSIX "osf"
  501. # elif defined(__solaris__) || defined(__sun)
  502. # if defined(__SVR4) || defined(__svr4__)
  503. # define LZO_OS_POSIX_SOLARIS 1
  504. # define LZO_INFO_OS_POSIX "solaris"
  505. # else
  506. # define LZO_OS_POSIX_SUNOS 1
  507. # define LZO_INFO_OS_POSIX "sunos"
  508. # endif
  509. # elif defined(__ultrix__) || defined(__ultrix)
  510. # define LZO_OS_POSIX_ULTRIX 1
  511. # define LZO_INFO_OS_POSIX "ultrix"
  512. # elif defined(_UNICOS)
  513. # define LZO_OS_POSIX_UNICOS 1
  514. # define LZO_INFO_OS_POSIX "unicos"
  515. # else
  516. # define LZO_OS_POSIX_UNKNOWN 1
  517. # define LZO_INFO_OS_POSIX "unknown"
  518. # endif
  519. #endif
  520. #endif
  521. #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
  522. # if (UINT_MAX != LZO_0xffffL)
  523. # error "unexpected configuration - check your compiler defines"
  524. # endif
  525. # if (ULONG_MAX != LZO_0xffffffffL)
  526. # error "unexpected configuration - check your compiler defines"
  527. # endif
  528. #endif
  529. #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64)
  530. # if (UINT_MAX != LZO_0xffffffffL)
  531. # error "unexpected configuration - check your compiler defines"
  532. # endif
  533. # if (ULONG_MAX != LZO_0xffffffffL)
  534. # error "unexpected configuration - check your compiler defines"
  535. # endif
  536. #endif
  537. #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__)
  538. # define LZO_CC_CILLY 1
  539. # define LZO_INFO_CC "Cilly"
  540. # if defined(__CILLY__)
  541. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__)
  542. # else
  543. # define LZO_INFO_CCVER "unknown"
  544. # endif
  545. #elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__)
  546. # define LZO_CC_SDCC 1
  547. # define LZO_INFO_CC "sdcc"
  548. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC)
  549. #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__)
  550. # define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0))
  551. # define LZO_INFO_CC "Pathscale C"
  552. # define LZO_INFO_CCVER __PATHSCALE__
  553. # if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
  554. # define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  555. # endif
  556. #elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0)
  557. # define LZO_CC_INTELC __INTEL_COMPILER
  558. # define LZO_INFO_CC "Intel C"
  559. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER)
  560. # if defined(_MSC_VER) && ((_MSC_VER-0) > 0)
  561. # define LZO_CC_INTELC_MSC _MSC_VER
  562. # elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
  563. # define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  564. # endif
  565. #elif defined(__POCC__) && defined(_WIN32)
  566. # define LZO_CC_PELLESC 1
  567. # define LZO_INFO_CC "Pelles C"
  568. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__)
  569. #elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
  570. # if defined(__GNUC_PATCHLEVEL__)
  571. # define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  572. # else
  573. # define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100)
  574. # endif
  575. # define LZO_CC_ARMCC __ARMCC_VERSION
  576. # define LZO_INFO_CC "ARM C Compiler"
  577. # define LZO_INFO_CCVER __VERSION__
  578. #elif defined(__clang__) && defined(__c2__) && defined(__c2_version__) && defined(_MSC_VER)
  579. # define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0))
  580. # define LZO_CC_CLANG_C2 _MSC_VER
  581. # define LZO_CC_CLANG_VENDOR_MICROSOFT 1
  582. # define LZO_INFO_CC "clang/c2"
  583. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__c2_version__)
  584. #elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__)
  585. # if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
  586. # define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0))
  587. # else
  588. # define LZO_CC_CLANG 0x010000L
  589. # endif
  590. # if defined(_MSC_VER) && ((_MSC_VER-0) > 0)
  591. # define LZO_CC_CLANG_MSC _MSC_VER
  592. # elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
  593. # define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  594. # endif
  595. # if defined(__APPLE_CC__)
  596. # define LZO_CC_CLANG_VENDOR_APPLE 1
  597. # define LZO_INFO_CC "clang/apple"
  598. # else
  599. # define LZO_CC_CLANG_VENDOR_LLVM 1
  600. # define LZO_INFO_CC "clang"
  601. # endif
  602. # if defined(__clang_version__)
  603. # define LZO_INFO_CCVER __clang_version__
  604. # else
  605. # define LZO_INFO_CCVER __VERSION__
  606. # endif
  607. #elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
  608. # if defined(__GNUC_PATCHLEVEL__)
  609. # define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  610. # else
  611. # define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100)
  612. # endif
  613. # define LZO_CC_LLVM LZO_CC_LLVM_GNUC
  614. # define LZO_INFO_CC "llvm-gcc"
  615. # define LZO_INFO_CCVER __VERSION__
  616. #elif defined(__ACK__) && defined(_ACK)
  617. # define LZO_CC_ACK 1
  618. # define LZO_INFO_CC "Amsterdam Compiler Kit C"
  619. # define LZO_INFO_CCVER "unknown"
  620. #elif defined(__ARMCC_VERSION) && !defined(__GNUC__)
  621. # define LZO_CC_ARMCC __ARMCC_VERSION
  622. # define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION
  623. # define LZO_INFO_CC "ARM C Compiler"
  624. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION)
  625. #elif defined(__AZTEC_C__)
  626. # define LZO_CC_AZTECC 1
  627. # define LZO_INFO_CC "Aztec C"
  628. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__)
  629. #elif defined(__CODEGEARC__)
  630. # define LZO_CC_CODEGEARC 1
  631. # define LZO_INFO_CC "CodeGear C"
  632. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__)
  633. #elif defined(__BORLANDC__)
  634. # define LZO_CC_BORLANDC 1
  635. # define LZO_INFO_CC "Borland C"
  636. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__)
  637. #elif defined(_CRAYC) && defined(_RELEASE)
  638. # define LZO_CC_CRAYC 1
  639. # define LZO_INFO_CC "Cray C"
  640. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE)
  641. #elif defined(__DMC__) && defined(__SC__)
  642. # define LZO_CC_DMC 1
  643. # define LZO_INFO_CC "Digital Mars C"
  644. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__)
  645. #elif defined(__DECC)
  646. # define LZO_CC_DECC 1
  647. # define LZO_INFO_CC "DEC C"
  648. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC)
  649. #elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0)
  650. # define LZO_CC_GHS 1
  651. # define LZO_INFO_CC "Green Hills C"
  652. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER)
  653. # if defined(_MSC_VER) && ((_MSC_VER-0) > 0)
  654. # define LZO_CC_GHS_MSC _MSC_VER
  655. # elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
  656. # define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  657. # endif
  658. #elif defined(__HIGHC__)
  659. # define LZO_CC_HIGHC 1
  660. # define LZO_INFO_CC "MetaWare High C"
  661. # define LZO_INFO_CCVER "unknown"
  662. #elif defined(__HP_aCC) && ((__HP_aCC-0) > 0)
  663. # define LZO_CC_HPACC __HP_aCC
  664. # define LZO_INFO_CC "HP aCC"
  665. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC)
  666. #elif defined(__IAR_SYSTEMS_ICC__)
  667. # define LZO_CC_IARC 1
  668. # define LZO_INFO_CC "IAR C"
  669. # if defined(__VER__)
  670. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__)
  671. # else
  672. # define LZO_INFO_CCVER "unknown"
  673. # endif
  674. #elif defined(__IBMC__) && ((__IBMC__-0) > 0)
  675. # define LZO_CC_IBMC __IBMC__
  676. # define LZO_INFO_CC "IBM C"
  677. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__)
  678. #elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0)
  679. # define LZO_CC_IBMC __IBMCPP__
  680. # define LZO_INFO_CC "IBM C"
  681. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__)
  682. #elif defined(__KEIL__) && defined(__C166__)
  683. # define LZO_CC_KEILC 1
  684. # define LZO_INFO_CC "Keil C"
  685. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__)
  686. #elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL)
  687. # define LZO_CC_LCCWIN32 1
  688. # define LZO_INFO_CC "lcc-win32"
  689. # define LZO_INFO_CCVER "unknown"
  690. #elif defined(__LCC__)
  691. # define LZO_CC_LCC 1
  692. # define LZO_INFO_CC "lcc"
  693. # if defined(__LCC_VERSION__)
  694. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__)
  695. # else
  696. # define LZO_INFO_CCVER "unknown"
  697. # endif
  698. #elif defined(__MWERKS__) && ((__MWERKS__-0) > 0)
  699. # define LZO_CC_MWERKS __MWERKS__
  700. # define LZO_INFO_CC "Metrowerks C"
  701. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__)
  702. #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386)
  703. # define LZO_CC_NDPC 1
  704. # define LZO_INFO_CC "Microway NDP C"
  705. # define LZO_INFO_CCVER "unknown"
  706. #elif defined(__PACIFIC__)
  707. # define LZO_CC_PACIFICC 1
  708. # define LZO_INFO_CC "Pacific C"
  709. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__)
  710. #elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__)
  711. # if defined(__PGIC_PATCHLEVEL__)
  712. # define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0))
  713. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__)
  714. # else
  715. # define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100)
  716. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0"
  717. # endif
  718. # define LZO_INFO_CC "Portland Group PGI C"
  719. #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__))
  720. # define LZO_CC_PGI 1
  721. # define LZO_INFO_CC "Portland Group PGI C"
  722. # define LZO_INFO_CCVER "unknown"
  723. #elif defined(__PUREC__) && defined(__TOS__)
  724. # define LZO_CC_PUREC 1
  725. # define LZO_INFO_CC "Pure C"
  726. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__)
  727. #elif defined(__SC__) && defined(__ZTC__)
  728. # define LZO_CC_SYMANTECC 1
  729. # define LZO_INFO_CC "Symantec C"
  730. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__)
  731. #elif defined(__SUNPRO_C)
  732. # define LZO_INFO_CC "SunPro C"
  733. # if ((__SUNPRO_C-0) > 0)
  734. # define LZO_CC_SUNPROC __SUNPRO_C
  735. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C)
  736. # else
  737. # define LZO_CC_SUNPROC 1
  738. # define LZO_INFO_CCVER "unknown"
  739. # endif
  740. #elif defined(__SUNPRO_CC)
  741. # define LZO_INFO_CC "SunPro C"
  742. # if ((__SUNPRO_CC-0) > 0)
  743. # define LZO_CC_SUNPROC __SUNPRO_CC
  744. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC)
  745. # else
  746. # define LZO_CC_SUNPROC 1
  747. # define LZO_INFO_CCVER "unknown"
  748. # endif
  749. #elif defined(__TINYC__)
  750. # define LZO_CC_TINYC 1
  751. # define LZO_INFO_CC "Tiny C"
  752. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__)
  753. #elif defined(__TSC__)
  754. # define LZO_CC_TOPSPEEDC 1
  755. # define LZO_INFO_CC "TopSpeed C"
  756. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__)
  757. #elif defined(__WATCOMC__)
  758. # define LZO_CC_WATCOMC 1
  759. # define LZO_INFO_CC "Watcom C"
  760. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__)
  761. #elif defined(__TURBOC__)
  762. # define LZO_CC_TURBOC 1
  763. # define LZO_INFO_CC "Turbo C"
  764. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__)
  765. #elif defined(__ZTC__)
  766. # define LZO_CC_ZORTECHC 1
  767. # define LZO_INFO_CC "Zortech C"
  768. # if ((__ZTC__-0) == 0x310)
  769. # define LZO_INFO_CCVER "0x310"
  770. # else
  771. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__)
  772. # endif
  773. #elif defined(__GNUC__) && defined(__VERSION__)
  774. # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
  775. # define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
  776. # elif defined(__GNUC_MINOR__)
  777. # define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100)
  778. # else
  779. # define LZO_CC_GNUC (__GNUC__ * 0x10000L)
  780. # endif
  781. # define LZO_INFO_CC "gcc"
  782. # define LZO_INFO_CCVER __VERSION__
  783. #elif defined(_MSC_VER) && ((_MSC_VER-0) > 0)
  784. # define LZO_CC_MSC _MSC_VER
  785. # define LZO_INFO_CC "Microsoft C"
  786. # if defined(_MSC_FULL_VER)
  787. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER)
  788. # else
  789. # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER)
  790. # endif
  791. #else
  792. # define LZO_CC_UNKNOWN 1
  793. # define LZO_INFO_CC "unknown"
  794. # define LZO_INFO_CCVER "unknown"
  795. #endif
  796. #if (LZO_CC_GNUC) && defined(__OPEN64__)
  797. # if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__)
  798. # define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0))
  799. # define LZO_CC_OPEN64_GNUC LZO_CC_GNUC
  800. # endif
  801. #endif
  802. #if (LZO_CC_GNUC) && defined(__PCC__)
  803. # if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__)
  804. # define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0))
  805. # define LZO_CC_PCC_GNUC LZO_CC_GNUC
  806. # endif
  807. #endif
  808. #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER)
  809. # error "LZO_CC_MSC: _MSC_FULL_VER is not defined"
  810. #endif
  811. #if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY)
  812. # if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY)
  813. # if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E)
  814. # define LZO_ARCH_CRAY_MPP 1
  815. # elif defined(_CRAY1)
  816. # define LZO_ARCH_CRAY_PVP 1
  817. # endif
  818. # endif
  819. #endif
  820. #if !defined(__LZO_ARCH_OVERRIDE)
  821. #if (LZO_ARCH_GENERIC)
  822. # define LZO_INFO_ARCH "generic"
  823. #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
  824. # define LZO_ARCH_I086 1
  825. # define LZO_INFO_ARCH "i086"
  826. #elif defined(__aarch64__) || defined(_M_ARM64)
  827. # define LZO_ARCH_ARM64 1
  828. # define LZO_INFO_ARCH "arm64"
  829. #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
  830. # define LZO_ARCH_ALPHA 1
  831. # define LZO_INFO_ARCH "alpha"
  832. #elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E))
  833. # define LZO_ARCH_ALPHA 1
  834. # define LZO_INFO_ARCH "alpha"
  835. #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
  836. # define LZO_ARCH_AMD64 1
  837. # define LZO_INFO_ARCH "amd64"
  838. #elif defined(__arm__) || defined(_M_ARM)
  839. # define LZO_ARCH_ARM 1
  840. # define LZO_INFO_ARCH "arm"
  841. #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__)
  842. # define LZO_ARCH_ARM 1
  843. # define LZO_INFO_ARCH "arm"
  844. #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__)
  845. # define LZO_ARCH_AVR 1
  846. # define LZO_INFO_ARCH "avr"
  847. #elif defined(__avr32__) || defined(__AVR32__)
  848. # define LZO_ARCH_AVR32 1
  849. # define LZO_INFO_ARCH "avr32"
  850. #elif defined(__bfin__)
  851. # define LZO_ARCH_BLACKFIN 1
  852. # define LZO_INFO_ARCH "blackfin"
  853. #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__)
  854. # define LZO_ARCH_C166 1
  855. # define LZO_INFO_ARCH "c166"
  856. #elif defined(__cris__)
  857. # define LZO_ARCH_CRIS 1
  858. # define LZO_INFO_ARCH "cris"
  859. #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__)
  860. # define LZO_ARCH_EZ80 1
  861. # define LZO_INFO_ARCH "ez80"
  862. #elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
  863. # define LZO_ARCH_H8300 1
  864. # define LZO_INFO_ARCH "h8300"
  865. #elif defined(__hppa__) || defined(__hppa)
  866. # define LZO_ARCH_HPPA 1
  867. # define LZO_INFO_ARCH "hppa"
  868. #elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386)
  869. # define LZO_ARCH_I386 1
  870. # define LZO_ARCH_IA32 1
  871. # define LZO_INFO_ARCH "i386"
  872. #elif (LZO_CC_ZORTECHC && defined(__I86__))
  873. # define LZO_ARCH_I386 1
  874. # define LZO_ARCH_IA32 1
  875. # define LZO_INFO_ARCH "i386"
  876. #elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386)
  877. # define LZO_ARCH_I386 1
  878. # define LZO_ARCH_IA32 1
  879. # define LZO_INFO_ARCH "i386"
  880. #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
  881. # define LZO_ARCH_IA64 1
  882. # define LZO_INFO_ARCH "ia64"
  883. #elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__)
  884. # define LZO_ARCH_M16C 1
  885. # define LZO_INFO_ARCH "m16c"
  886. #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__)
  887. # define LZO_ARCH_M16C 1
  888. # define LZO_INFO_ARCH "m16c"
  889. #elif defined(__m32r__)
  890. # define LZO_ARCH_M32R 1
  891. # define LZO_INFO_ARCH "m32r"
  892. #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K)
  893. # define LZO_ARCH_M68K 1
  894. # define LZO_INFO_ARCH "m68k"
  895. #elif (UINT_MAX == LZO_0xffffL) && defined(__C251__)
  896. # define LZO_ARCH_MCS251 1
  897. # define LZO_INFO_ARCH "mcs251"
  898. #elif (UINT_MAX == LZO_0xffffL) && defined(__C51__)
  899. # define LZO_ARCH_MCS51 1
  900. # define LZO_INFO_ARCH "mcs51"
  901. #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__)
  902. # define LZO_ARCH_MCS51 1
  903. # define LZO_INFO_ARCH "mcs51"
  904. #elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000)
  905. # define LZO_ARCH_MIPS 1
  906. # define LZO_INFO_ARCH "mips"
  907. #elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__)
  908. # define LZO_ARCH_MSP430 1
  909. # define LZO_INFO_ARCH "msp430"
  910. #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__)
  911. # define LZO_ARCH_MSP430 1
  912. # define LZO_INFO_ARCH "msp430"
  913. #elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR)
  914. # define LZO_ARCH_POWERPC 1
  915. # define LZO_INFO_ARCH "powerpc"
  916. #elif defined(__powerpc64__) || defined(__powerpc64) || defined(__ppc64__) || defined(__PPC64__)
  917. # define LZO_ARCH_POWERPC 1
  918. # define LZO_INFO_ARCH "powerpc"
  919. #elif defined(__powerpc64le__) || defined(__powerpc64le) || defined(__ppc64le__) || defined(__PPC64LE__)
  920. # define LZO_ARCH_POWERPC 1
  921. # define LZO_INFO_ARCH "powerpc"
  922. #elif defined(__riscv)
  923. # define LZO_ARCH_RISCV 1
  924. # define LZO_INFO_ARCH "riscv"
  925. #elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x)
  926. # define LZO_ARCH_S390 1
  927. # define LZO_INFO_ARCH "s390"
  928. #elif defined(__sh__) || defined(_M_SH)
  929. # define LZO_ARCH_SH 1
  930. # define LZO_INFO_ARCH "sh"
  931. #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8)
  932. # define LZO_ARCH_SPARC 1
  933. # define LZO_INFO_ARCH "sparc"
  934. #elif defined(__SPU__)
  935. # define LZO_ARCH_SPU 1
  936. # define LZO_INFO_ARCH "spu"
  937. #elif (UINT_MAX == LZO_0xffffL) && defined(__z80)
  938. # define LZO_ARCH_Z80 1
  939. # define LZO_INFO_ARCH "z80"
  940. #elif (LZO_ARCH_CRAY_PVP)
  941. # if defined(_CRAYSV1)
  942. # define LZO_ARCH_CRAY_SV1 1
  943. # define LZO_INFO_ARCH "cray_sv1"
  944. # elif (_ADDR64)
  945. # define LZO_ARCH_CRAY_T90 1
  946. # define LZO_INFO_ARCH "cray_t90"
  947. # elif (_ADDR32)
  948. # define LZO_ARCH_CRAY_YMP 1
  949. # define LZO_INFO_ARCH "cray_ymp"
  950. # else
  951. # define LZO_ARCH_CRAY_XMP 1
  952. # define LZO_INFO_ARCH "cray_xmp"
  953. # endif
  954. #else
  955. # define LZO_ARCH_UNKNOWN 1
  956. # define LZO_INFO_ARCH "unknown"
  957. #endif
  958. #endif
  959. #if !defined(LZO_ARCH_ARM_THUMB2)
  960. #if (LZO_ARCH_ARM)
  961. # if defined(__thumb__) || defined(__thumb) || defined(_M_THUMB)
  962. # if defined(__thumb2__)
  963. # define LZO_ARCH_ARM_THUMB2 1
  964. # elif 1 && defined(__TARGET_ARCH_THUMB) && ((__TARGET_ARCH_THUMB)+0 >= 4)
  965. # define LZO_ARCH_ARM_THUMB2 1
  966. # elif 1 && defined(_MSC_VER) && defined(_M_THUMB) && ((_M_THUMB)+0 >= 7)
  967. # define LZO_ARCH_ARM_THUMB2 1
  968. # endif
  969. # endif
  970. #endif
  971. #endif
  972. #if (LZO_ARCH_ARM_THUMB2)
  973. # undef LZO_INFO_ARCH
  974. # define LZO_INFO_ARCH "arm_thumb2"
  975. #endif
  976. #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2)
  977. # error "FIXME - missing define for CPU architecture"
  978. #endif
  979. #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32)
  980. # error "FIXME - missing LZO_OS_WIN32 define for CPU architecture"
  981. #endif
  982. #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64)
  983. # error "FIXME - missing LZO_OS_WIN64 define for CPU architecture"
  984. #endif
  985. #if (LZO_OS_OS216 || LZO_OS_WIN16)
  986. # define LZO_ARCH_I086PM 1
  987. #elif 1 && (LZO_OS_DOS16 && defined(BLX286))
  988. # define LZO_ARCH_I086PM 1
  989. #elif 1 && (LZO_OS_DOS16 && defined(DOSX286))
  990. # define LZO_ARCH_I086PM 1
  991. #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__))
  992. # define LZO_ARCH_I086PM 1
  993. #endif
  994. #if (LZO_ARCH_AMD64 && !LZO_ARCH_X64)
  995. # define LZO_ARCH_X64 1
  996. #elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE)
  997. # define LZO_ARCH_AMD64 1
  998. #endif
  999. #if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64)
  1000. # define LZO_ARCH_AARCH64 1
  1001. #elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE)
  1002. # define LZO_ARCH_ARM64 1
  1003. #endif
  1004. #if (LZO_ARCH_I386 && !LZO_ARCH_X86)
  1005. # define LZO_ARCH_X86 1
  1006. #elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE)
  1007. # define LZO_ARCH_I386 1
  1008. #endif
  1009. #if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64)
  1010. # error "unexpected configuration - check your compiler defines"
  1011. #endif
  1012. #if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64)
  1013. # error "unexpected configuration - check your compiler defines"
  1014. #endif
  1015. #if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86)
  1016. # error "unexpected configuration - check your compiler defines"
  1017. #endif
  1018. #if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM)
  1019. # error "unexpected configuration - check your compiler defines"
  1020. #endif
  1021. #if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM)
  1022. # error "unexpected configuration - check your compiler defines"
  1023. #endif
  1024. #if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2)
  1025. # error "unexpected configuration - check your compiler defines"
  1026. #endif
  1027. #if (LZO_ARCH_I086PM && !LZO_ARCH_I086)
  1028. # error "unexpected configuration - check your compiler defines"
  1029. #endif
  1030. #if (LZO_ARCH_I086)
  1031. # if (UINT_MAX != LZO_0xffffL)
  1032. # error "unexpected configuration - check your compiler defines"
  1033. # endif
  1034. # if (ULONG_MAX != LZO_0xffffffffL)
  1035. # error "unexpected configuration - check your compiler defines"
  1036. # endif
  1037. #endif
  1038. #if (LZO_ARCH_I386)
  1039. # if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__)
  1040. # error "unexpected configuration - check your compiler defines"
  1041. # endif
  1042. # if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__)
  1043. # error "unexpected configuration - check your compiler defines"
  1044. # endif
  1045. # if (ULONG_MAX != LZO_0xffffffffL)
  1046. # error "unexpected configuration - check your compiler defines"
  1047. # endif
  1048. #endif
  1049. #if (LZO_ARCH_AMD64 || LZO_ARCH_I386)
  1050. # if !defined(LZO_TARGET_FEATURE_SSE2)
  1051. # if defined(__SSE2__)
  1052. # define LZO_TARGET_FEATURE_SSE2 1
  1053. # elif defined(_MSC_VER) && (defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2))
  1054. # define LZO_TARGET_FEATURE_SSE2 1
  1055. # elif (LZO_CC_INTELC_MSC || LZO_CC_MSC) && defined(_M_AMD64)
  1056. # define LZO_TARGET_FEATURE_SSE2 1
  1057. # endif
  1058. # endif
  1059. # if !defined(LZO_TARGET_FEATURE_SSSE3)
  1060. # if (LZO_TARGET_FEATURE_SSE2)
  1061. # if defined(__SSSE3__)
  1062. # define LZO_TARGET_FEATURE_SSSE3 1
  1063. # elif defined(_MSC_VER) && defined(__AVX__)
  1064. # define LZO_TARGET_FEATURE_SSSE3 1
  1065. # endif
  1066. # endif
  1067. # endif
  1068. # if !defined(LZO_TARGET_FEATURE_SSE4_2)
  1069. # if (LZO_TARGET_FEATURE_SSSE3)
  1070. # if defined(__SSE4_2__)
  1071. # define LZO_TARGET_FEATURE_SSE4_2 1
  1072. # endif
  1073. # endif
  1074. # endif
  1075. # if !defined(LZO_TARGET_FEATURE_AVX)
  1076. # if (LZO_TARGET_FEATURE_SSSE3)
  1077. # if defined(__AVX__)
  1078. # define LZO_TARGET_FEATURE_AVX 1
  1079. # endif
  1080. # endif
  1081. # endif
  1082. # if !defined(LZO_TARGET_FEATURE_AVX2)
  1083. # if (LZO_TARGET_FEATURE_AVX)
  1084. # if defined(__AVX2__)
  1085. # define LZO_TARGET_FEATURE_AVX2 1
  1086. # endif
  1087. # endif
  1088. # endif
  1089. #endif
  1090. #if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2))
  1091. # error "unexpected configuration - check your compiler defines"
  1092. #endif
  1093. #if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3))
  1094. # error "unexpected configuration - check your compiler defines"
  1095. #endif
  1096. #if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3))
  1097. # error "unexpected configuration - check your compiler defines"
  1098. #endif
  1099. #if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX))
  1100. # error "unexpected configuration - check your compiler defines"
  1101. #endif
  1102. #if (LZO_ARCH_ARM)
  1103. # if !defined(LZO_TARGET_FEATURE_NEON)
  1104. # if defined(__ARM_NEON) && ((__ARM_NEON)+0)
  1105. # define LZO_TARGET_FEATURE_NEON 1
  1106. # elif 1 && defined(__ARM_NEON__) && ((__ARM_NEON__)+0)
  1107. # define LZO_TARGET_FEATURE_NEON 1
  1108. # elif 1 && defined(__TARGET_FEATURE_NEON) && ((__TARGET_FEATURE_NEON)+0)
  1109. # define LZO_TARGET_FEATURE_NEON 1
  1110. # endif
  1111. # endif
  1112. #elif (LZO_ARCH_ARM64)
  1113. # if !defined(LZO_TARGET_FEATURE_NEON)
  1114. # if 1
  1115. # define LZO_TARGET_FEATURE_NEON 1
  1116. # endif
  1117. # endif
  1118. #endif
  1119. #if 0
  1120. #elif !defined(__LZO_MM_OVERRIDE)
  1121. #if (LZO_ARCH_I086)
  1122. #if (UINT_MAX != LZO_0xffffL)
  1123. # error "unexpected configuration - check your compiler defines"
  1124. #endif
  1125. #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM)
  1126. # define LZO_MM_TINY 1
  1127. #elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM)
  1128. # define LZO_MM_HUGE 1
  1129. #elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL)
  1130. # define LZO_MM_SMALL 1
  1131. #elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM)
  1132. # define LZO_MM_MEDIUM 1
  1133. #elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM)
  1134. # define LZO_MM_COMPACT 1
  1135. #elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL)
  1136. # define LZO_MM_LARGE 1
  1137. #elif (LZO_CC_AZTECC)
  1138. # if defined(_LARGE_CODE) && defined(_LARGE_DATA)
  1139. # define LZO_MM_LARGE 1
  1140. # elif defined(_LARGE_CODE)
  1141. # define LZO_MM_MEDIUM 1
  1142. # elif defined(_LARGE_DATA)
  1143. # define LZO_MM_COMPACT 1
  1144. # else
  1145. # define LZO_MM_SMALL 1
  1146. # endif
  1147. #elif (LZO_CC_ZORTECHC && defined(__VCM__))
  1148. # define LZO_MM_LARGE 1
  1149. #else
  1150. # error "unknown LZO_ARCH_I086 memory model"
  1151. #endif
  1152. #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
  1153. #define LZO_HAVE_MM_HUGE_PTR 1
  1154. #define LZO_HAVE_MM_HUGE_ARRAY 1
  1155. #if (LZO_MM_TINY)
  1156. # undef LZO_HAVE_MM_HUGE_ARRAY
  1157. #endif
  1158. #if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC)
  1159. # undef LZO_HAVE_MM_HUGE_PTR
  1160. # undef LZO_HAVE_MM_HUGE_ARRAY
  1161. #elif (LZO_CC_DMC || LZO_CC_SYMANTECC)
  1162. # undef LZO_HAVE_MM_HUGE_ARRAY
  1163. #elif (LZO_CC_MSC && defined(_QC))
  1164. # undef LZO_HAVE_MM_HUGE_ARRAY
  1165. # if (_MSC_VER < 600)
  1166. # undef LZO_HAVE_MM_HUGE_PTR
  1167. # endif
  1168. #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295))
  1169. # undef LZO_HAVE_MM_HUGE_ARRAY
  1170. #endif
  1171. #if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR)
  1172. # if (LZO_OS_DOS16)
  1173. # error "unexpected configuration - check your compiler defines"
  1174. # elif (LZO_CC_ZORTECHC)
  1175. # else
  1176. # error "unexpected configuration - check your compiler defines"
  1177. # endif
  1178. #endif
  1179. #if defined(__cplusplus)
  1180. extern "C" {
  1181. #endif
  1182. #if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200))
  1183. extern void __near __cdecl _AHSHIFT(void);
  1184. # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
  1185. #elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
  1186. extern void __near __cdecl _AHSHIFT(void);
  1187. # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
  1188. #elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC)
  1189. extern void __near __cdecl _AHSHIFT(void);
  1190. # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
  1191. #elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295))
  1192. extern void __near __cdecl _AHSHIFT(void);
  1193. # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
  1194. #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16)
  1195. # define LZO_MM_AHSHIFT 12
  1196. #elif (LZO_CC_WATCOMC)
  1197. extern unsigned char _HShift;
  1198. # define LZO_MM_AHSHIFT ((unsigned) _HShift)
  1199. #else
  1200. # error "FIXME - implement LZO_MM_AHSHIFT"
  1201. #endif
  1202. #if defined(__cplusplus)
  1203. }
  1204. #endif
  1205. #endif
  1206. #elif (LZO_ARCH_C166)
  1207. #if !defined(__MODEL__)
  1208. # error "FIXME - LZO_ARCH_C166 __MODEL__"
  1209. #elif ((__MODEL__) == 0)
  1210. # define LZO_MM_SMALL 1
  1211. #elif ((__MODEL__) == 1)
  1212. # define LZO_MM_SMALL 1
  1213. #elif ((__MODEL__) == 2)
  1214. # define LZO_MM_LARGE 1
  1215. #elif ((__MODEL__) == 3)
  1216. # define LZO_MM_TINY 1
  1217. #elif ((__MODEL__) == 4)
  1218. # define LZO_MM_XTINY 1
  1219. #elif ((__MODEL__) == 5)
  1220. # define LZO_MM_XSMALL 1
  1221. #else
  1222. # error "FIXME - LZO_ARCH_C166 __MODEL__"
  1223. #endif
  1224. #elif (LZO_ARCH_MCS251)
  1225. #if !defined(__MODEL__)
  1226. # error "FIXME - LZO_ARCH_MCS251 __MODEL__"
  1227. #elif ((__MODEL__) == 0)
  1228. # define LZO_MM_SMALL 1
  1229. #elif ((__MODEL__) == 2)
  1230. # define LZO_MM_LARGE 1
  1231. #elif ((__MODEL__) == 3)
  1232. # define LZO_MM_TINY 1
  1233. #elif ((__MODEL__) == 4)
  1234. # define LZO_MM_XTINY 1
  1235. #elif ((__MODEL__) == 5)
  1236. # define LZO_MM_XSMALL 1
  1237. #else
  1238. # error "FIXME - LZO_ARCH_MCS251 __MODEL__"
  1239. #endif
  1240. #elif (LZO_ARCH_MCS51)
  1241. #if !defined(__MODEL__)
  1242. # error "FIXME - LZO_ARCH_MCS51 __MODEL__"
  1243. #elif ((__MODEL__) == 1)
  1244. # define LZO_MM_SMALL 1
  1245. #elif ((__MODEL__) == 2)
  1246. # define LZO_MM_LARGE 1
  1247. #elif ((__MODEL__) == 3)
  1248. # define LZO_MM_TINY 1
  1249. #elif ((__MODEL__) == 4)
  1250. # define LZO_MM_XTINY 1
  1251. #elif ((__MODEL__) == 5)
  1252. # define LZO_MM_XSMALL 1
  1253. #else
  1254. # error "FIXME - LZO_ARCH_MCS51 __MODEL__"
  1255. #endif
  1256. #elif (LZO_ARCH_CRAY_PVP)
  1257. # define LZO_MM_PVP 1
  1258. #else
  1259. # define LZO_MM_FLAT 1
  1260. #endif
  1261. #if (LZO_MM_COMPACT)
  1262. # define LZO_INFO_MM "compact"
  1263. #elif (LZO_MM_FLAT)
  1264. # define LZO_INFO_MM "flat"
  1265. #elif (LZO_MM_HUGE)
  1266. # define LZO_INFO_MM "huge"
  1267. #elif (LZO_MM_LARGE)
  1268. # define LZO_INFO_MM "large"
  1269. #elif (LZO_MM_MEDIUM)
  1270. # define LZO_INFO_MM "medium"
  1271. #elif (LZO_MM_PVP)
  1272. # define LZO_INFO_MM "pvp"
  1273. #elif (LZO_MM_SMALL)
  1274. # define LZO_INFO_MM "small"
  1275. #elif (LZO_MM_TINY)
  1276. # define LZO_INFO_MM "tiny"
  1277. #else
  1278. # error "unknown memory model"
  1279. #endif
  1280. #endif
  1281. #if !defined(__lzo_gnuc_extension__)
  1282. #if (LZO_CC_GNUC >= 0x020800ul)
  1283. # define __lzo_gnuc_extension__ __extension__
  1284. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1285. # define __lzo_gnuc_extension__ __extension__
  1286. #elif (LZO_CC_IBMC >= 600)
  1287. # define __lzo_gnuc_extension__ __extension__
  1288. #endif
  1289. #endif
  1290. #if !defined(__lzo_gnuc_extension__)
  1291. # define __lzo_gnuc_extension__ /*empty*/
  1292. #endif
  1293. #if !defined(lzo_has_builtin)
  1294. #if (LZO_CC_CLANG) && defined(__has_builtin)
  1295. # define lzo_has_builtin __has_builtin
  1296. #endif
  1297. #endif
  1298. #if !defined(lzo_has_builtin)
  1299. # define lzo_has_builtin(x) 0
  1300. #endif
  1301. #if !defined(lzo_has_attribute)
  1302. #if (LZO_CC_CLANG) && defined(__has_attribute)
  1303. # define lzo_has_attribute __has_attribute
  1304. #endif
  1305. #endif
  1306. #if !defined(lzo_has_attribute)
  1307. # define lzo_has_attribute(x) 0
  1308. #endif
  1309. #if !defined(lzo_has_declspec_attribute)
  1310. #if (LZO_CC_CLANG) && defined(__has_declspec_attribute)
  1311. # define lzo_has_declspec_attribute __has_declspec_attribute
  1312. #endif
  1313. #endif
  1314. #if !defined(lzo_has_declspec_attribute)
  1315. # define lzo_has_declspec_attribute(x) 0
  1316. #endif
  1317. #if !defined(lzo_has_feature)
  1318. #if (LZO_CC_CLANG) && defined(__has_feature)
  1319. # define lzo_has_feature __has_feature
  1320. #endif
  1321. #endif
  1322. #if !defined(lzo_has_feature)
  1323. # define lzo_has_feature(x) 0
  1324. #endif
  1325. #if !defined(lzo_has_extension)
  1326. #if (LZO_CC_CLANG) && defined(__has_extension)
  1327. # define lzo_has_extension __has_extension
  1328. #elif (LZO_CC_CLANG) && defined(__has_feature)
  1329. # define lzo_has_extension __has_feature
  1330. #endif
  1331. #endif
  1332. #if !defined(lzo_has_extension)
  1333. # define lzo_has_extension(x) 0
  1334. #endif
  1335. #if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0
  1336. # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul))
  1337. # define LZO_CFG_USE_NEW_STYLE_CASTS 0
  1338. # elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200))
  1339. # define LZO_CFG_USE_NEW_STYLE_CASTS 0
  1340. # else
  1341. # define LZO_CFG_USE_NEW_STYLE_CASTS 1
  1342. # endif
  1343. #endif
  1344. #if !defined(LZO_CFG_USE_NEW_STYLE_CASTS)
  1345. # define LZO_CFG_USE_NEW_STYLE_CASTS 0
  1346. #endif
  1347. #if !defined(__cplusplus)
  1348. # if defined(LZO_CFG_USE_NEW_STYLE_CASTS)
  1349. # undef LZO_CFG_USE_NEW_STYLE_CASTS
  1350. # endif
  1351. # define LZO_CFG_USE_NEW_STYLE_CASTS 0
  1352. #endif
  1353. #if !defined(LZO_REINTERPRET_CAST)
  1354. # if (LZO_CFG_USE_NEW_STYLE_CASTS)
  1355. # define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast<t> (e))
  1356. # endif
  1357. #endif
  1358. #if !defined(LZO_REINTERPRET_CAST)
  1359. # define LZO_REINTERPRET_CAST(t,e) ((t) (e))
  1360. #endif
  1361. #if !defined(LZO_STATIC_CAST)
  1362. # if (LZO_CFG_USE_NEW_STYLE_CASTS)
  1363. # define LZO_STATIC_CAST(t,e) (static_cast<t> (e))
  1364. # endif
  1365. #endif
  1366. #if !defined(LZO_STATIC_CAST)
  1367. # define LZO_STATIC_CAST(t,e) ((t) (e))
  1368. #endif
  1369. #if !defined(LZO_STATIC_CAST2)
  1370. # define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e))
  1371. #endif
  1372. #if !defined(LZO_UNCONST_CAST)
  1373. # if (LZO_CFG_USE_NEW_STYLE_CASTS)
  1374. # define LZO_UNCONST_CAST(t,e) (const_cast<t> (e))
  1375. # elif (LZO_HAVE_MM_HUGE_PTR)
  1376. # define LZO_UNCONST_CAST(t,e) ((t) (e))
  1377. # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1378. # define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e)))))
  1379. # endif
  1380. #endif
  1381. #if !defined(LZO_UNCONST_CAST)
  1382. # define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e))))
  1383. #endif
  1384. #if !defined(LZO_UNCONST_VOLATILE_CAST)
  1385. # if (LZO_CFG_USE_NEW_STYLE_CASTS)
  1386. # define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast<t> (e))
  1387. # elif (LZO_HAVE_MM_HUGE_PTR)
  1388. # define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e))
  1389. # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1390. # define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e)))))
  1391. # endif
  1392. #endif
  1393. #if !defined(LZO_UNCONST_VOLATILE_CAST)
  1394. # define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e))))
  1395. #endif
  1396. #if !defined(LZO_UNVOLATILE_CAST)
  1397. # if (LZO_CFG_USE_NEW_STYLE_CASTS)
  1398. # define LZO_UNVOLATILE_CAST(t,e) (const_cast<t> (e))
  1399. # elif (LZO_HAVE_MM_HUGE_PTR)
  1400. # define LZO_UNVOLATILE_CAST(t,e) ((t) (e))
  1401. # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1402. # define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e)))))
  1403. # endif
  1404. #endif
  1405. #if !defined(LZO_UNVOLATILE_CAST)
  1406. # define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e))))
  1407. #endif
  1408. #if !defined(LZO_UNVOLATILE_CONST_CAST)
  1409. # if (LZO_CFG_USE_NEW_STYLE_CASTS)
  1410. # define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast<t> (e))
  1411. # elif (LZO_HAVE_MM_HUGE_PTR)
  1412. # define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e))
  1413. # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1414. # define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e)))))
  1415. # endif
  1416. #endif
  1417. #if !defined(LZO_UNVOLATILE_CONST_CAST)
  1418. # define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e))))
  1419. #endif
  1420. #if !defined(LZO_PCAST)
  1421. # if (LZO_HAVE_MM_HUGE_PTR)
  1422. # define LZO_PCAST(t,e) ((t) (e))
  1423. # endif
  1424. #endif
  1425. #if !defined(LZO_PCAST)
  1426. # define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e))
  1427. #endif
  1428. #if !defined(LZO_CCAST)
  1429. # if (LZO_HAVE_MM_HUGE_PTR)
  1430. # define LZO_CCAST(t,e) ((t) (e))
  1431. # endif
  1432. #endif
  1433. #if !defined(LZO_CCAST)
  1434. # define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e))
  1435. #endif
  1436. #if !defined(LZO_ICONV)
  1437. # define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e)
  1438. #endif
  1439. #if !defined(LZO_ICAST)
  1440. # define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e)
  1441. #endif
  1442. #if !defined(LZO_ITRUNC)
  1443. # define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e)
  1444. #endif
  1445. #if !defined(__lzo_cte)
  1446. # if (LZO_CC_MSC || LZO_CC_WATCOMC)
  1447. # define __lzo_cte(e) ((void)0,(e))
  1448. # elif 1
  1449. # define __lzo_cte(e) ((void)0,(e))
  1450. # endif
  1451. #endif
  1452. #if !defined(__lzo_cte)
  1453. # define __lzo_cte(e) (e)
  1454. #endif
  1455. #if !defined(LZO_BLOCK_BEGIN)
  1456. # define LZO_BLOCK_BEGIN do {
  1457. # define LZO_BLOCK_END } while __lzo_cte(0)
  1458. #endif
  1459. #if !defined(LZO_UNUSED)
  1460. # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
  1461. # define LZO_UNUSED(var) ((void) &var)
  1462. # elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC)
  1463. # define LZO_UNUSED(var) if (&var) ; else
  1464. # elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul))
  1465. # define LZO_UNUSED(var) ((void) &var)
  1466. # elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1467. # define LZO_UNUSED(var) ((void) var)
  1468. # elif (LZO_CC_MSC && (_MSC_VER < 900))
  1469. # define LZO_UNUSED(var) if (&var) ; else
  1470. # elif (LZO_CC_KEILC)
  1471. # define LZO_UNUSED(var) {extern int lzo_unused__[1-2*!(sizeof(var)>0)]; (void)lzo_unused__;}
  1472. # elif (LZO_CC_PACIFICC)
  1473. # define LZO_UNUSED(var) ((void) sizeof(var))
  1474. # elif (LZO_CC_WATCOMC) && defined(__cplusplus)
  1475. # define LZO_UNUSED(var) ((void) var)
  1476. # else
  1477. # define LZO_UNUSED(var) ((void) &var)
  1478. # endif
  1479. #endif
  1480. #if !defined(LZO_UNUSED_RESULT)
  1481. # define LZO_UNUSED_RESULT(var) LZO_UNUSED(var)
  1482. #endif
  1483. #if !defined(LZO_UNUSED_FUNC)
  1484. # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
  1485. # define LZO_UNUSED_FUNC(func) ((void) func)
  1486. # elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC)
  1487. # define LZO_UNUSED_FUNC(func) if (func) ; else
  1488. # elif (LZO_CC_CLANG || LZO_CC_LLVM)
  1489. # define LZO_UNUSED_FUNC(func) ((void) &func)
  1490. # elif (LZO_CC_MSC && (_MSC_VER < 900))
  1491. # define LZO_UNUSED_FUNC(func) if (func) ; else
  1492. # elif (LZO_CC_MSC)
  1493. # define LZO_UNUSED_FUNC(func) ((void) &func)
  1494. # elif (LZO_CC_KEILC || LZO_CC_PELLESC)
  1495. # define LZO_UNUSED_FUNC(func) {extern int lzo_unused__[1-2*!(sizeof((int)func)>0)]; (void)lzo_unused__;}
  1496. # else
  1497. # define LZO_UNUSED_FUNC(func) ((void) func)
  1498. # endif
  1499. #endif
  1500. #if !defined(LZO_UNUSED_LABEL)
  1501. # if (LZO_CC_CLANG >= 0x020800ul)
  1502. # define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l)))
  1503. # elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC)
  1504. # define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l
  1505. # else
  1506. # define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l
  1507. # endif
  1508. #endif
  1509. #if !defined(LZO_DEFINE_UNINITIALIZED_VAR)
  1510. # if 0
  1511. # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var
  1512. # elif 0 && (LZO_CC_GNUC)
  1513. # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var
  1514. # else
  1515. # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init
  1516. # endif
  1517. #endif
  1518. #if !defined(__lzo_inline)
  1519. #if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295))
  1520. #elif defined(__cplusplus)
  1521. # define __lzo_inline inline
  1522. #elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L)
  1523. # define __lzo_inline inline
  1524. #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550))
  1525. # define __lzo_inline __inline
  1526. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
  1527. # define __lzo_inline __inline__
  1528. #elif (LZO_CC_DMC)
  1529. # define __lzo_inline __inline
  1530. #elif (LZO_CC_GHS)
  1531. # define __lzo_inline __inline__
  1532. #elif (LZO_CC_IBMC >= 600)
  1533. # define __lzo_inline __inline__
  1534. #elif (LZO_CC_INTELC)
  1535. # define __lzo_inline __inline
  1536. #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405))
  1537. # define __lzo_inline __inline
  1538. #elif (LZO_CC_MSC && (_MSC_VER >= 900))
  1539. # define __lzo_inline __inline
  1540. #elif (LZO_CC_SUNPROC >= 0x5100)
  1541. # define __lzo_inline __inline__
  1542. #endif
  1543. #endif
  1544. #if defined(__lzo_inline)
  1545. # ifndef __lzo_HAVE_inline
  1546. # define __lzo_HAVE_inline 1
  1547. # endif
  1548. #else
  1549. # define __lzo_inline /*empty*/
  1550. #endif
  1551. #if !defined(__lzo_forceinline)
  1552. #if (LZO_CC_GNUC >= 0x030200ul)
  1553. # define __lzo_forceinline __inline__ __attribute__((__always_inline__))
  1554. #elif (LZO_CC_IBMC >= 700)
  1555. # define __lzo_forceinline __inline__ __attribute__((__always_inline__))
  1556. #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450))
  1557. # define __lzo_forceinline __forceinline
  1558. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
  1559. # define __lzo_forceinline __inline__ __attribute__((__always_inline__))
  1560. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1561. # define __lzo_forceinline __inline__ __attribute__((__always_inline__))
  1562. #elif (LZO_CC_MSC && (_MSC_VER >= 1200))
  1563. # define __lzo_forceinline __forceinline
  1564. #elif (LZO_CC_PGI >= 0x0d0a00ul)
  1565. # define __lzo_forceinline __inline__ __attribute__((__always_inline__))
  1566. #elif (LZO_CC_SUNPROC >= 0x5100)
  1567. # define __lzo_forceinline __inline__ __attribute__((__always_inline__))
  1568. #endif
  1569. #endif
  1570. #if defined(__lzo_forceinline)
  1571. # ifndef __lzo_HAVE_forceinline
  1572. # define __lzo_HAVE_forceinline 1
  1573. # endif
  1574. #else
  1575. # define __lzo_forceinline __lzo_inline
  1576. #endif
  1577. #if !defined(__lzo_noinline)
  1578. #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul)
  1579. # define __lzo_noinline __attribute__((__noinline__,__used__))
  1580. #elif (LZO_CC_GNUC >= 0x030200ul)
  1581. # define __lzo_noinline __attribute__((__noinline__))
  1582. #elif (LZO_CC_IBMC >= 700)
  1583. # define __lzo_noinline __attribute__((__noinline__))
  1584. #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600))
  1585. # define __lzo_noinline __declspec(noinline)
  1586. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
  1587. # define __lzo_noinline __attribute__((__noinline__))
  1588. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1589. # define __lzo_noinline __attribute__((__noinline__))
  1590. #elif (LZO_CC_MSC && (_MSC_VER >= 1300))
  1591. # define __lzo_noinline __declspec(noinline)
  1592. #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64))
  1593. # if defined(__cplusplus)
  1594. # else
  1595. # define __lzo_noinline __declspec(noinline)
  1596. # endif
  1597. #elif (LZO_CC_PGI >= 0x0d0a00ul)
  1598. # define __lzo_noinline __attribute__((__noinline__))
  1599. #elif (LZO_CC_SUNPROC >= 0x5100)
  1600. # define __lzo_noinline __attribute__((__noinline__))
  1601. #endif
  1602. #endif
  1603. #if defined(__lzo_noinline)
  1604. # ifndef __lzo_HAVE_noinline
  1605. # define __lzo_HAVE_noinline 1
  1606. # endif
  1607. #else
  1608. # define __lzo_noinline /*empty*/
  1609. #endif
  1610. #if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline)
  1611. # error "unexpected configuration - check your compiler defines"
  1612. #endif
  1613. #if !defined(__lzo_static_inline)
  1614. #if (LZO_CC_IBMC)
  1615. # define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline
  1616. #endif
  1617. #endif
  1618. #if !defined(__lzo_static_inline)
  1619. # define __lzo_static_inline static __lzo_inline
  1620. #endif
  1621. #if !defined(__lzo_static_forceinline)
  1622. #if (LZO_CC_IBMC)
  1623. # define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline
  1624. #endif
  1625. #endif
  1626. #if !defined(__lzo_static_forceinline)
  1627. # define __lzo_static_forceinline static __lzo_forceinline
  1628. #endif
  1629. #if !defined(__lzo_static_noinline)
  1630. #if (LZO_CC_IBMC)
  1631. # define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline
  1632. #endif
  1633. #endif
  1634. #if !defined(__lzo_static_noinline)
  1635. # define __lzo_static_noinline static __lzo_noinline
  1636. #endif
  1637. #if !defined(__lzo_c99_extern_inline)
  1638. #if defined(__GNUC_GNU_INLINE__)
  1639. # define __lzo_c99_extern_inline __lzo_inline
  1640. #elif defined(__GNUC_STDC_INLINE__)
  1641. # define __lzo_c99_extern_inline extern __lzo_inline
  1642. #elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L)
  1643. # define __lzo_c99_extern_inline extern __lzo_inline
  1644. #endif
  1645. #if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline)
  1646. # define __lzo_c99_extern_inline __lzo_inline
  1647. #endif
  1648. #endif
  1649. #if defined(__lzo_c99_extern_inline)
  1650. # ifndef __lzo_HAVE_c99_extern_inline
  1651. # define __lzo_HAVE_c99_extern_inline 1
  1652. # endif
  1653. #else
  1654. # define __lzo_c99_extern_inline /*empty*/
  1655. #endif
  1656. #if !defined(__lzo_may_alias)
  1657. #if (LZO_CC_GNUC >= 0x030400ul)
  1658. # define __lzo_may_alias __attribute__((__may_alias__))
  1659. #elif (LZO_CC_CLANG >= 0x020900ul)
  1660. # define __lzo_may_alias __attribute__((__may_alias__))
  1661. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0
  1662. # define __lzo_may_alias __attribute__((__may_alias__))
  1663. #elif (LZO_CC_PGI >= 0x0d0a00ul) && 0
  1664. # define __lzo_may_alias __attribute__((__may_alias__))
  1665. #endif
  1666. #endif
  1667. #if defined(__lzo_may_alias)
  1668. # ifndef __lzo_HAVE_may_alias
  1669. # define __lzo_HAVE_may_alias 1
  1670. # endif
  1671. #else
  1672. # define __lzo_may_alias /*empty*/
  1673. #endif
  1674. #if !defined(__lzo_noreturn)
  1675. #if (LZO_CC_GNUC >= 0x020700ul)
  1676. # define __lzo_noreturn __attribute__((__noreturn__))
  1677. #elif (LZO_CC_IBMC >= 700)
  1678. # define __lzo_noreturn __attribute__((__noreturn__))
  1679. #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450))
  1680. # define __lzo_noreturn __declspec(noreturn)
  1681. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600))
  1682. # define __lzo_noreturn __attribute__((__noreturn__))
  1683. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1684. # define __lzo_noreturn __attribute__((__noreturn__))
  1685. #elif (LZO_CC_MSC && (_MSC_VER >= 1200))
  1686. # define __lzo_noreturn __declspec(noreturn)
  1687. #elif (LZO_CC_PGI >= 0x0d0a00ul)
  1688. # define __lzo_noreturn __attribute__((__noreturn__))
  1689. #endif
  1690. #endif
  1691. #if defined(__lzo_noreturn)
  1692. # ifndef __lzo_HAVE_noreturn
  1693. # define __lzo_HAVE_noreturn 1
  1694. # endif
  1695. #else
  1696. # define __lzo_noreturn /*empty*/
  1697. #endif
  1698. #if !defined(__lzo_nothrow)
  1699. #if (LZO_CC_GNUC >= 0x030300ul)
  1700. # define __lzo_nothrow __attribute__((__nothrow__))
  1701. #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus)
  1702. # define __lzo_nothrow __declspec(nothrow)
  1703. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900))
  1704. # define __lzo_nothrow __attribute__((__nothrow__))
  1705. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1706. # define __lzo_nothrow __attribute__((__nothrow__))
  1707. #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus)
  1708. # define __lzo_nothrow __declspec(nothrow)
  1709. #endif
  1710. #endif
  1711. #if defined(__lzo_nothrow)
  1712. # ifndef __lzo_HAVE_nothrow
  1713. # define __lzo_HAVE_nothrow 1
  1714. # endif
  1715. #else
  1716. # define __lzo_nothrow /*empty*/
  1717. #endif
  1718. #if !defined(__lzo_restrict)
  1719. #if (LZO_CC_GNUC >= 0x030400ul)
  1720. # define __lzo_restrict __restrict__
  1721. #elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus)
  1722. # define __lzo_restrict __restrict__
  1723. #elif (LZO_CC_IBMC >= 1210)
  1724. # define __lzo_restrict __restrict__
  1725. #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600))
  1726. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600))
  1727. # define __lzo_restrict __restrict__
  1728. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM)
  1729. # define __lzo_restrict __restrict__
  1730. #elif (LZO_CC_MSC && (_MSC_VER >= 1400))
  1731. # define __lzo_restrict __restrict
  1732. #elif (LZO_CC_PGI >= 0x0d0a00ul)
  1733. # define __lzo_restrict __restrict__
  1734. #endif
  1735. #endif
  1736. #if defined(__lzo_restrict)
  1737. # ifndef __lzo_HAVE_restrict
  1738. # define __lzo_HAVE_restrict 1
  1739. # endif
  1740. #else
  1741. # define __lzo_restrict /*empty*/
  1742. #endif
  1743. #if !defined(__lzo_alignof)
  1744. #if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
  1745. # define __lzo_alignof(e) __alignof__(e)
  1746. #elif (LZO_CC_GHS) && !defined(__cplusplus)
  1747. # define __lzo_alignof(e) __alignof__(e)
  1748. #elif (LZO_CC_IBMC >= 600)
  1749. # define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e))
  1750. #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700))
  1751. # define __lzo_alignof(e) __alignof__(e)
  1752. #elif (LZO_CC_MSC && (_MSC_VER >= 1300))
  1753. # define __lzo_alignof(e) __alignof(e)
  1754. #elif (LZO_CC_SUNPROC >= 0x5100)
  1755. # define __lzo_alignof(e) __alignof__(e)
  1756. #endif
  1757. #endif
  1758. #if defined(__lzo_alignof)
  1759. # ifndef __lzo_HAVE_alignof
  1760. # define __lzo_HAVE_alignof 1
  1761. # endif
  1762. #endif
  1763. #if !defined(__lzo_struct_packed)
  1764. #if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus)
  1765. #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul))
  1766. #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus)
  1767. #elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul))
  1768. #elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus)
  1769. #elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
  1770. # define __lzo_struct_packed(s) struct s {
  1771. # define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__));
  1772. # define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__));
  1773. #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100))
  1774. # define __lzo_struct_packed(s) struct s {
  1775. # define __lzo_struct_packed_end() } __attribute__((__packed__));
  1776. # define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__));
  1777. #elif (LZO_CC_IBMC >= 700)
  1778. # define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s {
  1779. # define __lzo_struct_packed_end() } __attribute__((__packed__));
  1780. # define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__));
  1781. #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
  1782. # define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s {
  1783. # define __lzo_struct_packed_end() } __pragma(pack(pop));
  1784. #elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
  1785. # define __lzo_struct_packed(s) _Packed struct s {
  1786. # define __lzo_struct_packed_end() };
  1787. #endif
  1788. #endif
  1789. #if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma)
  1790. # define __lzo_struct_packed_ma(s) __lzo_struct_packed(s)
  1791. #endif
  1792. #if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end)
  1793. # define __lzo_struct_packed_ma_end() __lzo_struct_packed_end()
  1794. #endif
  1795. #if !defined(__lzo_byte_struct)
  1796. #if defined(__lzo_struct_packed)
  1797. # define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end()
  1798. # define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end()
  1799. #elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100))
  1800. # define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__));
  1801. # define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__));
  1802. #endif
  1803. #endif
  1804. #if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma)
  1805. # define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n)
  1806. #endif
  1807. #if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof)
  1808. #if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul))
  1809. #elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus)
  1810. #elif (LZO_CC_CILLY || LZO_CC_PCC)
  1811. #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
  1812. # define __lzo_struct_align16(s) struct __declspec(align(16)) s {
  1813. # define __lzo_struct_align16_end() };
  1814. # define __lzo_struct_align32(s) struct __declspec(align(32)) s {
  1815. # define __lzo_struct_align32_end() };
  1816. # define __lzo_struct_align64(s) struct __declspec(align(64)) s {
  1817. # define __lzo_struct_align64_end() };
  1818. #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1819. # define __lzo_struct_align16(s) struct s {
  1820. # define __lzo_struct_align16_end() } __attribute__((__aligned__(16)));
  1821. # define __lzo_struct_align32(s) struct s {
  1822. # define __lzo_struct_align32_end() } __attribute__((__aligned__(32)));
  1823. # define __lzo_struct_align64(s) struct s {
  1824. # define __lzo_struct_align64_end() } __attribute__((__aligned__(64)));
  1825. #endif
  1826. #endif
  1827. #if !defined(__lzo_union_um)
  1828. #if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus)
  1829. #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul))
  1830. #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus)
  1831. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810))
  1832. #elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul))
  1833. #elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus)
  1834. #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100))
  1835. # define __lzo_union_am(s) union s {
  1836. # define __lzo_union_am_end() } __lzo_may_alias;
  1837. # define __lzo_union_um(s) union s {
  1838. # define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__));
  1839. #elif (LZO_CC_IBMC >= 700)
  1840. # define __lzo_union_am(s) __lzo_gnuc_extension__ union s {
  1841. # define __lzo_union_am_end() } __lzo_may_alias;
  1842. # define __lzo_union_um(s) __lzo_gnuc_extension__ union s {
  1843. # define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__));
  1844. #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
  1845. # define __lzo_union_um(s) __pragma(pack(push,1)) union s {
  1846. # define __lzo_union_um_end() } __pragma(pack(pop));
  1847. #elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
  1848. # define __lzo_union_um(s) _Packed union s {
  1849. # define __lzo_union_um_end() };
  1850. #endif
  1851. #endif
  1852. #if !defined(__lzo_union_am)
  1853. # define __lzo_union_am(s) union s {
  1854. # define __lzo_union_am_end() };
  1855. #endif
  1856. #if !defined(__lzo_constructor)
  1857. #if (LZO_CC_GNUC >= 0x030400ul)
  1858. # define __lzo_constructor __attribute__((__constructor__,__used__))
  1859. #elif (LZO_CC_GNUC >= 0x020700ul)
  1860. # define __lzo_constructor __attribute__((__constructor__))
  1861. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
  1862. # define __lzo_constructor __attribute__((__constructor__,__used__))
  1863. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1864. # define __lzo_constructor __attribute__((__constructor__))
  1865. #endif
  1866. #endif
  1867. #if defined(__lzo_constructor)
  1868. # ifndef __lzo_HAVE_constructor
  1869. # define __lzo_HAVE_constructor 1
  1870. # endif
  1871. #endif
  1872. #if !defined(__lzo_destructor)
  1873. #if (LZO_CC_GNUC >= 0x030400ul)
  1874. # define __lzo_destructor __attribute__((__destructor__,__used__))
  1875. #elif (LZO_CC_GNUC >= 0x020700ul)
  1876. # define __lzo_destructor __attribute__((__destructor__))
  1877. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
  1878. # define __lzo_destructor __attribute__((__destructor__,__used__))
  1879. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1880. # define __lzo_destructor __attribute__((__destructor__))
  1881. #endif
  1882. #endif
  1883. #if defined(__lzo_destructor)
  1884. # ifndef __lzo_HAVE_destructor
  1885. # define __lzo_HAVE_destructor 1
  1886. # endif
  1887. #endif
  1888. #if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor)
  1889. # error "unexpected configuration - check your compiler defines"
  1890. #endif
  1891. #if !defined(__lzo_likely) && !defined(__lzo_unlikely)
  1892. #if (LZO_CC_GNUC >= 0x030200ul)
  1893. # define __lzo_likely(e) (__builtin_expect(!!(e),1))
  1894. # define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
  1895. #elif (LZO_CC_IBMC >= 1010)
  1896. # define __lzo_likely(e) (__builtin_expect(!!(e),1))
  1897. # define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
  1898. #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800))
  1899. # define __lzo_likely(e) (__builtin_expect(!!(e),1))
  1900. # define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
  1901. #elif (LZO_CC_CLANG && LZO_CC_CLANG_C2)
  1902. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  1903. # define __lzo_likely(e) (__builtin_expect(!!(e),1))
  1904. # define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
  1905. #endif
  1906. #endif
  1907. #if defined(__lzo_likely)
  1908. # ifndef __lzo_HAVE_likely
  1909. # define __lzo_HAVE_likely 1
  1910. # endif
  1911. #else
  1912. # define __lzo_likely(e) (e)
  1913. #endif
  1914. #if defined(__lzo_very_likely)
  1915. # ifndef __lzo_HAVE_very_likely
  1916. # define __lzo_HAVE_very_likely 1
  1917. # endif
  1918. #else
  1919. # define __lzo_very_likely(e) __lzo_likely(e)
  1920. #endif
  1921. #if defined(__lzo_unlikely)
  1922. # ifndef __lzo_HAVE_unlikely
  1923. # define __lzo_HAVE_unlikely 1
  1924. # endif
  1925. #else
  1926. # define __lzo_unlikely(e) (e)
  1927. #endif
  1928. #if defined(__lzo_very_unlikely)
  1929. # ifndef __lzo_HAVE_very_unlikely
  1930. # define __lzo_HAVE_very_unlikely 1
  1931. # endif
  1932. #else
  1933. # define __lzo_very_unlikely(e) __lzo_unlikely(e)
  1934. #endif
  1935. #if !defined(__lzo_loop_forever)
  1936. # if (LZO_CC_IBMC)
  1937. # define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END
  1938. # else
  1939. # define __lzo_loop_forever() do { ; } while __lzo_cte(1)
  1940. # endif
  1941. #endif
  1942. #if !defined(__lzo_unreachable)
  1943. #if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) && lzo_has_builtin(__builtin_unreachable)
  1944. # define __lzo_unreachable() __builtin_unreachable();
  1945. #elif (LZO_CC_GNUC >= 0x040500ul)
  1946. # define __lzo_unreachable() __builtin_unreachable();
  1947. #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1
  1948. # define __lzo_unreachable() __builtin_unreachable();
  1949. #endif
  1950. #endif
  1951. #if defined(__lzo_unreachable)
  1952. # ifndef __lzo_HAVE_unreachable
  1953. # define __lzo_HAVE_unreachable 1
  1954. # endif
  1955. #else
  1956. # if 0
  1957. # define __lzo_unreachable() ((void)0);
  1958. # else
  1959. # define __lzo_unreachable() __lzo_loop_forever();
  1960. # endif
  1961. #endif
  1962. #if !defined(lzo_unused_funcs_impl)
  1963. # if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
  1964. # define lzo_unused_funcs_impl(r,f) static r __attribute__((__unused__)) f
  1965. # elif 1 && (LZO_CC_BORLANDC || LZO_CC_GNUC)
  1966. # define lzo_unused_funcs_impl(r,f) static r f
  1967. # else
  1968. # define lzo_unused_funcs_impl(r,f) __lzo_static_forceinline r f
  1969. # endif
  1970. #endif
  1971. #ifndef __LZO_CTA_NAME
  1972. #if (LZO_CFG_USE_COUNTER)
  1973. # define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__)
  1974. #else
  1975. # define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__)
  1976. #endif
  1977. #endif
  1978. #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER)
  1979. # if (LZO_CC_AZTECC || LZO_CC_ZORTECHC)
  1980. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END
  1981. # elif (LZO_CC_DMC || LZO_CC_SYMANTECC)
  1982. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END
  1983. # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295))
  1984. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END
  1985. # elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus)
  1986. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END
  1987. # elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__)
  1988. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END
  1989. # else
  1990. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END
  1991. # endif
  1992. #endif
  1993. #if !defined(LZO_COMPILE_TIME_ASSERT)
  1994. # if (LZO_CC_AZTECC)
  1995. # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];}
  1996. # elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030000ul))
  1997. # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));}
  1998. # elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
  1999. # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
  2000. # elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__)
  2001. # define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));}
  2002. # elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus)
  2003. # define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));}
  2004. # elif (LZO_CC_GNUC >= 0x040700ul)
  2005. # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));}
  2006. # elif (LZO_CC_MSC && (_MSC_VER < 900))
  2007. # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
  2008. # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295))
  2009. # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
  2010. # else
  2011. # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];}
  2012. # endif
  2013. #endif
  2014. #if (LZO_LANG_ASSEMBLER)
  2015. # undef LZO_COMPILE_TIME_ASSERT_HEADER
  2016. # define LZO_COMPILE_TIME_ASSERT_HEADER(e) /*empty*/
  2017. #else
  2018. LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1)
  2019. #if defined(__cplusplus)
  2020. extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) }
  2021. #endif
  2022. LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
  2023. #endif
  2024. #if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64)
  2025. # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC)
  2026. # elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
  2027. # define __lzo_cdecl __cdecl
  2028. # define __lzo_cdecl_atexit /*empty*/
  2029. # define __lzo_cdecl_main __cdecl
  2030. # if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC))
  2031. # define __lzo_cdecl_qsort __pascal
  2032. # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC))
  2033. # define __lzo_cdecl_qsort _stdcall
  2034. # else
  2035. # define __lzo_cdecl_qsort __cdecl
  2036. # endif
  2037. # elif (LZO_CC_WATCOMC)
  2038. # define __lzo_cdecl __cdecl
  2039. # else
  2040. # define __lzo_cdecl __cdecl
  2041. # define __lzo_cdecl_atexit __cdecl
  2042. # define __lzo_cdecl_main __cdecl
  2043. # define __lzo_cdecl_qsort __cdecl
  2044. # endif
  2045. # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC)
  2046. # elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC))
  2047. # define __lzo_cdecl_sighandler __pascal
  2048. # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC))
  2049. # define __lzo_cdecl_sighandler _stdcall
  2050. # elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
  2051. # define __lzo_cdecl_sighandler __clrcall
  2052. # elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
  2053. # if defined(_DLL)
  2054. # define __lzo_cdecl_sighandler _far _cdecl _loadds
  2055. # elif defined(_MT)
  2056. # define __lzo_cdecl_sighandler _far _cdecl
  2057. # else
  2058. # define __lzo_cdecl_sighandler _cdecl
  2059. # endif
  2060. # else
  2061. # define __lzo_cdecl_sighandler __cdecl
  2062. # endif
  2063. #elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC)
  2064. # define __lzo_cdecl __cdecl
  2065. #elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC))
  2066. # define __lzo_cdecl cdecl
  2067. #endif
  2068. #if !defined(__lzo_cdecl)
  2069. # define __lzo_cdecl /*empty*/
  2070. #endif
  2071. #if !defined(__lzo_cdecl_atexit)
  2072. # define __lzo_cdecl_atexit /*empty*/
  2073. #endif
  2074. #if !defined(__lzo_cdecl_main)
  2075. # define __lzo_cdecl_main /*empty*/
  2076. #endif
  2077. #if !defined(__lzo_cdecl_qsort)
  2078. # define __lzo_cdecl_qsort /*empty*/
  2079. #endif
  2080. #if !defined(__lzo_cdecl_sighandler)
  2081. # define __lzo_cdecl_sighandler /*empty*/
  2082. #endif
  2083. #if !defined(__lzo_cdecl_va)
  2084. # define __lzo_cdecl_va __lzo_cdecl
  2085. #endif
  2086. #if !(LZO_CFG_NO_WINDOWS_H)
  2087. #if !defined(LZO_HAVE_WINDOWS_H)
  2088. #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64)
  2089. # if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000))
  2090. # elif ((LZO_OS_WIN32 && defined(__PW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)))
  2091. # elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul)))
  2092. # else
  2093. # define LZO_HAVE_WINDOWS_H 1
  2094. # endif
  2095. #endif
  2096. #endif
  2097. #endif
  2098. #define LZO_SIZEOF_CHAR 1
  2099. #ifndef LZO_SIZEOF_SHORT
  2100. #if defined(SIZEOF_SHORT)
  2101. # define LZO_SIZEOF_SHORT (SIZEOF_SHORT)
  2102. #elif defined(__SIZEOF_SHORT__)
  2103. # define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__)
  2104. #endif
  2105. #endif
  2106. #ifndef LZO_SIZEOF_INT
  2107. #if defined(SIZEOF_INT)
  2108. # define LZO_SIZEOF_INT (SIZEOF_INT)
  2109. #elif defined(__SIZEOF_INT__)
  2110. # define LZO_SIZEOF_INT (__SIZEOF_INT__)
  2111. #endif
  2112. #endif
  2113. #ifndef LZO_SIZEOF_LONG
  2114. #if defined(SIZEOF_LONG)
  2115. # define LZO_SIZEOF_LONG (SIZEOF_LONG)
  2116. #elif defined(__SIZEOF_LONG__)
  2117. # define LZO_SIZEOF_LONG (__SIZEOF_LONG__)
  2118. #endif
  2119. #endif
  2120. #ifndef LZO_SIZEOF_LONG_LONG
  2121. #if defined(SIZEOF_LONG_LONG)
  2122. # define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG)
  2123. #elif defined(__SIZEOF_LONG_LONG__)
  2124. # define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__)
  2125. #endif
  2126. #endif
  2127. #ifndef LZO_SIZEOF___INT16
  2128. #if defined(SIZEOF___INT16)
  2129. # define LZO_SIZEOF___INT16 (SIZEOF___INT16)
  2130. #endif
  2131. #endif
  2132. #ifndef LZO_SIZEOF___INT32
  2133. #if defined(SIZEOF___INT32)
  2134. # define LZO_SIZEOF___INT32 (SIZEOF___INT32)
  2135. #endif
  2136. #endif
  2137. #ifndef LZO_SIZEOF___INT64
  2138. #if defined(SIZEOF___INT64)
  2139. # define LZO_SIZEOF___INT64 (SIZEOF___INT64)
  2140. #endif
  2141. #endif
  2142. #ifndef LZO_SIZEOF_VOID_P
  2143. #if defined(SIZEOF_VOID_P)
  2144. # define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P)
  2145. #elif defined(__SIZEOF_POINTER__)
  2146. # define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__)
  2147. #endif
  2148. #endif
  2149. #ifndef LZO_SIZEOF_SIZE_T
  2150. #if defined(SIZEOF_SIZE_T)
  2151. # define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T)
  2152. #elif defined(__SIZEOF_SIZE_T__)
  2153. # define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__)
  2154. #endif
  2155. #endif
  2156. #ifndef LZO_SIZEOF_PTRDIFF_T
  2157. #if defined(SIZEOF_PTRDIFF_T)
  2158. # define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T)
  2159. #elif defined(__SIZEOF_PTRDIFF_T__)
  2160. # define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__)
  2161. #endif
  2162. #endif
  2163. #define __LZO_LSR(x,b) (((x)+0ul) >> (b))
  2164. #if !defined(LZO_SIZEOF_SHORT)
  2165. # if (LZO_ARCH_CRAY_PVP)
  2166. # define LZO_SIZEOF_SHORT 8
  2167. # elif (USHRT_MAX == LZO_0xffffL)
  2168. # define LZO_SIZEOF_SHORT 2
  2169. # elif (__LZO_LSR(USHRT_MAX,7) == 1)
  2170. # define LZO_SIZEOF_SHORT 1
  2171. # elif (__LZO_LSR(USHRT_MAX,15) == 1)
  2172. # define LZO_SIZEOF_SHORT 2
  2173. # elif (__LZO_LSR(USHRT_MAX,31) == 1)
  2174. # define LZO_SIZEOF_SHORT 4
  2175. # elif (__LZO_LSR(USHRT_MAX,63) == 1)
  2176. # define LZO_SIZEOF_SHORT 8
  2177. # elif (__LZO_LSR(USHRT_MAX,127) == 1)
  2178. # define LZO_SIZEOF_SHORT 16
  2179. # else
  2180. # error "LZO_SIZEOF_SHORT"
  2181. # endif
  2182. #endif
  2183. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short))
  2184. #if !defined(LZO_SIZEOF_INT)
  2185. # if (LZO_ARCH_CRAY_PVP)
  2186. # define LZO_SIZEOF_INT 8
  2187. # elif (UINT_MAX == LZO_0xffffL)
  2188. # define LZO_SIZEOF_INT 2
  2189. # elif (UINT_MAX == LZO_0xffffffffL)
  2190. # define LZO_SIZEOF_INT 4
  2191. # elif (__LZO_LSR(UINT_MAX,7) == 1)
  2192. # define LZO_SIZEOF_INT 1
  2193. # elif (__LZO_LSR(UINT_MAX,15) == 1)
  2194. # define LZO_SIZEOF_INT 2
  2195. # elif (__LZO_LSR(UINT_MAX,31) == 1)
  2196. # define LZO_SIZEOF_INT 4
  2197. # elif (__LZO_LSR(UINT_MAX,63) == 1)
  2198. # define LZO_SIZEOF_INT 8
  2199. # elif (__LZO_LSR(UINT_MAX,127) == 1)
  2200. # define LZO_SIZEOF_INT 16
  2201. # else
  2202. # error "LZO_SIZEOF_INT"
  2203. # endif
  2204. #endif
  2205. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int))
  2206. #if !defined(LZO_SIZEOF_LONG)
  2207. # if (ULONG_MAX == LZO_0xffffffffL)
  2208. # define LZO_SIZEOF_LONG 4
  2209. # elif (__LZO_LSR(ULONG_MAX,7) == 1)
  2210. # define LZO_SIZEOF_LONG 1
  2211. # elif (__LZO_LSR(ULONG_MAX,15) == 1)
  2212. # define LZO_SIZEOF_LONG 2
  2213. # elif (__LZO_LSR(ULONG_MAX,31) == 1)
  2214. # define LZO_SIZEOF_LONG 4
  2215. # elif (__LZO_LSR(ULONG_MAX,39) == 1)
  2216. # define LZO_SIZEOF_LONG 5
  2217. # elif (__LZO_LSR(ULONG_MAX,63) == 1)
  2218. # define LZO_SIZEOF_LONG 8
  2219. # elif (__LZO_LSR(ULONG_MAX,127) == 1)
  2220. # define LZO_SIZEOF_LONG 16
  2221. # else
  2222. # error "LZO_SIZEOF_LONG"
  2223. # endif
  2224. #endif
  2225. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long))
  2226. #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
  2227. #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
  2228. # if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__)
  2229. # if (LZO_CC_GNUC >= 0x030300ul)
  2230. # if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0))
  2231. # define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG
  2232. # elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1)
  2233. # define LZO_SIZEOF_LONG_LONG 4
  2234. # endif
  2235. # endif
  2236. # endif
  2237. #endif
  2238. #endif
  2239. #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
  2240. #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
  2241. #if (LZO_ARCH_I086 && LZO_CC_DMC)
  2242. #elif (LZO_CC_CILLY) && defined(__GNUC__)
  2243. # define LZO_SIZEOF_LONG_LONG 8
  2244. #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
  2245. # define LZO_SIZEOF_LONG_LONG 8
  2246. #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400))
  2247. # define LZO_SIZEOF_LONG_LONG 8
  2248. #elif (LZO_OS_WIN64 || defined(_WIN64))
  2249. # define LZO_SIZEOF___INT64 8
  2250. #elif (LZO_ARCH_I386 && (LZO_CC_DMC))
  2251. # define LZO_SIZEOF_LONG_LONG 8
  2252. #elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700)))
  2253. # define LZO_SIZEOF_LONG_LONG 8
  2254. #elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__)))
  2255. # define LZO_SIZEOF_LONG_LONG 8
  2256. #elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC))
  2257. # define LZO_SIZEOF_LONG_LONG 8
  2258. #elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC))
  2259. # define LZO_SIZEOF___INT64 8
  2260. #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC))
  2261. # define LZO_SIZEOF___INT64 8
  2262. #elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520)))
  2263. # define LZO_SIZEOF___INT64 8
  2264. #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100)))
  2265. # define LZO_SIZEOF___INT64 8
  2266. #elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64))
  2267. # define LZO_SIZEOF_LONG_LONG 8
  2268. #elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64))
  2269. # define LZO_SIZEOF___INT64 8
  2270. #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__)
  2271. # define LZO_SIZEOF_LONG_LONG 8
  2272. #elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64)
  2273. # define LZO_SIZEOF_LONG_LONG 8
  2274. #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2)
  2275. #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
  2276. # define LZO_SIZEOF_LONG_LONG 8
  2277. #endif
  2278. #endif
  2279. #endif
  2280. #if defined(__cplusplus) && (LZO_CC_GNUC)
  2281. # if (LZO_CC_GNUC < 0x020800ul)
  2282. # undef LZO_SIZEOF_LONG_LONG
  2283. # endif
  2284. #endif
  2285. #if (LZO_CFG_NO_LONG_LONG)
  2286. # undef LZO_SIZEOF_LONG_LONG
  2287. #elif defined(__NO_LONG_LONG)
  2288. # undef LZO_SIZEOF_LONG_LONG
  2289. #elif defined(_NO_LONGLONG)
  2290. # undef LZO_SIZEOF_LONG_LONG
  2291. #endif
  2292. #if !defined(LZO_WORDSIZE)
  2293. #if (LZO_ARCH_ALPHA)
  2294. # define LZO_WORDSIZE 8
  2295. #elif (LZO_ARCH_AMD64)
  2296. # define LZO_WORDSIZE 8
  2297. #elif (LZO_ARCH_ARM64)
  2298. # define LZO_WORDSIZE 8
  2299. #elif (LZO_ARCH_AVR)
  2300. # define LZO_WORDSIZE 1
  2301. #elif (LZO_ARCH_H8300)
  2302. # if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
  2303. # define LZO_WORDSIZE 4
  2304. # else
  2305. # define LZO_WORDSIZE 2
  2306. # endif
  2307. #elif (LZO_ARCH_I086)
  2308. # define LZO_WORDSIZE 2
  2309. #elif (LZO_ARCH_IA64)
  2310. # define LZO_WORDSIZE 8
  2311. #elif (LZO_ARCH_M16C)
  2312. # define LZO_WORDSIZE 2
  2313. #elif (LZO_ARCH_SPU)
  2314. # define LZO_WORDSIZE 4
  2315. #elif (LZO_ARCH_Z80)
  2316. # define LZO_WORDSIZE 1
  2317. #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__))
  2318. # define LZO_WORDSIZE 8
  2319. #elif (LZO_OS_OS400 || defined(__OS400__))
  2320. # define LZO_WORDSIZE 8
  2321. #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64)
  2322. # define LZO_WORDSIZE 8
  2323. #endif
  2324. #endif
  2325. #if !defined(LZO_SIZEOF_VOID_P)
  2326. #if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32)
  2327. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4)
  2328. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4)
  2329. # define LZO_SIZEOF_VOID_P 4
  2330. #elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64)
  2331. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8)
  2332. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
  2333. # define LZO_SIZEOF_VOID_P 8
  2334. #elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64)
  2335. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4)
  2336. # define LZO_SIZEOF_VOID_P 8
  2337. #elif defined(__LP64__) || defined(__LP64) || defined(_LP64)
  2338. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
  2339. # define LZO_SIZEOF_VOID_P 8
  2340. #elif (LZO_ARCH_AVR)
  2341. # define LZO_SIZEOF_VOID_P 2
  2342. #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430)
  2343. # define LZO_SIZEOF_VOID_P 2
  2344. #elif (LZO_ARCH_H8300)
  2345. # if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
  2346. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 4)
  2347. # if defined(__NORMAL_MODE__)
  2348. # define LZO_SIZEOF_VOID_P 2
  2349. # else
  2350. # define LZO_SIZEOF_VOID_P 4
  2351. # endif
  2352. # else
  2353. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 2)
  2354. # define LZO_SIZEOF_VOID_P 2
  2355. # endif
  2356. # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4)
  2357. # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT
  2358. # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT
  2359. # endif
  2360. #elif (LZO_ARCH_I086)
  2361. # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM)
  2362. # define LZO_SIZEOF_VOID_P 2
  2363. # elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE)
  2364. # define LZO_SIZEOF_VOID_P 4
  2365. # else
  2366. # error "invalid LZO_ARCH_I086 memory model"
  2367. # endif
  2368. #elif (LZO_ARCH_M16C)
  2369. # if defined(__m32c_cpu__) || defined(__m32cm_cpu__)
  2370. # define LZO_SIZEOF_VOID_P 4
  2371. # else
  2372. # define LZO_SIZEOF_VOID_P 2
  2373. # endif
  2374. #elif (LZO_ARCH_SPU)
  2375. # define LZO_SIZEOF_VOID_P 4
  2376. #elif (LZO_ARCH_Z80)
  2377. # define LZO_SIZEOF_VOID_P 2
  2378. #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__))
  2379. # define LZO_SIZEOF_VOID_P 4
  2380. #elif (LZO_OS_OS400 || defined(__OS400__))
  2381. # if defined(__LLP64_IFC__)
  2382. # define LZO_SIZEOF_VOID_P 8
  2383. # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG
  2384. # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG
  2385. # else
  2386. # define LZO_SIZEOF_VOID_P 16
  2387. # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG
  2388. # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG
  2389. # endif
  2390. #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64)
  2391. # define LZO_SIZEOF_VOID_P 8
  2392. # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG
  2393. # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG
  2394. #endif
  2395. #endif
  2396. #if !defined(LZO_SIZEOF_VOID_P)
  2397. # define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG
  2398. #endif
  2399. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *))
  2400. #if !defined(LZO_SIZEOF_SIZE_T)
  2401. #if (LZO_ARCH_I086 || LZO_ARCH_M16C)
  2402. # define LZO_SIZEOF_SIZE_T 2
  2403. #endif
  2404. #endif
  2405. #if !defined(LZO_SIZEOF_SIZE_T)
  2406. # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P
  2407. #endif
  2408. #if defined(offsetof)
  2409. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t))
  2410. #endif
  2411. #if !defined(LZO_SIZEOF_PTRDIFF_T)
  2412. #if (LZO_ARCH_I086)
  2413. # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE)
  2414. # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P
  2415. # elif (LZO_MM_COMPACT || LZO_MM_LARGE)
  2416. # if (LZO_CC_BORLANDC || LZO_CC_TURBOC)
  2417. # define LZO_SIZEOF_PTRDIFF_T 4
  2418. # else
  2419. # define LZO_SIZEOF_PTRDIFF_T 2
  2420. # endif
  2421. # else
  2422. # error "invalid LZO_ARCH_I086 memory model"
  2423. # endif
  2424. #endif
  2425. #endif
  2426. #if !defined(LZO_SIZEOF_PTRDIFF_T)
  2427. # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T
  2428. #endif
  2429. #if defined(offsetof)
  2430. LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
  2431. #endif
  2432. #if !defined(LZO_WORDSIZE)
  2433. # define LZO_WORDSIZE LZO_SIZEOF_VOID_P
  2434. #endif
  2435. #if (LZO_ABI_NEUTRAL_ENDIAN)
  2436. # undef LZO_ABI_BIG_ENDIAN
  2437. # undef LZO_ABI_LITTLE_ENDIAN
  2438. #elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN)
  2439. #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP)
  2440. # define LZO_ABI_BIG_ENDIAN 1
  2441. #elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64)
  2442. # define LZO_ABI_LITTLE_ENDIAN 1
  2443. #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430 || LZO_ARCH_RISCV)
  2444. # define LZO_ABI_LITTLE_ENDIAN 1
  2445. #elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU)
  2446. # define LZO_ABI_BIG_ENDIAN 1
  2447. #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__)
  2448. # if (__LITTLE_ENDIAN__ == 1)
  2449. # define LZO_ABI_LITTLE_ENDIAN 1
  2450. # else
  2451. # define LZO_ABI_BIG_ENDIAN 1
  2452. # endif
  2453. #elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
  2454. # define LZO_ABI_BIG_ENDIAN 1
  2455. #elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
  2456. # define LZO_ABI_LITTLE_ENDIAN 1
  2457. #elif 1 && (LZO_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0)
  2458. # define LZO_ABI_BIG_ENDIAN 1
  2459. #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__)
  2460. # define LZO_ABI_BIG_ENDIAN 1
  2461. #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__)
  2462. # define LZO_ABI_LITTLE_ENDIAN 1
  2463. #elif 1 && (LZO_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32)
  2464. # define LZO_ABI_LITTLE_ENDIAN 1
  2465. #elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC)
  2466. # if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
  2467. # error "unexpected configuration - check your compiler defines"
  2468. # elif defined(__BIG_ENDIAN)
  2469. # define LZO_ABI_BIG_ENDIAN 1
  2470. # else
  2471. # define LZO_ABI_LITTLE_ENDIAN 1
  2472. # endif
  2473. # define LZO_ABI_LITTLE_ENDIAN 1
  2474. #elif 1 && (LZO_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0)
  2475. # define LZO_ABI_BIG_ENDIAN 1
  2476. #elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__)
  2477. # define LZO_ABI_BIG_ENDIAN 1
  2478. #elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__)
  2479. # define LZO_ABI_LITTLE_ENDIAN 1
  2480. #elif 1 && (LZO_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32)
  2481. # define LZO_ABI_LITTLE_ENDIAN 1
  2482. #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__)
  2483. # define LZO_ABI_BIG_ENDIAN 1
  2484. #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__)
  2485. # define LZO_ABI_LITTLE_ENDIAN 1
  2486. #endif
  2487. #endif
  2488. #if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN)
  2489. # error "unexpected configuration - check your compiler defines"
  2490. #endif
  2491. #if (LZO_ABI_BIG_ENDIAN)
  2492. # define LZO_INFO_ABI_ENDIAN "be"
  2493. #elif (LZO_ABI_LITTLE_ENDIAN)
  2494. # define LZO_INFO_ABI_ENDIAN "le"
  2495. #elif (LZO_ABI_NEUTRAL_ENDIAN)
  2496. # define LZO_INFO_ABI_ENDIAN "neutral"
  2497. #endif
  2498. #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2)
  2499. # define LZO_ABI_I8LP16 1
  2500. # define LZO_INFO_ABI_PM "i8lp16"
  2501. #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2)
  2502. # define LZO_ABI_ILP16 1
  2503. # define LZO_INFO_ABI_PM "ilp16"
  2504. #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4)
  2505. # define LZO_ABI_LP32 1
  2506. # define LZO_INFO_ABI_PM "lp32"
  2507. #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4)
  2508. # define LZO_ABI_ILP32 1
  2509. # define LZO_INFO_ABI_PM "ilp32"
  2510. #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8)
  2511. # define LZO_ABI_LLP64 1
  2512. # define LZO_INFO_ABI_PM "llp64"
  2513. #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8)
  2514. # define LZO_ABI_LP64 1
  2515. # define LZO_INFO_ABI_PM "lp64"
  2516. #elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8)
  2517. # define LZO_ABI_ILP64 1
  2518. # define LZO_INFO_ABI_PM "ilp64"
  2519. #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4)
  2520. # define LZO_ABI_IP32L64 1
  2521. # define LZO_INFO_ABI_PM "ip32l64"
  2522. #endif
  2523. #if (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_VOID_P == 4 && LZO_WORDSIZE == 8)
  2524. # define LZO_ABI_IP32W64 1
  2525. # ifndef LZO_INFO_ABI_PM
  2526. # define LZO_INFO_ABI_PM "ip32w64"
  2527. # endif
  2528. #endif
  2529. #if 0
  2530. #elif !defined(__LZO_LIBC_OVERRIDE)
  2531. #if (LZO_LIBC_NAKED)
  2532. # define LZO_INFO_LIBC "naked"
  2533. #elif (LZO_LIBC_FREESTANDING)
  2534. # define LZO_INFO_LIBC "freestanding"
  2535. #elif (LZO_LIBC_MOSTLY_FREESTANDING)
  2536. # define LZO_INFO_LIBC "mfreestanding"
  2537. #elif (LZO_LIBC_ISOC90)
  2538. # define LZO_INFO_LIBC "isoc90"
  2539. #elif (LZO_LIBC_ISOC99)
  2540. # define LZO_INFO_LIBC "isoc99"
  2541. #elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION)
  2542. # define LZO_LIBC_ISOC90 1
  2543. # define LZO_INFO_LIBC "isoc90"
  2544. #elif defined(__dietlibc__)
  2545. # define LZO_LIBC_DIETLIBC 1
  2546. # define LZO_INFO_LIBC "dietlibc"
  2547. #elif defined(_NEWLIB_VERSION)
  2548. # define LZO_LIBC_NEWLIB 1
  2549. # define LZO_INFO_LIBC "newlib"
  2550. #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__)
  2551. # if defined(__UCLIBC_SUBLEVEL__)
  2552. # define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0))
  2553. # else
  2554. # define LZO_LIBC_UCLIBC 0x00090bL
  2555. # endif
  2556. # define LZO_INFO_LIBC "uc" "libc"
  2557. #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__)
  2558. # define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100)
  2559. # define LZO_INFO_LIBC "glibc"
  2560. #elif (LZO_CC_MWERKS) && defined(__MSL__)
  2561. # define LZO_LIBC_MSL __MSL__
  2562. # define LZO_INFO_LIBC "msl"
  2563. #elif 1 && defined(__IAR_SYSTEMS_ICC__)
  2564. # define LZO_LIBC_ISOC90 1
  2565. # define LZO_INFO_LIBC "isoc90"
  2566. #else
  2567. # define LZO_LIBC_DEFAULT 1
  2568. # define LZO_INFO_LIBC "default"
  2569. #endif
  2570. #endif
  2571. #if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC))
  2572. # define LZO_ASM_SYNTAX_MSC 1
  2573. #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC))
  2574. #elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul))
  2575. #elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE))
  2576. # define LZO_ASM_SYNTAX_GNUC 1
  2577. #elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE))
  2578. # define LZO_ASM_SYNTAX_GNUC 1
  2579. #elif (LZO_CC_GNUC)
  2580. # define LZO_ASM_SYNTAX_GNUC 1
  2581. #endif
  2582. #if (LZO_ASM_SYNTAX_GNUC)
  2583. #if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul))
  2584. # define __LZO_ASM_CLOBBER "ax"
  2585. # define __LZO_ASM_CLOBBER_LIST_CC /*empty*/
  2586. # define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/
  2587. # define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/
  2588. #elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000))
  2589. # define __LZO_ASM_CLOBBER "memory"
  2590. # define __LZO_ASM_CLOBBER_LIST_CC /*empty*/
  2591. # define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory"
  2592. # define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/
  2593. #else
  2594. # define __LZO_ASM_CLOBBER "cc", "memory"
  2595. # define __LZO_ASM_CLOBBER_LIST_CC : "cc"
  2596. # define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory"
  2597. # define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/
  2598. #endif
  2599. #endif
  2600. #if (LZO_ARCH_ALPHA)
  2601. # define LZO_OPT_AVOID_UINT_INDEX 1
  2602. #elif (LZO_ARCH_AMD64)
  2603. # define LZO_OPT_AVOID_INT_INDEX 1
  2604. # define LZO_OPT_AVOID_UINT_INDEX 1
  2605. # ifndef LZO_OPT_UNALIGNED16
  2606. # define LZO_OPT_UNALIGNED16 1
  2607. # endif
  2608. # ifndef LZO_OPT_UNALIGNED32
  2609. # define LZO_OPT_UNALIGNED32 1
  2610. # endif
  2611. # ifndef LZO_OPT_UNALIGNED64
  2612. # define LZO_OPT_UNALIGNED64 1
  2613. # endif
  2614. #elif (LZO_ARCH_ARM)
  2615. # if defined(__ARM_FEATURE_UNALIGNED)
  2616. # if ((__ARM_FEATURE_UNALIGNED)+0)
  2617. # ifndef LZO_OPT_UNALIGNED16
  2618. # define LZO_OPT_UNALIGNED16 1
  2619. # endif
  2620. # ifndef LZO_OPT_UNALIGNED32
  2621. # define LZO_OPT_UNALIGNED32 1
  2622. # endif
  2623. # endif
  2624. # elif 1 && (LZO_ARCH_ARM_THUMB2)
  2625. # ifndef LZO_OPT_UNALIGNED16
  2626. # define LZO_OPT_UNALIGNED16 1
  2627. # endif
  2628. # ifndef LZO_OPT_UNALIGNED32
  2629. # define LZO_OPT_UNALIGNED32 1
  2630. # endif
  2631. # elif 1 && defined(__ARM_ARCH) && ((__ARM_ARCH)+0 >= 7)
  2632. # ifndef LZO_OPT_UNALIGNED16
  2633. # define LZO_OPT_UNALIGNED16 1
  2634. # endif
  2635. # ifndef LZO_OPT_UNALIGNED32
  2636. # define LZO_OPT_UNALIGNED32 1
  2637. # endif
  2638. # elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 7)
  2639. # ifndef LZO_OPT_UNALIGNED16
  2640. # define LZO_OPT_UNALIGNED16 1
  2641. # endif
  2642. # ifndef LZO_OPT_UNALIGNED32
  2643. # define LZO_OPT_UNALIGNED32 1
  2644. # endif
  2645. # elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 6) && (defined(__TARGET_PROFILE_A) || defined(__TARGET_PROFILE_R))
  2646. # ifndef LZO_OPT_UNALIGNED16
  2647. # define LZO_OPT_UNALIGNED16 1
  2648. # endif
  2649. # ifndef LZO_OPT_UNALIGNED32
  2650. # define LZO_OPT_UNALIGNED32 1
  2651. # endif
  2652. # elif 1 && defined(_MSC_VER) && defined(_M_ARM) && ((_M_ARM)+0 >= 7)
  2653. # ifndef LZO_OPT_UNALIGNED16
  2654. # define LZO_OPT_UNALIGNED16 1
  2655. # endif
  2656. # ifndef LZO_OPT_UNALIGNED32
  2657. # define LZO_OPT_UNALIGNED32 1
  2658. # endif
  2659. # endif
  2660. #elif (LZO_ARCH_ARM64)
  2661. # ifndef LZO_OPT_UNALIGNED16
  2662. # define LZO_OPT_UNALIGNED16 1
  2663. # endif
  2664. # ifndef LZO_OPT_UNALIGNED32
  2665. # define LZO_OPT_UNALIGNED32 1
  2666. # endif
  2667. # ifndef LZO_OPT_UNALIGNED64
  2668. # define LZO_OPT_UNALIGNED64 1
  2669. # endif
  2670. #elif (LZO_ARCH_CRIS)
  2671. # ifndef LZO_OPT_UNALIGNED16
  2672. # define LZO_OPT_UNALIGNED16 1
  2673. # endif
  2674. # ifndef LZO_OPT_UNALIGNED32
  2675. # define LZO_OPT_UNALIGNED32 1
  2676. # endif
  2677. #elif (LZO_ARCH_I386)
  2678. # ifndef LZO_OPT_UNALIGNED16
  2679. # define LZO_OPT_UNALIGNED16 1
  2680. # endif
  2681. # ifndef LZO_OPT_UNALIGNED32
  2682. # define LZO_OPT_UNALIGNED32 1
  2683. # endif
  2684. #elif (LZO_ARCH_IA64)
  2685. # define LZO_OPT_AVOID_INT_INDEX 1
  2686. # define LZO_OPT_AVOID_UINT_INDEX 1
  2687. # define LZO_OPT_PREFER_POSTINC 1
  2688. #elif (LZO_ARCH_M68K)
  2689. # define LZO_OPT_PREFER_POSTINC 1
  2690. # define LZO_OPT_PREFER_PREDEC 1
  2691. # if defined(__mc68020__) && !defined(__mcoldfire__)
  2692. # ifndef LZO_OPT_UNALIGNED16
  2693. # define LZO_OPT_UNALIGNED16 1
  2694. # endif
  2695. # ifndef LZO_OPT_UNALIGNED32
  2696. # define LZO_OPT_UNALIGNED32 1
  2697. # endif
  2698. # endif
  2699. #elif (LZO_ARCH_MIPS)
  2700. # define LZO_OPT_AVOID_UINT_INDEX 1
  2701. #elif (LZO_ARCH_POWERPC)
  2702. # define LZO_OPT_PREFER_PREINC 1
  2703. # define LZO_OPT_PREFER_PREDEC 1
  2704. # if (LZO_ABI_BIG_ENDIAN) || (LZO_WORDSIZE == 8)
  2705. # ifndef LZO_OPT_UNALIGNED16
  2706. # define LZO_OPT_UNALIGNED16 1
  2707. # endif
  2708. # ifndef LZO_OPT_UNALIGNED32
  2709. # define LZO_OPT_UNALIGNED32 1
  2710. # endif
  2711. # if (LZO_WORDSIZE == 8)
  2712. # ifndef LZO_OPT_UNALIGNED64
  2713. # define LZO_OPT_UNALIGNED64 1
  2714. # endif
  2715. # endif
  2716. # endif
  2717. #elif (LZO_ARCH_RISCV)
  2718. # define LZO_OPT_AVOID_UINT_INDEX 1
  2719. # ifndef LZO_OPT_UNALIGNED16
  2720. # define LZO_OPT_UNALIGNED16 1
  2721. # endif
  2722. # ifndef LZO_OPT_UNALIGNED32
  2723. # define LZO_OPT_UNALIGNED32 1
  2724. # endif
  2725. # if (LZO_WORDSIZE == 8)
  2726. # ifndef LZO_OPT_UNALIGNED64
  2727. # define LZO_OPT_UNALIGNED64 1
  2728. # endif
  2729. # endif
  2730. #elif (LZO_ARCH_S390)
  2731. # ifndef LZO_OPT_UNALIGNED16
  2732. # define LZO_OPT_UNALIGNED16 1
  2733. # endif
  2734. # ifndef LZO_OPT_UNALIGNED32
  2735. # define LZO_OPT_UNALIGNED32 1
  2736. # endif
  2737. # if (LZO_WORDSIZE == 8)
  2738. # ifndef LZO_OPT_UNALIGNED64
  2739. # define LZO_OPT_UNALIGNED64 1
  2740. # endif
  2741. # endif
  2742. #elif (LZO_ARCH_SH)
  2743. # define LZO_OPT_PREFER_POSTINC 1
  2744. # define LZO_OPT_PREFER_PREDEC 1
  2745. #endif
  2746. #ifndef LZO_CFG_NO_INLINE_ASM
  2747. #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC)
  2748. # define LZO_CFG_NO_INLINE_ASM 1
  2749. #elif (LZO_CC_LLVM)
  2750. # define LZO_CFG_NO_INLINE_ASM 1
  2751. #endif
  2752. #endif
  2753. #if (LZO_CFG_NO_INLINE_ASM)
  2754. # undef LZO_ASM_SYNTAX_MSC
  2755. # undef LZO_ASM_SYNTAX_GNUC
  2756. # undef __LZO_ASM_CLOBBER
  2757. # undef __LZO_ASM_CLOBBER_LIST_CC
  2758. # undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY
  2759. # undef __LZO_ASM_CLOBBER_LIST_EMPTY
  2760. #endif
  2761. #ifndef LZO_CFG_NO_UNALIGNED
  2762. #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC)
  2763. # define LZO_CFG_NO_UNALIGNED 1
  2764. #endif
  2765. #endif
  2766. #if (LZO_CFG_NO_UNALIGNED)
  2767. # undef LZO_OPT_UNALIGNED16
  2768. # undef LZO_OPT_UNALIGNED32
  2769. # undef LZO_OPT_UNALIGNED64
  2770. #endif
  2771. #if defined(__LZO_INFOSTR_MM)
  2772. #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM))
  2773. # define __LZO_INFOSTR_MM ""
  2774. #elif defined(LZO_INFO_MM)
  2775. # define __LZO_INFOSTR_MM "." LZO_INFO_MM
  2776. #else
  2777. # define __LZO_INFOSTR_MM ""
  2778. #endif
  2779. #if defined(__LZO_INFOSTR_PM)
  2780. #elif defined(LZO_INFO_ABI_PM)
  2781. # define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM
  2782. #else
  2783. # define __LZO_INFOSTR_PM ""
  2784. #endif
  2785. #if defined(__LZO_INFOSTR_ENDIAN)
  2786. #elif defined(LZO_INFO_ABI_ENDIAN)
  2787. # define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN
  2788. #else
  2789. # define __LZO_INFOSTR_ENDIAN ""
  2790. #endif
  2791. #if defined(__LZO_INFOSTR_OSNAME)
  2792. #elif defined(LZO_INFO_OS_CONSOLE)
  2793. # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE
  2794. #elif defined(LZO_INFO_OS_POSIX)
  2795. # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX
  2796. #else
  2797. # define __LZO_INFOSTR_OSNAME LZO_INFO_OS
  2798. #endif
  2799. #if defined(__LZO_INFOSTR_LIBC)
  2800. #elif defined(LZO_INFO_LIBC)
  2801. # define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC
  2802. #else
  2803. # define __LZO_INFOSTR_LIBC ""
  2804. #endif
  2805. #if defined(__LZO_INFOSTR_CCVER)
  2806. #elif defined(LZO_INFO_CCVER)
  2807. # define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER
  2808. #else
  2809. # define __LZO_INFOSTR_CCVER ""
  2810. #endif
  2811. #define LZO_INFO_STRING \
  2812. LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \
  2813. " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER
  2814. #if !(LZO_CFG_SKIP_LZO_TYPES)
  2815. #if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0))
  2816. # error "missing defines for sizes"
  2817. #endif
  2818. #if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0))
  2819. # error "missing defines for sizes"
  2820. #endif
  2821. #define LZO_TYPEOF_CHAR 1u
  2822. #define LZO_TYPEOF_SHORT 2u
  2823. #define LZO_TYPEOF_INT 3u
  2824. #define LZO_TYPEOF_LONG 4u
  2825. #define LZO_TYPEOF_LONG_LONG 5u
  2826. #define LZO_TYPEOF___INT8 17u
  2827. #define LZO_TYPEOF___INT16 18u
  2828. #define LZO_TYPEOF___INT32 19u
  2829. #define LZO_TYPEOF___INT64 20u
  2830. #define LZO_TYPEOF___INT128 21u
  2831. #define LZO_TYPEOF___INT256 22u
  2832. #define LZO_TYPEOF___MODE_QI 33u
  2833. #define LZO_TYPEOF___MODE_HI 34u
  2834. #define LZO_TYPEOF___MODE_SI 35u
  2835. #define LZO_TYPEOF___MODE_DI 36u
  2836. #define LZO_TYPEOF___MODE_TI 37u
  2837. #define LZO_TYPEOF_CHAR_P 129u
  2838. #if !defined(lzo_llong_t)
  2839. #if (LZO_SIZEOF_LONG_LONG+0 > 0)
  2840. # if !(LZO_LANG_ASSEMBLER)
  2841. __lzo_gnuc_extension__ typedef long long lzo_llong_t__;
  2842. __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
  2843. # endif
  2844. # define lzo_llong_t lzo_llong_t__
  2845. # define lzo_ullong_t lzo_ullong_t__
  2846. #endif
  2847. #endif
  2848. #if !defined(lzo_int16e_t)
  2849. #if (LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) && (LZO_SIZEOF_SHORT != 2)
  2850. # undef LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T
  2851. #endif
  2852. #if (LZO_SIZEOF_LONG == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT)
  2853. # define lzo_int16e_t long
  2854. # define lzo_uint16e_t unsigned long
  2855. # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG
  2856. #elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT)
  2857. # define lzo_int16e_t int
  2858. # define lzo_uint16e_t unsigned int
  2859. # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT
  2860. #elif (LZO_SIZEOF_SHORT == 2)
  2861. # define lzo_int16e_t short int
  2862. # define lzo_uint16e_t unsigned short int
  2863. # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT
  2864. #elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
  2865. # if !(LZO_LANG_ASSEMBLER)
  2866. typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
  2867. typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
  2868. # endif
  2869. # define lzo_int16e_t lzo_int16e_hi_t__
  2870. # define lzo_uint16e_t lzo_uint16e_hi_t__
  2871. # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI
  2872. #elif (LZO_SIZEOF___INT16 == 2)
  2873. # define lzo_int16e_t __int16
  2874. # define lzo_uint16e_t unsigned __int16
  2875. # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16
  2876. #else
  2877. #endif
  2878. #endif
  2879. #if defined(lzo_int16e_t)
  2880. # define LZO_SIZEOF_LZO_INT16E_T 2
  2881. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2)
  2882. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T)
  2883. #endif
  2884. #if !defined(lzo_int32e_t)
  2885. #if (LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) && (LZO_SIZEOF_INT != 4)
  2886. # undef LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T
  2887. #endif
  2888. #if (LZO_SIZEOF_LONG == 4) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT)
  2889. # define lzo_int32e_t long int
  2890. # define lzo_uint32e_t unsigned long int
  2891. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG
  2892. #elif (LZO_SIZEOF_INT == 4)
  2893. # define lzo_int32e_t int
  2894. # define lzo_uint32e_t unsigned int
  2895. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT
  2896. #elif (LZO_SIZEOF_SHORT == 4)
  2897. # define lzo_int32e_t short int
  2898. # define lzo_uint32e_t unsigned short int
  2899. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_SHORT
  2900. #elif (LZO_SIZEOF_LONG_LONG == 4)
  2901. # define lzo_int32e_t lzo_llong_t
  2902. # define lzo_uint32e_t lzo_ullong_t
  2903. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG
  2904. #elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
  2905. # if !(LZO_LANG_ASSEMBLER)
  2906. typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
  2907. typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
  2908. # endif
  2909. # define lzo_int32e_t lzo_int32e_si_t__
  2910. # define lzo_uint32e_t lzo_uint32e_si_t__
  2911. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
  2912. #elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
  2913. # if !(LZO_LANG_ASSEMBLER)
  2914. typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
  2915. typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
  2916. # endif
  2917. # define lzo_int32e_t lzo_int32e_si_t__
  2918. # define lzo_uint32e_t lzo_uint32e_si_t__
  2919. # define LZO_INT32_C(c) (c##LL)
  2920. # define LZO_UINT32_C(c) (c##ULL)
  2921. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
  2922. #elif (LZO_SIZEOF___INT32 == 4)
  2923. # define lzo_int32e_t __int32
  2924. # define lzo_uint32e_t unsigned __int32
  2925. # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32
  2926. #else
  2927. #endif
  2928. #endif
  2929. #if defined(lzo_int32e_t)
  2930. # define LZO_SIZEOF_LZO_INT32E_T 4
  2931. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4)
  2932. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T)
  2933. #endif
  2934. #if !defined(lzo_int64e_t)
  2935. #if (LZO_SIZEOF___INT64 == 8)
  2936. # if (LZO_CC_BORLANDC) && !defined(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T)
  2937. # define LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T LZO_TYPEOF___INT64
  2938. # endif
  2939. #endif
  2940. #if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && (LZO_SIZEOF_LONG_LONG != 8)
  2941. # undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T
  2942. #endif
  2943. #if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) && (LZO_SIZEOF___INT64 != 8)
  2944. # undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T
  2945. #endif
  2946. #if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
  2947. # define lzo_int64e_t int
  2948. # define lzo_uint64e_t unsigned int
  2949. # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT
  2950. #elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64)
  2951. # define lzo_int64e_t long int
  2952. # define lzo_uint64e_t unsigned long int
  2953. # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG
  2954. #elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64)
  2955. # define lzo_int64e_t lzo_llong_t
  2956. # define lzo_uint64e_t lzo_ullong_t
  2957. # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG_LONG
  2958. # if (LZO_CC_BORLANDC)
  2959. # define LZO_INT64_C(c) ((c) + 0ll)
  2960. # define LZO_UINT64_C(c) ((c) + 0ull)
  2961. # elif 0
  2962. # define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL))
  2963. # define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL))
  2964. # else
  2965. # define LZO_INT64_C(c) (c##LL)
  2966. # define LZO_UINT64_C(c) (c##ULL)
  2967. # endif
  2968. #elif (LZO_SIZEOF___INT64 == 8)
  2969. # define lzo_int64e_t __int64
  2970. # define lzo_uint64e_t unsigned __int64
  2971. # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF___INT64
  2972. # if (LZO_CC_BORLANDC)
  2973. # define LZO_INT64_C(c) ((c) + 0i64)
  2974. # define LZO_UINT64_C(c) ((c) + 0ui64)
  2975. # else
  2976. # define LZO_INT64_C(c) (c##i64)
  2977. # define LZO_UINT64_C(c) (c##ui64)
  2978. # endif
  2979. #else
  2980. #endif
  2981. #endif
  2982. #if defined(lzo_int64e_t)
  2983. # define LZO_SIZEOF_LZO_INT64E_T 8
  2984. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8)
  2985. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T)
  2986. #endif
  2987. #if !defined(lzo_int32l_t)
  2988. #if defined(lzo_int32e_t)
  2989. # define lzo_int32l_t lzo_int32e_t
  2990. # define lzo_uint32l_t lzo_uint32e_t
  2991. # define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T
  2992. # define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T
  2993. #elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
  2994. # define lzo_int32l_t int
  2995. # define lzo_uint32l_t unsigned int
  2996. # define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT
  2997. # define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT
  2998. #elif (LZO_SIZEOF_LONG >= 4)
  2999. # define lzo_int32l_t long int
  3000. # define lzo_uint32l_t unsigned long int
  3001. # define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG
  3002. # define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_LONG
  3003. #else
  3004. # error "lzo_int32l_t"
  3005. #endif
  3006. #endif
  3007. #if 1
  3008. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4)
  3009. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T)
  3010. #endif
  3011. #if !defined(lzo_int64l_t)
  3012. #if defined(lzo_int64e_t)
  3013. # define lzo_int64l_t lzo_int64e_t
  3014. # define lzo_uint64l_t lzo_uint64e_t
  3015. # define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T
  3016. # define LZO_TYPEOF_LZO_INT64L_T LZO_TYPEOF_LZO_INT64E_T
  3017. #else
  3018. #endif
  3019. #endif
  3020. #if defined(lzo_int64l_t)
  3021. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8)
  3022. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T)
  3023. #endif
  3024. #if !defined(lzo_int32f_t)
  3025. #if (LZO_SIZEOF_SIZE_T >= 8)
  3026. # define lzo_int32f_t lzo_int64l_t
  3027. # define lzo_uint32f_t lzo_uint64l_t
  3028. # define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T
  3029. # define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT64L_T
  3030. #else
  3031. # define lzo_int32f_t lzo_int32l_t
  3032. # define lzo_uint32f_t lzo_uint32l_t
  3033. # define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T
  3034. # define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT32L_T
  3035. #endif
  3036. #endif
  3037. #if 1
  3038. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4)
  3039. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T)
  3040. #endif
  3041. #if !defined(lzo_int64f_t)
  3042. #if defined(lzo_int64l_t)
  3043. # define lzo_int64f_t lzo_int64l_t
  3044. # define lzo_uint64f_t lzo_uint64l_t
  3045. # define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T
  3046. # define LZO_TYPEOF_LZO_INT64F_T LZO_TYPEOF_LZO_INT64L_T
  3047. #else
  3048. #endif
  3049. #endif
  3050. #if defined(lzo_int64f_t)
  3051. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8)
  3052. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T)
  3053. #endif
  3054. #if !defined(lzo_intptr_t)
  3055. #if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16))
  3056. # define __LZO_INTPTR_T_IS_POINTER 1
  3057. # if !(LZO_LANG_ASSEMBLER)
  3058. typedef char * lzo_intptr_t;
  3059. typedef char * lzo_uintptr_t;
  3060. # endif
  3061. # define lzo_intptr_t lzo_intptr_t
  3062. # define lzo_uintptr_t lzo_uintptr_t
  3063. # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P
  3064. # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P
  3065. #elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
  3066. # if !(LZO_LANG_ASSEMBLER)
  3067. typedef __w64 int lzo_intptr_t;
  3068. typedef __w64 unsigned int lzo_uintptr_t;
  3069. # endif
  3070. # define lzo_intptr_t lzo_intptr_t
  3071. # define lzo_uintptr_t lzo_uintptr_t
  3072. # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
  3073. # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT
  3074. #elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P)
  3075. # define lzo_intptr_t short
  3076. # define lzo_uintptr_t unsigned short
  3077. # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT
  3078. # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT
  3079. #elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
  3080. # define lzo_intptr_t int
  3081. # define lzo_uintptr_t unsigned int
  3082. # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
  3083. # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT
  3084. #elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P)
  3085. # define lzo_intptr_t long
  3086. # define lzo_uintptr_t unsigned long
  3087. # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG
  3088. # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LONG
  3089. #elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P)
  3090. # define lzo_intptr_t lzo_int64l_t
  3091. # define lzo_uintptr_t lzo_uint64l_t
  3092. # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T
  3093. # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LZO_INT64L_T
  3094. #else
  3095. # error "lzo_intptr_t"
  3096. #endif
  3097. #endif
  3098. #if 1
  3099. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *))
  3100. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t))
  3101. #endif
  3102. #if !defined(lzo_word_t)
  3103. #if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0)
  3104. #if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER)
  3105. # define lzo_word_t lzo_uintptr_t
  3106. # define lzo_sword_t lzo_intptr_t
  3107. # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T
  3108. # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LZO_INTPTR_T
  3109. #elif (LZO_WORDSIZE == LZO_SIZEOF_LONG)
  3110. # define lzo_word_t unsigned long
  3111. # define lzo_sword_t long
  3112. # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG
  3113. # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG
  3114. #elif (LZO_WORDSIZE == LZO_SIZEOF_INT)
  3115. # define lzo_word_t unsigned int
  3116. # define lzo_sword_t int
  3117. # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT
  3118. # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT
  3119. #elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT)
  3120. # define lzo_word_t unsigned short
  3121. # define lzo_sword_t short
  3122. # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT
  3123. # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_SHORT
  3124. #elif (LZO_WORDSIZE == 1)
  3125. # define lzo_word_t unsigned char
  3126. # define lzo_sword_t signed char
  3127. # define LZO_SIZEOF_LZO_WORD_T 1
  3128. # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_CHAR
  3129. #elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T)
  3130. # define lzo_word_t lzo_uint64l_t
  3131. # define lzo_sword_t lzo_int64l_t
  3132. # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
  3133. # define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
  3134. #elif (LZO_ARCH_SPU) && (LZO_CC_GNUC)
  3135. #if 0
  3136. # if !(LZO_LANG_ASSEMBLER)
  3137. typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__)));
  3138. typedef int lzo_sword_t __attribute__((__mode__(__V16QI__)));
  3139. # endif
  3140. # define lzo_word_t lzo_word_t
  3141. # define lzo_sword_t lzo_sword_t
  3142. # define LZO_SIZEOF_LZO_WORD_T 16
  3143. # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF___MODE_V16QI
  3144. #endif
  3145. #else
  3146. # error "lzo_word_t"
  3147. #endif
  3148. #endif
  3149. #endif
  3150. #if 1 && defined(lzo_word_t)
  3151. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE)
  3152. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE)
  3153. #endif
  3154. #if 1
  3155. #define lzo_int8_t signed char
  3156. #define lzo_uint8_t unsigned char
  3157. #define LZO_SIZEOF_LZO_INT8_T 1
  3158. #define LZO_TYPEOF_LZO_INT8_T LZO_TYPEOF_CHAR
  3159. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1)
  3160. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t))
  3161. #endif
  3162. #if defined(lzo_int16e_t)
  3163. #define lzo_int16_t lzo_int16e_t
  3164. #define lzo_uint16_t lzo_uint16e_t
  3165. #define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T
  3166. #define LZO_TYPEOF_LZO_INT16_T LZO_TYPEOF_LZO_INT16E_T
  3167. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2)
  3168. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t))
  3169. #endif
  3170. #if defined(lzo_int32e_t)
  3171. #define lzo_int32_t lzo_int32e_t
  3172. #define lzo_uint32_t lzo_uint32e_t
  3173. #define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T
  3174. #define LZO_TYPEOF_LZO_INT32_T LZO_TYPEOF_LZO_INT32E_T
  3175. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4)
  3176. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t))
  3177. #endif
  3178. #if defined(lzo_int64e_t)
  3179. #define lzo_int64_t lzo_int64e_t
  3180. #define lzo_uint64_t lzo_uint64e_t
  3181. #define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T
  3182. #define LZO_TYPEOF_LZO_INT64_T LZO_TYPEOF_LZO_INT64E_T
  3183. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8)
  3184. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t))
  3185. #endif
  3186. #if 1
  3187. #define lzo_int_least32_t lzo_int32l_t
  3188. #define lzo_uint_least32_t lzo_uint32l_t
  3189. #define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T
  3190. #define LZO_TYPEOF_LZO_INT_LEAST32_T LZO_TYPEOF_LZO_INT32L_T
  3191. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4)
  3192. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t))
  3193. #endif
  3194. #if defined(lzo_int64l_t)
  3195. #define lzo_int_least64_t lzo_int64l_t
  3196. #define lzo_uint_least64_t lzo_uint64l_t
  3197. #define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T
  3198. #define LZO_TYPEOF_LZO_INT_LEAST64_T LZO_TYPEOF_LZO_INT64L_T
  3199. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8)
  3200. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t))
  3201. #endif
  3202. #if 1
  3203. #define lzo_int_fast32_t lzo_int32f_t
  3204. #define lzo_uint_fast32_t lzo_uint32f_t
  3205. #define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T
  3206. #define LZO_TYPEOF_LZO_INT_FAST32_T LZO_TYPEOF_LZO_INT32F_T
  3207. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4)
  3208. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t))
  3209. #endif
  3210. #if defined(lzo_int64f_t)
  3211. #define lzo_int_fast64_t lzo_int64f_t
  3212. #define lzo_uint_fast64_t lzo_uint64f_t
  3213. #define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T
  3214. #define LZO_TYPEOF_LZO_INT_FAST64_T LZO_TYPEOF_LZO_INT64F_T
  3215. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8)
  3216. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t))
  3217. #endif
  3218. #if !defined(LZO_INT16_C)
  3219. # if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2)
  3220. # define LZO_INT16_C(c) ((c) + 0)
  3221. # define LZO_UINT16_C(c) ((c) + 0U)
  3222. # elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2)
  3223. # define LZO_INT16_C(c) ((c) + 0L)
  3224. # define LZO_UINT16_C(c) ((c) + 0UL)
  3225. # elif (LZO_SIZEOF_INT >= 2)
  3226. # define LZO_INT16_C(c) (c)
  3227. # define LZO_UINT16_C(c) (c##U)
  3228. # elif (LZO_SIZEOF_LONG >= 2)
  3229. # define LZO_INT16_C(c) (c##L)
  3230. # define LZO_UINT16_C(c) (c##UL)
  3231. # else
  3232. # error "LZO_INT16_C"
  3233. # endif
  3234. #endif
  3235. #if !defined(LZO_INT32_C)
  3236. # if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4)
  3237. # define LZO_INT32_C(c) ((c) + 0)
  3238. # define LZO_UINT32_C(c) ((c) + 0U)
  3239. # elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4)
  3240. # define LZO_INT32_C(c) ((c) + 0L)
  3241. # define LZO_UINT32_C(c) ((c) + 0UL)
  3242. # elif (LZO_SIZEOF_INT >= 4)
  3243. # define LZO_INT32_C(c) (c)
  3244. # define LZO_UINT32_C(c) (c##U)
  3245. # elif (LZO_SIZEOF_LONG >= 4)
  3246. # define LZO_INT32_C(c) (c##L)
  3247. # define LZO_UINT32_C(c) (c##UL)
  3248. # elif (LZO_SIZEOF_LONG_LONG >= 4)
  3249. # define LZO_INT32_C(c) (c##LL)
  3250. # define LZO_UINT32_C(c) (c##ULL)
  3251. # else
  3252. # error "LZO_INT32_C"
  3253. # endif
  3254. #endif
  3255. #if !defined(LZO_INT64_C) && defined(lzo_int64l_t)
  3256. # if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8)
  3257. # define LZO_INT64_C(c) ((c) + 0)
  3258. # define LZO_UINT64_C(c) ((c) + 0U)
  3259. # elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8)
  3260. # define LZO_INT64_C(c) ((c) + 0L)
  3261. # define LZO_UINT64_C(c) ((c) + 0UL)
  3262. # elif (LZO_SIZEOF_INT >= 8)
  3263. # define LZO_INT64_C(c) (c)
  3264. # define LZO_UINT64_C(c) (c##U)
  3265. # elif (LZO_SIZEOF_LONG >= 8)
  3266. # define LZO_INT64_C(c) (c##L)
  3267. # define LZO_UINT64_C(c) (c##UL)
  3268. # else
  3269. # error "LZO_INT64_C"
  3270. # endif
  3271. #endif
  3272. #endif
  3273. #endif
  3274. #endif
  3275. #undef LZO_HAVE_CONFIG_H
  3276. #include "minilzo.h"
  3277. #if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x20a0)
  3278. # error "version mismatch in miniLZO source files"
  3279. #endif
  3280. #ifdef MINILZO_HAVE_CONFIG_H
  3281. # define LZO_HAVE_CONFIG_H 1
  3282. #endif
  3283. #ifndef __LZO_CONF_H
  3284. #define __LZO_CONF_H 1
  3285. #if !defined(__LZO_IN_MINILZO)
  3286. #if defined(LZO_CFG_FREESTANDING) && (LZO_CFG_FREESTANDING)
  3287. # define LZO_LIBC_FREESTANDING 1
  3288. # define LZO_OS_FREESTANDING 1
  3289. #endif
  3290. #if defined(LZO_CFG_EXTRA_CONFIG_HEADER)
  3291. # include LZO_CFG_EXTRA_CONFIG_HEADER
  3292. #endif
  3293. #if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED)
  3294. # error "include this file first"
  3295. #endif
  3296. #if defined(LZO_CFG_BUILD_DLL) && (LZO_CFG_BUILD_DLL+0) && !defined(__LZO_EXPORT1) && !defined(__LZO_EXPORT2) && 0
  3297. #ifndef __LZODEFS_H_INCLUDED
  3298. #if defined(LZO_HAVE_CONFIG_H)
  3299. # include <config.h>
  3300. #endif
  3301. #include <limits.h>
  3302. #include <stddef.h>
  3303. #include <lzo/lzodefs.h>
  3304. #endif
  3305. #endif
  3306. #include <lzo/lzoconf.h>
  3307. #if defined(LZO_CFG_EXTRA_CONFIG_HEADER2)
  3308. # include LZO_CFG_EXTRA_CONFIG_HEADER2
  3309. #endif
  3310. #endif
  3311. #if !defined(__LZOCONF_H_INCLUDED) || (LZO_VERSION+0 != 0x20a0)
  3312. # error "version mismatch"
  3313. #endif
  3314. #if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1100))
  3315. # pragma warning(disable: 4702)
  3316. #endif
  3317. #if (LZO_CC_MSC && (_MSC_VER >= 1000))
  3318. # pragma warning(disable: 4127 4701)
  3319. # pragma warning(disable: 4514 4710 4711)
  3320. #endif
  3321. #if (LZO_CC_MSC && (_MSC_VER >= 1300))
  3322. # pragma warning(disable: 4820)
  3323. #endif
  3324. #if (LZO_CC_MSC && (_MSC_VER >= 1800))
  3325. # pragma warning(disable: 4746)
  3326. #endif
  3327. #if (LZO_CC_INTELC && (__INTEL_COMPILER >= 900))
  3328. # pragma warning(disable: 1684)
  3329. #endif
  3330. #if (LZO_CC_SUNPROC)
  3331. #if !defined(__cplusplus)
  3332. # pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED)
  3333. # pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP)
  3334. # pragma error_messages(off,E_STATEMENT_NOT_REACHED)
  3335. #endif
  3336. #endif
  3337. #if !defined(__LZO_NOEXPORT1)
  3338. # define __LZO_NOEXPORT1 /*empty*/
  3339. #endif
  3340. #if !defined(__LZO_NOEXPORT2)
  3341. # define __LZO_NOEXPORT2 /*empty*/
  3342. #endif
  3343. #if 1
  3344. # define LZO_PUBLIC_DECL(r) LZO_EXTERN(r)
  3345. #endif
  3346. #if 1
  3347. # define LZO_PUBLIC_IMPL(r) LZO_PUBLIC(r)
  3348. #endif
  3349. #if !defined(LZO_LOCAL_DECL)
  3350. # define LZO_LOCAL_DECL(r) __LZO_EXTERN_C LZO_LOCAL_IMPL(r)
  3351. #endif
  3352. #if !defined(LZO_LOCAL_IMPL)
  3353. # define LZO_LOCAL_IMPL(r) __LZO_NOEXPORT1 r __LZO_NOEXPORT2 __LZO_CDECL
  3354. #endif
  3355. #if 1
  3356. # define LZO_STATIC_DECL(r) LZO_PRIVATE(r)
  3357. #endif
  3358. #if 1
  3359. # define LZO_STATIC_IMPL(r) LZO_PRIVATE(r)
  3360. #endif
  3361. #if defined(__LZO_IN_MINILZO) || (LZO_CFG_FREESTANDING)
  3362. #elif 1
  3363. # include <string.h>
  3364. #else
  3365. # define LZO_WANT_ACC_INCD_H 1
  3366. #endif
  3367. #if defined(LZO_HAVE_CONFIG_H)
  3368. # define LZO_CFG_NO_CONFIG_HEADER 1
  3369. #endif
  3370. #if 1 && !defined(LZO_CFG_FREESTANDING)
  3371. #if 1 && !defined(HAVE_STRING_H)
  3372. #define HAVE_STRING_H 1
  3373. #endif
  3374. #if 1 && !defined(HAVE_MEMCMP)
  3375. #define HAVE_MEMCMP 1
  3376. #endif
  3377. #if 1 && !defined(HAVE_MEMCPY)
  3378. #define HAVE_MEMCPY 1
  3379. #endif
  3380. #if 1 && !defined(HAVE_MEMMOVE)
  3381. #define HAVE_MEMMOVE 1
  3382. #endif
  3383. #if 1 && !defined(HAVE_MEMSET)
  3384. #define HAVE_MEMSET 1
  3385. #endif
  3386. #endif
  3387. #if 1 && defined(HAVE_STRING_H)
  3388. #include <string.h>
  3389. #endif
  3390. #if 1 || defined(lzo_int8_t) || defined(lzo_uint8_t)
  3391. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1)
  3392. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint8_t) == 1)
  3393. #endif
  3394. #if 1 || defined(lzo_int16_t) || defined(lzo_uint16_t)
  3395. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2)
  3396. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint16_t) == 2)
  3397. #endif
  3398. #if 1 || defined(lzo_int32_t) || defined(lzo_uint32_t)
  3399. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4)
  3400. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32_t) == 4)
  3401. #endif
  3402. #if defined(lzo_int64_t) || defined(lzo_uint64_t)
  3403. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8)
  3404. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64_t) == 8)
  3405. #endif
  3406. #if (LZO_CFG_FREESTANDING)
  3407. # undef HAVE_MEMCMP
  3408. # undef HAVE_MEMCPY
  3409. # undef HAVE_MEMMOVE
  3410. # undef HAVE_MEMSET
  3411. #endif
  3412. #if !(HAVE_MEMCMP)
  3413. # undef memcmp
  3414. # define memcmp(a,b,c) lzo_memcmp(a,b,c)
  3415. #else
  3416. # undef lzo_memcmp
  3417. # define lzo_memcmp(a,b,c) memcmp(a,b,c)
  3418. #endif
  3419. #if !(HAVE_MEMCPY)
  3420. # undef memcpy
  3421. # define memcpy(a,b,c) lzo_memcpy(a,b,c)
  3422. #else
  3423. # undef lzo_memcpy
  3424. # define lzo_memcpy(a,b,c) memcpy(a,b,c)
  3425. #endif
  3426. #if !(HAVE_MEMMOVE)
  3427. # undef memmove
  3428. # define memmove(a,b,c) lzo_memmove(a,b,c)
  3429. #else
  3430. # undef lzo_memmove
  3431. # define lzo_memmove(a,b,c) memmove(a,b,c)
  3432. #endif
  3433. #if !(HAVE_MEMSET)
  3434. # undef memset
  3435. # define memset(a,b,c) lzo_memset(a,b,c)
  3436. #else
  3437. # undef lzo_memset
  3438. # define lzo_memset(a,b,c) memset(a,b,c)
  3439. #endif
  3440. #undef NDEBUG
  3441. #if (LZO_CFG_FREESTANDING)
  3442. # undef LZO_DEBUG
  3443. # define NDEBUG 1
  3444. # undef assert
  3445. # define assert(e) ((void)0)
  3446. #else
  3447. # if !defined(LZO_DEBUG)
  3448. # define NDEBUG 1
  3449. # endif
  3450. # include <assert.h>
  3451. #endif
  3452. #if 0 && defined(__BOUNDS_CHECKING_ON)
  3453. # include <unchecked.h>
  3454. #else
  3455. # define BOUNDS_CHECKING_OFF_DURING(stmt) stmt
  3456. # define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr)
  3457. #endif
  3458. #if (LZO_CFG_PGO)
  3459. # undef __lzo_likely
  3460. # undef __lzo_unlikely
  3461. # define __lzo_likely(e) (e)
  3462. # define __lzo_unlikely(e) (e)
  3463. #endif
  3464. #undef _
  3465. #undef __
  3466. #undef ___
  3467. #undef ____
  3468. #undef _p0
  3469. #undef _p1
  3470. #undef _p2
  3471. #undef _p3
  3472. #undef _p4
  3473. #undef _s0
  3474. #undef _s1
  3475. #undef _s2
  3476. #undef _s3
  3477. #undef _s4
  3478. #undef _ww
  3479. #if 1
  3480. # define LZO_BYTE(x) ((unsigned char) (x))
  3481. #else
  3482. # define LZO_BYTE(x) ((unsigned char) ((x) & 0xff))
  3483. #endif
  3484. #define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b))
  3485. #define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b))
  3486. #define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c))
  3487. #define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c))
  3488. #define lzo_sizeof(type) ((lzo_uint) (sizeof(type)))
  3489. #define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array))))
  3490. #define LZO_SIZE(bits) (1u << (bits))
  3491. #define LZO_MASK(bits) (LZO_SIZE(bits) - 1)
  3492. #define LZO_USIZE(bits) ((lzo_uint) 1 << (bits))
  3493. #define LZO_UMASK(bits) (LZO_USIZE(bits) - 1)
  3494. #if !defined(DMUL)
  3495. #if 0
  3496. # define DMUL(a,b) ((lzo_xint) ((lzo_uint32_t)(a) * (lzo_uint32_t)(b)))
  3497. #else
  3498. # define DMUL(a,b) ((lzo_xint) ((a) * (b)))
  3499. #endif
  3500. #endif
  3501. #ifndef __LZO_FUNC_H
  3502. #define __LZO_FUNC_H 1
  3503. #if !defined(LZO_BITOPS_USE_ASM_BITSCAN) && !defined(LZO_BITOPS_USE_GNUC_BITSCAN) && !defined(LZO_BITOPS_USE_MSC_BITSCAN)
  3504. #if 1 && (LZO_ARCH_AMD64) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_ASM_SYNTAX_GNUC)
  3505. #define LZO_BITOPS_USE_ASM_BITSCAN 1
  3506. #elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul))))
  3507. #define LZO_BITOPS_USE_GNUC_BITSCAN 1
  3508. #elif (LZO_OS_WIN32 || LZO_OS_WIN64) && ((LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1010)) || (LZO_CC_MSC && (_MSC_VER >= 1400)))
  3509. #define LZO_BITOPS_USE_MSC_BITSCAN 1
  3510. #if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
  3511. #include <intrin.h>
  3512. #endif
  3513. #if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
  3514. #pragma intrinsic(_BitScanReverse)
  3515. #pragma intrinsic(_BitScanForward)
  3516. #endif
  3517. #if (LZO_CC_MSC) && (LZO_ARCH_AMD64)
  3518. #pragma intrinsic(_BitScanReverse64)
  3519. #pragma intrinsic(_BitScanForward64)
  3520. #endif
  3521. #endif
  3522. #endif
  3523. __lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v)
  3524. {
  3525. #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
  3526. unsigned long r; (void) _BitScanReverse(&r, v); return (unsigned) r ^ 31;
  3527. #define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v)
  3528. #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC)
  3529. lzo_uint32_t r;
  3530. __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
  3531. return (unsigned) r ^ 31;
  3532. #define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v)
  3533. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT == 4)
  3534. unsigned r; r = (unsigned) __builtin_clz(v); return r;
  3535. #define lzo_bitops_ctlz32(v) ((unsigned) __builtin_clz(v))
  3536. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8)
  3537. unsigned r; r = (unsigned) __builtin_clzl(v); return r ^ 32;
  3538. #define lzo_bitops_ctlz32(v) (((unsigned) __builtin_clzl(v)) ^ 32)
  3539. #else
  3540. LZO_UNUSED(v); return 0;
  3541. #endif
  3542. }
  3543. #if defined(lzo_uint64_t)
  3544. __lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v)
  3545. {
  3546. #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64)
  3547. unsigned long r; (void) _BitScanReverse64(&r, v); return (unsigned) r ^ 63;
  3548. #define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v)
  3549. #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC)
  3550. lzo_uint64_t r;
  3551. __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
  3552. return (unsigned) r ^ 63;
  3553. #define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v)
  3554. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8)
  3555. unsigned r; r = (unsigned) __builtin_clzl(v); return r;
  3556. #define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzl(v))
  3557. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG == 8) && (LZO_WORDSIZE >= 8)
  3558. unsigned r; r = (unsigned) __builtin_clzll(v); return r;
  3559. #define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzll(v))
  3560. #else
  3561. LZO_UNUSED(v); return 0;
  3562. #endif
  3563. }
  3564. #endif
  3565. __lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v)
  3566. {
  3567. #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
  3568. unsigned long r; (void) _BitScanForward(&r, v); return (unsigned) r;
  3569. #define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v)
  3570. #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC)
  3571. lzo_uint32_t r;
  3572. __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
  3573. return (unsigned) r;
  3574. #define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v)
  3575. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT >= 4)
  3576. unsigned r; r = (unsigned) __builtin_ctz(v); return r;
  3577. #define lzo_bitops_cttz32(v) ((unsigned) __builtin_ctz(v))
  3578. #else
  3579. LZO_UNUSED(v); return 0;
  3580. #endif
  3581. }
  3582. #if defined(lzo_uint64_t)
  3583. __lzo_static_forceinline unsigned lzo_bitops_cttz64_func(lzo_uint64_t v)
  3584. {
  3585. #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64)
  3586. unsigned long r; (void) _BitScanForward64(&r, v); return (unsigned) r;
  3587. #define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v)
  3588. #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC)
  3589. lzo_uint64_t r;
  3590. __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
  3591. return (unsigned) r;
  3592. #define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v)
  3593. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG >= 8) && (LZO_WORDSIZE >= 8)
  3594. unsigned r; r = (unsigned) __builtin_ctzl(v); return r;
  3595. #define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzl(v))
  3596. #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG >= 8) && (LZO_WORDSIZE >= 8)
  3597. unsigned r; r = (unsigned) __builtin_ctzll(v); return r;
  3598. #define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzll(v))
  3599. #else
  3600. LZO_UNUSED(v); return 0;
  3601. #endif
  3602. }
  3603. #endif
  3604. lzo_unused_funcs_impl(void, lzo_bitops_unused_funcs)(void)
  3605. {
  3606. LZO_UNUSED_FUNC(lzo_bitops_unused_funcs);
  3607. LZO_UNUSED_FUNC(lzo_bitops_ctlz32_func);
  3608. LZO_UNUSED_FUNC(lzo_bitops_cttz32_func);
  3609. #if defined(lzo_uint64_t)
  3610. LZO_UNUSED_FUNC(lzo_bitops_ctlz64_func);
  3611. LZO_UNUSED_FUNC(lzo_bitops_cttz64_func);
  3612. #endif
  3613. }
  3614. #if defined(__lzo_alignof) && !(LZO_CFG_NO_UNALIGNED)
  3615. #if !defined(lzo_memops_tcheck__) && 0
  3616. #define lzo_memops_tcheck__(t,a,b) ((void)0, sizeof(t) == (a) && __lzo_alignof(t) == (b))
  3617. #endif
  3618. #endif
  3619. #ifndef lzo_memops_TU0p
  3620. #define lzo_memops_TU0p void __LZO_MMODEL *
  3621. #endif
  3622. #ifndef lzo_memops_TU1p
  3623. #define lzo_memops_TU1p unsigned char __LZO_MMODEL *
  3624. #endif
  3625. #ifndef lzo_memops_TU2p
  3626. #if (LZO_OPT_UNALIGNED16)
  3627. typedef lzo_uint16_t __lzo_may_alias lzo_memops_TU2;
  3628. #define lzo_memops_TU2p volatile lzo_memops_TU2 *
  3629. #elif defined(__lzo_byte_struct)
  3630. __lzo_byte_struct(lzo_memops_TU2_struct,2)
  3631. typedef struct lzo_memops_TU2_struct lzo_memops_TU2;
  3632. #else
  3633. struct lzo_memops_TU2_struct { unsigned char a[2]; } __lzo_may_alias;
  3634. typedef struct lzo_memops_TU2_struct lzo_memops_TU2;
  3635. #endif
  3636. #ifndef lzo_memops_TU2p
  3637. #define lzo_memops_TU2p lzo_memops_TU2 *
  3638. #endif
  3639. #endif
  3640. #ifndef lzo_memops_TU4p
  3641. #if (LZO_OPT_UNALIGNED32)
  3642. typedef lzo_uint32_t __lzo_may_alias lzo_memops_TU4;
  3643. #define lzo_memops_TU4p volatile lzo_memops_TU4 __LZO_MMODEL *
  3644. #elif defined(__lzo_byte_struct)
  3645. __lzo_byte_struct(lzo_memops_TU4_struct,4)
  3646. typedef struct lzo_memops_TU4_struct lzo_memops_TU4;
  3647. #else
  3648. struct lzo_memops_TU4_struct { unsigned char a[4]; } __lzo_may_alias;
  3649. typedef struct lzo_memops_TU4_struct lzo_memops_TU4;
  3650. #endif
  3651. #ifndef lzo_memops_TU4p
  3652. #define lzo_memops_TU4p lzo_memops_TU4 __LZO_MMODEL *
  3653. #endif
  3654. #endif
  3655. #ifndef lzo_memops_TU8p
  3656. #if (LZO_OPT_UNALIGNED64)
  3657. typedef lzo_uint64_t __lzo_may_alias lzo_memops_TU8;
  3658. #define lzo_memops_TU8p volatile lzo_memops_TU8 __LZO_MMODEL *
  3659. #elif defined(__lzo_byte_struct)
  3660. __lzo_byte_struct(lzo_memops_TU8_struct,8)
  3661. typedef struct lzo_memops_TU8_struct lzo_memops_TU8;
  3662. #else
  3663. struct lzo_memops_TU8_struct { unsigned char a[8]; } __lzo_may_alias;
  3664. typedef struct lzo_memops_TU8_struct lzo_memops_TU8;
  3665. #endif
  3666. #ifndef lzo_memops_TU8p
  3667. #define lzo_memops_TU8p lzo_memops_TU8 __LZO_MMODEL *
  3668. #endif
  3669. #endif
  3670. #ifndef lzo_memops_set_TU1p
  3671. #define lzo_memops_set_TU1p volatile lzo_memops_TU1p
  3672. #endif
  3673. #ifndef lzo_memops_move_TU1p
  3674. #define lzo_memops_move_TU1p lzo_memops_TU1p
  3675. #endif
  3676. #define LZO_MEMOPS_SET1(dd,cc) \
  3677. LZO_BLOCK_BEGIN \
  3678. lzo_memops_set_TU1p d__1 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
  3679. d__1[0] = LZO_BYTE(cc); \
  3680. LZO_BLOCK_END
  3681. #define LZO_MEMOPS_SET2(dd,cc) \
  3682. LZO_BLOCK_BEGIN \
  3683. lzo_memops_set_TU1p d__2 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
  3684. d__2[0] = LZO_BYTE(cc); d__2[1] = LZO_BYTE(cc); \
  3685. LZO_BLOCK_END
  3686. #define LZO_MEMOPS_SET3(dd,cc) \
  3687. LZO_BLOCK_BEGIN \
  3688. lzo_memops_set_TU1p d__3 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
  3689. d__3[0] = LZO_BYTE(cc); d__3[1] = LZO_BYTE(cc); d__3[2] = LZO_BYTE(cc); \
  3690. LZO_BLOCK_END
  3691. #define LZO_MEMOPS_SET4(dd,cc) \
  3692. LZO_BLOCK_BEGIN \
  3693. lzo_memops_set_TU1p d__4 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
  3694. d__4[0] = LZO_BYTE(cc); d__4[1] = LZO_BYTE(cc); d__4[2] = LZO_BYTE(cc); d__4[3] = LZO_BYTE(cc); \
  3695. LZO_BLOCK_END
  3696. #define LZO_MEMOPS_MOVE1(dd,ss) \
  3697. LZO_BLOCK_BEGIN \
  3698. lzo_memops_move_TU1p d__1 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
  3699. const lzo_memops_move_TU1p s__1 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
  3700. d__1[0] = s__1[0]; \
  3701. LZO_BLOCK_END
  3702. #define LZO_MEMOPS_MOVE2(dd,ss) \
  3703. LZO_BLOCK_BEGIN \
  3704. lzo_memops_move_TU1p d__2 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
  3705. const lzo_memops_move_TU1p s__2 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
  3706. d__2[0] = s__2[0]; d__2[1] = s__2[1]; \
  3707. LZO_BLOCK_END
  3708. #define LZO_MEMOPS_MOVE3(dd,ss) \
  3709. LZO_BLOCK_BEGIN \
  3710. lzo_memops_move_TU1p d__3 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
  3711. const lzo_memops_move_TU1p s__3 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
  3712. d__3[0] = s__3[0]; d__3[1] = s__3[1]; d__3[2] = s__3[2]; \
  3713. LZO_BLOCK_END
  3714. #define LZO_MEMOPS_MOVE4(dd,ss) \
  3715. LZO_BLOCK_BEGIN \
  3716. lzo_memops_move_TU1p d__4 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
  3717. const lzo_memops_move_TU1p s__4 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
  3718. d__4[0] = s__4[0]; d__4[1] = s__4[1]; d__4[2] = s__4[2]; d__4[3] = s__4[3]; \
  3719. LZO_BLOCK_END
  3720. #define LZO_MEMOPS_MOVE8(dd,ss) \
  3721. LZO_BLOCK_BEGIN \
  3722. lzo_memops_move_TU1p d__8 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
  3723. const lzo_memops_move_TU1p s__8 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
  3724. d__8[0] = s__8[0]; d__8[1] = s__8[1]; d__8[2] = s__8[2]; d__8[3] = s__8[3]; \
  3725. d__8[4] = s__8[4]; d__8[5] = s__8[5]; d__8[6] = s__8[6]; d__8[7] = s__8[7]; \
  3726. LZO_BLOCK_END
  3727. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0)==1)
  3728. #define LZO_MEMOPS_COPY1(dd,ss) LZO_MEMOPS_MOVE1(dd,ss)
  3729. #if (LZO_OPT_UNALIGNED16)
  3730. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2)
  3731. #define LZO_MEMOPS_COPY2(dd,ss) \
  3732. * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)
  3733. #elif defined(lzo_memops_tcheck__)
  3734. #define LZO_MEMOPS_COPY2(dd,ss) \
  3735. LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU2,2,1)) { \
  3736. * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss); \
  3737. } else { LZO_MEMOPS_MOVE2(dd,ss); } LZO_BLOCK_END
  3738. #else
  3739. #define LZO_MEMOPS_COPY2(dd,ss) LZO_MEMOPS_MOVE2(dd,ss)
  3740. #endif
  3741. #if (LZO_OPT_UNALIGNED32)
  3742. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4)
  3743. #define LZO_MEMOPS_COPY4(dd,ss) \
  3744. * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)
  3745. #elif defined(lzo_memops_tcheck__)
  3746. #define LZO_MEMOPS_COPY4(dd,ss) \
  3747. LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU4,4,1)) { \
  3748. * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss); \
  3749. } else { LZO_MEMOPS_MOVE4(dd,ss); } LZO_BLOCK_END
  3750. #else
  3751. #define LZO_MEMOPS_COPY4(dd,ss) LZO_MEMOPS_MOVE4(dd,ss)
  3752. #endif
  3753. #if (LZO_WORDSIZE != 8)
  3754. #define LZO_MEMOPS_COPY8(dd,ss) \
  3755. LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END
  3756. #else
  3757. #if (LZO_OPT_UNALIGNED64)
  3758. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
  3759. #define LZO_MEMOPS_COPY8(dd,ss) \
  3760. * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)
  3761. #elif (LZO_OPT_UNALIGNED32)
  3762. #define LZO_MEMOPS_COPY8(dd,ss) \
  3763. LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END
  3764. #elif defined(lzo_memops_tcheck__)
  3765. #define LZO_MEMOPS_COPY8(dd,ss) \
  3766. LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU8,8,1)) { \
  3767. * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss); \
  3768. } else { LZO_MEMOPS_MOVE8(dd,ss); } LZO_BLOCK_END
  3769. #else
  3770. #define LZO_MEMOPS_COPY8(dd,ss) LZO_MEMOPS_MOVE8(dd,ss)
  3771. #endif
  3772. #endif
  3773. #define LZO_MEMOPS_COPYN(dd,ss,nn) \
  3774. LZO_BLOCK_BEGIN \
  3775. lzo_memops_TU1p d__n = (lzo_memops_TU1p) (lzo_memops_TU0p) (dd); \
  3776. const lzo_memops_TU1p s__n = (const lzo_memops_TU1p) (const lzo_memops_TU0p) (ss); \
  3777. lzo_uint n__n = (nn); \
  3778. while ((void)0, n__n >= 8) { LZO_MEMOPS_COPY8(d__n, s__n); d__n += 8; s__n += 8; n__n -= 8; } \
  3779. if ((void)0, n__n >= 4) { LZO_MEMOPS_COPY4(d__n, s__n); d__n += 4; s__n += 4; n__n -= 4; } \
  3780. if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \
  3781. LZO_BLOCK_END
  3782. __lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss)
  3783. {
  3784. lzo_uint16_t v;
  3785. #if (LZO_ABI_LITTLE_ENDIAN)
  3786. LZO_MEMOPS_COPY2(&v, ss);
  3787. #elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
  3788. const lzo_memops_TU2p s = (const lzo_memops_TU2p) ss;
  3789. unsigned long vv;
  3790. __asm__("lhbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s));
  3791. v = (lzo_uint16_t) vv;
  3792. #else
  3793. const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss;
  3794. v = (lzo_uint16_t) (((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8));
  3795. #endif
  3796. return v;
  3797. }
  3798. #if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
  3799. #define LZO_MEMOPS_GET_LE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss))
  3800. #else
  3801. #define LZO_MEMOPS_GET_LE16(ss) lzo_memops_get_le16(ss)
  3802. #endif
  3803. __lzo_static_forceinline lzo_uint32_t lzo_memops_get_le32(const lzo_voidp ss)
  3804. {
  3805. lzo_uint32_t v;
  3806. #if (LZO_ABI_LITTLE_ENDIAN)
  3807. LZO_MEMOPS_COPY4(&v, ss);
  3808. #elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
  3809. const lzo_memops_TU4p s = (const lzo_memops_TU4p) ss;
  3810. unsigned long vv;
  3811. __asm__("lwbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s));
  3812. v = (lzo_uint32_t) vv;
  3813. #else
  3814. const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss;
  3815. v = (lzo_uint32_t) (((lzo_uint32_t)s[0]) | ((lzo_uint32_t)s[1] << 8) | ((lzo_uint32_t)s[2] << 16) | ((lzo_uint32_t)s[3] << 24));
  3816. #endif
  3817. return v;
  3818. }
  3819. #if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN)
  3820. #define LZO_MEMOPS_GET_LE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss))
  3821. #else
  3822. #define LZO_MEMOPS_GET_LE32(ss) lzo_memops_get_le32(ss)
  3823. #endif
  3824. #if (LZO_OPT_UNALIGNED64) && (LZO_ABI_LITTLE_ENDIAN)
  3825. #define LZO_MEMOPS_GET_LE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss))
  3826. #endif
  3827. __lzo_static_forceinline lzo_uint16_t lzo_memops_get_ne16(const lzo_voidp ss)
  3828. {
  3829. lzo_uint16_t v;
  3830. LZO_MEMOPS_COPY2(&v, ss);
  3831. return v;
  3832. }
  3833. #if (LZO_OPT_UNALIGNED16)
  3834. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2)
  3835. #define LZO_MEMOPS_GET_NE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss))
  3836. #else
  3837. #define LZO_MEMOPS_GET_NE16(ss) lzo_memops_get_ne16(ss)
  3838. #endif
  3839. __lzo_static_forceinline lzo_uint32_t lzo_memops_get_ne32(const lzo_voidp ss)
  3840. {
  3841. lzo_uint32_t v;
  3842. LZO_MEMOPS_COPY4(&v, ss);
  3843. return v;
  3844. }
  3845. #if (LZO_OPT_UNALIGNED32)
  3846. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4)
  3847. #define LZO_MEMOPS_GET_NE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss))
  3848. #else
  3849. #define LZO_MEMOPS_GET_NE32(ss) lzo_memops_get_ne32(ss)
  3850. #endif
  3851. #if (LZO_OPT_UNALIGNED64)
  3852. LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
  3853. #define LZO_MEMOPS_GET_NE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss))
  3854. #endif
  3855. __lzo_static_forceinline void lzo_memops_put_le16(lzo_voidp dd, lzo_uint16_t vv)
  3856. {
  3857. #if (LZO_ABI_LITTLE_ENDIAN)
  3858. LZO_MEMOPS_COPY2(dd, &vv);
  3859. #elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
  3860. lzo_memops_TU2p d = (lzo_memops_TU2p) dd;
  3861. unsigned long v = vv;
  3862. __asm__("sthbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v));
  3863. #else
  3864. lzo_memops_TU1p d = (lzo_memops_TU1p) dd;
  3865. d[0] = LZO_BYTE((vv ) & 0xff);
  3866. d[1] = LZO_BYTE((vv >> 8) & 0xff);
  3867. #endif
  3868. }
  3869. #if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
  3870. #define LZO_MEMOPS_PUT_LE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv))
  3871. #else
  3872. #define LZO_MEMOPS_PUT_LE16(dd,vv) lzo_memops_put_le16(dd,vv)
  3873. #endif
  3874. __lzo_static_forceinline void lzo_memops_put_le32(lzo_voidp dd, lzo_uint32_t vv)
  3875. {
  3876. #if (LZO_ABI_LITTLE_ENDIAN)
  3877. LZO_MEMOPS_COPY4(dd, &vv);
  3878. #elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
  3879. lzo_memops_TU4p d = (lzo_memops_TU4p) dd;
  3880. unsigned long v = vv;
  3881. __asm__("stwbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v));
  3882. #else
  3883. lzo_memops_TU1p d = (lzo_memops_TU1p) dd;
  3884. d[0] = LZO_BYTE((vv ) & 0xff);
  3885. d[1] = LZO_BYTE((vv >> 8) & 0xff);
  3886. d[2] = LZO_BYTE((vv >> 16) & 0xff);
  3887. d[3] = LZO_BYTE((vv >> 24) & 0xff);
  3888. #endif
  3889. }
  3890. #if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN)
  3891. #define LZO_MEMOPS_PUT_LE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv))
  3892. #else
  3893. #define LZO_MEMOPS_PUT_LE32(dd,vv) lzo_memops_put_le32(dd,vv)
  3894. #endif
  3895. __lzo_static_forceinline void lzo_memops_put_ne16(lzo_voidp dd, lzo_uint16_t vv)
  3896. {
  3897. LZO_MEMOPS_COPY2(dd, &vv);
  3898. }
  3899. #if (LZO_OPT_UNALIGNED16)
  3900. #define LZO_MEMOPS_PUT_NE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv))
  3901. #else
  3902. #define LZO_MEMOPS_PUT_NE16(dd,vv) lzo_memops_put_ne16(dd,vv)
  3903. #endif
  3904. __lzo_static_forceinline void lzo_memops_put_ne32(lzo_voidp dd, lzo_uint32_t vv)
  3905. {
  3906. LZO_MEMOPS_COPY4(dd, &vv);
  3907. }
  3908. #if (LZO_OPT_UNALIGNED32)
  3909. #define LZO_MEMOPS_PUT_NE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv))
  3910. #else
  3911. #define LZO_MEMOPS_PUT_NE32(dd,vv) lzo_memops_put_ne32(dd,vv)
  3912. #endif
  3913. lzo_unused_funcs_impl(void, lzo_memops_unused_funcs)(void)
  3914. {
  3915. LZO_UNUSED_FUNC(lzo_memops_unused_funcs);
  3916. LZO_UNUSED_FUNC(lzo_memops_get_le16);
  3917. LZO_UNUSED_FUNC(lzo_memops_get_le32);
  3918. LZO_UNUSED_FUNC(lzo_memops_get_ne16);
  3919. LZO_UNUSED_FUNC(lzo_memops_get_ne32);
  3920. LZO_UNUSED_FUNC(lzo_memops_put_le16);
  3921. LZO_UNUSED_FUNC(lzo_memops_put_le32);
  3922. LZO_UNUSED_FUNC(lzo_memops_put_ne16);
  3923. LZO_UNUSED_FUNC(lzo_memops_put_ne32);
  3924. }
  3925. #endif
  3926. #ifndef UA_SET1
  3927. #define UA_SET1 LZO_MEMOPS_SET1
  3928. #endif
  3929. #ifndef UA_SET2
  3930. #define UA_SET2 LZO_MEMOPS_SET2
  3931. #endif
  3932. #ifndef UA_SET3
  3933. #define UA_SET3 LZO_MEMOPS_SET3
  3934. #endif
  3935. #ifndef UA_SET4
  3936. #define UA_SET4 LZO_MEMOPS_SET4
  3937. #endif
  3938. #ifndef UA_MOVE1
  3939. #define UA_MOVE1 LZO_MEMOPS_MOVE1
  3940. #endif
  3941. #ifndef UA_MOVE2
  3942. #define UA_MOVE2 LZO_MEMOPS_MOVE2
  3943. #endif
  3944. #ifndef UA_MOVE3
  3945. #define UA_MOVE3 LZO_MEMOPS_MOVE3
  3946. #endif
  3947. #ifndef UA_MOVE4
  3948. #define UA_MOVE4 LZO_MEMOPS_MOVE4
  3949. #endif
  3950. #ifndef UA_MOVE8
  3951. #define UA_MOVE8 LZO_MEMOPS_MOVE8
  3952. #endif
  3953. #ifndef UA_COPY1
  3954. #define UA_COPY1 LZO_MEMOPS_COPY1
  3955. #endif
  3956. #ifndef UA_COPY2
  3957. #define UA_COPY2 LZO_MEMOPS_COPY2
  3958. #endif
  3959. #ifndef UA_COPY3
  3960. #define UA_COPY3 LZO_MEMOPS_COPY3
  3961. #endif
  3962. #ifndef UA_COPY4
  3963. #define UA_COPY4 LZO_MEMOPS_COPY4
  3964. #endif
  3965. #ifndef UA_COPY8
  3966. #define UA_COPY8 LZO_MEMOPS_COPY8
  3967. #endif
  3968. #ifndef UA_COPYN
  3969. #define UA_COPYN LZO_MEMOPS_COPYN
  3970. #endif
  3971. #ifndef UA_COPYN_X
  3972. #define UA_COPYN_X LZO_MEMOPS_COPYN
  3973. #endif
  3974. #ifndef UA_GET_LE16
  3975. #define UA_GET_LE16 LZO_MEMOPS_GET_LE16
  3976. #endif
  3977. #ifndef UA_GET_LE32
  3978. #define UA_GET_LE32 LZO_MEMOPS_GET_LE32
  3979. #endif
  3980. #ifdef LZO_MEMOPS_GET_LE64
  3981. #ifndef UA_GET_LE64
  3982. #define UA_GET_LE64 LZO_MEMOPS_GET_LE64
  3983. #endif
  3984. #endif
  3985. #ifndef UA_GET_NE16
  3986. #define UA_GET_NE16 LZO_MEMOPS_GET_NE16
  3987. #endif
  3988. #ifndef UA_GET_NE32
  3989. #define UA_GET_NE32 LZO_MEMOPS_GET_NE32
  3990. #endif
  3991. #ifdef LZO_MEMOPS_GET_NE64
  3992. #ifndef UA_GET_NE64
  3993. #define UA_GET_NE64 LZO_MEMOPS_GET_NE64
  3994. #endif
  3995. #endif
  3996. #ifndef UA_PUT_LE16
  3997. #define UA_PUT_LE16 LZO_MEMOPS_PUT_LE16
  3998. #endif
  3999. #ifndef UA_PUT_LE32
  4000. #define UA_PUT_LE32 LZO_MEMOPS_PUT_LE32
  4001. #endif
  4002. #ifndef UA_PUT_NE16
  4003. #define UA_PUT_NE16 LZO_MEMOPS_PUT_NE16
  4004. #endif
  4005. #ifndef UA_PUT_NE32
  4006. #define UA_PUT_NE32 LZO_MEMOPS_PUT_NE32
  4007. #endif
  4008. #define MEMCPY8_DS(dest,src,len) \
  4009. lzo_memcpy(dest,src,len); dest += len; src += len
  4010. #define BZERO8_PTR(s,l,n) \
  4011. lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n))
  4012. #define MEMCPY_DS(dest,src,len) \
  4013. do *dest++ = *src++; while (--len > 0)
  4014. LZO_EXTERN(const lzo_bytep) lzo_copyright(void);
  4015. #ifndef __LZO_PTR_H
  4016. #define __LZO_PTR_H 1
  4017. #ifdef __cplusplus
  4018. extern "C" {
  4019. #endif
  4020. #if (LZO_ARCH_I086)
  4021. #error "LZO_ARCH_I086 is unsupported"
  4022. #elif (LZO_MM_PVP)
  4023. #error "LZO_MM_PVP is unsupported"
  4024. #else
  4025. #define PTR(a) ((lzo_uintptr_t) (a))
  4026. #define PTR_LINEAR(a) PTR(a)
  4027. #define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0)
  4028. #define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0)
  4029. #define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0)
  4030. #define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0)
  4031. #endif
  4032. #define PTR_LT(a,b) (PTR(a) < PTR(b))
  4033. #define PTR_GE(a,b) (PTR(a) >= PTR(b))
  4034. #define PTR_DIFF(a,b) (PTR(a) - PTR(b))
  4035. #define pd(a,b) ((lzo_uint) ((a)-(b)))
  4036. LZO_EXTERN(lzo_uintptr_t)
  4037. __lzo_ptr_linear(const lzo_voidp ptr);
  4038. typedef union
  4039. {
  4040. char a_char;
  4041. unsigned char a_uchar;
  4042. short a_short;
  4043. unsigned short a_ushort;
  4044. int a_int;
  4045. unsigned int a_uint;
  4046. long a_long;
  4047. unsigned long a_ulong;
  4048. lzo_int a_lzo_int;
  4049. lzo_uint a_lzo_uint;
  4050. lzo_xint a_lzo_xint;
  4051. lzo_int16_t a_lzo_int16_t;
  4052. lzo_uint16_t a_lzo_uint16_t;
  4053. lzo_int32_t a_lzo_int32_t;
  4054. lzo_uint32_t a_lzo_uint32_t;
  4055. #if defined(lzo_uint64_t)
  4056. lzo_int64_t a_lzo_int64_t;
  4057. lzo_uint64_t a_lzo_uint64_t;
  4058. #endif
  4059. size_t a_size_t;
  4060. ptrdiff_t a_ptrdiff_t;
  4061. lzo_uintptr_t a_lzo_uintptr_t;
  4062. void * a_void_p;
  4063. char * a_char_p;
  4064. unsigned char * a_uchar_p;
  4065. const void * a_c_void_p;
  4066. const char * a_c_char_p;
  4067. const unsigned char * a_c_uchar_p;
  4068. lzo_voidp a_lzo_voidp;
  4069. lzo_bytep a_lzo_bytep;
  4070. const lzo_voidp a_c_lzo_voidp;
  4071. const lzo_bytep a_c_lzo_bytep;
  4072. }
  4073. lzo_full_align_t;
  4074. #ifdef __cplusplus
  4075. }
  4076. #endif
  4077. #endif
  4078. #ifndef LZO_DETERMINISTIC
  4079. #define LZO_DETERMINISTIC 1
  4080. #endif
  4081. #ifndef LZO_DICT_USE_PTR
  4082. #define LZO_DICT_USE_PTR 1
  4083. #endif
  4084. #if (LZO_DICT_USE_PTR)
  4085. # define lzo_dict_t const lzo_bytep
  4086. # define lzo_dict_p lzo_dict_t *
  4087. #else
  4088. # define lzo_dict_t lzo_uint
  4089. # define lzo_dict_p lzo_dict_t *
  4090. #endif
  4091. #endif
  4092. #if !defined(MINILZO_CFG_SKIP_LZO_PTR)
  4093. LZO_PUBLIC(lzo_uintptr_t)
  4094. __lzo_ptr_linear(const lzo_voidp ptr)
  4095. {
  4096. lzo_uintptr_t p;
  4097. #if (LZO_ARCH_I086)
  4098. #error "LZO_ARCH_I086 is unsupported"
  4099. #elif (LZO_MM_PVP)
  4100. #error "LZO_MM_PVP is unsupported"
  4101. #else
  4102. p = (lzo_uintptr_t) PTR_LINEAR(ptr);
  4103. #endif
  4104. return p;
  4105. }
  4106. LZO_PUBLIC(unsigned)
  4107. __lzo_align_gap(const lzo_voidp ptr, lzo_uint size)
  4108. {
  4109. #if (__LZO_UINTPTR_T_IS_POINTER)
  4110. #error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
  4111. #else
  4112. lzo_uintptr_t p, n;
  4113. if (size < 2) return 0;
  4114. p = __lzo_ptr_linear(ptr);
  4115. #if 0
  4116. n = (((p + size - 1) / size) * size) - p;
  4117. #else
  4118. if ((size & (size - 1)) != 0)
  4119. return 0;
  4120. n = size; n = ((p + n - 1) & ~(n - 1)) - p;
  4121. #endif
  4122. #endif
  4123. assert((long)n >= 0);
  4124. assert(n <= size);
  4125. return (unsigned)n;
  4126. }
  4127. #endif
  4128. #if !defined(MINILZO_CFG_SKIP_LZO_UTIL)
  4129. /* If you use the LZO library in a product, I would appreciate that you
  4130. * keep this copyright string in the executable of your product.
  4131. */
  4132. static const char lzo_copyright_[] =
  4133. #if !defined(__LZO_IN_MINLZO)
  4134. LZO_VERSION_STRING;
  4135. #else
  4136. "\r\n\n"
  4137. "LZO data compression library.\n"
  4138. "$Copyright: LZO Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer\n"
  4139. "<markus@oberhumer.com>\n"
  4140. "http://www.oberhumer.com $\n\n"
  4141. "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n"
  4142. "$Info: " LZO_INFO_STRING " $\n";
  4143. #endif
  4144. static const char lzo_version_string_[] = LZO_VERSION_STRING;
  4145. static const char lzo_version_date_[] = LZO_VERSION_DATE;
  4146. LZO_PUBLIC(const lzo_bytep)
  4147. lzo_copyright(void)
  4148. {
  4149. return (const lzo_bytep) lzo_copyright_;
  4150. }
  4151. LZO_PUBLIC(unsigned)
  4152. lzo_version(void)
  4153. {
  4154. return LZO_VERSION;
  4155. }
  4156. LZO_PUBLIC(const char *)
  4157. lzo_version_string(void)
  4158. {
  4159. return lzo_version_string_;
  4160. }
  4161. LZO_PUBLIC(const char *)
  4162. lzo_version_date(void)
  4163. {
  4164. return lzo_version_date_;
  4165. }
  4166. LZO_PUBLIC(const lzo_charp)
  4167. _lzo_version_string(void)
  4168. {
  4169. return lzo_version_string_;
  4170. }
  4171. LZO_PUBLIC(const lzo_charp)
  4172. _lzo_version_date(void)
  4173. {
  4174. return lzo_version_date_;
  4175. }
  4176. #define LZO_BASE 65521u
  4177. #define LZO_NMAX 5552
  4178. #define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1
  4179. #define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1)
  4180. #define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2)
  4181. #define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4)
  4182. #define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8)
  4183. LZO_PUBLIC(lzo_uint32_t)
  4184. lzo_adler32(lzo_uint32_t adler, const lzo_bytep buf, lzo_uint len)
  4185. {
  4186. lzo_uint32_t s1 = adler & 0xffff;
  4187. lzo_uint32_t s2 = (adler >> 16) & 0xffff;
  4188. unsigned k;
  4189. if (buf == NULL)
  4190. return 1;
  4191. while (len > 0)
  4192. {
  4193. k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX;
  4194. len -= k;
  4195. if (k >= 16) do
  4196. {
  4197. LZO_DO16(buf,0);
  4198. buf += 16;
  4199. k -= 16;
  4200. } while (k >= 16);
  4201. if (k != 0) do
  4202. {
  4203. s1 += *buf++;
  4204. s2 += s1;
  4205. } while (--k > 0);
  4206. s1 %= LZO_BASE;
  4207. s2 %= LZO_BASE;
  4208. }
  4209. return (s2 << 16) | s1;
  4210. }
  4211. #undef LZO_DO1
  4212. #undef LZO_DO2
  4213. #undef LZO_DO4
  4214. #undef LZO_DO8
  4215. #undef LZO_DO16
  4216. #endif
  4217. #if !defined(MINILZO_CFG_SKIP_LZO_STRING)
  4218. #undef lzo_memcmp
  4219. #undef lzo_memcpy
  4220. #undef lzo_memmove
  4221. #undef lzo_memset
  4222. #if !defined(__LZO_MMODEL_HUGE)
  4223. # undef LZO_HAVE_MM_HUGE_PTR
  4224. #endif
  4225. #define lzo_hsize_t lzo_uint
  4226. #define lzo_hvoid_p lzo_voidp
  4227. #define lzo_hbyte_p lzo_bytep
  4228. #define LZOLIB_PUBLIC(r,f) LZO_PUBLIC(r) f
  4229. #define lzo_hmemcmp lzo_memcmp
  4230. #define lzo_hmemcpy lzo_memcpy
  4231. #define lzo_hmemmove lzo_memmove
  4232. #define lzo_hmemset lzo_memset
  4233. #define __LZOLIB_HMEMCPY_CH_INCLUDED 1
  4234. #if !defined(LZOLIB_PUBLIC)
  4235. # define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f)
  4236. #endif
  4237. LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len)
  4238. {
  4239. #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCMP)
  4240. const lzo_hbyte_p p1 = LZO_STATIC_CAST(const lzo_hbyte_p, s1);
  4241. const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, s2);
  4242. if __lzo_likely(len > 0) do
  4243. {
  4244. int d = *p1 - *p2;
  4245. if (d != 0)
  4246. return d;
  4247. p1++; p2++;
  4248. } while __lzo_likely(--len > 0);
  4249. return 0;
  4250. #else
  4251. return memcmp(s1, s2, len);
  4252. #endif
  4253. }
  4254. LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len)
  4255. {
  4256. #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCPY)
  4257. lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest);
  4258. const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src);
  4259. if (!(len > 0) || p1 == p2)
  4260. return dest;
  4261. do
  4262. *p1++ = *p2++;
  4263. while __lzo_likely(--len > 0);
  4264. return dest;
  4265. #else
  4266. return memcpy(dest, src, len);
  4267. #endif
  4268. }
  4269. LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len)
  4270. {
  4271. #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMMOVE)
  4272. lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest);
  4273. const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src);
  4274. if (!(len > 0) || p1 == p2)
  4275. return dest;
  4276. if (p1 < p2)
  4277. {
  4278. do
  4279. *p1++ = *p2++;
  4280. while __lzo_likely(--len > 0);
  4281. }
  4282. else
  4283. {
  4284. p1 += len;
  4285. p2 += len;
  4286. do
  4287. *--p1 = *--p2;
  4288. while __lzo_likely(--len > 0);
  4289. }
  4290. return dest;
  4291. #else
  4292. return memmove(dest, src, len);
  4293. #endif
  4294. }
  4295. LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int cc, lzo_hsize_t len)
  4296. {
  4297. #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMSET)
  4298. lzo_hbyte_p p = LZO_STATIC_CAST(lzo_hbyte_p, s);
  4299. unsigned char c = LZO_ITRUNC(unsigned char, cc);
  4300. if __lzo_likely(len > 0) do
  4301. *p++ = c;
  4302. while __lzo_likely(--len > 0);
  4303. return s;
  4304. #else
  4305. return memset(s, cc, len);
  4306. #endif
  4307. }
  4308. #undef LZOLIB_PUBLIC
  4309. #endif
  4310. #if !defined(MINILZO_CFG_SKIP_LZO_INIT)
  4311. #if !defined(__LZO_IN_MINILZO)
  4312. #define LZO_WANT_ACC_CHK_CH 1
  4313. #undef LZOCHK_ASSERT
  4314. LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0)
  4315. LZOCHK_ASSERT_IS_SIGNED_T(lzo_int)
  4316. LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint)
  4317. #if !(__LZO_UINTPTR_T_IS_POINTER)
  4318. LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t)
  4319. #endif
  4320. LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
  4321. LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
  4322. #endif
  4323. #undef LZOCHK_ASSERT
  4324. union lzo_config_check_union {
  4325. lzo_uint a[2];
  4326. unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))];
  4327. #if defined(lzo_uint64_t)
  4328. lzo_uint64_t c[2];
  4329. #endif
  4330. };
  4331. #if 0
  4332. #define u2p(ptr,off) ((lzo_voidp) (((lzo_bytep)(lzo_voidp)(ptr)) + (off)))
  4333. #else
  4334. static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off)
  4335. {
  4336. return (lzo_voidp) ((lzo_bytep) ptr + off);
  4337. }
  4338. #endif
  4339. LZO_PUBLIC(int)
  4340. _lzo_config_check(void)
  4341. {
  4342. #if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030100ul && LZO_CC_CLANG < 0x030300ul))
  4343. # if 0
  4344. volatile
  4345. # endif
  4346. #endif
  4347. union lzo_config_check_union u;
  4348. lzo_voidp p;
  4349. unsigned r = 1;
  4350. u.a[0] = u.a[1] = 0;
  4351. p = u2p(&u, 0);
  4352. r &= ((* (lzo_bytep) p) == 0);
  4353. #if !(LZO_CFG_NO_CONFIG_CHECK)
  4354. #if (LZO_ABI_BIG_ENDIAN)
  4355. u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128;
  4356. p = u2p(&u, 0);
  4357. r &= ((* (lzo_uintp) p) == 128);
  4358. #endif
  4359. #if (LZO_ABI_LITTLE_ENDIAN)
  4360. u.a[0] = u.a[1] = 0; u.b[0] = 128;
  4361. p = u2p(&u, 0);
  4362. r &= ((* (lzo_uintp) p) == 128);
  4363. #endif
  4364. u.a[0] = u.a[1] = 0;
  4365. u.b[0] = 1; u.b[3] = 2;
  4366. p = u2p(&u, 1);
  4367. r &= UA_GET_NE16(p) == 0;
  4368. r &= UA_GET_LE16(p) == 0;
  4369. u.b[1] = 128;
  4370. r &= UA_GET_LE16(p) == 128;
  4371. u.b[2] = 129;
  4372. r &= UA_GET_LE16(p) == LZO_UINT16_C(0x8180);
  4373. #if (LZO_ABI_BIG_ENDIAN)
  4374. r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8081);
  4375. #endif
  4376. #if (LZO_ABI_LITTLE_ENDIAN)
  4377. r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8180);
  4378. #endif
  4379. u.a[0] = u.a[1] = 0;
  4380. u.b[0] = 3; u.b[5] = 4;
  4381. p = u2p(&u, 1);
  4382. r &= UA_GET_NE32(p) == 0;
  4383. r &= UA_GET_LE32(p) == 0;
  4384. u.b[1] = 128;
  4385. r &= UA_GET_LE32(p) == 128;
  4386. u.b[2] = 129; u.b[3] = 130; u.b[4] = 131;
  4387. r &= UA_GET_LE32(p) == LZO_UINT32_C(0x83828180);
  4388. #if (LZO_ABI_BIG_ENDIAN)
  4389. r &= UA_GET_NE32(p) == LZO_UINT32_C(0x80818283);
  4390. #endif
  4391. #if (LZO_ABI_LITTLE_ENDIAN)
  4392. r &= UA_GET_NE32(p) == LZO_UINT32_C(0x83828180);
  4393. #endif
  4394. #if defined(UA_GET_NE64)
  4395. u.c[0] = u.c[1] = 0;
  4396. u.b[0] = 5; u.b[9] = 6;
  4397. p = u2p(&u, 1);
  4398. u.c[0] = u.c[1] = 0;
  4399. r &= UA_GET_NE64(p) == 0;
  4400. #if defined(UA_GET_LE64)
  4401. r &= UA_GET_LE64(p) == 0;
  4402. u.b[1] = 128;
  4403. r &= UA_GET_LE64(p) == 128;
  4404. #endif
  4405. #endif
  4406. #if defined(lzo_bitops_ctlz32)
  4407. { unsigned i = 0; lzo_uint32_t v;
  4408. for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
  4409. r &= lzo_bitops_ctlz32(v) == 31 - i;
  4410. r &= lzo_bitops_ctlz32_func(v) == 31 - i;
  4411. }}
  4412. #endif
  4413. #if defined(lzo_bitops_ctlz64)
  4414. { unsigned i = 0; lzo_uint64_t v;
  4415. for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
  4416. r &= lzo_bitops_ctlz64(v) == 63 - i;
  4417. r &= lzo_bitops_ctlz64_func(v) == 63 - i;
  4418. }}
  4419. #endif
  4420. #if defined(lzo_bitops_cttz32)
  4421. { unsigned i = 0; lzo_uint32_t v;
  4422. for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
  4423. r &= lzo_bitops_cttz32(v) == i;
  4424. r &= lzo_bitops_cttz32_func(v) == i;
  4425. }}
  4426. #endif
  4427. #if defined(lzo_bitops_cttz64)
  4428. { unsigned i = 0; lzo_uint64_t v;
  4429. for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
  4430. r &= lzo_bitops_cttz64(v) == i;
  4431. r &= lzo_bitops_cttz64_func(v) == i;
  4432. }}
  4433. #endif
  4434. #endif
  4435. LZO_UNUSED_FUNC(lzo_bitops_unused_funcs);
  4436. return r == 1 ? LZO_E_OK : LZO_E_ERROR;
  4437. }
  4438. LZO_PUBLIC(int)
  4439. __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
  4440. int s6, int s7, int s8, int s9)
  4441. {
  4442. int r;
  4443. #if defined(__LZO_IN_MINILZO)
  4444. #elif (LZO_CC_MSC && ((_MSC_VER) < 700))
  4445. #else
  4446. #define LZO_WANT_ACC_CHK_CH 1
  4447. #undef LZOCHK_ASSERT
  4448. #define LZOCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr)
  4449. #endif
  4450. #undef LZOCHK_ASSERT
  4451. if (v == 0)
  4452. return LZO_E_ERROR;
  4453. r = (s1 == -1 || s1 == (int) sizeof(short)) &&
  4454. (s2 == -1 || s2 == (int) sizeof(int)) &&
  4455. (s3 == -1 || s3 == (int) sizeof(long)) &&
  4456. (s4 == -1 || s4 == (int) sizeof(lzo_uint32_t)) &&
  4457. (s5 == -1 || s5 == (int) sizeof(lzo_uint)) &&
  4458. (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) &&
  4459. (s7 == -1 || s7 == (int) sizeof(char *)) &&
  4460. (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) &&
  4461. (s9 == -1 || s9 == (int) sizeof(lzo_callback_t));
  4462. if (!r)
  4463. return LZO_E_ERROR;
  4464. r = _lzo_config_check();
  4465. if (r != LZO_E_OK)
  4466. return r;
  4467. return r;
  4468. }
  4469. #if !defined(__LZO_IN_MINILZO)
  4470. #if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD)
  4471. #if 0
  4472. BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment,
  4473. WORD wHeapSize, LPSTR lpszCmdLine )
  4474. #else
  4475. int __far __pascal LibMain ( int a, short b, short c, long d )
  4476. #endif
  4477. {
  4478. LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d);
  4479. return 1;
  4480. }
  4481. #endif
  4482. #endif
  4483. #endif
  4484. #define LZO1X 1
  4485. #define LZO_EOF_CODE 1
  4486. #define M2_MAX_OFFSET 0x0800
  4487. #if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS)
  4488. #if 1 && defined(UA_GET_LE32)
  4489. #undef LZO_DICT_USE_PTR
  4490. #define LZO_DICT_USE_PTR 0
  4491. #undef lzo_dict_t
  4492. #define lzo_dict_t lzo_uint16_t
  4493. #endif
  4494. #define LZO_NEED_DICT_H 1
  4495. #ifndef D_BITS
  4496. #define D_BITS 14
  4497. #endif
  4498. #define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5)
  4499. #define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f)
  4500. #if 1
  4501. #define DINDEX(dv,p) DM(((DMUL(0x1824429d,dv)) >> (32-D_BITS)))
  4502. #else
  4503. #define DINDEX(dv,p) DM((dv) + ((dv) >> (32-D_BITS)))
  4504. #endif
  4505. #ifndef __LZO_CONFIG1X_H
  4506. #define __LZO_CONFIG1X_H 1
  4507. #if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z)
  4508. # define LZO1X 1
  4509. #endif
  4510. #if !defined(__LZO_IN_MINILZO)
  4511. #include <lzo/lzo1x.h>
  4512. #endif
  4513. #ifndef LZO_EOF_CODE
  4514. #define LZO_EOF_CODE 1
  4515. #endif
  4516. #undef LZO_DETERMINISTIC
  4517. #define M1_MAX_OFFSET 0x0400
  4518. #ifndef M2_MAX_OFFSET
  4519. #define M2_MAX_OFFSET 0x0800
  4520. #endif
  4521. #define M3_MAX_OFFSET 0x4000
  4522. #define M4_MAX_OFFSET 0xbfff
  4523. #define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET)
  4524. #define M1_MIN_LEN 2
  4525. #define M1_MAX_LEN 2
  4526. #define M2_MIN_LEN 3
  4527. #ifndef M2_MAX_LEN
  4528. #define M2_MAX_LEN 8
  4529. #endif
  4530. #define M3_MIN_LEN 3
  4531. #define M3_MAX_LEN 33
  4532. #define M4_MIN_LEN 3
  4533. #define M4_MAX_LEN 9
  4534. #define M1_MARKER 0
  4535. #define M2_MARKER 64
  4536. #define M3_MARKER 32
  4537. #define M4_MARKER 16
  4538. #ifndef MIN_LOOKAHEAD
  4539. #define MIN_LOOKAHEAD (M2_MAX_LEN + 1)
  4540. #endif
  4541. #if defined(LZO_NEED_DICT_H)
  4542. #ifndef LZO_HASH
  4543. #define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B
  4544. #endif
  4545. #define DL_MIN_LEN M2_MIN_LEN
  4546. #ifndef __LZO_DICT_H
  4547. #define __LZO_DICT_H 1
  4548. #ifdef __cplusplus
  4549. extern "C" {
  4550. #endif
  4551. #if !defined(D_BITS) && defined(DBITS)
  4552. # define D_BITS DBITS
  4553. #endif
  4554. #if !defined(D_BITS)
  4555. # error "D_BITS is not defined"
  4556. #endif
  4557. #if (D_BITS < 16)
  4558. # define D_SIZE LZO_SIZE(D_BITS)
  4559. # define D_MASK LZO_MASK(D_BITS)
  4560. #else
  4561. # define D_SIZE LZO_USIZE(D_BITS)
  4562. # define D_MASK LZO_UMASK(D_BITS)
  4563. #endif
  4564. #define D_HIGH ((D_MASK >> 1) + 1)
  4565. #if !defined(DD_BITS)
  4566. # define DD_BITS 0
  4567. #endif
  4568. #define DD_SIZE LZO_SIZE(DD_BITS)
  4569. #define DD_MASK LZO_MASK(DD_BITS)
  4570. #if !defined(DL_BITS)
  4571. # define DL_BITS (D_BITS - DD_BITS)
  4572. #endif
  4573. #if (DL_BITS < 16)
  4574. # define DL_SIZE LZO_SIZE(DL_BITS)
  4575. # define DL_MASK LZO_MASK(DL_BITS)
  4576. #else
  4577. # define DL_SIZE LZO_USIZE(DL_BITS)
  4578. # define DL_MASK LZO_UMASK(DL_BITS)
  4579. #endif
  4580. #if (D_BITS != DL_BITS + DD_BITS)
  4581. # error "D_BITS does not match"
  4582. #endif
  4583. #if (D_BITS < 6 || D_BITS > 18)
  4584. # error "invalid D_BITS"
  4585. #endif
  4586. #if (DL_BITS < 6 || DL_BITS > 20)
  4587. # error "invalid DL_BITS"
  4588. #endif
  4589. #if (DD_BITS < 0 || DD_BITS > 6)
  4590. # error "invalid DD_BITS"
  4591. #endif
  4592. #if !defined(DL_MIN_LEN)
  4593. # define DL_MIN_LEN 3
  4594. #endif
  4595. #if !defined(DL_SHIFT)
  4596. # define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN)
  4597. #endif
  4598. #define LZO_HASH_GZIP 1
  4599. #define LZO_HASH_GZIP_INCREMENTAL 2
  4600. #define LZO_HASH_LZO_INCREMENTAL_A 3
  4601. #define LZO_HASH_LZO_INCREMENTAL_B 4
  4602. #if !defined(LZO_HASH)
  4603. # error "choose a hashing strategy"
  4604. #endif
  4605. #undef DM
  4606. #undef DX
  4607. #if (DL_MIN_LEN == 3)
  4608. # define _DV2_A(p,shift1,shift2) \
  4609. (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2])
  4610. # define _DV2_B(p,shift1,shift2) \
  4611. (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0])
  4612. # define _DV3_B(p,shift1,shift2,shift3) \
  4613. ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0])
  4614. #elif (DL_MIN_LEN == 2)
  4615. # define _DV2_A(p,shift1,shift2) \
  4616. (( (lzo_xint)(p[0]) << shift1) ^ p[1])
  4617. # define _DV2_B(p,shift1,shift2) \
  4618. (( (lzo_xint)(p[1]) << shift1) ^ p[2])
  4619. #else
  4620. # error "invalid DL_MIN_LEN"
  4621. #endif
  4622. #define _DV_A(p,shift) _DV2_A(p,shift,shift)
  4623. #define _DV_B(p,shift) _DV2_B(p,shift,shift)
  4624. #define DA2(p,s1,s2) \
  4625. (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0])
  4626. #define DS2(p,s1,s2) \
  4627. (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0])
  4628. #define DX2(p,s1,s2) \
  4629. (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0])
  4630. #define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0])
  4631. #define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0])
  4632. #define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0])
  4633. #define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s)))
  4634. #define DM(v) DMS(v,0)
  4635. #if (LZO_HASH == LZO_HASH_GZIP)
  4636. # define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT))
  4637. #elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL)
  4638. # define __LZO_HASH_INCREMENTAL 1
  4639. # define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT)
  4640. # define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2])
  4641. # define _DINDEX(dv,p) (dv)
  4642. # define DVAL_LOOKAHEAD DL_MIN_LEN
  4643. #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A)
  4644. # define __LZO_HASH_INCREMENTAL 1
  4645. # define DVAL_FIRST(dv,p) dv = _DV_A((p),5)
  4646. # define DVAL_NEXT(dv,p) \
  4647. dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2])
  4648. # define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5)
  4649. # define DVAL_LOOKAHEAD DL_MIN_LEN
  4650. #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B)
  4651. # define __LZO_HASH_INCREMENTAL 1
  4652. # define DVAL_FIRST(dv,p) dv = _DV_B((p),5)
  4653. # define DVAL_NEXT(dv,p) \
  4654. dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5)))
  4655. # define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5)
  4656. # define DVAL_LOOKAHEAD DL_MIN_LEN
  4657. #else
  4658. # error "choose a hashing strategy"
  4659. #endif
  4660. #ifndef DINDEX
  4661. #define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS)
  4662. #endif
  4663. #if !defined(DINDEX1) && defined(D_INDEX1)
  4664. #define DINDEX1 D_INDEX1
  4665. #endif
  4666. #if !defined(DINDEX2) && defined(D_INDEX2)
  4667. #define DINDEX2 D_INDEX2
  4668. #endif
  4669. #if !defined(__LZO_HASH_INCREMENTAL)
  4670. # define DVAL_FIRST(dv,p) ((void) 0)
  4671. # define DVAL_NEXT(dv,p) ((void) 0)
  4672. # define DVAL_LOOKAHEAD 0
  4673. #endif
  4674. #if !defined(DVAL_ASSERT)
  4675. #if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG)
  4676. #if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
  4677. static void __attribute__((__unused__))
  4678. #else
  4679. static void
  4680. #endif
  4681. DVAL_ASSERT(lzo_xint dv, const lzo_bytep p)
  4682. {
  4683. lzo_xint df;
  4684. DVAL_FIRST(df,(p));
  4685. assert(DINDEX(dv,p) == DINDEX(df,p));
  4686. }
  4687. #else
  4688. # define DVAL_ASSERT(dv,p) ((void) 0)
  4689. #endif
  4690. #endif
  4691. #if (LZO_DICT_USE_PTR)
  4692. # define DENTRY(p,in) (p)
  4693. # define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex]
  4694. #else
  4695. # define DENTRY(p,in) ((lzo_dict_t) pd(p, in))
  4696. # define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex]
  4697. #endif
  4698. #if (DD_BITS == 0)
  4699. # define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in)
  4700. # define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in)
  4701. # define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in)
  4702. #else
  4703. # define UPDATE_D(dict,drun,dv,p,in) \
  4704. dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK
  4705. # define UPDATE_I(dict,drun,index,p,in) \
  4706. dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK
  4707. # define UPDATE_P(ptr,drun,p,in) \
  4708. (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK
  4709. #endif
  4710. #if (LZO_DICT_USE_PTR)
  4711. #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \
  4712. (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset)
  4713. #define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \
  4714. (BOUNDS_CHECKING_OFF_IN_EXPR(( \
  4715. m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \
  4716. PTR_LT(m_pos,in) || \
  4717. (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) == 0 || \
  4718. m_off > max_offset )))
  4719. #else
  4720. #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \
  4721. (m_off == 0 || \
  4722. ((m_off = pd(ip, in) - m_off) > max_offset) || \
  4723. (m_pos = (ip) - (m_off), 0) )
  4724. #define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \
  4725. (pd(ip, in) <= m_off || \
  4726. ((m_off = pd(ip, in) - m_off) > max_offset) || \
  4727. (m_pos = (ip) - (m_off), 0) )
  4728. #endif
  4729. #if (LZO_DETERMINISTIC)
  4730. # define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET
  4731. #else
  4732. # define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET
  4733. #endif
  4734. #ifdef __cplusplus
  4735. }
  4736. #endif
  4737. #endif
  4738. #endif
  4739. #endif
  4740. #define LZO_DETERMINISTIC !(LZO_DICT_USE_PTR)
  4741. #ifndef DO_COMPRESS
  4742. #define DO_COMPRESS lzo1x_1_compress
  4743. #endif
  4744. #if 1 && defined(DO_COMPRESS) && !defined(do_compress)
  4745. # define do_compress LZO_PP_ECONCAT2(DO_COMPRESS,_core)
  4746. #endif
  4747. static __lzo_noinline lzo_uint
  4748. do_compress ( const lzo_bytep in , lzo_uint in_len,
  4749. lzo_bytep out, lzo_uintp out_len,
  4750. lzo_uint ti, lzo_voidp wrkmem)
  4751. {
  4752. const lzo_bytep ip;
  4753. lzo_bytep op;
  4754. const lzo_bytep const in_end = in + in_len;
  4755. const lzo_bytep const ip_end = in + in_len - 20;
  4756. const lzo_bytep ii;
  4757. lzo_dict_p const dict = (lzo_dict_p) wrkmem;
  4758. op = out;
  4759. ip = in;
  4760. ii = ip;
  4761. ip += ti < 4 ? 4 - ti : 0;
  4762. for (;;)
  4763. {
  4764. const lzo_bytep m_pos;
  4765. #if !(LZO_DETERMINISTIC)
  4766. LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0);
  4767. lzo_uint m_len;
  4768. lzo_uint dindex;
  4769. next:
  4770. if __lzo_unlikely(ip >= ip_end)
  4771. break;
  4772. DINDEX1(dindex,ip);
  4773. GINDEX(m_pos,m_off,dict,dindex,in);
  4774. if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
  4775. goto literal;
  4776. #if 1
  4777. if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
  4778. goto try_match;
  4779. DINDEX2(dindex,ip);
  4780. #endif
  4781. GINDEX(m_pos,m_off,dict,dindex,in);
  4782. if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
  4783. goto literal;
  4784. if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
  4785. goto try_match;
  4786. goto literal;
  4787. try_match:
  4788. #if (LZO_OPT_UNALIGNED32)
  4789. if (UA_GET_NE32(m_pos) != UA_GET_NE32(ip))
  4790. #else
  4791. if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3])
  4792. #endif
  4793. {
  4794. literal:
  4795. UPDATE_I(dict,0,dindex,ip,in);
  4796. ip += 1 + ((ip - ii) >> 5);
  4797. continue;
  4798. }
  4799. UPDATE_I(dict,0,dindex,ip,in);
  4800. #else
  4801. lzo_uint m_off;
  4802. lzo_uint m_len;
  4803. {
  4804. lzo_uint32_t dv;
  4805. lzo_uint dindex;
  4806. literal:
  4807. ip += 1 + ((ip - ii) >> 5);
  4808. next:
  4809. if __lzo_unlikely(ip >= ip_end)
  4810. break;
  4811. dv = UA_GET_LE32(ip);
  4812. dindex = DINDEX(dv,ip);
  4813. GINDEX(m_off,m_pos,in+dict,dindex,in);
  4814. UPDATE_I(dict,0,dindex,ip,in);
  4815. if __lzo_unlikely(dv != UA_GET_LE32(m_pos))
  4816. goto literal;
  4817. }
  4818. #endif
  4819. ii -= ti; ti = 0;
  4820. {
  4821. lzo_uint t = pd(ip,ii);
  4822. if (t != 0)
  4823. {
  4824. if (t <= 3)
  4825. {
  4826. op[-2] = LZO_BYTE(op[-2] | t);
  4827. #if (LZO_OPT_UNALIGNED32)
  4828. UA_COPY4(op, ii);
  4829. op += t;
  4830. #else
  4831. { do *op++ = *ii++; while (--t > 0); }
  4832. #endif
  4833. }
  4834. #if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64)
  4835. else if (t <= 16)
  4836. {
  4837. *op++ = LZO_BYTE(t - 3);
  4838. UA_COPY8(op, ii);
  4839. UA_COPY8(op+8, ii+8);
  4840. op += t;
  4841. }
  4842. #endif
  4843. else
  4844. {
  4845. if (t <= 18)
  4846. *op++ = LZO_BYTE(t - 3);
  4847. else
  4848. {
  4849. lzo_uint tt = t - 18;
  4850. *op++ = 0;
  4851. while __lzo_unlikely(tt > 255)
  4852. {
  4853. tt -= 255;
  4854. UA_SET1(op, 0);
  4855. op++;
  4856. }
  4857. assert(tt > 0);
  4858. *op++ = LZO_BYTE(tt);
  4859. }
  4860. #if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64)
  4861. do {
  4862. UA_COPY8(op, ii);
  4863. UA_COPY8(op+8, ii+8);
  4864. op += 16; ii += 16; t -= 16;
  4865. } while (t >= 16); if (t > 0)
  4866. #endif
  4867. { do *op++ = *ii++; while (--t > 0); }
  4868. }
  4869. }
  4870. }
  4871. m_len = 4;
  4872. {
  4873. #if (LZO_OPT_UNALIGNED64)
  4874. lzo_uint64_t v;
  4875. v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
  4876. if __lzo_unlikely(v == 0) {
  4877. do {
  4878. m_len += 8;
  4879. v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
  4880. if __lzo_unlikely(ip + m_len >= ip_end)
  4881. goto m_len_done;
  4882. } while (v == 0);
  4883. }
  4884. #if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz64)
  4885. m_len += lzo_bitops_ctlz64(v) / CHAR_BIT;
  4886. #elif (LZO_ABI_BIG_ENDIAN)
  4887. if ((v >> (64 - CHAR_BIT)) == 0) do {
  4888. v <<= CHAR_BIT;
  4889. m_len += 1;
  4890. } while ((v >> (64 - CHAR_BIT)) == 0);
  4891. #elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz64)
  4892. m_len += lzo_bitops_cttz64(v) / CHAR_BIT;
  4893. #elif (LZO_ABI_LITTLE_ENDIAN)
  4894. if ((v & UCHAR_MAX) == 0) do {
  4895. v >>= CHAR_BIT;
  4896. m_len += 1;
  4897. } while ((v & UCHAR_MAX) == 0);
  4898. #else
  4899. if (ip[m_len] == m_pos[m_len]) do {
  4900. m_len += 1;
  4901. } while (ip[m_len] == m_pos[m_len]);
  4902. #endif
  4903. #elif (LZO_OPT_UNALIGNED32)
  4904. lzo_uint32_t v;
  4905. v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
  4906. if __lzo_unlikely(v == 0) {
  4907. do {
  4908. m_len += 4;
  4909. v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
  4910. if (v != 0)
  4911. break;
  4912. m_len += 4;
  4913. v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
  4914. if __lzo_unlikely(ip + m_len >= ip_end)
  4915. goto m_len_done;
  4916. } while (v == 0);
  4917. }
  4918. #if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz32)
  4919. m_len += lzo_bitops_ctlz32(v) / CHAR_BIT;
  4920. #elif (LZO_ABI_BIG_ENDIAN)
  4921. if ((v >> (32 - CHAR_BIT)) == 0) do {
  4922. v <<= CHAR_BIT;
  4923. m_len += 1;
  4924. } while ((v >> (32 - CHAR_BIT)) == 0);
  4925. #elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz32)
  4926. m_len += lzo_bitops_cttz32(v) / CHAR_BIT;
  4927. #elif (LZO_ABI_LITTLE_ENDIAN)
  4928. if ((v & UCHAR_MAX) == 0) do {
  4929. v >>= CHAR_BIT;
  4930. m_len += 1;
  4931. } while ((v & UCHAR_MAX) == 0);
  4932. #else
  4933. if (ip[m_len] == m_pos[m_len]) do {
  4934. m_len += 1;
  4935. } while (ip[m_len] == m_pos[m_len]);
  4936. #endif
  4937. #else
  4938. if __lzo_unlikely(ip[m_len] == m_pos[m_len]) {
  4939. do {
  4940. m_len += 1;
  4941. if (ip[m_len] != m_pos[m_len])
  4942. break;
  4943. m_len += 1;
  4944. if (ip[m_len] != m_pos[m_len])
  4945. break;
  4946. m_len += 1;
  4947. if (ip[m_len] != m_pos[m_len])
  4948. break;
  4949. m_len += 1;
  4950. if (ip[m_len] != m_pos[m_len])
  4951. break;
  4952. m_len += 1;
  4953. if (ip[m_len] != m_pos[m_len])
  4954. break;
  4955. m_len += 1;
  4956. if (ip[m_len] != m_pos[m_len])
  4957. break;
  4958. m_len += 1;
  4959. if (ip[m_len] != m_pos[m_len])
  4960. break;
  4961. m_len += 1;
  4962. if __lzo_unlikely(ip + m_len >= ip_end)
  4963. goto m_len_done;
  4964. } while (ip[m_len] == m_pos[m_len]);
  4965. }
  4966. #endif
  4967. }
  4968. m_len_done:
  4969. m_off = pd(ip,m_pos);
  4970. ip += m_len;
  4971. ii = ip;
  4972. if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
  4973. {
  4974. m_off -= 1;
  4975. #if defined(LZO1X)
  4976. *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2));
  4977. *op++ = LZO_BYTE(m_off >> 3);
  4978. #elif defined(LZO1Y)
  4979. *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2));
  4980. *op++ = LZO_BYTE(m_off >> 2);
  4981. #endif
  4982. }
  4983. else if (m_off <= M3_MAX_OFFSET)
  4984. {
  4985. m_off -= 1;
  4986. if (m_len <= M3_MAX_LEN)
  4987. *op++ = LZO_BYTE(M3_MARKER | (m_len - 2));
  4988. else
  4989. {
  4990. m_len -= M3_MAX_LEN;
  4991. *op++ = M3_MARKER | 0;
  4992. while __lzo_unlikely(m_len > 255)
  4993. {
  4994. m_len -= 255;
  4995. UA_SET1(op, 0);
  4996. op++;
  4997. }
  4998. *op++ = LZO_BYTE(m_len);
  4999. }
  5000. *op++ = LZO_BYTE(m_off << 2);
  5001. *op++ = LZO_BYTE(m_off >> 6);
  5002. }
  5003. else
  5004. {
  5005. m_off -= 0x4000;
  5006. if (m_len <= M4_MAX_LEN)
  5007. *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8) | (m_len - 2));
  5008. else
  5009. {
  5010. m_len -= M4_MAX_LEN;
  5011. *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8));
  5012. while __lzo_unlikely(m_len > 255)
  5013. {
  5014. m_len -= 255;
  5015. UA_SET1(op, 0);
  5016. op++;
  5017. }
  5018. *op++ = LZO_BYTE(m_len);
  5019. }
  5020. *op++ = LZO_BYTE(m_off << 2);
  5021. *op++ = LZO_BYTE(m_off >> 6);
  5022. }
  5023. goto next;
  5024. }
  5025. *out_len = pd(op, out);
  5026. return pd(in_end,ii-ti);
  5027. }
  5028. LZO_PUBLIC(int)
  5029. DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
  5030. lzo_bytep out, lzo_uintp out_len,
  5031. lzo_voidp wrkmem )
  5032. {
  5033. const lzo_bytep ip = in;
  5034. lzo_bytep op = out;
  5035. lzo_uint l = in_len;
  5036. lzo_uint t = 0;
  5037. while (l > 20)
  5038. {
  5039. lzo_uint ll = l;
  5040. lzo_uintptr_t ll_end;
  5041. #if 0 || (LZO_DETERMINISTIC)
  5042. ll = LZO_MIN(ll, 49152);
  5043. #endif
  5044. ll_end = (lzo_uintptr_t)ip + ll;
  5045. if ((ll_end + ((t + ll) >> 5)) <= ll_end || (const lzo_bytep)(ll_end + ((t + ll) >> 5)) <= ip + ll)
  5046. break;
  5047. #if (LZO_DETERMINISTIC)
  5048. lzo_memset(wrkmem, 0, ((lzo_uint)1 << D_BITS) * sizeof(lzo_dict_t));
  5049. #endif
  5050. t = do_compress(ip,ll,op,out_len,t,wrkmem);
  5051. ip += ll;
  5052. op += *out_len;
  5053. l -= ll;
  5054. }
  5055. t += l;
  5056. if (t > 0)
  5057. {
  5058. const lzo_bytep ii = in + in_len - t;
  5059. if (op == out && t <= 238)
  5060. *op++ = LZO_BYTE(17 + t);
  5061. else if (t <= 3)
  5062. op[-2] = LZO_BYTE(op[-2] | t);
  5063. else if (t <= 18)
  5064. *op++ = LZO_BYTE(t - 3);
  5065. else
  5066. {
  5067. lzo_uint tt = t - 18;
  5068. *op++ = 0;
  5069. while (tt > 255)
  5070. {
  5071. tt -= 255;
  5072. UA_SET1(op, 0);
  5073. op++;
  5074. }
  5075. assert(tt > 0);
  5076. *op++ = LZO_BYTE(tt);
  5077. }
  5078. UA_COPYN(op, ii, t);
  5079. op += t;
  5080. }
  5081. *op++ = M4_MARKER | 1;
  5082. *op++ = 0;
  5083. *op++ = 0;
  5084. *out_len = pd(op, out);
  5085. return LZO_E_OK;
  5086. }
  5087. #endif
  5088. #undef do_compress
  5089. #undef DO_COMPRESS
  5090. #undef LZO_HASH
  5091. #undef LZO_TEST_OVERRUN
  5092. #undef DO_DECOMPRESS
  5093. #define DO_DECOMPRESS lzo1x_decompress
  5094. #if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS)
  5095. #if defined(LZO_TEST_OVERRUN)
  5096. # if !defined(LZO_TEST_OVERRUN_INPUT)
  5097. # define LZO_TEST_OVERRUN_INPUT 2
  5098. # endif
  5099. # if !defined(LZO_TEST_OVERRUN_OUTPUT)
  5100. # define LZO_TEST_OVERRUN_OUTPUT 2
  5101. # endif
  5102. # if !defined(LZO_TEST_OVERRUN_LOOKBEHIND)
  5103. # define LZO_TEST_OVERRUN_LOOKBEHIND 1
  5104. # endif
  5105. #endif
  5106. #undef TEST_IP
  5107. #undef TEST_OP
  5108. #undef TEST_IP_AND_TEST_OP
  5109. #undef TEST_LB
  5110. #undef TEST_LBO
  5111. #undef NEED_IP
  5112. #undef NEED_OP
  5113. #undef TEST_IV
  5114. #undef TEST_OV
  5115. #undef HAVE_TEST_IP
  5116. #undef HAVE_TEST_OP
  5117. #undef HAVE_NEED_IP
  5118. #undef HAVE_NEED_OP
  5119. #undef HAVE_ANY_IP
  5120. #undef HAVE_ANY_OP
  5121. #if defined(LZO_TEST_OVERRUN_INPUT)
  5122. # if (LZO_TEST_OVERRUN_INPUT >= 1)
  5123. # define TEST_IP (ip < ip_end)
  5124. # endif
  5125. # if (LZO_TEST_OVERRUN_INPUT >= 2)
  5126. # define NEED_IP(x) \
  5127. if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun
  5128. # define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun
  5129. # endif
  5130. #endif
  5131. #if defined(LZO_TEST_OVERRUN_OUTPUT)
  5132. # if (LZO_TEST_OVERRUN_OUTPUT >= 1)
  5133. # define TEST_OP (op <= op_end)
  5134. # endif
  5135. # if (LZO_TEST_OVERRUN_OUTPUT >= 2)
  5136. # undef TEST_OP
  5137. # define NEED_OP(x) \
  5138. if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun
  5139. # define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun
  5140. # endif
  5141. #endif
  5142. #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
  5143. # define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun
  5144. # define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun
  5145. #else
  5146. # define TEST_LB(m_pos) ((void) 0)
  5147. # define TEST_LBO(m_pos,o) ((void) 0)
  5148. #endif
  5149. #if !defined(LZO_EOF_CODE) && !defined(TEST_IP)
  5150. # define TEST_IP (ip < ip_end)
  5151. #endif
  5152. #if defined(TEST_IP)
  5153. # define HAVE_TEST_IP 1
  5154. #else
  5155. # define TEST_IP 1
  5156. #endif
  5157. #if defined(TEST_OP)
  5158. # define HAVE_TEST_OP 1
  5159. #else
  5160. # define TEST_OP 1
  5161. #endif
  5162. #if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP)
  5163. # define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP)
  5164. #elif defined(HAVE_TEST_IP)
  5165. # define TEST_IP_AND_TEST_OP TEST_IP
  5166. #elif defined(HAVE_TEST_OP)
  5167. # define TEST_IP_AND_TEST_OP TEST_OP
  5168. #else
  5169. # define TEST_IP_AND_TEST_OP 1
  5170. #endif
  5171. #if defined(NEED_IP)
  5172. # define HAVE_NEED_IP 1
  5173. #else
  5174. # define NEED_IP(x) ((void) 0)
  5175. # define TEST_IV(x) ((void) 0)
  5176. #endif
  5177. #if defined(NEED_OP)
  5178. # define HAVE_NEED_OP 1
  5179. #else
  5180. # define NEED_OP(x) ((void) 0)
  5181. # define TEST_OV(x) ((void) 0)
  5182. #endif
  5183. #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP)
  5184. # define HAVE_ANY_IP 1
  5185. #endif
  5186. #if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP)
  5187. # define HAVE_ANY_OP 1
  5188. #endif
  5189. #if defined(DO_DECOMPRESS)
  5190. LZO_PUBLIC(int)
  5191. DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
  5192. lzo_bytep out, lzo_uintp out_len,
  5193. lzo_voidp wrkmem )
  5194. #endif
  5195. {
  5196. lzo_bytep op;
  5197. const lzo_bytep ip;
  5198. lzo_uint t;
  5199. #if defined(COPY_DICT)
  5200. lzo_uint m_off;
  5201. const lzo_bytep dict_end;
  5202. #else
  5203. const lzo_bytep m_pos;
  5204. #endif
  5205. const lzo_bytep const ip_end = in + in_len;
  5206. #if defined(HAVE_ANY_OP)
  5207. lzo_bytep const op_end = out + *out_len;
  5208. #endif
  5209. #if defined(LZO1Z)
  5210. lzo_uint last_m_off = 0;
  5211. #endif
  5212. LZO_UNUSED(wrkmem);
  5213. #if defined(COPY_DICT)
  5214. if (dict)
  5215. {
  5216. if (dict_len > M4_MAX_OFFSET)
  5217. {
  5218. dict += dict_len - M4_MAX_OFFSET;
  5219. dict_len = M4_MAX_OFFSET;
  5220. }
  5221. dict_end = dict + dict_len;
  5222. }
  5223. else
  5224. {
  5225. dict_len = 0;
  5226. dict_end = NULL;
  5227. }
  5228. #endif
  5229. *out_len = 0;
  5230. op = out;
  5231. ip = in;
  5232. NEED_IP(1);
  5233. if (*ip > 17)
  5234. {
  5235. t = *ip++ - 17;
  5236. if (t < 4)
  5237. goto match_next;
  5238. assert(t > 0); NEED_OP(t); NEED_IP(t+3);
  5239. do *op++ = *ip++; while (--t > 0);
  5240. goto first_literal_run;
  5241. }
  5242. for (;;)
  5243. {
  5244. NEED_IP(3);
  5245. t = *ip++;
  5246. if (t >= 16)
  5247. goto match;
  5248. if (t == 0)
  5249. {
  5250. while (*ip == 0)
  5251. {
  5252. t += 255;
  5253. ip++;
  5254. TEST_IV(t);
  5255. NEED_IP(1);
  5256. }
  5257. t += 15 + *ip++;
  5258. }
  5259. assert(t > 0); NEED_OP(t+3); NEED_IP(t+6);
  5260. #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
  5261. t += 3;
  5262. if (t >= 8) do
  5263. {
  5264. UA_COPY8(op,ip);
  5265. op += 8; ip += 8; t -= 8;
  5266. } while (t >= 8);
  5267. if (t >= 4)
  5268. {
  5269. UA_COPY4(op,ip);
  5270. op += 4; ip += 4; t -= 4;
  5271. }
  5272. if (t > 0)
  5273. {
  5274. *op++ = *ip++;
  5275. if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
  5276. }
  5277. #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
  5278. #if !(LZO_OPT_UNALIGNED32)
  5279. if (PTR_ALIGNED2_4(op,ip))
  5280. {
  5281. #endif
  5282. UA_COPY4(op,ip);
  5283. op += 4; ip += 4;
  5284. if (--t > 0)
  5285. {
  5286. if (t >= 4)
  5287. {
  5288. do {
  5289. UA_COPY4(op,ip);
  5290. op += 4; ip += 4; t -= 4;
  5291. } while (t >= 4);
  5292. if (t > 0) do *op++ = *ip++; while (--t > 0);
  5293. }
  5294. else
  5295. do *op++ = *ip++; while (--t > 0);
  5296. }
  5297. #if !(LZO_OPT_UNALIGNED32)
  5298. }
  5299. else
  5300. #endif
  5301. #endif
  5302. #if !(LZO_OPT_UNALIGNED32)
  5303. {
  5304. *op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
  5305. do *op++ = *ip++; while (--t > 0);
  5306. }
  5307. #endif
  5308. first_literal_run:
  5309. t = *ip++;
  5310. if (t >= 16)
  5311. goto match;
  5312. #if defined(COPY_DICT)
  5313. #if defined(LZO1Z)
  5314. m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
  5315. last_m_off = m_off;
  5316. #else
  5317. m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
  5318. #endif
  5319. NEED_OP(3);
  5320. t = 3; COPY_DICT(t,m_off)
  5321. #else
  5322. #if defined(LZO1Z)
  5323. t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
  5324. m_pos = op - t;
  5325. last_m_off = t;
  5326. #else
  5327. m_pos = op - (1 + M2_MAX_OFFSET);
  5328. m_pos -= t >> 2;
  5329. m_pos -= *ip++ << 2;
  5330. #endif
  5331. TEST_LB(m_pos); NEED_OP(3);
  5332. *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
  5333. #endif
  5334. goto match_done;
  5335. for (;;) {
  5336. match:
  5337. if (t >= 64)
  5338. {
  5339. #if defined(COPY_DICT)
  5340. #if defined(LZO1X)
  5341. m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3);
  5342. t = (t >> 5) - 1;
  5343. #elif defined(LZO1Y)
  5344. m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2);
  5345. t = (t >> 4) - 3;
  5346. #elif defined(LZO1Z)
  5347. m_off = t & 0x1f;
  5348. if (m_off >= 0x1c)
  5349. m_off = last_m_off;
  5350. else
  5351. {
  5352. m_off = 1 + (m_off << 6) + (*ip++ >> 2);
  5353. last_m_off = m_off;
  5354. }
  5355. t = (t >> 5) - 1;
  5356. #endif
  5357. #else
  5358. #if defined(LZO1X)
  5359. m_pos = op - 1;
  5360. m_pos -= (t >> 2) & 7;
  5361. m_pos -= *ip++ << 3;
  5362. t = (t >> 5) - 1;
  5363. #elif defined(LZO1Y)
  5364. m_pos = op - 1;
  5365. m_pos -= (t >> 2) & 3;
  5366. m_pos -= *ip++ << 2;
  5367. t = (t >> 4) - 3;
  5368. #elif defined(LZO1Z)
  5369. {
  5370. lzo_uint off = t & 0x1f;
  5371. m_pos = op;
  5372. if (off >= 0x1c)
  5373. {
  5374. assert(last_m_off > 0);
  5375. m_pos -= last_m_off;
  5376. }
  5377. else
  5378. {
  5379. off = 1 + (off << 6) + (*ip++ >> 2);
  5380. m_pos -= off;
  5381. last_m_off = off;
  5382. }
  5383. }
  5384. t = (t >> 5) - 1;
  5385. #endif
  5386. TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
  5387. goto copy_match;
  5388. #endif
  5389. }
  5390. else if (t >= 32)
  5391. {
  5392. t &= 31;
  5393. if (t == 0)
  5394. {
  5395. while (*ip == 0)
  5396. {
  5397. t += 255;
  5398. ip++;
  5399. TEST_OV(t);
  5400. NEED_IP(1);
  5401. }
  5402. t += 31 + *ip++;
  5403. NEED_IP(2);
  5404. }
  5405. #if defined(COPY_DICT)
  5406. #if defined(LZO1Z)
  5407. m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
  5408. last_m_off = m_off;
  5409. #else
  5410. m_off = 1 + (ip[0] >> 2) + (ip[1] << 6);
  5411. #endif
  5412. #else
  5413. #if defined(LZO1Z)
  5414. {
  5415. lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2);
  5416. m_pos = op - off;
  5417. last_m_off = off;
  5418. }
  5419. #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
  5420. m_pos = op - 1;
  5421. m_pos -= UA_GET_LE16(ip) >> 2;
  5422. #else
  5423. m_pos = op - 1;
  5424. m_pos -= (ip[0] >> 2) + (ip[1] << 6);
  5425. #endif
  5426. #endif
  5427. ip += 2;
  5428. }
  5429. else if (t >= 16)
  5430. {
  5431. #if defined(COPY_DICT)
  5432. m_off = (t & 8) << 11;
  5433. #else
  5434. m_pos = op;
  5435. m_pos -= (t & 8) << 11;
  5436. #endif
  5437. t &= 7;
  5438. if (t == 0)
  5439. {
  5440. while (*ip == 0)
  5441. {
  5442. t += 255;
  5443. ip++;
  5444. TEST_OV(t);
  5445. NEED_IP(1);
  5446. }
  5447. t += 7 + *ip++;
  5448. NEED_IP(2);
  5449. }
  5450. #if defined(COPY_DICT)
  5451. #if defined(LZO1Z)
  5452. m_off += (ip[0] << 6) + (ip[1] >> 2);
  5453. #else
  5454. m_off += (ip[0] >> 2) + (ip[1] << 6);
  5455. #endif
  5456. ip += 2;
  5457. if (m_off == 0)
  5458. goto eof_found;
  5459. m_off += 0x4000;
  5460. #if defined(LZO1Z)
  5461. last_m_off = m_off;
  5462. #endif
  5463. #else
  5464. #if defined(LZO1Z)
  5465. m_pos -= (ip[0] << 6) + (ip[1] >> 2);
  5466. #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
  5467. m_pos -= UA_GET_LE16(ip) >> 2;
  5468. #else
  5469. m_pos -= (ip[0] >> 2) + (ip[1] << 6);
  5470. #endif
  5471. ip += 2;
  5472. if (m_pos == op)
  5473. goto eof_found;
  5474. m_pos -= 0x4000;
  5475. #if defined(LZO1Z)
  5476. last_m_off = pd((const lzo_bytep)op, m_pos);
  5477. #endif
  5478. #endif
  5479. }
  5480. else
  5481. {
  5482. #if defined(COPY_DICT)
  5483. #if defined(LZO1Z)
  5484. m_off = 1 + (t << 6) + (*ip++ >> 2);
  5485. last_m_off = m_off;
  5486. #else
  5487. m_off = 1 + (t >> 2) + (*ip++ << 2);
  5488. #endif
  5489. NEED_OP(2);
  5490. t = 2; COPY_DICT(t,m_off)
  5491. #else
  5492. #if defined(LZO1Z)
  5493. t = 1 + (t << 6) + (*ip++ >> 2);
  5494. m_pos = op - t;
  5495. last_m_off = t;
  5496. #else
  5497. m_pos = op - 1;
  5498. m_pos -= t >> 2;
  5499. m_pos -= *ip++ << 2;
  5500. #endif
  5501. TEST_LB(m_pos); NEED_OP(2);
  5502. *op++ = *m_pos++; *op++ = *m_pos;
  5503. #endif
  5504. goto match_done;
  5505. }
  5506. #if defined(COPY_DICT)
  5507. NEED_OP(t+3-1);
  5508. t += 3-1; COPY_DICT(t,m_off)
  5509. #else
  5510. TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
  5511. #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
  5512. if (op - m_pos >= 8)
  5513. {
  5514. t += (3 - 1);
  5515. if (t >= 8) do
  5516. {
  5517. UA_COPY8(op,m_pos);
  5518. op += 8; m_pos += 8; t -= 8;
  5519. } while (t >= 8);
  5520. if (t >= 4)
  5521. {
  5522. UA_COPY4(op,m_pos);
  5523. op += 4; m_pos += 4; t -= 4;
  5524. }
  5525. if (t > 0)
  5526. {
  5527. *op++ = m_pos[0];
  5528. if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } }
  5529. }
  5530. }
  5531. else
  5532. #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
  5533. #if !(LZO_OPT_UNALIGNED32)
  5534. if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos))
  5535. {
  5536. assert((op - m_pos) >= 4);
  5537. #else
  5538. if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
  5539. {
  5540. #endif
  5541. UA_COPY4(op,m_pos);
  5542. op += 4; m_pos += 4; t -= 4 - (3 - 1);
  5543. do {
  5544. UA_COPY4(op,m_pos);
  5545. op += 4; m_pos += 4; t -= 4;
  5546. } while (t >= 4);
  5547. if (t > 0) do *op++ = *m_pos++; while (--t > 0);
  5548. }
  5549. else
  5550. #endif
  5551. {
  5552. copy_match:
  5553. *op++ = *m_pos++; *op++ = *m_pos++;
  5554. do *op++ = *m_pos++; while (--t > 0);
  5555. }
  5556. #endif
  5557. match_done:
  5558. #if defined(LZO1Z)
  5559. t = ip[-1] & 3;
  5560. #else
  5561. t = ip[-2] & 3;
  5562. #endif
  5563. if (t == 0)
  5564. break;
  5565. match_next:
  5566. assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3);
  5567. #if 0
  5568. do *op++ = *ip++; while (--t > 0);
  5569. #else
  5570. *op++ = *ip++;
  5571. if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
  5572. #endif
  5573. t = *ip++;
  5574. }
  5575. }
  5576. eof_found:
  5577. *out_len = pd(op, out);
  5578. return (ip == ip_end ? LZO_E_OK :
  5579. (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
  5580. #if defined(HAVE_NEED_IP)
  5581. input_overrun:
  5582. *out_len = pd(op, out);
  5583. return LZO_E_INPUT_OVERRUN;
  5584. #endif
  5585. #if defined(HAVE_NEED_OP)
  5586. output_overrun:
  5587. *out_len = pd(op, out);
  5588. return LZO_E_OUTPUT_OVERRUN;
  5589. #endif
  5590. #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
  5591. lookbehind_overrun:
  5592. *out_len = pd(op, out);
  5593. return LZO_E_LOOKBEHIND_OVERRUN;
  5594. #endif
  5595. }
  5596. #endif
  5597. #define LZO_TEST_OVERRUN 1
  5598. #undef DO_DECOMPRESS
  5599. #define DO_DECOMPRESS lzo1x_decompress_safe
  5600. #if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE)
  5601. #if defined(LZO_TEST_OVERRUN)
  5602. # if !defined(LZO_TEST_OVERRUN_INPUT)
  5603. # define LZO_TEST_OVERRUN_INPUT 2
  5604. # endif
  5605. # if !defined(LZO_TEST_OVERRUN_OUTPUT)
  5606. # define LZO_TEST_OVERRUN_OUTPUT 2
  5607. # endif
  5608. # if !defined(LZO_TEST_OVERRUN_LOOKBEHIND)
  5609. # define LZO_TEST_OVERRUN_LOOKBEHIND 1
  5610. # endif
  5611. #endif
  5612. #undef TEST_IP
  5613. #undef TEST_OP
  5614. #undef TEST_IP_AND_TEST_OP
  5615. #undef TEST_LB
  5616. #undef TEST_LBO
  5617. #undef NEED_IP
  5618. #undef NEED_OP
  5619. #undef TEST_IV
  5620. #undef TEST_OV
  5621. #undef HAVE_TEST_IP
  5622. #undef HAVE_TEST_OP
  5623. #undef HAVE_NEED_IP
  5624. #undef HAVE_NEED_OP
  5625. #undef HAVE_ANY_IP
  5626. #undef HAVE_ANY_OP
  5627. #if defined(LZO_TEST_OVERRUN_INPUT)
  5628. # if (LZO_TEST_OVERRUN_INPUT >= 1)
  5629. # define TEST_IP (ip < ip_end)
  5630. # endif
  5631. # if (LZO_TEST_OVERRUN_INPUT >= 2)
  5632. # define NEED_IP(x) \
  5633. if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun
  5634. # define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun
  5635. # endif
  5636. #endif
  5637. #if defined(LZO_TEST_OVERRUN_OUTPUT)
  5638. # if (LZO_TEST_OVERRUN_OUTPUT >= 1)
  5639. # define TEST_OP (op <= op_end)
  5640. # endif
  5641. # if (LZO_TEST_OVERRUN_OUTPUT >= 2)
  5642. # undef TEST_OP
  5643. # define NEED_OP(x) \
  5644. if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun
  5645. # define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun
  5646. # endif
  5647. #endif
  5648. #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
  5649. # define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun
  5650. # define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun
  5651. #else
  5652. # define TEST_LB(m_pos) ((void) 0)
  5653. # define TEST_LBO(m_pos,o) ((void) 0)
  5654. #endif
  5655. #if !defined(LZO_EOF_CODE) && !defined(TEST_IP)
  5656. # define TEST_IP (ip < ip_end)
  5657. #endif
  5658. #if defined(TEST_IP)
  5659. # define HAVE_TEST_IP 1
  5660. #else
  5661. # define TEST_IP 1
  5662. #endif
  5663. #if defined(TEST_OP)
  5664. # define HAVE_TEST_OP 1
  5665. #else
  5666. # define TEST_OP 1
  5667. #endif
  5668. #if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP)
  5669. # define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP)
  5670. #elif defined(HAVE_TEST_IP)
  5671. # define TEST_IP_AND_TEST_OP TEST_IP
  5672. #elif defined(HAVE_TEST_OP)
  5673. # define TEST_IP_AND_TEST_OP TEST_OP
  5674. #else
  5675. # define TEST_IP_AND_TEST_OP 1
  5676. #endif
  5677. #if defined(NEED_IP)
  5678. # define HAVE_NEED_IP 1
  5679. #else
  5680. # define NEED_IP(x) ((void) 0)
  5681. # define TEST_IV(x) ((void) 0)
  5682. #endif
  5683. #if defined(NEED_OP)
  5684. # define HAVE_NEED_OP 1
  5685. #else
  5686. # define NEED_OP(x) ((void) 0)
  5687. # define TEST_OV(x) ((void) 0)
  5688. #endif
  5689. #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP)
  5690. # define HAVE_ANY_IP 1
  5691. #endif
  5692. #if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP)
  5693. # define HAVE_ANY_OP 1
  5694. #endif
  5695. #if defined(DO_DECOMPRESS)
  5696. LZO_PUBLIC(int)
  5697. DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
  5698. lzo_bytep out, lzo_uintp out_len,
  5699. lzo_voidp wrkmem )
  5700. #endif
  5701. {
  5702. lzo_bytep op;
  5703. const lzo_bytep ip;
  5704. lzo_uint t;
  5705. #if defined(COPY_DICT)
  5706. lzo_uint m_off;
  5707. const lzo_bytep dict_end;
  5708. #else
  5709. const lzo_bytep m_pos;
  5710. #endif
  5711. const lzo_bytep const ip_end = in + in_len;
  5712. #if defined(HAVE_ANY_OP)
  5713. lzo_bytep const op_end = out + *out_len;
  5714. #endif
  5715. #if defined(LZO1Z)
  5716. lzo_uint last_m_off = 0;
  5717. #endif
  5718. LZO_UNUSED(wrkmem);
  5719. #if defined(COPY_DICT)
  5720. if (dict)
  5721. {
  5722. if (dict_len > M4_MAX_OFFSET)
  5723. {
  5724. dict += dict_len - M4_MAX_OFFSET;
  5725. dict_len = M4_MAX_OFFSET;
  5726. }
  5727. dict_end = dict + dict_len;
  5728. }
  5729. else
  5730. {
  5731. dict_len = 0;
  5732. dict_end = NULL;
  5733. }
  5734. #endif
  5735. *out_len = 0;
  5736. op = out;
  5737. ip = in;
  5738. NEED_IP(1);
  5739. if (*ip > 17)
  5740. {
  5741. t = *ip++ - 17;
  5742. if (t < 4)
  5743. goto match_next;
  5744. assert(t > 0); NEED_OP(t); NEED_IP(t+3);
  5745. do *op++ = *ip++; while (--t > 0);
  5746. goto first_literal_run;
  5747. }
  5748. for (;;)
  5749. {
  5750. NEED_IP(3);
  5751. t = *ip++;
  5752. if (t >= 16)
  5753. goto match;
  5754. if (t == 0)
  5755. {
  5756. while (*ip == 0)
  5757. {
  5758. t += 255;
  5759. ip++;
  5760. TEST_IV(t);
  5761. NEED_IP(1);
  5762. }
  5763. t += 15 + *ip++;
  5764. }
  5765. assert(t > 0); NEED_OP(t+3); NEED_IP(t+6);
  5766. #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
  5767. t += 3;
  5768. if (t >= 8) do
  5769. {
  5770. UA_COPY8(op,ip);
  5771. op += 8; ip += 8; t -= 8;
  5772. } while (t >= 8);
  5773. if (t >= 4)
  5774. {
  5775. UA_COPY4(op,ip);
  5776. op += 4; ip += 4; t -= 4;
  5777. }
  5778. if (t > 0)
  5779. {
  5780. *op++ = *ip++;
  5781. if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
  5782. }
  5783. #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
  5784. #if !(LZO_OPT_UNALIGNED32)
  5785. if (PTR_ALIGNED2_4(op,ip))
  5786. {
  5787. #endif
  5788. UA_COPY4(op,ip);
  5789. op += 4; ip += 4;
  5790. if (--t > 0)
  5791. {
  5792. if (t >= 4)
  5793. {
  5794. do {
  5795. UA_COPY4(op,ip);
  5796. op += 4; ip += 4; t -= 4;
  5797. } while (t >= 4);
  5798. if (t > 0) do *op++ = *ip++; while (--t > 0);
  5799. }
  5800. else
  5801. do *op++ = *ip++; while (--t > 0);
  5802. }
  5803. #if !(LZO_OPT_UNALIGNED32)
  5804. }
  5805. else
  5806. #endif
  5807. #endif
  5808. #if !(LZO_OPT_UNALIGNED32)
  5809. {
  5810. *op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
  5811. do *op++ = *ip++; while (--t > 0);
  5812. }
  5813. #endif
  5814. first_literal_run:
  5815. t = *ip++;
  5816. if (t >= 16)
  5817. goto match;
  5818. #if defined(COPY_DICT)
  5819. #if defined(LZO1Z)
  5820. m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
  5821. last_m_off = m_off;
  5822. #else
  5823. m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
  5824. #endif
  5825. NEED_OP(3);
  5826. t = 3; COPY_DICT(t,m_off)
  5827. #else
  5828. #if defined(LZO1Z)
  5829. t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
  5830. m_pos = op - t;
  5831. last_m_off = t;
  5832. #else
  5833. m_pos = op - (1 + M2_MAX_OFFSET);
  5834. m_pos -= t >> 2;
  5835. m_pos -= *ip++ << 2;
  5836. #endif
  5837. TEST_LB(m_pos); NEED_OP(3);
  5838. *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
  5839. #endif
  5840. goto match_done;
  5841. for (;;) {
  5842. match:
  5843. if (t >= 64)
  5844. {
  5845. #if defined(COPY_DICT)
  5846. #if defined(LZO1X)
  5847. m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3);
  5848. t = (t >> 5) - 1;
  5849. #elif defined(LZO1Y)
  5850. m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2);
  5851. t = (t >> 4) - 3;
  5852. #elif defined(LZO1Z)
  5853. m_off = t & 0x1f;
  5854. if (m_off >= 0x1c)
  5855. m_off = last_m_off;
  5856. else
  5857. {
  5858. m_off = 1 + (m_off << 6) + (*ip++ >> 2);
  5859. last_m_off = m_off;
  5860. }
  5861. t = (t >> 5) - 1;
  5862. #endif
  5863. #else
  5864. #if defined(LZO1X)
  5865. m_pos = op - 1;
  5866. m_pos -= (t >> 2) & 7;
  5867. m_pos -= *ip++ << 3;
  5868. t = (t >> 5) - 1;
  5869. #elif defined(LZO1Y)
  5870. m_pos = op - 1;
  5871. m_pos -= (t >> 2) & 3;
  5872. m_pos -= *ip++ << 2;
  5873. t = (t >> 4) - 3;
  5874. #elif defined(LZO1Z)
  5875. {
  5876. lzo_uint off = t & 0x1f;
  5877. m_pos = op;
  5878. if (off >= 0x1c)
  5879. {
  5880. assert(last_m_off > 0);
  5881. m_pos -= last_m_off;
  5882. }
  5883. else
  5884. {
  5885. off = 1 + (off << 6) + (*ip++ >> 2);
  5886. m_pos -= off;
  5887. last_m_off = off;
  5888. }
  5889. }
  5890. t = (t >> 5) - 1;
  5891. #endif
  5892. TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
  5893. goto copy_match;
  5894. #endif
  5895. }
  5896. else if (t >= 32)
  5897. {
  5898. t &= 31;
  5899. if (t == 0)
  5900. {
  5901. while (*ip == 0)
  5902. {
  5903. t += 255;
  5904. ip++;
  5905. TEST_OV(t);
  5906. NEED_IP(1);
  5907. }
  5908. t += 31 + *ip++;
  5909. NEED_IP(2);
  5910. }
  5911. #if defined(COPY_DICT)
  5912. #if defined(LZO1Z)
  5913. m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
  5914. last_m_off = m_off;
  5915. #else
  5916. m_off = 1 + (ip[0] >> 2) + (ip[1] << 6);
  5917. #endif
  5918. #else
  5919. #if defined(LZO1Z)
  5920. {
  5921. lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2);
  5922. m_pos = op - off;
  5923. last_m_off = off;
  5924. }
  5925. #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
  5926. m_pos = op - 1;
  5927. m_pos -= UA_GET_LE16(ip) >> 2;
  5928. #else
  5929. m_pos = op - 1;
  5930. m_pos -= (ip[0] >> 2) + (ip[1] << 6);
  5931. #endif
  5932. #endif
  5933. ip += 2;
  5934. }
  5935. else if (t >= 16)
  5936. {
  5937. #if defined(COPY_DICT)
  5938. m_off = (t & 8) << 11;
  5939. #else
  5940. m_pos = op;
  5941. m_pos -= (t & 8) << 11;
  5942. #endif
  5943. t &= 7;
  5944. if (t == 0)
  5945. {
  5946. while (*ip == 0)
  5947. {
  5948. t += 255;
  5949. ip++;
  5950. TEST_OV(t);
  5951. NEED_IP(1);
  5952. }
  5953. t += 7 + *ip++;
  5954. NEED_IP(2);
  5955. }
  5956. #if defined(COPY_DICT)
  5957. #if defined(LZO1Z)
  5958. m_off += (ip[0] << 6) + (ip[1] >> 2);
  5959. #else
  5960. m_off += (ip[0] >> 2) + (ip[1] << 6);
  5961. #endif
  5962. ip += 2;
  5963. if (m_off == 0)
  5964. goto eof_found;
  5965. m_off += 0x4000;
  5966. #if defined(LZO1Z)
  5967. last_m_off = m_off;
  5968. #endif
  5969. #else
  5970. #if defined(LZO1Z)
  5971. m_pos -= (ip[0] << 6) + (ip[1] >> 2);
  5972. #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
  5973. m_pos -= UA_GET_LE16(ip) >> 2;
  5974. #else
  5975. m_pos -= (ip[0] >> 2) + (ip[1] << 6);
  5976. #endif
  5977. ip += 2;
  5978. if (m_pos == op)
  5979. goto eof_found;
  5980. m_pos -= 0x4000;
  5981. #if defined(LZO1Z)
  5982. last_m_off = pd((const lzo_bytep)op, m_pos);
  5983. #endif
  5984. #endif
  5985. }
  5986. else
  5987. {
  5988. #if defined(COPY_DICT)
  5989. #if defined(LZO1Z)
  5990. m_off = 1 + (t << 6) + (*ip++ >> 2);
  5991. last_m_off = m_off;
  5992. #else
  5993. m_off = 1 + (t >> 2) + (*ip++ << 2);
  5994. #endif
  5995. NEED_OP(2);
  5996. t = 2; COPY_DICT(t,m_off)
  5997. #else
  5998. #if defined(LZO1Z)
  5999. t = 1 + (t << 6) + (*ip++ >> 2);
  6000. m_pos = op - t;
  6001. last_m_off = t;
  6002. #else
  6003. m_pos = op - 1;
  6004. m_pos -= t >> 2;
  6005. m_pos -= *ip++ << 2;
  6006. #endif
  6007. TEST_LB(m_pos); NEED_OP(2);
  6008. *op++ = *m_pos++; *op++ = *m_pos;
  6009. #endif
  6010. goto match_done;
  6011. }
  6012. #if defined(COPY_DICT)
  6013. NEED_OP(t+3-1);
  6014. t += 3-1; COPY_DICT(t,m_off)
  6015. #else
  6016. TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
  6017. #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
  6018. if (op - m_pos >= 8)
  6019. {
  6020. t += (3 - 1);
  6021. if (t >= 8) do
  6022. {
  6023. UA_COPY8(op,m_pos);
  6024. op += 8; m_pos += 8; t -= 8;
  6025. } while (t >= 8);
  6026. if (t >= 4)
  6027. {
  6028. UA_COPY4(op,m_pos);
  6029. op += 4; m_pos += 4; t -= 4;
  6030. }
  6031. if (t > 0)
  6032. {
  6033. *op++ = m_pos[0];
  6034. if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } }
  6035. }
  6036. }
  6037. else
  6038. #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
  6039. #if !(LZO_OPT_UNALIGNED32)
  6040. if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos))
  6041. {
  6042. assert((op - m_pos) >= 4);
  6043. #else
  6044. if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
  6045. {
  6046. #endif
  6047. UA_COPY4(op,m_pos);
  6048. op += 4; m_pos += 4; t -= 4 - (3 - 1);
  6049. do {
  6050. UA_COPY4(op,m_pos);
  6051. op += 4; m_pos += 4; t -= 4;
  6052. } while (t >= 4);
  6053. if (t > 0) do *op++ = *m_pos++; while (--t > 0);
  6054. }
  6055. else
  6056. #endif
  6057. {
  6058. copy_match:
  6059. *op++ = *m_pos++; *op++ = *m_pos++;
  6060. do *op++ = *m_pos++; while (--t > 0);
  6061. }
  6062. #endif
  6063. match_done:
  6064. #if defined(LZO1Z)
  6065. t = ip[-1] & 3;
  6066. #else
  6067. t = ip[-2] & 3;
  6068. #endif
  6069. if (t == 0)
  6070. break;
  6071. match_next:
  6072. assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3);
  6073. #if 0
  6074. do *op++ = *ip++; while (--t > 0);
  6075. #else
  6076. *op++ = *ip++;
  6077. if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
  6078. #endif
  6079. t = *ip++;
  6080. }
  6081. }
  6082. eof_found:
  6083. *out_len = pd(op, out);
  6084. return (ip == ip_end ? LZO_E_OK :
  6085. (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
  6086. #if defined(HAVE_NEED_IP)
  6087. input_overrun:
  6088. *out_len = pd(op, out);
  6089. return LZO_E_INPUT_OVERRUN;
  6090. #endif
  6091. #if defined(HAVE_NEED_OP)
  6092. output_overrun:
  6093. *out_len = pd(op, out);
  6094. return LZO_E_OUTPUT_OVERRUN;
  6095. #endif
  6096. #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
  6097. lookbehind_overrun:
  6098. *out_len = pd(op, out);
  6099. return LZO_E_LOOKBEHIND_OVERRUN;
  6100. #endif
  6101. }
  6102. #endif
  6103. /***** End of minilzo.c *****/