minilzo.c 209 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365
  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 *****/