// // Copyright 2020 FoxyUtils ehf. All rights reserved. // // This is a commercial product and requires a license to operate. // A trial license can be obtained at https://unidoc.io // // DO NOT EDIT: generated by unitwist Go source code obfuscator. // // Use of this source code is governed by the UniDoc End User License Agreement // terms that can be accessed at https://unidoc.io/eula/ package arithmetic ;import (_e "fmt";_ee "github.com/unidoc/unipdf/v3/common";_c "github.com/unidoc/unipdf/v3/internal/bitwise";_dc "github.com/unidoc/unipdf/v3/internal/jbig2/internal";_b "io";_d "strings";);func (_bga *Decoder )readByte ()error {if _bga ._f .StreamPosition ()> _bga ._bb {if _ ,_cd :=_bga ._f .Seek (-1,_b .SeekCurrent ); _cd !=nil {return _cd ;};};_ea ,_fd :=_bga ._f .ReadByte ();if _fd !=nil {return _fd ;};_bga ._ca =_ea ;if _bga ._ca ==0xFF{_ge ,_gfa :=_bga ._f .ReadByte ();if _gfa !=nil {return _gfa ;};if _ge > 0x8F{_bga ._de +=0xFF00;_bga ._ed =8;if _ ,_bf :=_bga ._f .Seek (-2,_b .SeekCurrent ); _bf !=nil {return _bf ;};}else {_bga ._de +=uint64 (_ge )<<9;_bga ._ed =7;};}else {_ea ,_fd =_bga ._f .ReadByte ();if _fd !=nil {return _fd ;};_bga ._ca =_ea ;_bga ._de +=uint64 (_bga ._ca )<<8;_bga ._ed =8;};_bga ._de &=0xFFFFFFFFFF;return nil ;};var (_gc =[][4]uint32 {{0x5601,1,1,1},{0x3401,2,6,0},{0x1801,3,9,0},{0x0AC1,4,12,0},{0x0521,5,29,0},{0x0221,38,33,0},{0x5601,7,6,1},{0x5401,8,14,0},{0x4801,9,14,0},{0x3801,10,14,0},{0x3001,11,17,0},{0x2401,12,18,0},{0x1C01,13,20,0},{0x1601,29,21,0},{0x5601,15,14,1},{0x5401,16,14,0},{0x5101,17,15,0},{0x4801,18,16,0},{0x3801,19,17,0},{0x3401,20,18,0},{0x3001,21,19,0},{0x2801,22,19,0},{0x2401,23,20,0},{0x2201,24,21,0},{0x1C01,25,22,0},{0x1801,26,23,0},{0x1601,27,24,0},{0x1401,28,25,0},{0x1201,29,26,0},{0x1101,30,27,0},{0x0AC1,31,28,0},{0x09C1,32,29,0},{0x08A1,33,30,0},{0x0521,34,31,0},{0x0441,35,32,0},{0x02A1,36,33,0},{0x0221,37,34,0},{0x0141,38,35,0},{0x0111,39,36,0},{0x0085,40,37,0},{0x0049,41,38,0},{0x0025,42,39,0},{0x0015,43,40,0},{0x0009,44,41,0},{0x0005,45,42,0},{0x0001,45,43,0},{0x5601,46,46,0}}; );func (_gbd *Decoder )DecodeIAID (codeLen uint64 ,stats *DecoderStats )(int64 ,error ){_gbd ._dd =1;var _gf uint64 ;for _gf =0;_gf < codeLen ;_gf ++{stats .SetIndex (int32 (_gbd ._dd ));_fb ,_gcb :=_gbd .DecodeBit (stats );if _gcb !=nil {return 0,_gcb ; };_gbd ._dd =(_gbd ._dd <<1)|int64 (_fb );};_deb :=_gbd ._dd -(1< 0{return -_bcb ,nil ;};return 0,_dc .ErrOOB ;};func (_ega *DecoderStats )String ()string {_fdg :=&_d .Builder {};_fdg .WriteString (_e .Sprintf ("S\u0074\u0061\u0074\u0073\u003a\u0020\u0020\u0025\u0064\u000a",len (_ega ._ddf ))); for _cce ,_cb :=range _ega ._ddf {if _cb !=0{_fdg .WriteString (_e .Sprintf ("N\u006f\u0074\u0020\u007aer\u006f \u0061\u0074\u003a\u0020\u0025d\u0020\u002d\u0020\u0025\u0064\u000a",_cce ,_cb ));};};return _fdg .String ();};func (_bc *Decoder )DecodeBit (stats *DecoderStats )(int ,error ){var (_cf int ; _ag =_gc [stats .cx ()][0];_fa =int32 (stats .cx ()););defer func (){_bc ._a ++}();_bc ._cc -=_ag ;if (_bc ._de >>16)< uint64 (_ag ){_cf =_bc .lpsExchange (stats ,_fa ,_ag );if _dea :=_bc .renormalize ();_dea !=nil {return 0,_dea ;};}else {_bc ._de -=uint64 (_ag )<<16; if (_bc ._cc &0x8000)==0{_cf =_bc .mpsExchange (stats ,_fa );if _gb :=_bc .renormalize ();_gb !=nil {return 0,_gb ;};}else {_cf =int (stats .getMps ());};};return _cf ,nil ;};func (_bff *Decoder )mpsExchange (_ddb *DecoderStats ,_ba int32 )int {_bfa :=_ddb ._aff [_ddb ._dg ]; if _bff ._cc < _gc [_ba ][0]{if _gc [_ba ][3]==1{_ddb .toggleMps ();};_ddb .setEntry (int (_gc [_ba ][2]));return int (1-_bfa );};_ddb .setEntry (int (_gc [_ba ][1]));return int (_bfa );};func (_ae *Decoder )decodeIntBit (_fad *DecoderStats )(int ,error ){_fad .SetIndex (int32 (_ae ._dd )); _eg ,_bd :=_ae .DecodeBit (_fad );if _bd !=nil {_ee .Log .Debug ("\u0041\u0072\u0069\u0074\u0068\u006d\u0065t\u0069\u0063\u0044e\u0063\u006f\u0064e\u0072\u0020'\u0064\u0065\u0063\u006f\u0064\u0065I\u006etB\u0069\u0074\u0027\u002d\u003e\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0042\u0069\u0074\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0020\u0025\u0076",_bd ); return _eg ,_bd ;};if _ae ._dd < 256{_ae ._dd =((_ae ._dd <