/***************************************************************************\
-|* Function Parser for C++ v4.5 *|
+|* Function Parser for C++ v4.5.1 *|
|*-------------------------------------------------------------------------*|
|* Function optimizer *|
|*-------------------------------------------------------------------------*|
#include "fparser.hh"
#include "extrasrc/fptypes.hh"
#include "extrasrc/fpaux.hh"
-#define l64 y91 a),
-#define l54 if(n5 iK3
-#define l44 ,{ReplaceParams,
-#define l34 cTan iO
-#define l24 "Found "
-#define l14 ,cPow,
-#define l04 stackpos
-#define iZ3 sim.nY 1,
-#define iY3 ,tree,info
-#define iX3 "dup(%u) "
-#define iW3 "%d, cost "
-#define iV3 "PUSH "i13(
-#define iU3 "immed "<<
-#define iT3 mFuncParsers
-#define iS3 e62{assert
-#define iR3 stderr
-#define iQ3 sep2=" "
-#define iP3 FPHASH_CONST
-#define iO3 .SetParamsMove(
-#define iN3 cache_needed[
-#define iM3 fprintf
-#define iL3 ::cout<<"Applying "
-#define iK3 HANDLE_UNARY_CONST_FUNC
-#define iJ3 1)i61){
-#define iI3 c_count
-#define iH3 s_count
-#define iG3 2)lS 2*
-#define iF3 tmp.yH1
-#define iE3 tmp2.nJ
-#define iD3 ,tZ 2,
-#define iC3 (p0 n51&&
-#define iB3 else nM
-#define iA3 max.val
-#define i93 eK2 if(
-#define i83 tree c9
-#define i73 sim.x61
-#define i63 ].swap(
-#define i53 codes[b
-#define i43 whydump
-#define i33 );}case
-#define i23 :if(eQ3
-#define i13 ;DumpTree
-#define i03 :{lX1 r
-#define tZ3 nparams
-#define tY3 cLog iO
-#define tX3 l4 16,1,
-#define tW3 l4 0,1,
-#define tV3 0x12 nH
-#define tU3 ,0,0x16},{
-#define tT3 nQ 0,
-#define tS3 cAbs nQ
-#define tR3 false;}
-#define tQ3 nE1 cF1
-#define tP3 xF1++b)
-#define tO3 =false;
-#define tN3 {data->
-#define tM3 info.
-#define tL3 b.Value)
-#define tK3 b.Opcode
-#define tJ3 ,tB info
-#define tI3 tree xD
-#define tH3 xD cMul);
-#define tG3 ParamHolder
-#define tF3 size()
-#define tE3 .second
-#define tD3 ]tE3
-#define tC3 ].first
-#define tB3 Ne_Mask
-#define tA3 Gt_Mask
-#define t93 Lt_Mask
-#define t83 opcode,
-#define t73 resize(
-#define t63 t33 nC1;
-#define t53 xD cond nC
-#define t43 );}else
-#define t33 lE2 a)
-#define t23 AddFrom(
-#define t13 max.known
-#define t03 =fp_pow(
-#define eZ3 (tree)!=
-#define eY3 );if(
-#define eX3 public:
-#define eW3 pclone
-#define eV3 Others
-#define eU3 --cN1.
-#define eT3 cOr,l6
-#define eS3 newpow
-#define eR3 if(p0 yN
-#define eQ3 &*(*x5 n71){
-#define eP3 ,lT 1,0,
-#define eO3 lE2 1)
-#define eN3 (op1==
-#define eM3 change
-#define eL3 (count
-#define eK3 133,2,
-#define eJ3 Needs
-#define eI3 byteCode
-#define eH3 (p1 nC1
-#define eG3 lS1 nC==
-#define eF3 cLog2by
-#define eE3 factor_t
-#define eD3 (*x5)[0].info
-#define eC3 tree nC1
-#define eB3 value1
-#define eA3 Finite
-#define e93 fp_mod(
-#define e83 )const
-#define e73 (e83{
-#define e63 else{if(
-#define e53 xK());nD
-#define e43 TreeCountItem
-#define e33 if(op==
-#define e23 yN val)<
-#define e13 p yN val
-#define e03 c9 ifp2
-#define cZ3 cAbsNot
-#define cY3 stackptr
-#define cX3 cLog);xL
-#define cW3 switch(tM
-#define cV3 p1 cK p1);
-#define cU3 );p1 c9 ifp1
-#define cT3 .empty()
-#define cS3 opcodes
-#define cR3 did_muli
-#define cQ3 xD data.
-#define cP3 &Value){
-#define cO3 yH const
-#define cN3 used[b]
-#define cM3 sizeof(
-#define cL3 cAbsIf,
-#define cK3 cNotNot,
-#define cJ3 18,2 eN1
-#define cI3 c22 iE,
-#define cH3 450998,
-#define cG3 cAtan2,
-#define cF3 cExp2 nQ
-#define cE3 lJ 2},0,
-#define cD3 middle2
-#define cC3 ::string
-#define cB3 fp_equal(
-#define cA3 ;if(cB3
-#define c93 (iE2 l8 1)xC1
-#define c83 FP_GetOpcodeName(
-#define c73 default:
-#define c63 n31;case
-#define c53 tG));nV
-#define c43 range nJ3
-#define c33 range<yN2
-#define c23 range xK
-#define c13 Ge0Lt1
-#define c03 Gt0Le1
-#define yZ3 cAdd lS2
-#define yY3 ==cOr tE2
-#define yX3 IsLogicalValue y91
-#define yW3 cAbsIf)
-#define yV3 iterator
-#define yU3 begin();
-#define yT3 TreeSet
-#define yS3 parent
-#define yR3 insert(i
-#define yQ3 newrel
-#define yP3 for iJ nS
-#define yO3 ;tree tK2
-#define yN3 ;nV l5::
-#define yM3 ;for iA1 a=
-#define yL3 param.
-#define yK3 ¶m=*
-#define yJ3 break;l73
-#define yI3 xE lT 2,
-#define yH3 ;}static yU1
-#define yG3 ::ByteCodeSynth xK
-#define yF3 break;}
-#define yE3 synth lO2
-#define yD3 synth.xM
-#define yC3 b_needed
-#define yB3 cachepos
-#define yA3 half=
-#define y93 ,iB,1,l51+1);
-#define y83 131,4,1,
-#define y73 131,8,1,
-#define y63 4,1,2,1,
-#define y53 )n31 lH
-#define y43 ,1,562 nP
-#define y33 ){case
-#define y23 (yL3
-#define y13 ){switch(
-#define y03 (cond yV
-#define xZ3 {i31 lE
-#define xY3 template lL
-#define xX3 iY2 tF3
-#define xW3 template lX
-#define xV3 ::vector
-#define xU3 FindPos(
-#define xT3 src_pos
-#define xS3 reserve(
-#define xR3 nJ1 void
-#define xQ3 treeptr
-#define xP3 tA1 void
-#define xO3 ImmedTag
-#define xN3 a,const
-#define xM3 RefCount
-#define xL3 Birth();
-#define xK3 typename
-#define xJ3 7168,
-#define xI3 cost_t
-#define xH3 fpdata
-#define xG3 middle
-#define xF3 };enum
-#define xE3 tG1 1))){
-#define xD3 sqrt_cost
-#define xC3 const int
-#define xB3 maxValue1
-#define xA3 minValue1
-#define x93 maxValue0
-#define x83 minValue0
-#define x73 ValueType
-#define x63 yN n3 0),
-#define x53 =true;lI2
-#define x43 yK known
-#define x33 yK n3 0),
-#define x23 abs_mul
-#define x13 l8 a));
-#define x03 pos_set
-#define nZ3 ContainsOtherCandidates
-#define nY3 goto cY
-#define nX3 l14 xV1
-#define nW3 t2=!t2;}
-#define nV3 bool t2 tO3
-#define nU3 (yK val)
-#define nT3 result
-#define nS3 .tL1 n]
-#define nR3 1)tG1 1));
-#define nQ3 nT3 yN known
-#define nP3 nT3 n51
-#define nO3 ),child);
-#define nN3 mulgroup)
-#define nM3 nP3 tO3 if(
-#define nL3 nT3 yN val
-#define nK3 nT3 tF2
-#define nJ3 xK nT3
-#define nI3 const std::eT
-#define nH3 const char*
-#define nG3 nE3 IsNever nV2
-#define nF3 nE3 IsAlways;if(
-#define nE3 ))return
-#define nD3 y3 cAdd);
-#define nC3 subtree
-#define nB3 invtree
-#define nA3 MakeHash(
-#define n93 yR false;
-#define n83 rulenumit
-#define n73 cAnd l3
-#define n63 282870 nP
-#define n53 ,tree nX
-#define n43 ,1,538 nP
-#define n33 cAnd,l6
-#define n23 MakeEqual
-#define n13 MakeTrue,
-#define n03 newbase
-#define lZ3 branch1op
-#define lY3 branch2op
-#define lX3 overlap
-#define lW3 nE1 c9 y6
-#define lV3 truth_b
-#define lU3 truth_a
-#define lT3 if y91 0)
-#define lS3 found_dup
-#define lR3 (mulgroup
-#define lQ3 cH1 eJ&
-#define lP3 rangeutil
-#define lO3 Plan_Has(
-#define lN3 StackMax)
-#define lM3 ;if(half
-#define lL3 ;}void
-#define lK3 cGreater,
-#define lJ3 ,cGreater
-#define lI3 )lL3
-#define lH3 nT3 xQ
-#define lG3 const xA2
-#define lF3 namespace
-#define lE3 ByteCode[
-#define lD3 inverted
-#define lC3 IsNever:
-#define lB3 .known&&
-#define lA3 ==cNot||
-#define l93 iftree
-#define l83 if(i01==
-#define l73 }switch(
-#define l63 depcodes
-#define l53 explicit
-#define l43 l2 16 eI
-#define l33 l91 2,1,
-#define l23 cCosh nQ
-#define l13 n91 1,
-#define l03 VarBegin
-#define iZ2 Params[a].
-#define iY2 Params.
-#define iX2 ].data);
-#define iW2 PlusInf
-#define iV2 Value_t
-#define iU2 ;iV2
-#define iT2 (nT3
-#define iS2 synth);
-#define iR2 lJ2 apos==
-#define iQ2 default_function_handling
-#define iP2 xD i01);
-#define iO2 tE3)
-#define iN2 begin(),
-#define iM2 cond_add
-#define iL2 cond_mul
-#define iK2 cond_and
-#define iJ2 ){eJ r;r xD
-#define iI2 func lL1
-#define iH2 const eH
-#define iG2 bool eA1
-#define iF2 unsigned
-#define iE2 leaf1
-#define iD2 costree
-#define iC2 sintree
-#define iB2 leaf_count
-#define iA2 sub_params
-#define i92 tG1-1)))xC
-#define i82 printf(
-#define i72 swap(tmp);
-#define i62 cbrt_count
-#define i52 sqrt_count
-#define i42 ,std::cout
-#define i32 pcall_tree
-#define i22 after_powi
-#define i12 GetHash().
-#define i02 *x5 n71,info
-#define tZ2 eQ1=0;a eX2
-#define tY2 eQ1;if t51
-#define tX2 grammar
-#define tW2 cCos iO
-#define tV2 l14 l2 0,2,
-#define tU2 cEqual eW1
-#define tT2 0x12},{{3,
-#define tS2 cNeg,lT 1,
-#define tR2 ,bool abs)
-#define tQ2 sim.Eat(
-#define tP2 .what nU1
-#define tO2 tJ2 nT3(
-#define tN2 ,n42 l2 c22
-#define tM2 if y91 1)i61&&
-#define tL2 ;range.xE2
-#define tK2 .DelParam(
-#define tJ2 ){iV2
-#define tI2 nR tJ2 tmp=
-#define tH2 );nD lC
-#define tG2 iC3 p0 tF2>=x22
-#define tF2 .min.val
-#define tE2 )?0:1))l7
-#define tD2 .n_int_sqrt
-#define tC2 ;}else{x5=new
-#define tB2 (half&63)-1;
-#define tA2 ),0},{
-#define t92 ),Value
-#define t82 data;data.
-#define t72 MakeNEqual
-#define t62 (exponent
-#define t52 Dump(std::
+#define l14 {Value_t
+#define l04 ),info,
+#define iZ3 {data->
+#define iY3 ==cNot||
+#define iX3 "Found "
+#define iW3 info.lQ[b
+#define iV3 ;o<<"\n";
+#define iU3 )yR 2,cPow
+#define iT3 ;}static yU1
+#define iS3 (tree)!=
+#define iR3 ),Value(
+#define iQ3 stackpos
+#define iP3 minValue0
+#define iO3 "dup(%u) "
+#define iN3 =true;iO1
+#define iM3 eR{assert
+#define iL3 "%d, cost "
+#define iK3 "PUSH " iL2
+#define iJ3 "immed "<<
+#define iI3 mFuncParsers
+#define iH3 param.data
+#define iG3 stderr
+#define iF3 sep2=" "
+#define iE3 FPHASH_CONST
+#define iD3 cache_needed[
+#define iC3 fprintf
+#define iB3 "Applying "
+#define iA3 FUNCTIONPARSER_INSTANTIATE_OPTIMIZE
+#define i93 FUNCTIONPARSER_INSTANTIATE_EMPTY_OPTIMIZE
+#define i83 HANDLE_UNARY_CONST_FUNC
+#define i73 {if(n11
+#define i63 second;
+#define i53 within,
+#define i43 AddFrom(
+#define i33 tH3==
+#define i23 c_count
+#define i13 MaxOp
+#define i03 else nM
+#define tZ3 =tZ cL3
+#define tY3 .nJ 0));
+#define tX3 .nJ 1));
+#define tW3 lD m.
+#define tV3 ;a<tree.xB
+#define tU3 iZ);}if
+#define tT3 cS ifp2
+#define tS3 sim.xB1
+#define tR3 );tO tL1
+#define tQ3 ].swap(
+#define tP3 codes[b
+#define tO3 whydump
+#define tN3 for lS1
+#define tM3 for(;a<
+#define tL3 nparams
+#define tK3 281856,
+#define tJ3 cTan i7
+#define tI3 l2 2,2,
+#define tH3 ;if(op
+#define tG3 l4 0,1,
+#define tF3 0x12 nH
+#define tE3 FixIncompleteHashes()
+#define tD3 cSinh,
+#define tC3 ,cTan nS
+#define tB3 ,iX 1,
+#define tA3 nS 0,
+#define t93 cAbs nS
+#define t83 ;case
+#define t73 i1 t83
+#define t63 Params[
+#define t53 Params(
+#define t43 &&p nL3
+#define t33 fp_pow(
+#define t23 false;}
+#define t13 lD1 y4.
+#define t03 cAbsIf)
+#define eZ3 l91++b)
+#define eY3 lX1 nC==
+#define eX3 ;exponent
+#define eW3 =false;
+#define eV3 tN cS1);
+#define eU3 .empty()
+#define eT3 nS3))n92
+#define eS3 (opcode==
+#define eR3 <data eJ3;++
+#define eQ3 l14 nS3(
+#define eP3 ByteCodeSynth xF
+#define eO3 std xM3<
+#define eN3 middle2
+#define eM3 std::string
+#define eL3 SetOpcode(
+#define eK3 ;for iZ1
+#define eJ3 .size()
+#define eI3 ].second
+#define eH3 ].first
+#define eG3 return p
+#define eF3 TreeCountItem
+#define eE3 }return
+#define eD3 Ne_Mask
+#define eC3 Gt_Mask
+#define eB3 Lt_Mask
+#define eA3 const eK
+#define e93 .n7 synth.
+#define e83 range nE3
+#define e73 eK3 a=
+#define e63 ,eQ,c92
+#define e53 eO|lT1)
+#define e43 public:
+#define e33 Rehash(
+#define e23 switch(
+#define e13 pclone
+#define e03 cOr,l6
+#define cZ3 newpow
+#define cY3 change
+#define cX3 (Value_t
+#define cW3 (count
+#define cV3 133,2,
+#define cU3 ,tree
+#define cT3 byteCode
+#define cS3 child)
+#define cR3 (p1 x41)
+#define cQ3 cLog2by
+#define cP3 long iD1
+#define cO3 factor_t
+#define cN3 (p0 yI&&
+#define cM3 value1
+#define cL3 a));if(!
+#define cK3 fp_mod(
+#define cJ3 else{if(
+#define cI3 )min.set(
+#define cH3 xF());nD
+#define cG3 max.known
+#define cF3 known&&
+#define cE3 tX p2;p2
+#define cD3 {tree.x4
+#define cC3 cAbsNot
+#define cB3 ,x53 l8
+#define cA3 e23 lY1
+#define c93 xW 0)nC
+#define c83 IsLogicalValue(xW
+#define c73 }switch
+#define c63 stackptr
+#define c53 cLog);xG
+#define c43 l8 0));
+#define c33 opcodes
+#define c23 did_muli
+#define c13 &Value){
+#define c03 yD const
+#define yZ3 (param.
+#define yY3 ){e23
+#define yX3 :if(&*lE1){
+#define yW3 :{n31 r=
+#define yV3 xY3 e23
+#define yU3 param=*(
+#define yT3 cAbsIf,
+#define yS3 cNotNot,
+#define yR3 l4 16,1,
+#define yQ3 yO3 info
+#define yP3 lE1=r.specs;if(r.found){
+#define yO3 *x8)[a].
+#define yN3 cLess,cH
+#define yM3 default_function_handling
+#define yL3 l4 20,1,
+#define yK3 l4 4,1,
+#define yJ3 450998,
+#define yI3 cExp2 nS
+#define yH3 lJ 2},0,
+#define yG3 )lS 3*3*2*2
+#define yF3 default:
+#define yE3 range<nV
+#define yD3 range xF
+#define yC3 Ge0Lt1
+#define yB3 Gt0Le1
+#define yA3 cAdd lV2
+#define y93 if(op1==
+#define y83 iterator
+#define y73 begin();
+#define y63 TreeSet
+#define y53 parent
+#define y43 insert(i
+#define y33 newrel
+#define y23 y03 xX3 xO2
+#define y13 y03 iF2;if(
+#define y03 ))return
+#define xZ3 ;if(half
+#define xY3 break;}
+#define xX3 IsNever
+#define xW3 e62 eO1
+#define xV3 synth.xH
+#define xU3 b_needed
+#define xT3 cachepos
+#define xS3 ,lE1,info
+#define xR3 half=
+#define xQ3 131,4,1,
+#define xP3 131,8,1,
+#define xO3 ,iM,1,lC1+1);
+#define xN3 4,1,2,1,
+#define xM3 ::vector
+#define xL3 1 y5 n41
+#define xK3 FindPos(
+#define xJ3 src_pos
+#define xI3 xM1 xQ+
+#define xH3 reserve(
+#define xG3 treeptr
+#define xF3 .resize(
+#define xE3 tO1 void
+#define xD3 ImmedTag
+#define xC3 a,const
+#define xB3 RefCount
+#define xA3 Birth();
+#define x93 typename
+#define x83 unsigned
+#define x73 template
+#define x63 7168,
+#define x53 leaf1
+#define x43 cost_t
+#define x33 fpdata
+#define x23 middle
+#define x13 sqrt_cost
+#define x03 const int
+#define nZ3 mul_count
+#define nY3 );nZ l5::
+#define nX3 e62 2)));
+#define nW3 maxValue1
+#define nV3 minValue1
+#define nU3 maxValue0
+#define nT3 ValueType
+#define nS3 result
+#define nR3 nS3;}case
+#define nQ3 nS3.tL
+#define nP3 ::res,b8<
+#define nO3 eG3 yM
+#define nN3 .what nS1
+#define nM3 e62 1),e62 1));
+#define nL3 .max.val
+#define nK3 nS3 yM2
+#define nJ3 nS3 e61
+#define nI3 nS3 yI
+#define nH3 nS3 nL3
+#define nG3 nS3 tG1
+#define nF3 nS3 yM
+#define nE3 xF nS3
+#define nD3 tO n3 0),
+#define nC3 i8);nD lC
+#define nB3 abs_mul
+#define nA3 xM3<x83>&e71
+#define n93 l8 a));
+#define n83 pos_set
+#define n73 goto e1
+#define n63 p1.lT2 p1
+#define n53 [funcno].
+#define n43 eN1[++IP]
+#define n33 sim.x2 1,
+#define n23 {sim.Eat(
+#define n13 eN1[IP]==
+#define n03 subtree
+#define lZ3 invtree
+#define lY3 MakeHash(
+#define lX3 parampair
+#define lW3 rulenumit
+#define lV3 cAnd l3
+#define lU3 ,cMul l3
+#define lT3 cAnd,l6
+#define lS3 x9 lT 2,
+#define lR3 },{{1,
+#define lQ3 cEqual,
+#define lP3 lQ3 lA
+#define lO3 t01},{{3,
+#define lN3 MakeEqual
+#define lM3 nC1,l5::
+#define lL3 nC1,{l5::
+#define lK3 newbase
+#define lJ3 fp_equal(
+#define lI3 branch1op
+#define lH3 branch2op
+#define lG3 if(lJ3
+#define lF3 l8 a)xI
+#define lE3 overlap
+#define lD3 truth_b
+#define lC3 truth_a
+#define lB3 found_dup
+#define lA3 nQ r;r iH
+#define l93 void set(
+#define l83 {tP1 lE
+#define l73 rangeutil
+#define l63 Plan_Has(
+#define l53 StackMax)
+#define l43 i1 true;}
+#define l33 namespace
+#define l23 (cond yX
+#define l13 inverted
+#define l03 xX3:
+#define iZ2 iftree
+#define iY2 depcodes
+#define iX2 explicit
+#define iW2 cCosh nS
+#define iV2 t01 nH
+#define iU2 VarBegin
+#define iT2 t63 a]
+#define iS2 iR2 size()
+#define iR2 Params.
+#define iQ2 ].data);
+#define iP2 i8)));nZ
+#define iO2 yQ1.SubTrees
+#define iN2 yQ1.Others
+#define iM2 );synth
+#define iL2 ;DumpTree(
+#define iK2 ;Value_t
+#define iJ2 begin(),
+#define iI2 cond_add
+#define iH2 cond_mul
+#define iG2 cond_and
+#define iF2 IsAlways
+#define iE2 func lQ1
+#define iD2 bool eM1
+#define iC2 Forget()
+#define iB2 .second);
+#define iA2 Optimize()
+#define i92 costree
+#define i82 sintree
+#define i72 leaf_count
+#define i62 &&cond eD)
+#define i52 .tT1 n]
+#define i42 =GetParam(
+#define i32 sub_params
+#define i22 nC==cLog2&&
+#define i12 nC==cPow&&
+#define i02 printf(
+#define tZ2 cbrt_count
+#define tY2 sqrt_count
+#define tX2 cPow i7
+#define tW2 ,cPow,
+#define tV2 ,cGreater
+#define tU2 exponent);
+#define tT2 Finite
+#define tS2 min.n3 0),
+#define tR2 p1 cS ifp1
+#define tQ2 yR 2,cAdd)
+#define tP2 pcall_tree
+#define tO2 after_powi
+#define tN2 GetHash().
+#define tM2 yP t23
+#define tL2 params)
+#define tK2 grammar
+#define tJ2 cEqual t11
+#define tI2 cLog nS
+#define tH2 cNeg,lT 1,
+#define tG2 ),0},{
+#define tF2 std::move(
+#define tE2 iH cond nC
+#define tD2 tree iH
+#define tC2 ){eL3
+#define tB2 tree))cJ
+#define tA2 );t0=!t0;}
+#define t92 tmp c91 tree
+#define t82 nQ tmp;tmp iH
+#define t72 tree nC
+#define t62 MakeNEqual
+#define t52 )?0:1))l7
#define t42 isInteger(
#define t32 Comparison
#define t22 needs_flip
-#define t12 value]
-#define t02 ~size_t(0)
-#define eZ2 xJ1 xS+1);
-#define eY2 TopLevel)
-#define eX2 <xV;++a)
-#define eW2 }}return
-#define eV2 vector<bool>
-#define eU2 *)&*start_at;
-#define eT2 Rule&rule,
-#define eS2 >::res,b8<
-#define eR2 continue;}
-#define eQ2 c9 tree);
-#define eP2 mul_item
-#define eO2 innersub
-#define eN2 cbrt_cost
-#define eM2 best_cost
-#define eL2 fp_min(yL
-#define eK2 tree t31);}
-#define eJ2 tree))cZ
-#define eI2 condition
-#define eH2 per_item
-#define eG2 item_type
-#define eF2 first2
-#define eE2 l4 18,1,
-#define eD2 lJ 1},0,
-#define eC2 Decision
-#define eB2 not_tree
-#define eA2 group_by
-#define e92 exponent=
-#define e82 ->second
-#define e72 :xL iV2(
-#define e62 eJ&tree)
-#define e52 targetpos
-#define e42 ParamSpec
-#define e32 rhs.hash2;}
-#define e22 rhs.hash1
-#define e12 struct
-#define e02 Forget()
-#define cZ2 &&cond e8))
-#define cY2 source_tree
-#define cX2 nC==cLog2&&
-#define cW2 ,eL1 0x1 nH
-#define cV2 )lS 3*3*
-#define cU2 (tK==eA3&&
-#define cT2 );yF3
-#define cS2 ;iB.Remember(
-#define cR2 <tW,xI3>
-#define cQ2 );sim.nY 2,
-#define cP2 )continue
-#define cO2 CodeTree lW
-#define cN2 p1_evenness
-#define cM2 isNegative(
-#define cL2 yN known&&(
-#define cK2 neg_set
-#define cJ2 cNop,cNop}}
-#define cI2 cTanh,cNop,
-#define cH2 NewHash
-#define cG2 >e12 cA<
-#define cF2 matches
-#define cE2 .match_tree
-#define cD2 cH1 void*)&
-#define cC2 cSin iO
-#define cB2 cTan nQ
-#define cA2 ,cLog nQ
-#define c92 cCos nQ
-#define c82 long value
-#define c72 (std::move(
-#define c62 (xX l8 a)xF
-#define c52 negated
-#define c42 Specializer
-#define c32 params
-#define c22 18,2,
-#define c12 coshtree
-#define c02 sinhtree
-#define yZ2 best_score
-#define yY2 mulvalue
-#define yX2 pow_item
-#define yW2 subgroup
-#define yV2 nC==cPow&&tO
-#define yU2 PowiResult
-#define yT2 ))y53
-#define yS2 0));c23
-#define yR2 maxValue
-#define yQ2 minValue
-#define yP2 div_tree
-#define yO2 pow_tree
-#define yN2 iV2 nT
-#define yM2 preserve
-#define yL2 PullResult()
-#define yK2 dup_or_fetch
-#define yJ2 nominator]
-#define yI2 test_order
-#define yH2 parampair
-#define yG2 yH2,
-#define yF2 .param_count
-#define yE2 minimum_need
-#define yD2 shift(index)
-#define yC2 {std::cout<<
-#define yB2 rulenumber
-#define yA2 l2 16,2,
-#define y92 cTanh nQ
-#define y82 l14 l2 2,2,
-#define y72 ,cPow iO
-#define y62 cSinh nQ
-#define y52 cIf,n91 3,
+#define t12 (half&63)-1;
+#define t02 value]
+#define eZ2 lT1 opcode
+#define eY2 )lS 3*3*3*2
+#define eX2 cS tree);
+#define eW2 mul_item
+#define eV2 innersub
+#define eU2 cbrt_cost
+#define eT2 best_cost
+#define eS2 condition
+#define eR2 nominator
+#define eQ2 per_item
+#define eP2 item_type
+#define eO2 first2
+#define eN2 l4 18,1,
+#define eM2 cIf,iX 3,
+#define eL2 lJ 1},0,
+#define eK2 tJ 1},0,
+#define eJ2 Decision
+#define eI2 not_tree
+#define eH2 (mulgroup
+#define eG2 (lR));nD lC
+#define eF2 Become(xW
+#define eE2 group_by
+#define eD2 exponent=
+#define eC2 ->second
+#define eB2 targetpos
+#define eA2 ParamSpec
+#define e92 rhs.hash2;}
+#define e82 rhs.hash1
+#define e72 struct
+#define e62 Value_t(
+#define e52 .n_int_sqrt
+#define e42 const std::eP
+#define e32 const char*
+#define e22 nT 409641,
+#define e12 ,xF1);lC
+#define e02 );xY3
+#define cZ2 if(t72==
+#define cY2 eO3 bool>
+#define cX2 ,(long double)
+#define cW2 ContainsOtherCandidates
+#define cV2 std::cout
+#define cU2 source_tree
+#define cT2 GetParam eS
+#define cS2 <tP,x43>
+#define cR2 p1_evenness
+#define cQ2 isNegative(
+#define cP2 neg_set
+#define cO2 }else{x8=new
+#define cN2 );}void
+#define cM2 cNop,cNop}}
+#define cL2 cTanh,cNop,
+#define cK2 NewHash
+#define cJ2 >e72 cB<
+#define cI2 matches
+#define cH2 {cV2<<
+#define cG2 iS1 void*)&
+#define cF2 cGreater,cH
+#define cE2 cSin i7
+#define cD2 cCos nS
+#define cC2 ,t21 0x1 nH
+#define cB2 +=1 i1 n91;
+#define cA2 negated
+#define c92 synth);
+#define c82 Specializer
+#define c72 ifdata.ofs
+#define c62 (IfData&ifdata
+#define c52 .push_back(
+#define c42 ;}data;data.
+#define c32 );sim.x2 2,
+#define c22 nP)l14 tmp=
+#define c12 (*x8)[0].info
+#define c02 CodeTree
+#define yZ2 c02 xF
+#define yY2 coshtree
+#define yX2 sinhtree
+#define yW2 best_score
+#define yV2 mulvalue
+#define yU2 pow_item
+#define yT2 subgroup
+#define yS2 PowiResult
+#define yR2 .match_tree
+#define yQ2 )l43
+#define yP2 0));yD3
+#define yO2 maxValue
+#define yN2 minValue
+#define yM2 yI eW3 if(
+#define yL2 fp_min(yL,
+#define yK2 div_tree
+#define yJ2 pow_tree
+#define yI2 preserve
+#define yH2 ,cCos i7
+#define yG2 (rule cU3,info
+#define yF2 e62 0.5)
+#define yE2 PullResult()
+#define yD2 dup_or_fetch
+#define yC2 e33 false
+#define yB2 test_order
+#define yA2 lX3,
+#define y92 .param_count
+#define y82 shift(index)
+#define y72 rulenumber
+#define y62 cTanh nS
+#define y52 cSinh nS
#define y42 cInv,lT 1,
#define y32 constraints=
-#define y22 GetDepth()
-#define y12 factor_immed
-#define y02 changes
-#define xZ2 c9 cond l8
-#define xY2 Become y91
-#define xX2 for(xK3
+#define y22 factor_immed
+#define y12 changes
+#define y02 n81 cS y4 l8
+#define xZ2 cS leaf2 l8
+#define xY2 cS x53 l8
+#define xX2 cS cond l8
#define xW2 exp_diff
#define xV2 ExponentInfo
#define xU2 lower_bound(
#define xT2 factor
#define xS2 is_logical
#define xR2 newrel_and
-#define xQ2 )){data x7 lN
-#define xP2 Suboptimal
-#define xO2 eK[c eA
+#define xQ2 tH[c eE
+#define xP2 ;iM.Remember(
+#define xO2 i1 Unknown;}
#define xN2 res_stackpos
#define xM2 half_pos
-#define xL2 ifdata.ofs
-#define xK2 i8 push_back(
-#define xJ2 n31 true;}
-#define xI2 >>1)):(
-#define xH2 CodeTreeData
-#define xG2 exponent)
-#define xF2 yN known)
-#define xE2 multiply(
-#define xD2 )y3 cPow)
-#define xC2 var_trees
-#define xB2 nB OPCODE
-#define xA2 CodeTree&
-#define x92 parent_opcode
-#define x82 GetParam(a eS
-#define x72 {cW start_at;
-#define x62 changed=true;
-#define x52 log2_exponent
-#define x42 iV2(2)));
-#define x32 lR,tH)tH2
-#define x22 iV2(0.0))
-#define x12 dup_fetch_pos
-#define x02 IsNever cL lC
-#define nZ2 cSin nQ
-#define nY2 Value_EvenInt
-#define nX2 AddCollection
-#define nW2 ConditionType
-#define nV2 n31 Unknown;}
-#define nU2 1 y7 i8 size(
-#define nT2 (iF2
-#define nS2 iA|nT2)
-#define nR2 SpecialOpcode
-#define nQ2 =i e82.
-#define nP2 yN known&&p
-#define nO2 assimilated
-#define nN2 denominator
-#define nM2 fraction
-#define nL2 DUP_BOTH();
-#define nK2 0x80000000u
-#define nJ2 IsDescendantOf
+#define xL2 >>1)):(
+#define xK2 CodeTreeData
+#define xJ2 multiply(
+#define xI2 tO known)
+#define xH2 var_trees
+#define xG2 erase(cs_it);
+#define xF2 parent_opcode
+#define xE2 log2_exponent
+#define xD2 yB swap(tmp);
+#define xC2 Value(Value::
+#define xB2 dup_fetch_pos
+#define xA2 a;if(eK1){x8=
+#define x92 {cZ start_at;
+#define x82 xX3 cQ lC
+#define x72 cSin nS
+#define x62 Value_EvenInt
+#define x52 )){data xC
+#define x42 MakeFalse,{l5
+#define x32 if(list.first
+#define x22 AddCollection
+#define x12 ConditionType
+#define x02 DUP_ONE(apos)
+#define nZ2 SpecialOpcode
+#define nY2 =i eC2.
+#define nX2 IsDefined()
+#define nW2 fp_max(yL);
+#define nV2 (tree,cV2
+#define nU2 e62-1)
+#define nT2 assimilated
+#define nS2 denominator
+#define nR2 fraction
+#define nQ2 l2 18,2,
+#define nP2 .GetDepth()
+#define nO2 iH t72)
+#define nN2 xI leaf2 l8
+#define nM2 DUP_BOTH();
+#define nL2 x73 lL
+#define nK2 -1-offset].
+#define nJ2 tree.GetHash()
#define nI2 TreeCounts
-#define nH2 SetOpcode(
-#define nG2 found_log2
-#define nF2 div_params
-#define nE2 immed_sum
-#define nD2 lE3++IP]
-#define nC2 sim n92
-#define nB2 ;sim.Push(
-#define nA2 ,cMul l3
-#define n92 .Eat(1,
-#define n82 OPCODE(opcode)
-#define n72 FactorStack xK
-#define n62 Rehash(false);
-#define n52 IsAlways cL lC
-#define n42 cEqual,
-#define n32 cNotNot nQ
-#define n22 cNot nQ
-#define n12 DumpHashesFrom
-#define n02 replacing_slot
-#define lZ2 RefParams
-#define lY2 if_always[
-#define lX2 WhatDoWhenCase
-#define lW2 exponent_immed
-#define lV2 new_base_immed
-#define lU2 base_immed
-#define lT2 );std::cout<<
-#define lS2 ||op1==
-#define lR2 l8 0));
-#define lQ2 data[a tD3
-#define lP2 if(newrel_or==
-#define lO2 .AddOperation(
-#define lN2 DUP_ONE(apos);
-#define lM2 flipped
-#define lL2 .UseGetNeeded(
-#define lK2 ,fp_max(yL);
-#define lJ2 else if(
-#define lI2 lJ2!nT3
-#define lH2 synth.PushImmed(
-#define lG2 (*x5)[a].info
-#define lF2 ,PowiCache&iB,
-#define lE2 tree l8
-#define lD2 <<tree.i12
-#define lC2 const eJ&
-#define lB2 ,l1 0x0},{{3,
-#define lA2 ,0,0x4},{{1,
-#define l92 {case IsAlways:
-#define l82 e3 2,131,
-#define l72 (IfData&ifdata
-#define l62 [xS-1-offset].
-#define l52 lE3 a
-#define l42 Immed.tF3);
-#define l32 OptimizedUsing
-#define l22 Var_or_Funcno
-#define l12 l22;
-#define l02 GetParams(
-#define iZ1 crc32_t
-#define iY1 signed_chain
-#define iX1 MinusInf
-#define iW1 n_immeds
-#define iV1 stack.tF3
-#define iU1 FindClone(xI
-#define iT1 lE3 IP]
-#define iS1 GetOpcode())
-#define iR1 needs_rehash
-#define iQ1 AnyWhere_Rec
-#define iP1 ~iF2(0)
-#define iO1 41,42,43,44,
-#define iN1 p1_logical_b
-#define iM1 p0_logical_b
-#define iL1 p1_logical_a
-#define iK1 p0_logical_a
-#define iJ1 *const func)
-#define iI1 synth.DoDup(
-#define iH1 cache_needed
-#define iG1 e3 2,1,e3 2,
-#define iF1 treelist
-#define iE1 has_bad_balance
-#define iD1 {if(GetOpcode()
-#define iC1 if(remaining[a])
-#define iB1 (*x5 n71=r.specs;if(r.found){
-#define iA1 (size_t
-#define i91 }yF3 case
-#define i81 for iA1 b=0;b<
-#define i71 for iA1 a y0
-#define i61 .IsImmed()
-#define i51 i61){if(
-#define i41 eE3 xT2
-#define i31 template<
-#define i21 divgroup
-#define i11 2*2*2)lS 3
-#define i01 tree nC
-#define tZ1 xW3 void
-#define tY1 yD3 1
-#define tX1 ,iB,eU,iS2
-#define tW1 fp_abs(iA3))
-#define tV1 fp_abs(min.val)
-#define tU1 tJ 2},0,0x0},{{
-#define tT1 Oneness_NotOne|
-#define tS1 Value_IsInteger
-#define tR1 Constness_Const
-#define tQ1 ;xI iO3
-#define tP1 l32(
-#define tO1 reltype
-#define tN1 SequenceOpcodes
-#define tM1 synth.Find(
-#define tL1 sep_list[
-#define tK1 TreeCountType xK
-#define tJ1 nI2.erase(cs_it);
-#define tI1 nE3 true
-#define tH1 yK set(fp_floor);
-#define tG1 ,iV2(
-#define tF1 );exponent
-#define tE1 back().thenbranch
-#define tD1 grammar_rules[*r]
-#define tC1 goto fail;}
-#define tB1 l1 0x4 nH
-#define tA1 lZ2);
-#define t91 IsDefined()){
-#define t81 eJ tmp;tmp xD
-#define t71 >(iV2(1),
-#define t61 x22{xO
-#define t51 (&*start_at){x5=(
-#define t41 DelParam(a);}
-#define t31 tK2 a
-#define t21 a)i61)
-#define t11 n82);
-#define t01 0.5)xD2;lC
-#define eZ1 std::cout<<"POP "
-#define eY1 stack[iV1-
-#define eX1 stack.push_back(
-#define eW1 ,l0 2,
-#define eV1 CollectionSet xK
-#define eU1 xK())y3 cMul);lC
-#define eT1 .Rehash();
-#define eS1 ParsePowiMuli
-#define eR1 MaxChildDepth
-#define eQ1 iF2 a
-#define eP1 std::pair<It,It>
-#define eO1 cLess,l2
-#define eN1 ,n63 281856,
-#define eM1 cNEqual,
-#define eL1 cPow,lA
-#define eK1 Sign_Negative
-#define eJ1 Value_Logical
-#define eI1 yD MakeFalse,{l5
-#define eH1 new_factor_immed
-#define eG1 occurance_pos
-#define eF1 exponent_hash
-#define eE1 exponent_list
-#define eD1 CollectMulGroup(
-#define eC1 source_set
-#define eB1 exponent,yT3
-#define eA1 operator
-#define e91 FindAndDup(tree);
-#define e81 ParamSpec_Extract
-#define e71 retry_anyparams_3
-#define e61 retry_anyparams_2
-#define e51 needlist_cached_t
-#define e41 lJ 2}lA2
-#define e31 lJ 1}lA2
-#define e21 CodeTreeImmed xK(
-#define e11 by_float_exponent
-#define e01 fp_equal t62
-#define cZ1 new_exp
-#define cY1 end()&&i->first==
-#define cX1 return BecomeZero;
-#define cW1 return BecomeOne;
-#define cV1 if(lQ.tF3<=n1)
-#define cU1 addgroup
-#define cT1 found_log2by
-#define cS1 nC==cZ3)
-#define cR1 if(keep_powi
-#define cQ1 l22)
-#define cP1 branch1_backup
-#define cO1 branch2_backup
-#define cN1 NeedList
-#define cM1 tree.SetParam(
-#define cL1 exponent_map
-#define cK1 plain_set
-#define cJ1 rangehalf
-#define cI1 ;synth.StackTopIs(
-#define cH1 (const
-#define cG1 cH1 iV2&
-#define cF1 eT1 tI3 op1);tree.DelParams()
-#define cE1 .GetParamCount()==
-#define cD1 LightWeight(
-#define cC1 if(value
-#define cB1 xW3 yX
-#define cA1 xW3 static
-#define c91 m yN set(fp_ceil);tV
-#define c81 m yN val
-#define c71 m yN known
-#define c61 )yH2 tE3;
-#define c51 ::MakeTrue
-#define c41 should_regenerate=true;
-#define c31 should_regenerate,
-#define c21 Collection
-#define c11 RelationshipResult
-#define c01 Subdivide_Combine(
-#define yZ1 e83 yR
-#define yY1 rhs yZ1 hash1
-#define yX1 PositionalParams,0
-#define yW1 best_sep_factor
+#define nH2 ,e62 1))){
+#define nG2 bool t0 eW3
+#define nF2 found_log2
+#define nE2 div_params
+#define nD2 immed_sum
+#define nC2 :sim.Eat(1,
+#define nB2 OPCODE(opcode)
+#define nA2 ;sim.Push(
+#define n92 break;nS3*=
+#define n82 FactorStack xF
+#define n72 iF2 cQ lC
+#define n62 cLessOrEq,
+#define n52 282870 nT
+#define n42 cNotNot nS
+#define n32 cNot nS
+#define n22 replacing_slot
+#define n12 RefParams
+#define n02 if_always[
+#define lZ2 WhatDoWhenCase
+#define lY2 exponent_immed
+#define lX2 new_base_immed
+#define lW2 base_immed
+#define lV2 ||op1==
+#define lU2 remaining
+#define lT2 Rehash t8
+#define lS2 data[a eI3
+#define lR2 lT2 r);}
+#define lQ2 if(newrel_or==
+#define lP2 .UseGetNeeded(
+#define lO2 e7 2,131,
+#define lN2 Immed eJ3);
+#define lM2 OptimizedUsing
+#define lL2 Var_or_Funcno
+#define lK2 lL2;
+#define lJ2 GetParams(
+#define lI2 crc32_t
+#define lH2 signed_chain
+#define lG2 MinusInf
+#define lF2 synth.Find(
+#define lE2 );cV2<<
+#define lD2 return true;
+#define lC2 n_immeds
+#define lB2 stack eJ3
+#define lA2 FindClone(xM
+#define l92 GetOpcode())
+#define l82 needs_rehash
+#define l72 AnyWhere_Rec
+#define l62 minimum_need
+#define l52 ~x83(0)
+#define l42 41,42,43,44,
+#define l32 p1_logical_b
+#define l22 p0_logical_b
+#define l12 p1_logical_a
+#define l02 p0_logical_a
+#define iZ1 (size_t
+#define iY1 )e73
+#define iX1 TopLevel)
+#define iW1 .e33)
+#define iV1 {pow.CopyOnWrite
+#define iU1 nB OPCODE
+#define iT1 const yZ2
+#define iS1 (const
+#define iR1 iS1 yZ2&
+#define iQ1 ,PowiCache&iM,
+#define iP1 else if(
+#define iO1 iP1!nS3
+#define iN1 synth.DoDup(
+#define iM1 cache_needed
+#define iL1 e7 2,1,e7 2,
+#define iK1 [c72+
+#define iJ1 treelist
+#define iI1 IsDescendantOf(
+#define iH1 has_bad_balance
+#define iG1 )tN mulgroup)
+#define iF1 .SetParamsMove(
+#define iE1 cO3 xT2
+#define iD1 double)exponent
+#define iC1 {if(GetOpcode()
+#define iB1 cV2<<std::y11
+#define iA1 cV2<<"POP "
+#define i91 DelParam(
+#define i81 set(fp_ceil);tK
+#define i71 fp_abs(max.val))
+#define i61 fp_abs(min.val)
+#define i51 cNEqual
+#define i41 },0,0x0},{{
+#define i31 tJ 2 i41
+#define i21 Oneness_NotOne|
+#define i11 Value_IsInteger
+#define i01 Constness_Const
+#define tZ1 DumpHashesFrom(
+#define tY1 reltype
+#define tX1 const Value_t&i)
+#define tW1 const c02&
+#define tV1 const Value_t&v
+#define tU1 SequenceOpcodes
+#define tT1 sep_list[
+#define tS1 ;else_tree
+#define tR1 goto fail;}
+#define tQ1 l1 0x4 nH
+#define tP1 x73<
+#define tO1 n12);
+#define tN1 ){case iF2:
+#define tM1 grammar_rules[*r]
+#define tL1 x73 set_if<
+#define tK1 x73 lX
+#define tJ1 TreeCountType xF
+#define tI1 GetParamCount(nX
+#define tH1 >(e62 1),
+#define tG1 nL3)
+#define tF1 )lX3.second
+#define tE1 e62 0.0)){nU
+#define tD1 .IsImmed()
+#define tC1 a)tD1)
+#define tB1 nB2);
+#define tA1 stack[lB2-
+#define t91 stack c52
+#define t81 )eX3 iW1;
+#define t71 synth.PushImmed(
+#define t61 MaxChildDepth
+#define t51 repl_param_list,
+#define t41 const Rule&rule,
+#define t31 std::pair<It,It>
+#define t21 cPow,lA
+#define t11 ,l0 2,
+#define t01 ,l1 0x12
+#define eZ1 Sign_Negative
+#define eY1 Value_Logical
+#define eX1 yZ2&b
+#define eW1 new_factor_immed
+#define eV1 occurance_pos
+#define eU1 exponent_hash
+#define eT1 exponent_list
+#define eS1 CollectionSet xF
+#define eR1 CollectMulGroup(
+#define eQ1 source_set
+#define eP1 exponent,y63
+#define eO1 *const func)(
+#define eN1 ByteCode
+#define eM1 operator
+#define eL1 FindAndDup(tree);
+#define eK1 &*start_at
+#define eJ1 <<nJ2.
+#define eI1 xW 1)tD1&&
+#define eH1 retry_anyparams_3
+#define eG1 retry_anyparams_2
+#define eF1 e6(),eO3
+#define eE1 needlist_cached_t
+#define eD1 yH3 0x4 lR3
+#define eC1 eL2 0x4 lR3
+#define eB1 ),lM2(
+#define eA1 CodeTreeImmed xF(
+#define e91 GetParamCount()==
+#define e81 .back().thenbranch
+#define e71 eN1,size_t&IP,size_t limit,size_t y2
+#define e61 .cG3
+#define e51 (lR,xW i8));nD
+#define e41 ;flipped=!flipped;}
+#define e31 ,l1 0x0},{{3,
+#define e21 }xY3 case
+#define e11 for iZ1 b=0;b<
+#define e01 by_float_exponent
+#define cZ1 lJ3 exponent
+#define cY1 new_exp
+#define cX1 end()&&i->first==
+#define cW1 return BecomeZero;
+#define cV1 =comp.AddItem(atree
+#define cU1 return BecomeOne;
+#define cT1 if(lQ eJ3<=n1)
+#define cS1 addgroup
+#define cR1 found_log2by
+#define cQ1 nC==cC3)
+#define cP1 ParsePowiMuli(
+#define cO1 lL2)
+#define cN1 eL 529654 nT
+#define cM1 branch1_backup
+#define cL1 branch2_backup
+#define cK1 exponent_map
+#define cJ1 plain_set
+#define cI1 rangehalf
+#define cH1 LightWeight(
+#define cG1 xV3 1
+#define cF1 divgroup
+#define cE1 ,iM e63
+#define cD1 if(value
+#define cC1 tK1 c0
+#define cB1 tK1 static
+#define cA1 mulgroup.
+#define c91 .AddParamMove(
+#define c81 yB AddParamMove(
+#define c71 ;n81 cY op1 yB DelParams
+#define c61 should_regenerate=true;
+#define c51 should_regenerate,
+#define c41 Collection
+#define c31 RelationshipResult
+#define c21 Subdivide_Combine(
+#define c11 long value
+#define c01 )const yP
+#define yZ1 rhs c01 hash1
+#define yY1 for iZ1 a xY
+#define yX1 best_sep_factor
+#define yW1 SynthesizeParam
#define yV1 needlist_cached
-#define yU1 inline iF2
-#define yT1 252421 nP 24830
-#define yS1 t83 bool pad
-#define yR1 MakesInteger(
-#define yQ1 mulgroup.
-#define yP1 .AddParamMove(
-#define yO1 =comp.AddItem(atree
-#define yN1 tree i61 cL
-#define yM1 ByteCodeSynth xK&synth)
-#define yL1 lF3 FPoptimizer_Optimize
-#define yK1 (long double)
-#define yJ1 const iV2&value
-#define yI1 best_sep_cost
-#define yH1 AddParamMove(tree);
-#define yG1 MultiplicationRange
-#define yF1 pihalf_limits
-#define yE1 n_stacked
-#define yD1 cH2.hash1
-#define yC1 AnyParams_Rec
-#define yB1 ):e2(),std xV3<
-#define yA1 i13 cJ
-#define y91 (lE2
-#define y81 Become(value l8 0))
-#define y71 always_sincostan
-#define y61 Recheck_RefCount_Div
-#define y51 Recheck_RefCount_Mul
-#define y41 mulgroup;mulgroup xD
+#define yU1 inline x83
+#define yT1 opcode,bool pad
+#define yS1 changed=true;
+#define yR1 );xM iF1
+#define yQ1 NeedList
+#define yP1 tK1 bool
+#define yO1 ;tK1
+#define yN1 i91 a);}
+#define yM1 MakesInteger(
+#define yL1 const Value_t&value
+#define yK1 best_sep_cost
+#define yJ1 MultiplicationRange
+#define yI1 .min.set(fp_floor);
+#define yH1 pihalf_limits
+#define yG1 yR 2,cMul);lC
+#define yF1 n_stacked
+#define yE1 cK2.hash1
+#define yD1 AnyParams_Rec
+#define yC1 ;synth.StackTopIs(
+#define yB1 synth.AddOperation(
+#define yA1 continue;
+#define y91 Become(value l8 0))
+#define y81 }inline
+#define y71 PositionalParams,0}
+#define y61 always_sincostan
+#define y51 Recheck_RefCount_Div
+#define y41 Recheck_RefCount_Mul
#define y31 MultiplyAndMakeLong(
-#define y21 iV2(0)
-#define y11 covers_plus1
+#define y21 covers_plus1
+#define y11 endl;DumpHashes(
#define y01 if(synth.FindAndDup(
-#define xZ1 SynthesizeParam(
-#define xY1 grammar_func
+#define xZ1 grammar_func
+#define xY1 tree tD1 cQ
#define xX1 cOr l3 16,1,
-#define xW1 252180 nP 281854
-#define xV1 l2 0,2,165888 nP
-#define xU1 l1 tV3
-#define xT1 Modulo_Radians},
+#define xW1 252421 nT 24830,
+#define xV1 l2 0,2,165888 nT
+#define xU1 Modulo_Radians},
+#define xT1 yB SetParam(
#define xS1 PositionType
#define xR1 CollectionResult
-#define xQ1 ;m yN template set_if<
-#define xP1 ByteCode,size_t&IP,size_t limit,size_t y1
-#define xO1 iT2))break;nT3*=
-#define xN1 xW3 bool
-#define xM1 const_offset
-#define xL1 inline TriTruthValue
-#define xK1 stacktop_desired
-#define xJ1 SetStackTop(
-#define xI1 }inline
-#define xH1 FPoptimizer_ByteCode
-#define xG1 1)?(poly^(
-#define xF1 GetParamCount();
-#define xE1 public e2,public std xV3<
-#define xD1 y21)
-#define xC1 xF leaf2 l8
-#define xB1 c22 529654 nP
-#define xA1 cond_type
-#define x91 fphash_value_t
-#define x81 Recheck_RefCount_RDiv
-#define x71 cMul);tmp.nJ 0));tmp.
-#define x61 SwapLastTwoInStack();
-#define x51 fPExponentIsTooLarge(
-#define x41 CollectMulGroup_Item(
-#define x31 pair<iV2,yT3>
-#define x21 nL xJ1 xS-1);
+#define xQ1 const_offset
+#define xP1 inline TriTruthValue
+#define xO1 stacktop_desired
+#define xN1 iU3);lC
+#define xM1 SetStackTop(
+#define xL1 tK1 void
+#define xK1 FPoptimizer_ByteCode
+#define xJ1 1)?(poly^(
+#define xI1 eP3&synth)
+#define xH1 e62 0)
+#define xG1 xH1)
+#define xF1 cond_type
+#define xE1 fphash_value_t
+#define xD1 Recheck_RefCount_RDiv
+#define xC1 cMul);tmp tY3 tmp.
+#define xB1 SwapLastTwoInStack();
+#define xA1 SetParams(lJ2)
+#define x91 fPExponentIsTooLarge(
+#define x81 CollectMulGroup_Item(
+#define x71 pair<Value_t,y63>
+#define x61 (x53 l8 1)nN2
+#define x51 for iZ1 a=0;a<yC++a)
+#define x41 .GetImmed()
+#define x31 {int mStackPtr=0;
+#define x21 nL xM1 xQ-1);
#define x11 covers_full_cycle
#define x01 AssembleSequence(
-#define nZ1 <<std::dec<<")";}
-#define nY1 yD MakeNotP1,l5::
-#define nX1 yD MakeNotP0,l5::
-#define nW1 {DataP slot_holder(xY[
-#define nV1 :return p tF2
-#define nU1 !=xB)if(TestCase(
-#define nT1 &&IsLogicalValue(
-#define nS1 std::pair<T1,T2>&
-#define nR1 i31 xK3
-#define nQ1 has_good_balance_found
-#define nP1 n_occurrences
-#define nO1 found_log2_on_exponent
-#define nN1 covers_minus1
-#define nM1 needs_resynth
-#define nL1 immed_product
-#define nK1 ,2,1 xN if(found[data.
-#define nJ1 ;xW3
-#define nI1 yJ3 bitmask&
-#define nH1 Sign_Positive
-#define nG1 SetParamMove(
-#define nF1 CodeTreeImmed(iV2(
-#define nE1 changed_if
-#define nD1 0,xG2;DelParam(1);
-#define nC1 .GetImmed()
-#define nB1 for iA1 a=0;a<c8++a)
-#define nA1 iF2 index
-#define n91 lA 0x4},{{
-#define n81 iI1 found[data.
-#define n71 )[a].start_at
-#define n61 ,cIf,l0 3,
-#define n51 .min.known
-#define n41 .xF1 a-->0;)if(
-#define n31 ;return
-#define n21 n31 xP2;}
-#define n11 >::Optimize(){}
-#define n01 n_as_tanh_param
-#define lZ1 opposite=
-#define lY1 x91(
-#define lX1 MatchResultType
-#define lW1 needs_sincos
-#define lV1 resulting_exponent
-#define lU1 val):Value(Value::
-#define lT1 Unknown:c73;}
-#define lS1 GetParam(a)
-#define lR1 inverse_nominator]
-#define lQ1 cMul l3 0,1,
-#define lP1 tree yP1
-#define lO1 AddFunctionOpcode(
-#define lN1 SetParams(l02));
-#define lM1 o<<"("<<std::hex<<data.
-#define lL1 (val);else*this=model;}
-#define lK1 IfBalanceGood(
-#define lJ1 n_as_tan_param
-#define lI1 changed_exponent
-#define lH1 &&e13<iV2(
-#define lG1 inverse_denominator
-#define lF1 ;cH2.hash2+=
-#define lE1 xK(rule.repl_param_list,
-#define lD1 retry_positionalparams_2
-#define lC1 situation_flags&
-#define lB1 518 nP 400412,
-#define lA1 7168 nP 401798
-#define l91 }},{ProduceNewTree,
-#define l81 data.subfunc_opcode
-#define l71 i61 tJ2
-#define l61 CopyOnWrite();
-#define l51 recursioncount
-#define l41 PlanNtimesCache(
-#define l31 >){int mStackPtr=0;
-#define l21 FPoptimizer_Grammar
-#define l11 AddOperation(cInv,1,1 xN}
-#define l01 GetPositivityInfo eZ3
-#define iZ ParamSpec_SubFunctionData
-#define iY iA1 a=c8 a-->0;)
-#define iX PositionalParams_Rec
-#define iW yD MakeNotNotP1,l5::
-#define iV ,cMul x4
-#define iU eT1 tI3 iE2 nC);tree.
-#define iT yD MakeNotNotP0,l5::
-#define iS lE3 xL2+
-#define iR DumpTreeWithIndent(*this);
-#define iQ switch(type y33 cond_or:
-#define iP ;if(eY2 tM3 SaveMatchedParamIndex(
-#define iO ,l4 2,1,
-#define iN CalculateResultBoundaries(
-#define iM i31 iF2 Compare>
-#define iL cE3 0x0},{{1,
-#define iK edited_powgroup
-#define iJ iA1 a=xF1 a
-#define iI has_unknown_max
-#define iH has_unknown_min
-#define iG static const c23
-#define iF synthed_tree
-#define iE 408964 nP 24963
-#define iD SelectedParams,0},0,0x0},{{
-#define iC collections
-#define iB cache
-#define iA ;xK2 nK2
-#define i9 )iA);
-#define i8 ByteCode.
-#define i7 ;pow xD cLog);tree tH3
-#define i6 goto ReplaceTreeWithOne;case
-#define i5 ]);yE3
-#define i4 !=xB)return lY2
-#define i3 e11.data
-#define i2 l53 xH2(
-#define i1 needs_sinhcosh
-#define i0 cAdd x4
-#define tZ cAdd l3 0,
-#define tY tA2 iV2(
-#define tX xW3 nA
-#define tW int_exponent_t
-#define tV return m;}case
-#define tU MakeFalse,l5::
-#define tT lT2 std::endl;DumpHashes(
-#define tS ,ByteCode,IP,limit,y1,stack);
-#define tR matched_params
-#define tQ [n1 tC3=true;lQ[n1 tD3
-#define tP l21::Grammar*
-#define tO powgroup l8
-#define tN );p2 cK p2);tI3 l93 nC);cZ}
-#define tM GetLogicalValue y91
-#define tL t02&&found[data.
-#define tK valueType
-#define tJ xE AnyParams,
-#define tI =iN lE2
-#define tH eO3 nC1
-#define tG (tH)
-#define tF nF1(
-#define tE has_mulgroups_remaining
-#define tD by_exponent
-#define tC const iZ
-#define tB MatchInfo xK&
-#define tA Rehash();iA2.push_back(
-#define t9 best_factor
-#define t8 RootPowerTable xK::RootPowers[
-#define t7 MatchPositionSpec_AnyParams xK
-#define t6 cLessOrEq,l2
-#define t5 lF3 FPoptimizer_CodeTree
+#define nZ1 inverse_nominator
+#define nY1 252180 nT 281854,
+#define nX1 <<std::dec<<")";}
+#define nW1 {DataP slot_holder(y1[
+#define nV1 },{l5::MakeNotP1,l5::
+#define nU1 },{l5::MakeNotP0,l5::
+#define nT1 },{l5::MakeNotNotP1,l5::
+#define nS1 !=xJ)if(TestCase(
+#define nR1 AddFunctionOpcode
+#define nQ1 public e6,public eO3
+#define nP1 yZ2&tree,
+#define nO1 std::pair<T1,T2>&
+#define nN1 tP1 x93
+#define nM1 has_good_balance_found
+#define nL1 n_occurrences
+#define nK1 found_log2_on_exponent
+#define nJ1 covers_minus1
+#define nI1 needs_resynth
+#define nH1 immed_product
+#define nG1 l33 FPoptimizer_Optimize
+#define nF1 (ParamSpec_Extract xF(
+#define nE1 yV3 bitmask&
+#define nD1 Sign_Positive
+#define nC1 ::MakeTrue
+#define nB1 SetParamMove(
+#define nA1 CodeTreeImmed(e62
+#define n91 Suboptimal
+#define n81 changed_if
+#define n71 n_as_tanh_param
+#define n61 opposite=
+#define n51 xE1(
+#define n41 eN1 eJ3
+#define n31 MatchResultType
+#define n21 yP yZ2(
+#define n11 needs_sincos
+#define n01 resulting_exponent
+#define lZ1 Unknown:yF3;}
+#define lY1 GetLogicalValue(xW
+#define lX1 GetParam(a)
+#define lW1 cMul l3 0,1,
+#define lV1 IsImmed())l14
+#define lU1 void FunctionParserBase
+#define lT1 (x83
+#define lS1 lT1 a=0;a<xT;++a)
+#define lR1 o<<"("<<std::hex<<data.
+#define lQ1 (val);else*this=model;}
+#define lP1 IfBalanceGood(
+#define lO1 n_as_tan_param
+#define lN1 changed_exponent
+#define lM1 inverse_denominator
+#define lL1 ;cK2.hash2+=
+#define lK1 retry_positionalparams_2
+#define lJ1 x83 index
+#define lI1 situation_flags&
+#define lH1 518 nT 400412,
+#define lG1 data.subfunc_opcode
+#define lF1 },{l5::MakeNotNotP0,l5::
+#define lE1 (yO3 start_at
+#define lD1 CopyOnWrite();
+#define lC1 recursioncount
+#define lB1 PlanNtimesCache(
+#define lA1 FPoptimizer_Grammar
+#define l91 GetParamCount();
+#define l81 GetPositivityInfo iS3
+#define l71 ParamSpec_SubFunctionData
+#define l61 t43<e62
+#define l51 (tree.GetParamCount()
+#define l41 iZ1 a=yC a-->0;)
+#define l31 PositionalParams_Rec
+#define l21 DumpTreeWithIndent(*this);
+#define l11 e23 type){case cond_or:
+#define l01 tP1 x83 Compare>
+#define iZ tree.i91 a
+#define iY .l91 a-->0;)if(
+#define iX lA 0x4},{{
+#define iW lJ 2 i41 1,
+#define iV edited_powgroup
+#define iU has_unknown_max
+#define iT has_unknown_min
+#define iS static const yD3
+#define iR if(keep_powi
+#define iQ synthed_tree
+#define iP 7168 nT 401798,
+#define iO SelectedParams,0 i41
+#define iN collections
+#define iM cache
+#define iL ,cIf,l0 3,
+#define iK ,eN1,IP,limit,y2,stack);
+#define iJ by_exponent
+#define iI );p2.lT2 p2 yB eL3 iZ2 nC);cJ}
+#define iH .eL3
+#define iG mulgroup;mulgroup iH
+#define iF (p0 e61&&p0 nL3 i2
+#define iE cN3 p0 yM>=e62 0.0))
+#define iD goto ReplaceTreeWithOne t83
+#define iC !=xJ)return n02
+#define iB e01.data
+#define iA iX2 xK2(
+#define i9 needs_sinhcosh
+#define i8 1)x41
+#define i7 ,l4 2,1,
+#define i6 cAdd l3 0,
+#define i5 tG2 e62
+#define i4 tK1 n9
+#define i3 MakeFalse,l5::
+#define i2 <=fp_const_negativezero xF())
+#define i1 ;return
+#define i0 )i1 lH
+#define tZ CalculateResultBoundaries(xW
+#define tY p0=CalculateResultBoundaries(
+#define tX ;yZ2
+#define tW ,2,1 iM2.xR if(found[data.
+#define tV 408964 nT 24963,
+#define tU 528503 nT 24713,
+#define tT matched_params
+#define tS [n1 eH3=true;lQ[n1 eI3
+#define tR lA1::Grammar*
+#define tQ AddOperation(cInv,1,1 iM2.xR}
+#define tP int_exponent_t
+#define tO m.max.
+#define tN ;AddParamMove(
+#define tM nM nU2,e62 1));
+#define tL cG3 eW3
+#define tK return m;}case
+#define tJ x9 AnyParams,
+#define tI powgroup l8
+#define tH relationships
+#define tG ]!=~size_t(0)){synth.yT
+#define tF }},{ProduceNewTree,2,1,
+#define tE nA1(
+#define tD has_mulgroups_remaining
+#define tC MatchInfo xF&
+#define tB e33);i32 c52
+#define tA best_factor
+#define t9 RootPowerTable xF::RootPowers[
+#define t8 (c81
+#define t7 :goto ReplaceTreeWithZero t83
+#define t6 MatchPositionSpec_AnyParams xF
+#define t5 l33 FPoptimizer_CodeTree
#define t4 n_as_sinh_param
#define t3 n_as_cosh_param
-#define t2 is_signed
-#define t1 result_positivity
-#define t0 yN known tO3
-#define eZ biggest_minimum
-#define eY 142455 nP 141449,
-#define eX cond_tree
-#define eW else_tree
-#define eV then_tree
-#define eU sequencing
-#define eT string c83
-#define eS );bool needs_cow=GetRefCount()>1;
-#define eR nM iV2(-nR3
-#define eQ {AdoptChildrenWithSameOpcode(tree);
-#define eP lJ3,l2 c22
-#define eO ;AddParamMove(
-#define eN yN known&&p0 yN val<=fp_const_negativezero xK())
-#define eM tree.GetParamCount()
-#define eL :goto ReplaceTreeWithZero;case
-#define eK relationships
-#define eJ CodeTree xK
-#define eI ,2,122999 nP 139399,
-#define eH std xV3<eJ>
-#define eG if_stack
-#define eF (l02));yQ1 Rehash();
-#define eE n_as_sin_param
-#define eD n_as_cos_param
-#define eC PowiResolver::
-#define eB cIf,tW3
-#define eA ].relationship
-#define e9 PACKED_GRAMMAR_ATTRIBUTE;
-#define e8 .BalanceGood
-#define e7 AddParamMove(yW2
-#define e6 back().endif_location
-#define e5 x91 key
-#define e4 AddParamMove(mul);
-#define e3 130,1,
-#define e2 MatchPositionSpecBase
-#define e1 l53 CodeTree(
-#define e0 smallest_maximum
-#define cZ goto redo;
-#define cY ReplaceTreeWithParam0;
-#define cX factor_needs_rehashing
-#define cW MatchPositionSpecBaseP
-#define cV xK3 tK1::yV3
-#define cU e81 xK(nN.param_list,
-#define cT 243,244,245,246,249,250,251,253,255,256,257,258,259}};}
-#define cS ];};extern"C"{
-#define cR 79,122,123,160,161,163,164,165,166,167,168,169,178,179,180,200,204,212,216,224,236,237,239,240,
-#define cQ 27,28,29,30,31,32,33,35,36,
-#define cP const ParamSpec_SubFunction
-#define cO const ParamSpec_ParamHolder
-#define cN otherhalf
-#define cM StackState
-#define cL )return false;
-#define cK eT1 lP1
-#define cJ (tree lT2"\n";
-#define cI const SequenceOpCode xK
-#define cH paramholder_matches[nZ]
-#define cG MatchPositionSpec_PositionalParams xK
-#define cF lC2 tree,std::ostream&o
-#define cE paramholder_matches.
-#define cD iV2(1.5)*fp_const_pi xK()
-#define cC xB,l5::Never yD xB,l5::Never}
-#define cB CalculatePowiFactorCost(
-#define cA ImmedHashGenerator
-#define c9 .AddParam(
-#define c8 eM;
-#define c7 ::map<fphash_t,std::set<std cC3> >
-#define c6 ComparisonSetBase::
-#define c5 AddParamMove(comp.cK1[a].value);
-#define c4 ,yA2 528503 nP 24713,
-#define c3 T1,xK3 T2>inline iG2()(
-#define c2 has_nonlogical_values
-#define c1 from_logical_context)
-#define c0 AnyParams,0 l91
-#define yZ for iA1 a=xX.xF1 a-->0;)
-#define yY POWI_CACHE_SIZE
-#define yX static inline eJ
-#define yW ++IP;eR2 if(iT1==cS3.
-#define yV .FoundChild
-#define yU BalanceResultType
-#define yT xM3(0),Opcode(
-#define yS );void lO1 iF2 t83 c42<
-#define yR {return
-#define yQ const yR data->
-#define yP +=fp_const_twopi xK();
-#define yO fp_const_twopi xK()eY3
-#define yN .max.
-#define yM eJ tmp,tmp2;tmp2 xD
+#define t2 ();pow iH cLog yB eL3 cMul
+#define t1 0,tU2 i91 1);
+#define t0 is_signed
+#define eZ result_positivity
+#define eY biggest_minimum
+#define eX const l71
+#define eW 122999 nT 139399,
+#define eV 142455 nT 141449,
+#define eU cond_tree
+#define eT then_tree
+#define eS (a);bool needs_cow=GetRefCount()>1;
+#define eR yZ2&tree)
+#define eQ sequencing
+#define eP string FP_GetOpcodeName(
+#define eO );eN1 c52 0x80000000u
+#define eN {if(needs_cow){lD1 goto
+#define eM (lJ2));cA1 e33);
+#define eL ,nQ2
+#define eK eO3 yZ2>
+#define eJ if_stack
+#define eI n_as_sin_param
+#define eH n_as_cos_param
+#define eG PowiResolver::
+#define eF cIf,tG3
+#define eE ].relationship
+#define eD .BalanceGood
+#define eC AddParamMove(yT2
+#define eB valueType
+#define eA back().endif_location
+#define e9 xE1 key
+#define e8 AddParamMove(mul);
+#define e7 130,1,
+#define e6 MatchPositionSpecBase
+#define e5 iX2 c02(
+#define e4 smallest_maximum
+#define e3 ]!=~size_t(0)&&found[data.
+#define e2 }PACKED_GRAMMAR_ATTRIBUTE;
+#define e1 ReplaceTreeWithParam0;
+#define e0 factor_needs_rehashing
+#define cZ MatchPositionSpecBaseP
+#define cY .e33 yB eL3
+#define cX x93 tJ1::y83
+#define cW ParamSpec_Extract xF(nN.param_list,
+#define cV }x32 x41==e62
+#define cU 243,244,245,246,249,250,251,253,255,256,257,258,259}};}
+#define cT ];};extern"C"{
+#define cS .AddParam(
+#define cR iL2 tree lE2"\n";
+#define cQ )return false;
+#define cP 79,122,123,160,161,163,164,165,166,167,168,169,178,179,180,200,204,212,216,224,236,237,239,240,
+#define cO 27,28,29,30,31,32,33,35,36,
+#define cN const ParamSpec_SubFunction
+#define cM const ParamSpec_ParamHolder
+#define cL otherhalf
+#define cK :{AdoptChildrenWithSameOpcode(tree);
+#define cJ goto redo;
+#define cI StackState
+#define cH l2 16,2,
+#define cG const SequenceOpCode xF
+#define cF MatchPositionSpec_PositionalParams xF
+#define cE const nP1 std::ostream&o
+#define cD e62 1.5)*fp_const_pi xF()
+#define cC CalculatePowiFactorCost(
+#define cB ImmedHashGenerator
+#define cA paramholder_matches
+#define c9 ::map<fphash_t,std::set<eM3> >
+#define c8 ComparisonSetBase::
+#define c7 AddParamMove(comp.cJ1[a].value);
+#define c6 T1,x93 T2>inline iD2()(
+#define c5 has_nonlogical_values
+#define c4 from_logical_context)
+#define c3 AnyParams,0}},{ProduceNewTree,
+#define c2 for iZ1 a=xV.l91 a-->0;)
+#define c1 POWI_CACHE_SIZE
+#define c0 static inline yZ2
+#define yZ ++IP;yA1}if(n13 c33.
+#define yY },{l5::xJ,l5::Never},{l5::xJ,l5::Never}}
+#define yX .FoundChild
+#define yW BalanceResultType
+#define yV {yZ2 tmp;tmp iH
+#define yU yB1 GetOpcode(),
+#define yT DoDup(found[data.
+#define yS xB3(0),Opcode(
+#define yR ;sim.Eat(
+#define yQ );void nR1 eZ2,c82<
+#define yP {return
+#define yO const yP data->
+#define yN +=fp_const_twopi xF();
+#define yM .min.val
#define yL fp_sin(min),fp_sin(max))
-#define yK m.min.
-#define yJ lO2 GetOpcode(),
-#define yI for iA1 a=0;a<xF1++a){if(
-#define yH static void nA3 nB fphash_t&cH2,
+#define yK fp_const_twopi xF());if(
+#define yJ {yZ2 tmp,tmp2;tmp2 iH
+#define yI .min.known
+#define yH for iZ1 a=0;a<l91++a){if(
#define yG MatchPositionSpec_AnyWhere
-#define yF if y23 data.match_type==
+#define yF if yZ3 data.match_type==
#define yE void OutFloatHex(std::ostream&o,
-#define yD },{l5::
-#define yC AddParam(CodeTreeImmed(
-#define yB cGreaterOrEq,
-#define yA ,xK3 eJ::
-#define y9 xK model=cJ1 xK()){if(known
-#define y8 AssembleSequence_Subdivide(
-#define y7 ]=nK2|iF2(
-#define y6 branch2
-#define y5 (n83 r=range.first;r!=range tE3;++r){
-#define y4 !=t02){n81
-#define y3 ;tQ2 2,
-#define y2 iF2 c;iF2 short l[
-#define y1 factor_stack_base
-#define y0 =0;a<yS3.xF1++a)if(
-#define xZ ,eL1 0x4 nH
-#define xY data->Params
-#define xX branch1
-#define xW );eR2 if(list.first nC1==iV2(
-#define xV nN yF2
-#define xU =fp_cosh nU3;c81=fp_cosh(c81);
-#define xT {nI2.erase(i);eR2
-#define xS StackTop
-#define xR FPOPT_autoptr
-#define xQ +=nT3 n31 nT3;}xW3 inline iV2
-#define xP int_exponent
-#define xO tree.ReplaceWithImmed(
-#define xN )cI1*this)n31;}
-#define xM GetStackTop()-
-#define xL sim.AddConst(
-#define xK <iV2>
-#define xJ .SetParam(0,l93 lR2 eJ p1;p1 xD
-#define xI newnode
-#define xH has_highlevel_opcodes
-#define xG eD2 0x0},{{
-#define xF .IsIdenticalTo(
-#define xE ,cAdd,
-#define xD .nH2
-#define xC {if(needs_cow){l61 goto
-#define xB Unchanged
-#define xA cF=std::cout
-#define x9 best_selected_sep
-#define x8 i31>void FunctionParserBase<
-#define x7 ->Recalculate_Hash_NoRecursion();}
-#define x6 xF1++a)if(ApplyGrammar(tX2,t33,
-#define x5 position
-#define x4 l3 2,1,
-#define x3 ;iE3 0));tmp xD cInv);tmp yP1 tmp2)n31
-#define x2 nB1{c23
-#define x1 std xV3<CodeTree>
-#define x0 TestImmedConstraints y23 constraints,tree)cL
-#define nZ paramholder_index
-#define nY x61 tQ2
-#define nX )){tree.FixIncompleteHashes();}
-#define nW );cR1){nC2 cInv cT2 xL-1 xD2;lC
-#define nV return true;case
-#define nU occurance_counts
-#define nT >p tI a)eY3 p.
-#define nS -->0;){lC2 powgroup=lS1;if(powgroup
-#define nR lT3 i61
-#define nQ ,l0 1,
-#define nP ,{2,
-#define nO const FPoptimizer_CodeTree::eJ&tree
+#define yD {static void lY3 nB fphash_t&cK2,
+#define yC tree.l91
+#define yB );tree.
+#define yA AddParam(CodeTreeImmed(
+#define y9 cGreaterOrEq,
+#define y8 ,x93 yZ2::
+#define y7 xF model=cI1 xF()){if(known
+#define y6 AssembleSequence_Subdivide(
+#define y5 ]=0x80000000u|x83(
+#define y4 branch2
+#define y3 x83 c;x83 short l[
+#define y2 factor_stack_base
+#define y1 data->Params
+#define y0 (lW3 r=range.first;r!=range.i63++r){
+#define xZ {nI2.erase(i);yA1}
+#define xY =0;a<y53.l91++a)if(
+#define xX ,t21 0x4 nH
+#define xW tree l8
+#define xV branch1
+#define xU ,nU2))eN
+#define xT nN y92
+#define xS =fp_cosh(m yM);tO val=fp_cosh(tO val);
+#define xR StackTopIs(*this)i1;}
+#define xQ StackTop
+#define xP FPOPT_autoptr
+#define xO +=nS3 i1 nS3;}tK1 inline Value_t
+#define xN int_exponent
+#define xM newnode
+#define xL lJ 1 i41
+#define xK has_highlevel_opcodes
+#define xJ Unchanged
+#define xI .IsIdenticalTo(
+#define xH GetStackTop()-
+#define xG sim.AddConst(
+#define xF <Value_t>
+#define xE cE=cV2
+#define xD best_selected_sep
+#define xC ->Recalculate_Hash_NoRecursion();}
+#define xB l91++a)if(ApplyGrammar(tK2,xW a),
+#define xA lU3 2,1,
+#define x9 ,cAdd,
+#define x8 position
+#define x7 x51{yD3
+#define x6 ;tmp2 tY3 tmp iH cInv);tmp c91 tmp2)i1
+#define x5 eO3 c02>
+#define x4 SetParam(0,iZ2 l8 0))tX p1;p1 iH
+#define x3 TestImmedConstraints yZ3 constraints cU3)cQ
+#define x2 SwapLastTwoInStack()yR
+#define x1 n23 1,cInv e02 xG-1 xN1
+#define x0 paramholder_index
+#define nZ lD2 case
+#define nY occurance_counts
+#define nX );a-->0;){iT1&powgroup=lX1;if(powgroup
+#define nW )){tree.tE3;}
+#define nV Value_t>p=tZ a));if(p.
+#define nU tree.ReplaceWithImmed(
+#define nT ,{2,
+#define nS ,l0 1,
+#define nR ,cAdd l3 2,1,
+#define nQ ){yZ2
+#define nP if(xW 0)tD1
+#define nO const FPoptimizer_CodeTree::yZ2&tree
#define nN model_tree
-#define nM return c23(
-#define nL ){using lF3 FUNCTIONPARSERTYPES;
-#define nK eH&lZ2
-#define nJ AddParam y91
-#define nI ConstantFolding_LogicCommon(tree,c6
+#define nM return yD3(
+#define nL ){using l33 FUNCTIONPARSERTYPES;
+#define nK eK&n12
+#define nJ AddParam(xW
+#define nI ConstantFolding_LogicCommon(tree,c8
#define nH },{{2,
-#define nG nR1 Ref>inline void xR<Ref>::
-#define nF AnyParams,1},0,0x0},{{
-#define nE ):data(new xH2 xK(
+#define nG nN1 Ref>inline void xP<Ref>::
+#define nF AnyParams,1 i41
+#define nE ):data(new xK2 xF(
#define nD goto do_return;}
#define nC .GetOpcode()
#define nB FUNCTIONPARSERTYPES::
-#define nA xH2 xK::xH2(
-#define n9 b;}};i31>e12 Comp<nB
-#define n8 l22(),Params(),Hash(),Depth(1),tP1 0){}
-#define n7 SynthesizeByteCode(iS2
-#define n6 while(ApplyGrammar(cD2
-#define n5 GetIntegerInfo y91 0))==IsAlways)nY3
-#define n4 ;lP1 nE1)xJ2
-#define n3 template set_if<cGreater>(iV2(
-#define n2 DumpParams xK y23 data.param_list,yL3 data yF2,o);
+#define nA b;}};tP1>e72 Comp<nB
+#define n9 xK2 xF::xK2(
+#define n8 lL2(),t53),Hash(),Depth(1 eB1 0){}
+#define n7 SynthesizeByteCode(c92
+#define n6 while(ApplyGrammar(cG2
+#define n5 GetIntegerInfo(xW 0))==iF2)n73
+#define n4 ;tree c91 n81 yQ2
+#define n3 tL1 cGreater>(e62
+#define n2 DumpParams xF yZ3 data.param_list,iH3 y92,o);
#define n1 restholder_index
-#define n0 eJ exponent;exponent xD cMul tF1 c9
-#define lZ lR eY3 fp_nequal(tmp,xD1){xO iV2(1)/tmp);nD}lC
-#define lY :if(ParamComparer xK()(Params[1],Params[0])){std::swap(Params[0],Params[1]);Opcode=
-#define lX <xK3 iV2>
-#define lW xK tmp;tmp xD cPow);tmp.nJ 0));tmp.yC iV2(
-#define lV tR1,0x0},
-#define lU AddParamMove(pow l8 1));pow tK2 1);pow eT1 tree.nG1 0,pow);goto NowWeAreMulGroup;}
+#define n0 yZ2 exponent eX3 iH cMul)eX3 cS
+#define lZ lR);if(fp_nequal(tmp,xG1){nU e62 1)/tmp);nD}lC
+#define lY :if(ParamComparer xF()(t63 1],t63 0])){std::swap(t63 0],t63 1]);Opcode=
+#define lX <x93 Value_t>
+#define lW xF tmp;tmp iH cPow);tmp tY3 tmp.yA e62
+#define lV i01,0x0},
+#define lU AddParamMove(pow l8 1));pow.i91 1);pow.e33 yB nB1 0,pow);goto NowWeAreMulGroup;}
#define lT GroupFunction,0},lV{{
-#define lS tG1 1)/iV2(
-#define lR lE2 0)nC1
+#define lS ,e62 1)/e62
+#define lR xW 0)x41
#define lQ restholder_matches
-#define lP yD1|=key;x91 crc=(key>>10)|(key<<(64-10))lF1((~lY1 crc))*3)^1234567;}};
-#define lO nE1;nE1 iP2 nE1.AddParamMove y91 0));nE1 c9 xX l8
-#define lN xW3 eJ::CodeTree(
-#define lM cM1 0,lE2 0)lR2 cM1 1,CodeTreeImmed(
-#define lL lX void ByteCodeSynth xK::lO1 iF2 t83 c42<
+#define lP yE1|=key;xE1 crc=(key>>10)|(key<<(64-10))lL1((~n51 crc))*3)^1234567;}};
+#define lO n81;n81 nO2;n81 c91 xW 0));n81 cS xV l8
+#define lN tK1 yZ2::c02(
+#define lM tree.SetParam(0,xW 0)l8 0)xT1 1,CodeTreeImmed(
+#define lL lX void eP3::nR1 eZ2,c82<
#define lK cMul,lT 2,
#define lJ cMul,AnyParams,
-#define lI y91 0)i61&&eO3 i61){xO
-#define lH iN tmp i33
-#define lG :eM3=comp.AddRelationship(atree l8 0),atree l8 1),c6
+#define lI (xW 0)tD1&&xW 1)tD1){nU
+#define lH CalculateResultBoundaries(tmp);}case
+#define lG :cY3=comp.AddRelationship(atree l8 0),atree l8 1),c8
#define lF cPow,l0 2
-#define lE xK3 iV2>inline iG2()cG1 xN3 iV2&b)yR a
-#define lD {c23 m tI 0));
-#define lC break;case
-#define lB tZ1 eJ::
-#define lA yX1},0,
+#define lE x93 Value_t>inline iD2()iS1 Value_t&xC3 Value_t&b)yP a
+#define lD {yD3 m=tZ 0));
+#define lC break t83
+#define lB xL1 yZ2::
+#define lA y71,0,
#define l9 l1 0x0 nH
#define l8 .GetParam(
-#define l7 ;eJ nE1;nE1 iP2 nE1 iO3 tree.l02));nE1 eT1 tI3
+#define l7 tX n81;n81 nO2;n81 iF1 tree.lJ2));n81 cY
#define l6 SelectedParams,0},0,0x0 nH
#define l5 RangeComparisonData
-#define l4 yX1 l91
-#define l3 ,AnyParams,0}}l44
-#define l2 yX1}}l44
+#define l4 y71},{ProduceNewTree,
+#define l3 ,AnyParams,0}},{ReplaceParams,
+#define l2 y71},{ReplaceParams,
#define l1 cMul,SelectedParams,0},0,
#define l0 lA 0x0},{{
#ifdef _MSC_VER
typedef
-iF2
+x83
int
-iZ1;
+lI2;
#else
#include <stdint.h>
typedef
uint_least32_t
-iZ1;
+lI2;
#endif
-lF3
+l33
crc32{enum{startvalue=0xFFFFFFFFUL,poly=0xEDB88320UL}
-;i31
-iZ1
-crc>e12
-b8{enum{b1=(crc&xG1
+;tP1
+lI2
+crc>e72
+b8{enum{b1=(crc&xJ1
crc
-xI2
-crc>>1),b2=(b1&xG1
+xL2
+crc>>1),b2=(b1&xJ1
b1
-xI2
-b1>>1),b3=(b2&xG1
+xL2
+b1>>1),b3=(b2&xJ1
b2
-xI2
-b2>>1),b4=(b3&xG1
+xL2
+b2>>1),b4=(b3&xJ1
b3
-xI2
-b3>>1),b5=(b4&xG1
+xL2
+b3>>1),b5=(b4&xJ1
b4
-xI2
-b4>>1),b6=(b5&xG1
+xL2
+b4>>1),b6=(b5&xJ1
b5
-xI2
-b5>>1),b7=(b6&xG1
+xL2
+b5>>1),b7=(b6&xJ1
b6
-xI2
-b6>>1),res=(b7&xG1
+xL2
+b6>>1),res=(b7&xJ1
b7
-xI2
+xL2
b7>>1)}
;}
;inline
-iZ1
-update(iZ1
-crc,iF2
+lI2
+update(lI2
+crc,x83
b){
-#define B4(n) b8<n eS2 n+1 eS2 n+2 eS2 n+3>::res
+#define B4(n) b8<n>nP3 n+1>nP3 n+2>nP3 n+3>::res
#define R(n) B4(n),B4(n+4),B4(n+8),B4(n+12)
static
const
-iZ1
+lI2
table[256]={R(0x00),R(0x10),R(0x20),R(0x30),R(0x40),R(0x50),R(0x60),R(0x70),R(0x80),R(0x90),R(0xA0),R(0xB0),R(0xC0),R(0xD0),R(0xE0),R(0xF0)}
;
#undef R
#undef B4
-return((crc>>8))^table[(crc^b)&0xFF];xI1
-iZ1
-calc_upd(iZ1
+return((crc>>8))^table[(crc^b)&0xFF];y81
+lI2
+calc_upd(lI2
c,const
-iF2
+x83
char*buf,size_t
-size){iZ1
-value=c;for
-iA1
-p=0;p<size;++p)value=update(value,buf[p])n31
-value;xI1
-iZ1
+size){lI2
+value=c
+eK3
+p=0;p<size;++p)value=update(value,buf[p])i1
+value;y81
+lI2
calc
-cH1
-iF2
+iS1
+x83
char*buf,size_t
-size)yR
+size)yP
calc_upd(startvalue,buf,size);}
}
#ifndef FPOptimizerAutoPtrHH
#define FPOptimizerAutoPtrHH
-nR1
+nN1
Ref>class
-xR{eX3
-xR():p(0){}
-xR(Ref*b):p(b){xL3}
-xR
-cH1
-xR&b):p(b.p){xL3
-xI1
-Ref&eA1*(yZ1*p;xI1
-Ref*eA1->(yZ1
+xP{e43
+xP():p(0){}
+xP(Ref*b):p(b){xA3}
+xP
+iS1
+xP&b):p(b.p){xA3
+y81
+Ref&eM1*(c01*p;y81
+Ref*eM1->(c01
p;}
-xR&eA1=(Ref*b){Set(b)n31*this;}
-xR&eA1=cH1
-xR&b){Set(b.p)n31*this;}
+xP&eM1=(Ref*b){Set(b)i1*this;}
+xP&eM1=iS1
+xP&b){Set(b.p)i1*this;}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-xR(xR&&b):p(b.p){b.p=0;}
-xR&eA1=(xR&&b){if(p!=b.p){e02;p=b.p;b.p=0;}
-return*this;}
+xP(xP&&b):p(b.p){b.p=0;}
+xP&eM1=(xP&&b){if(p!=b.p){iC2;p=b.p;b.p=0;eE3*this;}
#endif
-~xR(){e02
-lL3
-UnsafeSetP(Ref*newp){p=newp
-lL3
-swap(xR<Ref>&b){Ref*tmp=p;p=b.p;b.p=tmp;}
+~xP(){Forget(cN2
+UnsafeSetP(Ref*newp){p=newp;}
+void
+swap(xP<Ref>&b){Ref*tmp=p;p=b.p;b.p=tmp;}
private:inline
static
void
Have(Ref*p2);inline
void
-e02;inline
+iC2;inline
void
-xL3
+xA3
inline
void
Set(Ref*p2);private:Ref*p;}
;nG
-e02{if(!p)return;p->xM3-=1;if(!p->xM3)delete
+iC2{if(!p)return;p->xB3-=1;if(!p->xB3)delete
p;}
nG
-Have(Ref*p2){if(p2)++(p2->xM3);}
+Have(Ref*p2){if(p2)++(p2->xB3);}
nG
Birth(){Have(p);}
nG
-Set(Ref*p2){Have(p2);e02;p=p2;}
+Set(Ref*p2){Have(p2);iC2;p=p2;}
#endif
#include <utility>
-e12
-Compare2ndRev{nR1
+e72
+Compare2ndRev{nN1
T>inline
-iG2()cH1
-T&xN3
+iD2()iS1
+T&xC3
T&b
-yZ1
-a
-tE3>b
-tE3;}
+c01
+a.second>b.i63}
}
-;e12
-Compare1st{nR1
-c3
+;e72
+Compare1st{nN1
+c6
const
-nS1
-xN3
-nS1
+nO1
+xC3
+nO1
b
-yZ1
+c01
a.first<b.first;}
-nR1
-c3
+nN1
+c6
const
-nS1
+nO1
a,T1
b
-yZ1
+c01
a.first<b;}
-nR1
-c3
+nN1
+c6
T1
-xN3
-nS1
+xC3
+nO1
b
-yZ1
+c01
a<b.first;}
}
;
#define FPoptimizerHashHH
#ifdef _MSC_VER
typedef
-iF2
+x83
long
long
-x91;
+xE1;
#define FPHASH_CONST(x) x##ULL
#else
#include <stdint.h>
typedef
uint_fast64_t
-x91;
+xE1;
#define FPHASH_CONST(x) x##ULL
#endif
-lF3
-FUNCTIONPARSERTYPES{e12
-fphash_t{x91
+l33
+FUNCTIONPARSERTYPES{e72
+fphash_t{xE1
hash1,hash2;fphash_t():hash1(0),hash2(0){}
fphash_t
-cH1
-x91&xN3
-x91&b):hash1(a),hash2(b){}
-iG2==cH1
-fphash_t&yY1==e22&&hash2==e32
-iG2!=cH1
-fphash_t&yY1!=e22||hash2!=e32
-iG2<cH1
-fphash_t&yY1!=e22?hash1<e22:hash2<e32}
+iS1
+xE1&xC3
+xE1&b):hash1(a),hash2(b){}
+iD2==iS1
+fphash_t&yZ1==e82&&hash2==e92
+iD2!=iS1
+fphash_t&yZ1!=e82||hash2!=e92
+iD2<iS1
+fphash_t&yZ1!=e82?hash1<e82:hash2<e92}
;}
#endif
#ifndef FPOptimizer_CodeTreeHH
#ifdef FP_SUPPORT_OPTIMIZER
#include <vector>
#include <utility>
-lF3
-l21{e12
+l33
+lA1{e72
Grammar;}
-lF3
-xH1{xW3
+l33
+xK1{tK1
class
ByteCodeSynth;}
-t5{xW3
+t5{tK1
class
-CodeTree
-nJ1
-e12
-xH2
-nJ1
+c02
+yO1
+e72
+xK2
+yO1
class
-CodeTree{typedef
-xR<xH2
-xK>DataP;DataP
-data;eX3
-CodeTree();~CodeTree();e12
+c02{typedef
+xP<xK2
+xF>DataP;DataP
+data;e43
+c02();~c02();e72
OpcodeTag{}
-;e1
-xB2
-o,OpcodeTag);e12
+;e5
+iU1
+o,OpcodeTag);e72
FuncOpcodeTag{}
-;e1
-xB2
-o,iF2
-f,FuncOpcodeTag);e12
-xO3{}
-;e1
-const
-iV2&v,xO3);
+;e5
+iU1
+o,x83
+f,FuncOpcodeTag);e72
+xD3{}
+;e5
+tV1,xD3);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-e1
-iV2&&v,xO3);
+e5
+Value_t&&v,xD3);
#endif
-e12
+e72
VarTag{}
-;e1
-iF2
-varno,VarTag);e12
+;e5
+x83
+varno,VarTag);e72
CloneTag{}
-;e1
-lG3
+;e5
+tW1
b,CloneTag);void
GenerateFrom
-cH1
-xK3
+iS1
+x93
FunctionParserBase
-xK::Data&data,bool
+xF::Data&data,bool
keep_powi=false);void
GenerateFrom
-cH1
-xK3
+iS1
+x93
FunctionParserBase
-xK::Data&data,const
-x1&xC2,bool
+xF::Data&data,const
+x5&xH2,bool
keep_powi=false);void
-SynthesizeByteCode(std
-xV3<iF2>&eI3,std
-xV3
-xK&immed,size_t&stacktop_max);void
-SynthesizeByteCode(xH1
-yG3&synth,bool
-MustPopTemps=true
-e83;size_t
-SynthCommonSubExpressions(xH1::yM1
+SynthesizeByteCode(eO3
+x83>&cT3,std
+xM3
+xF&immed,size_t&stacktop_max);void
+SynthesizeByteCode(xK1::eP3&synth,bool
+MustPopTemps=true)const;size_t
+SynthCommonSubExpressions(xK1::xI1
const;void
SetParams
-cH1
-x1&xP3
-SetParamsMove(x1&tA1
-CodeTree
+iS1
+x5&xE3
+SetParamsMove(x5&tO1
+c02
GetUniqueRef();
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
-SetParams(x1&&tA1
+SetParams(x5&&tO1
#endif
void
SetParam
-iA1
-which,lG3
+iZ1
+which,tW1
b);void
-nG1
+nB1
size_t
-which,xA2
-b);void
-AddParam
-cH1
-xA2
-param);void
-AddParamMove(xA2
+which,c02&b);void
+AddParam(tW1
param);void
+AddParamMove(c02¶m);void
AddParams
-cH1
-x1&xP3
-AddParamsMove(x1&xP3
-AddParamsMove(x1&lZ2,size_t
-n02);void
-DelParam
-iA1
+iS1
+x5&xE3
+AddParamsMove(x5&xE3
+AddParamsMove(x5&n12,size_t
+n22);void
+i91
+size_t
index);void
DelParams();void
-Become
-cH1
-xA2
+Become(tW1
b);inline
size_t
-GetParamCount(yZ1
-l02).tF3;xI1
-xA2
-GetParam
-iA1
-n)yR
-l02)[n];xI1
-lG3
+GetParamCount(c01
+lJ2)eJ3;y81
+c02&GetParam
+iZ1
+n)yP
+lJ2)[n];y81
+tW1
GetParam
-iA1
+iZ1
n
-yZ1
-l02)[n];xI1
+c01
+lJ2)[n];y81
void
-nH2
-xB2
-o)tN3
-Opcode=o;xI1
-xB2
-GetOpcode()yQ
-Opcode;xI1
+eL3
+iU1
+o)iZ3
+Opcode=o;y81
+iU1
+GetOpcode()yO
+Opcode;y81
nB
fphash_t
-GetHash()yQ
-Hash;xI1
+GetHash()yO
+Hash;y81
const
-x1&l02
-yZ1
-xY;xI1
-x1&l02)yR
-xY;xI1
+x5&lJ2
+c01
+y1;y81
+x5&lJ2)yP
+y1;y81
size_t
-y22
-yQ
-Depth;xI1
+GetDepth()yO
+Depth;y81
const
-iV2&GetImmed()yQ
-Value;xI1
-iF2
-GetVar()yQ
-l12
-xI1
-iF2
-GetFuncNo()yQ
-l12
-xI1
+Value_t&GetImmed()yO
+Value;y81
+x83
+GetVar()yO
+lK2
+y81
+x83
+GetFuncNo()yO
+lK2
+y81
bool
-IsDefined(yZ1
+IsDefined(c01
GetOpcode()!=nB
-cNop;xI1
+cNop;y81
bool
-IsImmed(yZ1
+IsImmed(c01
GetOpcode()==nB
-cImmed;xI1
+cImmed;y81
bool
-IsVar(yZ1
+IsVar(c01
GetOpcode()==nB
-l03;xI1
-iF2
-GetRefCount()yQ
-xM3
-lL3
-ReplaceWithImmed
-cG1
-i);void
-Rehash(bool
+iU2;y81
+x83
+GetRefCount()yO
+xB3;}
+void
+ReplaceWithImmed(tX1;void
+e33
+bool
constantfolding=true);void
Sort();inline
void
-Mark_Incompletely_Hashed()tN3
-Depth=0;xI1
+Mark_Incompletely_Hashed()iZ3
+Depth=0;y81
bool
-Is_Incompletely_Hashed()yQ
-Depth==0;xI1
+Is_Incompletely_Hashed()yO
+Depth==0;y81
const
-tP
-GetOptimizedUsing()yQ
-l32;xI1
+tR
+GetOptimizedUsing()yO
+lM2;y81
void
SetOptimizedUsing
-cH1
-tP
-g)tN3
-l32=g;}
+iS1
+tR
+g)iZ3
+lM2=g;}
bool
RecreateInversionsAndNegations(bool
prefer_base2=false);void
-FixIncompleteHashes();void
-swap(xA2
-b){data.swap(b.data);}
+tE3;void
+swap(c02&b){data.swap(b.data);}
bool
-IsIdenticalTo
-cH1
-xA2
-b
-e83;void
-l61}
-nJ1
-e12
-xH2{int
-xM3;xB2
+IsIdenticalTo(tW1
+b)const;void
+lD1}
+yO1
+e72
+xK2{int
+xB3;iU1
Opcode
-iU2
-Value;iF2
-l12
-eH
+iK2
+Value;x83
+lK2
+eK
Params;nB
fphash_t
Hash;size_t
Depth;const
-tP
-l32;xH2();xH2
-cH1
-xH2&b);i2
-xB2
-o);i2
-xB2
-o,iF2
-f);i2
-const
-iV2&i);
+tR
+lM2;xK2();xK2
+iS1
+xK2&b);iA
+iU1
+o);iA
+iU1
+o,x83
+f);iA
+tX1;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-i2
-iV2&&i);xH2(xH2&&b);
+iA
+Value_t&&i);xK2(xK2&&b);
#endif
bool
IsIdenticalTo
-cH1
-xH2&b
-e83;void
+iS1
+xK2&b)const;void
Sort();void
Recalculate_Hash_NoRecursion();private:void
-eA1=cH1
-xH2&b);}
-nJ1
-yX
-CodeTreeImmed
-cG1
-i)yR
-eJ(i
-yA
-xO3());}
+eM1=iS1
+xK2&b);}
+yO1
+c0
+CodeTreeImmed(tX1
+n21
+i
+y8
+xD3());}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-cB1
-CodeTreeImmed(iV2&&i)yR
-eJ
-c72
-i)yA
-xO3());}
+cC1
+CodeTreeImmed
+cX3&&i)n21
+tF2
+i)y8
+xD3());}
#endif
-cB1
-CodeTreeOp(xB2
-opcode)yR
-eJ(opcode
-yA
+cC1
+CodeTreeOp(iU1
+opcode)n21
+opcode
+y8
OpcodeTag());}
-cB1
-CodeTreeFuncOp(xB2
-t83
-iF2
-f)yR
-eJ(t83
-f
-yA
+cC1
+CodeTreeFuncOp(iU1
+opcode,x83
+f)n21
+opcode,f
+y8
FuncOpcodeTag());}
-cB1
+cC1
CodeTreeVar
-nT2
-varno)yR
-eJ(varno
-yA
+lT1
+varno)n21
+varno
+y8
VarTag());}
#ifdef FUNCTIONPARSER_SUPPORT_DEBUGGING
-tZ1
-DumpHashes(xA)xR3
-DumpTree(xA)xR3
-DumpTreeWithIndent(xA,const
-std
-cC3&indent="\\"
+xL1
+DumpHashes(xE);xL1
+DumpTree(xE);xL1
+DumpTreeWithIndent(xE,const
+eM3&indent="\\"
);
#endif
}
#ifndef FPOptimizer_GrammarHH
#define FPOptimizer_GrammarHH
#include <iostream>
-t5{xW3
+t5{tK1
class
-CodeTree;}
-lF3
-l21{enum
-ImmedConstraint_Value{ValueMask=0x07,Value_AnyNum=0x0,nY2=0x1,Value_OddInt=0x2,tS1=0x3,Value_NonInteger=0x4,eJ1=0x5
-xF3
-ImmedConstraint_Sign{SignMask=0x18,Sign_AnySign=0x00,nH1=0x08,eK1=0x10,Sign_NoIdea=0x18
-xF3
-ImmedConstraint_Oneness{OnenessMask=0x60,Oneness_Any=0x00,Oneness_One=0x20,Oneness_NotOne=0x40
-xF3
-ImmedConstraint_Constness{ConstnessMask=0x180,Constness_Any=0x00,tR1=0x80,Constness_NotConst=0x100
-xF3
-Modulo_Mode{Modulo_None=0,Modulo_Radians=1
-xF3
-Situation_Flags{LogicalContextOnly=0x01,NotForIntegers=0x02,OnlyForIntegers=0x04,OnlyForComplex=0x08,NotForComplex=0x10
-xF3
-nR2{NumConstant,tG3,SubFunction
-xF3
-ParamMatchingType{PositionalParams,SelectedParams,AnyParams,GroupFunction
-xF3
+c02;}
+l33
+lA1{enum
+ImmedConstraint_Value{ValueMask=0x07,Value_AnyNum=0x0,x62=0x1,Value_OddInt=0x2,i11=0x3,Value_NonInteger=0x4,eY1=0x5}
+;enum
+ImmedConstraint_Sign{SignMask=0x18,Sign_AnySign=0x00,nD1=0x08,eZ1=0x10,Sign_NoIdea=0x18}
+;enum
+ImmedConstraint_Oneness{OnenessMask=0x60,Oneness_Any=0x00,Oneness_One=0x20,Oneness_NotOne=0x40}
+;enum
+ImmedConstraint_Constness{ConstnessMask=0x180,Constness_Any=0x00,i01=0x80,Constness_NotConst=0x100}
+;enum
+Modulo_Mode{Modulo_None=0,Modulo_Radians=1}
+;enum
+Situation_Flags{LogicalContextOnly=0x01,NotForIntegers=0x02,OnlyForIntegers=0x04,OnlyForComplex=0x08,NotForComplex=0x10}
+;enum
+nZ2{NumConstant,ParamHolder,SubFunction}
+;enum
+ParamMatchingType{PositionalParams,SelectedParams,AnyParams,GroupFunction}
+;enum
RuleType{ProduceNewTree,ReplaceParams}
;
#ifdef __GNUC__
# define PACKED_GRAMMAR_ATTRIBUTE
#endif
typedef
-std::pair<nR2,const
-void*>e42
-nJ1
-e42
-e81
-nT2
-paramlist,nA1)nJ1
+std::pair<nZ2,const
+void*>eA2
+yO1
+eA2
+ParamSpec_Extract
+lT1
+paramlist,lJ1)yO1
bool
ParamSpec_Compare
-cH1
-void*xN3
-void*b,nR2
-type);iF2
+iS1
+void*xC3
+void*b,nZ2
+type);x83
ParamSpec_GetDepCode
-cH1
-e42&b);e12
-ParamSpec_ParamHolder{nA1:8;iF2
-constraints:9;iF2
-depcode:15;}
-e9
-xW3
-e12
-ParamSpec_NumConstant{iV2
-constvalue;iF2
+iS1
+eA2&b);e72
+ParamSpec_ParamHolder{lJ1:8;x83
+constraints:9;x83
+depcode:15;e2
+tK1
+e72
+ParamSpec_NumConstant
+l14
+constvalue;x83
modulo;}
-;e12
-iZ{iF2
-param_count:2;iF2
-param_list:30;xB2
+;e72
+l71{x83
+param_count:2;x83
+param_list:30;iU1
subfunc_opcode:8;ParamMatchingType
-match_type:3;iF2
-n1:5;}
-e9
-e12
-ParamSpec_SubFunction{iZ
-data;iF2
-constraints:9;iF2
-depcode:7;}
-e9
-e12
+match_type:3;x83
+n1:5;e2
+e72
+ParamSpec_SubFunction{l71
+data;x83
+constraints:9;x83
+depcode:7;e2
+e72
Rule{RuleType
-ruletype:2;iF2
-situation_flags:5;iF2
-repl_param_count:2+9;iF2
-repl_param_list:30;iZ
-match_tree;}
-e9
-e12
-Grammar{iF2
-rule_count;iF2
+ruletype:2;x83
+situation_flags:5;x83
+repl_param_count:2+9;x83
+repl_param_list:30;l71
+match_tree;e2
+e72
+Grammar{x83
+rule_count;x83
short
rule_list[999
-cS
+cT
extern
const
Rule
grammar_rules[];}
-tZ1
+xL1
DumpParam
-cH1
-e42&p,std::ostream&o=std::cout)xR3
+iS1
+eA2&p,std::ostream&o=cV2);xL1
DumpParams
-nT2
-paramlist,iF2
-count,std::ostream&o=std::cout);}
+lT1
+paramlist,x83
+count,std::ostream&o=cV2);}
#endif
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
#define CONSTANT_POS_INF HUGE_VAL
#define CONSTANT_NEG_INF (-HUGE_VAL)
-lF3
-FUNCTIONPARSERTYPES{xW3
+l33
+FUNCTIONPARSERTYPES{tK1
inline
-iV2
-fp_const_pihalf()yR
+Value_t
+fp_const_pihalf()yP
fp_const_pi
-xK()*iV2(0.5);}
-xW3
+xF()*yF2;}
+tK1
inline
-iV2
-fp_const_twopi(tO2
+Value_t
+fp_const_twopi()eQ3
fp_const_pi
-xK());lH3
-fp_const_twoe(tO2
+xF());nS3
+xO
+fp_const_twoe()eQ3
fp_const_e
-xK());lH3
-fp_const_twoeinv(tO2
+xF());nS3
+xO
+fp_const_twoeinv()eQ3
fp_const_einv
-xK());lH3
-fp_const_negativezero()yR-fp_epsilon
-xK();}
+xF());nS3
+xO
+fp_const_negativezero()yP-Epsilon
+xF::value;}
}
#ifdef FP_SUPPORT_OPTIMIZER
#include <vector>
#include <utility>
#include <iostream>
-yL1{using
-lF3
-l21;using
+nG1{using
+l33
+lA1;using
t5;using
-lF3
+l33
FUNCTIONPARSERTYPES
-nJ1
+yO1
class
-MatchInfo{eX3
-std
-xV3<std::pair<bool,eH> >lQ;eH
-paramholder_matches;std
-xV3<iF2>tR;eX3
-MatchInfo():lQ(),paramholder_matches(),tR(){}
-eX3
+MatchInfo{e43
+eO3
+std::pair<bool,eK> >lQ;eK
+cA;eO3
+x83>tT;e43
+MatchInfo():lQ(),cA(),tT(){}
+e43
bool
SaveOrTestRestHolder
-nT2
-n1,iH2&iF1){cV1{lQ.t73
+lT1
+n1,eA3&iJ1){cT1{lQ
+xF3
n1+1);lQ
-tQ=iF1
-xJ2
+tS=iJ1
+l43
if(lQ[n1
-tC3==false){lQ
-tQ=iF1
-xJ2
-iH2&found=lQ[n1
-tD3;if(iF1.tF3!=found.tF3
-cL
+eH3==false){lQ
+tS=iJ1
+l43
+eA3&found=lQ[n1
+eI3;if(iJ1
+eJ3!=found
+eJ3
+cQ
for
-iA1
-a=0;a<iF1.tF3;++a)if(!iF1[a]xF
-found[a])cL
-return
-true
-lL3
+iZ1
+a=0;a<iJ1
+eJ3;++a)if(!iJ1[a]xI
+found[a])cQ
+lD2}
+void
SaveRestHolder
-nT2
-n1,eH&iF1){cV1
-lQ.t73
+lT1
+n1,eK&iJ1){cT1
+lQ
+xF3
n1+1);lQ
-tQ.swap(iF1);}
+tS.swap(iJ1);}
bool
SaveOrTestParamHolder
-nT2
-nZ,lC2
-xQ3){if(cE
-tF3<=nZ){cE
-xS3
-nZ+1);cE
-t73
-nZ);cE
-push_back(xQ3)xJ2
-if(!cH.t91
-cH=xQ3
-xJ2
+lT1
+x0,iT1&xG3){if(cA
+eJ3<=x0){cA.xH3
+x0+1);cA
+xF3
+x0);cA
+c52
+xG3
+yQ2
+if(!cA[x0].nX2){cA[x0]=xG3
+l43
return
-xQ3
-xF
-cH
-lI3
-SaveMatchedParamIndex(nA1){tR.push_back(index);}
-lC2
-GetParamHolderValueIfFound
-nT2
-nZ
-e83{static
-const
-eJ
-dummytree;if(cE
-tF3<=nZ)return
+xG3
+xI
+cA[x0]cN2
+SaveMatchedParamIndex(lJ1){tT
+c52
+index);}
+iT1&GetParamHolderValueIfFound
+lT1
+x0)const{static
+iT1
+dummytree;if(cA
+eJ3<=x0)return
dummytree
-n31
-cH;}
-lC2
-GetParamHolderValue
-nT2
-nZ
-yZ1
-cH;}
+i1
+cA[x0];}
+iT1&GetParamHolderValue
+lT1
+x0
+c01
+cA[x0];}
bool
HasRestHolder
-nT2
-n1
-yZ1
-lQ.tF3>n1&&lQ[n1
-tC3==true;}
-iH2&GetRestHolderValues
-nT2
+lT1
n1
-e83{static
-iH2
-empty_result;cV1
+c01
+lQ
+eJ3>n1&&lQ[n1
+eH3==true;}
+eA3&GetRestHolderValues
+lT1
+n1)const{static
+eA3
+empty_result;cT1
return
empty_result
-n31
+i1
lQ[n1
-tD3;}
+eI3;}
const
-std
-xV3<iF2>&GetMatchedParamIndexes(yZ1
-tR
-lL3
-swap(tB
-b){lQ.swap(b.lQ);cE
-swap(b.paramholder_matches);tR.swap(b.tR);}
-tB
-eA1=cH1
-tB
-b){lQ=b.lQ;paramholder_matches=b.paramholder_matches;tR=b.tR
-n31*this;}
+eO3
+x83>&GetMatchedParamIndexes(c01
+tT;}
+void
+swap(tC
+b){lQ.swap(b.lQ);cA.swap(b.cA);tT.swap(b.tT);}
+tC
+eM1=iS1
+tC
+b){lQ=b.lQ;cA=b.cA;tT=b.tT
+i1*this;}
}
;class
-e2;typedef
-xR<e2>cW;class
-e2{eX3
+e6;typedef
+xP<e6>cZ;class
+e6{e43
int
-xM3;eX3
-e2():xM3(0){}
-virtual~e2(){}
-}
-;e12
-lX1{bool
-found;cW
-specs;lX1(bool
+xB3;e43
+e6():xB3(0){}
+virtual~e6(){}
+}
+;e72
+n31{bool
+found;cZ
+specs;n31(bool
f):found(f),specs(){}
-lX1(bool
+n31(bool
f,const
-cW&s):found(f),specs(s){}
+cZ&s):found(f),specs(s){}
}
-xR3
-SynthesizeRule
-cH1
-eT2
-eJ&tree
-tJ3)nJ1
-lX1
+;xL1
+SynthesizeRule(t41
+nP1
+tC
+info)yO1
+n31
TestParam
-cH1
-e42&yG2
-lC2
-tree,const
-cW&start_at
-tJ3)nJ1
-lX1
-TestParams(tC&nN,lC2
-tree,const
-cW&start_at
-tJ3,bool
-eY2
-nJ1
+iS1
+eA2&yA2
+const
+nP1
+const
+cZ&start_at,tC
+info)yO1
+n31
+TestParams(eX&nN,const
+nP1
+const
+cZ&start_at,tC
+info,bool
+iX1
+yO1
bool
ApplyGrammar
-cH1
-Grammar&tX2,FPoptimizer_CodeTree::eJ&tree,bool
-from_logical_context=false)xR3
-ApplyGrammars(FPoptimizer_CodeTree::e62
-nJ1
+iS1
+Grammar&tK2,FPoptimizer_CodeTree::nP1
bool
-IsLogisticallyPlausibleParamsMatch(tC&c32,lC2
-tree);}
-lF3
-l21{tZ1
-DumpMatch
-cH1
-eT2
+from_logical_context=false);xL1
+ApplyGrammars(FPoptimizer_CodeTree::eR
+yO1
+bool
+IsLogisticallyPlausibleParamsMatch(eX¶ms,const
+eR;}
+l33
+lA1{xL1
+DumpMatch(t41
nO,const
-FPoptimizer_Optimize::tB
+FPoptimizer_Optimize::tC
info,bool
-DidMatch,std::ostream&o=std::cout)xR3
-DumpMatch
-cH1
-eT2
+DidMatch,std::ostream&o=cV2);xL1
+DumpMatch(t41
nO,const
-FPoptimizer_Optimize::tB
-info,nH3
-i43,std::ostream&o=std::cout);}
+FPoptimizer_Optimize::tC
+info,e32
+tO3,std::ostream&o=cV2);}
#endif
#include <string>
-nI3
-l21::nR2
-yS1=false);nI3
-xB2
-yS1=false);
+e42
+lA1::nZ2
+yT1=false);e42
+iU1
+yT1=false);
#include <string>
#include <sstream>
#include <assert.h>
#include <iostream>
using
-lF3
-l21;using
-lF3
-FUNCTIONPARSERTYPES;nI3
-l21::nR2
-yS1){
+l33
+lA1;using
+l33
+FUNCTIONPARSERTYPES;e42
+lA1::nZ2
+yT1){
#if 1
-nH3
-p=0;switch(opcode
-y33
+e32
+p=0;e23
+opcode){case
NumConstant:p="NumConstant"
;lC
-tG3:p="ParamHolder"
+ParamHolder:p="ParamHolder"
;lC
SubFunction:p="SubFunction"
-;yF3
+;xY3
std::ostringstream
-tmp;assert(p);tmp<<p;if(pad)while(tmp.str().tF3<12)tmp<<' ' n31
+tmp;assert(p);tmp<<p;if(pad)while(tmp.str()eJ3<12)tmp<<' '
+i1
tmp.str();
#else
std::ostringstream
-tmp;tmp<<opcode;if(pad)while(tmp.str().tF3<5)tmp<<' 'n31
+tmp;tmp<<opcode;if(pad)while(tmp.str()eJ3<5)tmp<<' '
+i1
tmp.str();
#endif
}
-nI3
-xB2
-yS1){
+e42
+iU1
+yT1){
#if 1
-nH3
-p=0;switch(opcode
-y33
+e32
+p=0;e23
+opcode){case
cAbs:p="cAbs"
;lC
cAcos:p="cAcos"
;lC
cEqual:p="cEqual"
;lC
-cNEqual:p="cNEqual"
+i51:p="cNEqual"
;lC
cLess:p="cLess"
;lC
;lC
cPopNMov:p="cPopNMov"
;lC
-eF3:p="cLog2by"
+cQ3:p="cLog2by"
;lC
cNop:p="cNop"
;break;
;lC
cSinhCosh:p="cSinhCosh"
;lC
-cZ3:p="cAbsNot"
+cC3:p="cAbsNot"
;lC
cAbsNotNot:p="cAbsNotNot"
;lC
;lC
cRSqrt:p="cRSqrt"
;lC
-l03:p="VarBegin"
-;yF3
+iU2:p="VarBegin"
+;xY3
std::ostringstream
-tmp;assert(p);tmp<<p;if(pad)while(tmp.str().tF3<12)tmp<<' ' n31
+tmp;assert(p);tmp<<p;if(pad)while(tmp.str()eJ3<12)tmp<<' '
+i1
tmp.str();
#else
std::ostringstream
-tmp;tmp<<opcode;if(pad)while(tmp.str().tF3<5)tmp<<' ' n31
+tmp;tmp<<opcode;if(pad)while(tmp.str()eJ3<5)tmp<<' '
+i1
tmp.str();
#endif
}
;
#endif
enum{MAX_MULI_BYTECODE_LENGTH=3}
-;lF3
-xH1{xW3
+;l33
+xK1{tK1
class
-ByteCodeSynth{eX3
-ByteCodeSynth():ByteCode(),Immed(),cM(),xS(0),StackMax(0){i8
-xS3
-64);Immed.xS3
-8);cM.xS3
+ByteCodeSynth{e43
+ByteCodeSynth():eN1(),Immed(),cI(),xQ(0),StackMax(0){eN1.xH3
+64);Immed.xH3
+8);cI.xH3
16
-lI3
-Pull(std
-xV3<iF2>&bc,std
-xV3
-xK&imm,size_t&StackTop_max){for(eQ1=0;a<i8
-tF3;++a){l52]&=~nK2;}
-i8
-swap(bc);Immed.swap(imm);StackTop_max=StackMax;}
+cN2
+Pull(eO3
+x83>&bc,std
+xM3
+xF&imm,size_t&StackTop_max){for
+lT1
+a=0;a<n41;++a){eN1[a]&=~0x80000000u;}
+eN1.swap(bc);Immed.swap(imm);StackTop_max=StackMax;}
size_t
-GetByteCodeSize(yZ1
-i8
-tF3;}
+GetByteCodeSize(c01
+n41;}
size_t
-GetStackTop(yZ1
-xS
-lL3
-PushVar
-nT2
-varno){xK2
-varno);eZ2}
+GetStackTop(c01
+xQ;}
void
-PushImmed(iV2
+PushVar
+lT1
+varno){eN1
+c52
+varno);xI3
+1
+cN2
+PushImmed
+cX3
immed
nL
-xK2
-cImmed);Immed.push_back(immed);eZ2}
-void
+eN1
+c52
+cImmed);Immed
+c52
+immed);xI3
+1
+cN2
StackTopIs(nO,int
-offset=0){if((int)xS>offset){cM
-l62
-first=true;cM
-l62
+offset=0){if((int)xQ>offset){cI[xQ
+nK2
+first=true;cI[xQ
+nK2
second=tree;}
}
bool
IsStackTop(nO,int
offset=0
-yZ1(int)xS>offset&&cM
-l62
-first&&cM
-l62
+c01(int)xQ>offset&&cI[xQ
+nK2
+first&&cI[xQ
+nK2
second
-xF
-tree);xI1
+xI
+tree);y81
void
EatNParams
-nT2
-eat_count){xS-=eat_count
-lL3
+lT1
+eat_count){xQ-=eat_count;}
+void
ProducedNParams
-nT2
-produce_count){xJ1
-xS+produce_count
-lI3
+lT1
+produce_count){xI3
+produce_count
+cN2
DoPopNMov
-iA1
-e52,size_t
+iZ1
+eB2,size_t
srcpos
nL
-xK2
-cPopNMov)nS2
-e52)nS2
-srcpos);xJ1
-srcpos+1);cM[e52]=cM[srcpos];xJ1
-e52+1
-lI3
+eN1
+c52
+cPopNMov
+e53
+eB2
+e53
+srcpos);xM1
+srcpos+1);cI[eB2]=cI[srcpos];xM1
+eB2+1
+cN2
DoDup
-iA1
-xT3
+iZ1
+xJ3
nL
-if(xT3==xS-1){xK2
-cDup
-t43{xK2
-cFetch)nS2
-xT3);}
-eZ2
-cM[xS-1]=cM[xT3];}
+if(xJ3==xQ-1){eN1
+c52
+cDup);}
+else{eN1
+c52
+cFetch
+e53
+xJ3);}
+xI3
+1);cI[xQ-1]=cI[xJ3];}
#ifdef FUNCTIONPARSER_SUPPORT_DEBUGGING
-i31
+tP1
int>void
-Dump(){std::ostream&o=std::cout;o<<"Stack state now("
-<<xS<<"):\n"
-yM3
-0;a<xS;++a){o<<a<<": "
-;if(cM[a
-tC3){nO=cM[a
-tD3;o<<'['<<std::hex<<(void*)(&tree.l02))<<std::dec<<','<<tree.GetRefCount()<<']'i13(tree,o
-t43
+Dump(){std::ostream&o=cV2;o<<"Stack state now("
+<<xQ<<"):\n"
+e73
+0;a<xQ;++a){o<<a<<": "
+;if(cI[a
+eH3){nO=cI[a
+eI3;o<<'['<<std::hex<<(void*)(&tree.lJ2))<<std::dec<<','<<tree.GetRefCount()<<']'
+iL2
+tree,o);}
+else
o<<"?"
-;o<<"\n"
-;}
+iV3}
o<<std::flush;}
#endif
size_t
-xU3
-nO
-e83{for
-iA1
-a=xS;a-->0;)if(cM[a
-tC3&&cM[a
-tD3
-xF
+xK3
+nO)const{for
+iZ1
+a=xQ;a-->0;)if(cI[a
+eH3&&cI[a
+eI3
+xI
tree
-nE3
+y03
a
-n31
-t02;}
+i1~size_t(0);}
bool
Find(nO
-yZ1
-xU3
-tree)!=t02;}
+c01
+xK3
+tree)!=~size_t(0);}
bool
FindAndDup(nO){size_t
-pos=xU3
-tree
-eY3
-pos!=t02){
+pos=xK3
+tree);if(pos!=~size_t(0)){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<l24"duplicate at ["
+cV2<<iX3"duplicate at ["
<<pos<<"]: "
-i13(tree
-lT2" -- issuing cDup or cFetch\n"
+iL2
+tree
+lE2" -- issuing cDup or cFetch\n"
;
#endif
-DoDup(pos)xJ2
+DoDup(pos
+yQ2
return
-tR3
-e12
+t23
+e72
IfData{size_t
ofs;}
;void
SynthIfStep1
-l72,xB2
+c62,iU1
op
x21
-xL2=i8
-tF3;xK2
+c72=n41;eN1
+c52
op
-i9
-xK2
-nK2
-lI3
+eO
+eO
+cN2
SynthIfStep2
-l72
+c62
x21
-iS
-nU2)+2);iS
+eN1
+iK1
+xL3+2);eN1
+iK1
2
-y7
-l42
-xL2=i8
-tF3;xK2
+y5
+lN2
+c72=n41;eN1
+c52
cJump
-i9
-xK2
-nK2
-lI3
+eO
+eO
+cN2
SynthIfStep3
-l72
+c62
x21
-i8
-back()|=nK2;iS
-nU2)-1);iS
+eN1.back()|=0x80000000u;eN1
+iK1
+xL3-1);eN1
+iK1
2
-y7
-l42
-eZ2
-for
-iA1
-a=0;a<xL2;++a){if(l52]==cJump&&l52+1]==(nK2|(xL2-1))){l52+nU2)-1);l52+2
-y7
-l42
-l73
-l52]y33
+y5
+lN2
+xI3
+1
+iY1
+0;a<c72;++a){if(eN1[a]==cJump&&eN1[a+1]==(0x80000000u|(c72-1))){eN1[a+xL3-1);eN1[a+2
+y5
+lN2
+c73(eN1[a]){case
cAbsIf:case
cIf:case
cJump:case
cPopNMov:a+=2;lC
cFCall:case
cPCall:case
-cFetch:a+=1;break;c73
-yF3}
+cFetch:a+=1;break;yF3
+xY3}
}
protected:void
-xJ1
+xM1
size_t
-value){xS=value;if(xS>lN3{StackMax=xS;cM.t73
-lN3;}
+value){xQ=value;if(xQ>l53{StackMax=xQ;cI
+xF3
+l53;}
}
-protected:std
-xV3<iF2>ByteCode;std
-xV3
-xK
-Immed;std
-xV3<std::pair<bool,FPoptimizer_CodeTree::eJ> >cM;size_t
-xS;size_t
+protected:eO3
+x83>eN1;std
+xM3
+xF
+Immed;eO3
+std::pair<bool,FPoptimizer_CodeTree::yZ2> >cI;size_t
+xQ;size_t
StackMax;private:void
-incStackPtr(){if(xS+2>lN3
-cM.t73
-StackMax=xS+2);}
-i31
+incStackPtr(){if(xQ+2>l53
+cI
+xF3
+StackMax=xQ+2);}
+tP1
bool
IsIntType,bool
-IsComplexType>e12
-c42{}
-;eX3
+IsComplexType>e72
+c82{}
+;e43
void
AddOperation
-nT2
-t83
-iF2
-eat_count,iF2
-produce_count=1){EatNParams(eat_count);lO1
-opcode);ProducedNParams(produce_count
-lI3
-lO1
-iF2
-t83
-c42<false,false>yS
-false,true>yS
-true,false>yS
+eZ2,x83
+eat_count,x83
+produce_count=1){EatNParams(eat_count);nR1(opcode);ProducedNParams(produce_count
+cN2
+nR1
+eZ2,c82<false,false>yQ
+false,true>yQ
+true,false>yQ
true,true>);inline
void
-lO1
-iF2
-opcode){lO1
-t83
-c42<bool(nB
+nR1
+eZ2){nR1(opcode,c82<bool(nB
IsIntType
-xK::nT3),bool(nB
+xF::nS3),bool(nB
IsComplexType
-xK::nT3)>());}
+xF::nS3)>());}
}
-nJ1
-e12
+yO1
+e72
SequenceOpCode
-nJ1
-e12
-tN1{static
-cI
+yO1
+e72
+tU1{static
+cG
AddSequence;static
-cI
+cG
MulSequence;}
-xR3
+;xL1
x01
long
-count,cI&eU,yM1;}
+count,cG&eQ,xI1;}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
-FUNCTIONPARSERTYPES;lF3
-xH1{xW3
-e12
-SequenceOpCode{iV2
-basevalue;iF2
-op_flip;iF2
-op_normal,op_normal_flip;iF2
+l33
+FUNCTIONPARSERTYPES;l33
+xK1{tK1
+e72
+SequenceOpCode
+l14
+basevalue;x83
+op_flip;x83
+op_normal,op_normal_flip;x83
op_inverse,op_inverse_flip;}
-nJ1
-cI
-tN1
-xK::AddSequence={y21,cNeg
-xE
+yO1
+cG
+tU1
+xF::AddSequence={xH1,cNeg
+x9
cAdd,cSub,cRSub}
-nJ1
-cI
-tN1
-xK::MulSequence={iV2(1),cInv,cMul,cMul,cDiv,cRDiv}
+yO1
+cG
+tU1
+xF::MulSequence={e62
+1),cInv,cMul,cMul,cDiv,cRDiv}
;
#define findName(a,b,c) "var"
#define TryCompilePowi(o) false
#define mData this
-#define mByteCode ByteCode
+#define mByteCode eN1
#define mImmed Immed
-xY3
-false,false
-l31
+nL2
+false,false>)x31
# define FP_FLOAT_VERSION 1
# define FP_COMPLEX_VERSION 0
# include "extrasrc/fp_opcode_add.inc"
# undef FP_COMPLEX_VERSION
# undef FP_FLOAT_VERSION
}
-xY3
-true,false
-l31
+nL2
+true,false>)x31
# define FP_FLOAT_VERSION 0
# define FP_COMPLEX_VERSION 0
# include "extrasrc/fp_opcode_add.inc"
# undef FP_FLOAT_VERSION
}
#ifdef FP_SUPPORT_COMPLEX_NUMBERS
-xY3
-false,true
-l31
+nL2
+false,true>)x31
# define FP_FLOAT_VERSION 1
# define FP_COMPLEX_VERSION 1
# include "extrasrc/fp_opcode_add.inc"
# undef FP_COMPLEX_VERSION
# undef FP_FLOAT_VERSION
}
-xY3
-true,true
-l31
+nL2
+true,true>)x31
# define FP_FLOAT_VERSION 0
# define FP_COMPLEX_VERSION 1
# include "extrasrc/fp_opcode_add.inc"
#undef TryCompilePowi
}
using
-lF3
-xH1;
+l33
+xK1;
#define POWI_TABLE_SIZE 256
#define POWI_WINDOW_SIZE 3
-lF3
-xH1{
+l33
+xK1{
#ifndef FP_GENERATING_POWI_TABLE
extern
const
-iF2
+x83
char
powi_table[POWI_TABLE_SIZE];const
#endif
-iF2
+x83
char
-powi_table[POWI_TABLE_SIZE]={0,1,1,1,2,1,2,1,y63
-4,1,2,y73
-2,1,y63
-8,eK3
-y83
-15,1,16,1,2,1,4,1,2,y73
-2,1,4,eK3
-1,16,1,25,y83
-27,5,8,3,2,1,30,1,31,3,32,1,2,1,y63
-8,1,2,y83
-39,1,16,137,2,1,4,eK3
-y73
-45,135,4,31,2,5,32,1,2,131,50,1,51,1,8,3,2,1,54,1,55,3,16,1,57,133,4,137,2,135,60,1,61,3,62,133,63,1,iG1
-131,iG1
-139,l82
-e3
-30,1,130,137,2,31,l82
-e3
-e3
-130,eK3
-1,e3
-e3
-2,1,130,133,iG1
-61,130,133,62,139,130,137,e3
-l82
-e3
-e3
-iG1
-131,e3
-e3
-130,131,2,133,l82
-130,141,e3
-130,eK3
-1,e3
-5,135,e3
-l82
-e3
-l82
-130,133,130,141,130,131,e3
-e3
+powi_table[POWI_TABLE_SIZE]={0,1,1,1,2,1,2,1,xN3
+4,1,2,xP3
+2,1,xN3
+8,cV3
+xQ3
+15,1,16,1,2,1,4,1,2,xP3
+2,1,4,cV3
+1,16,1,25,xQ3
+27,5,8,3,2,1,30,1,31,3,32,1,2,1,xN3
+8,1,2,xQ3
+39,1,16,137,2,1,4,cV3
+xP3
+45,135,4,31,2,5,32,1,2,131,50,1,51,1,8,3,2,1,54,1,55,3,16,1,57,133,4,137,2,135,60,1,61,3,62,133,63,1,iL1
+131,iL1
+139,lO2
+e7
+30,1,130,137,2,31,lO2
+e7
+e7
+130,cV3
+1,e7
+e7
+2,1,130,133,iL1
+61,130,133,62,139,130,137,e7
+lO2
+e7
+e7
+iL1
+131,e7
+e7
+130,131,2,133,lO2
+130,141,e7
+130,cV3
+1,e7
+5,135,e7
+lO2
+e7
+lO2
+130,133,130,141,130,131,e7
+e7
2,131}
;}
static
-xC3
-yY=256;
+x03
+c1=256;
#define FPO(x)
-lF3{class
+l33{class
PowiCache{private:int
-iB[yY];int
-iH1[yY];eX3
-PowiCache():iB(),iH1(){iB[1]=1;}
+iM[c1];int
+iM1[c1];e43
+PowiCache():iM(),iM1(){iM[1]=1;}
bool
-Plan_Add(c82,int
-count){cC1>=yY
-cL
-iH1[t12+=count
-n31
-iB[t12!=0
-lL3
-lO3
-c82){cC1<yY)iB[t12=1
-lL3
+Plan_Add(c11,int
+count){cD1>=c1
+cQ
+iM1[t02+=count
+i1
+iM[t02!=0;}
+void
+l63
+c11){cD1<c1)iM[t02=1;}
+void
Start
-iA1
+iZ1
value1_pos){for(int
-n=2;n<yY;++n)iB[n]=-1;Remember(1,value1_pos);DumpContents();}
+n=2;n<c1;++n)iM[n]=-1;Remember(1,value1_pos);DumpContents();}
int
-Find(c82
-e83{cC1<yY){if(iB[t12>=0){FPO(iM3(iR3,"* I found %ld from cache (%u,%d)\n",value,(unsigned)cache[value],iN3 value]))n31
-iB[t12;eW2-1
-lL3
-Remember(c82,size_t
-l04){cC1>=yY)return;FPO(iM3(iR3,"* Remembering that %ld can be found at %u (%d uses remain)\n",value,(unsigned)l04,iN3 value]));iB[t12=(int)l04
-lL3
-DumpContents
-e73
-FPO(for(int a=1;a<POWI_CACHE_SIZE;++a)if(cache[a]>=0||iN3 a]>0){iM3(iR3,"== cache: sp=%d, val=%d, needs=%d\n",cache[a],a,iN3 a]);})}
+Find(c11)const{cD1<c1){if(iM[t02>=0){FPO(iC3(iG3,"* I found %ld from cache (%u,%d)\n",value,(unsigned)cache[value],iD3 value]))i1
+iM[t02;}
+eE3-1;}
+void
+Remember(c11,size_t
+iQ3){cD1>=c1)return;FPO(iC3(iG3,"* Remembering that %ld can be found at %u (%d uses remain)\n",value,(unsigned)iQ3,iD3 value]));iM[t02=(int)iQ3;}
+void
+DumpContents()const{FPO(for(int a=1;a<POWI_CACHE_SIZE;++a)if(cache[a]>=0||iD3 a]>0){iC3(iG3,"== cache: sp=%d, val=%d, needs=%d\n",cache[a],a,iD3 a]);})}
int
-UseGetNeeded(c82){cC1>=0&&value<yY)return--iH1[t12
-n31
+UseGetNeeded(c11){cD1>=0&&value<c1)return--iM1[t02
+i1
0;}
}
-nJ1
+yO1
size_t
-y8
+y6
long
count
-lF2
-cI&eU,yM1
-xR3
-c01
+iQ1
+cG&eQ,xI1;xL1
+c21
size_t
apos,long
aval,size_t
bpos,long
bval
-lF2
-iF2
-cumulation_opcode,iF2
-cimulation_opcode_flip,yM1;void
-l41
-c82
-lF2
+iQ1
+x83
+cumulation_opcode,x83
+cimulation_opcode_flip,xI1;void
+lB1
+c11
+iQ1
int
need_count,int
-l51=0){cC1<1)return;
+lC1=0){cD1<1)return;
#ifdef FP_GENERATING_POWI_TABLE
-if(l51>32)throw
+if(lC1>32)throw
false;
#endif
-if(iB.Plan_Add(value,need_count
-nE3;long
-yA3
-1;cC1<POWI_TABLE_SIZE){yA3
-powi_table[t12
-lM3&128){half&=127
-lM3&64)yA3-tB2
-FPO(iM3(iR3,"value=%ld, half=%ld, otherhalf=%ld\n",value,half,value/half));l41
+if(iM.Plan_Add(value,need_count
+y03;long
+xR3
+1;cD1<POWI_TABLE_SIZE){xR3
+powi_table[t02
+xZ3&128){half&=127
+xZ3&64)xR3-t12
+FPO(iC3(iG3,"value=%ld, half=%ld, otherhalf=%ld\n",value,half,value/half));lB1
half
-y93
-iB.lO3
-half)n31;}
-lJ2
-half&64){yA3-tB2}
+xO3
+iM.l63
+half)i1;}
+iP1
+half&64){xR3-t12}
}
else
-cC1&1)yA3
+cD1&1)xR3
value&((1<<POWI_WINDOW_SIZE)-1);else
-yA3
+xR3
value/2;long
-cN=value-half
-lM3>cN||half<0)std::swap(half,cN);FPO(iM3(iR3,"value=%ld, half=%ld, otherhalf=%ld\n",value,half,otherhalf))lM3==cN){l41
-half,iB,2,l51+1
-t43{l41
+cL=value-half
+xZ3>cL||half<0)std::swap(half,cL);FPO(iC3(iG3,"value=%ld, half=%ld, otherhalf=%ld\n",value,half,otherhalf))xZ3==cL){lB1
+half,iM,2,lC1+1);}
+else{lB1
half
-y93
-l41
-cN>0?cN:-cN
-y93}
-iB.lO3
+xO3
+lB1
+cL>0?cL:-cL
+xO3}
+iM.l63
value);}
-xW3
+tK1
size_t
-y8
-c82
-lF2
-cI&eU,yM1{int
-yB3=iB.Find(value
-eY3
-yB3>=0)yR
-yB3;}
+y6
+c11
+iQ1
+cG&eQ,xI1{int
+xT3=iM.Find(value);if(xT3>=0)yP
+xT3;}
long
-yA3
-1;cC1<POWI_TABLE_SIZE){yA3
-powi_table[t12
-lM3&128){half&=127
-lM3&64)yA3-tB2
-FPO(iM3(iR3,"* I want %ld, my plan is %ld * %ld\n",value,half,value/half));size_t
-xM2=y8
+xR3
+1;cD1<POWI_TABLE_SIZE){xR3
+powi_table[t02
+xZ3&128){half&=127
+xZ3&64)xR3-t12
+FPO(iC3(iG3,"* I want %ld, my plan is %ld * %ld\n",value,half,value/half));size_t
+xM2=y6
half
-tX1
-if(iB
-lL2
-half)>0||xM2!=tY1){iI1
-xM2)cS2
-half,tY1);}
+cE1
+if(iM
+lP2
+half)>0||xM2!=cG1){iN1
+xM2)xP2
+half,cG1);}
x01
-value/half,eU,iS2
+value/half
+e63
size_t
-l04=tY1
-cS2
-value,l04);iB.DumpContents()n31
-l04;}
-lJ2
-half&64){yA3-tB2}
+iQ3=cG1
+xP2
+value,iQ3);iM.DumpContents()i1
+iQ3;}
+iP1
+half&64){xR3-t12}
}
else
-cC1&1)yA3
+cD1&1)xR3
value&((1<<POWI_WINDOW_SIZE)-1);else
-yA3
+xR3
value/2;long
-cN=value-half
-lM3>cN||half<0)std::swap(half,cN);FPO(iM3(iR3,"* I want %ld, my plan is %ld + %ld\n",value,half,value-half))lM3==cN){size_t
-xM2=y8
+cL=value-half
+xZ3>cL||half<0)std::swap(half,cL);FPO(iC3(iG3,"* I want %ld, my plan is %ld + %ld\n",value,half,value-half))xZ3==cL){size_t
+xM2=y6
half
-tX1
-c01
-xM2,half,xM2,half,iB,eU.op_normal,eU.op_normal_flip,iS2}
+cE1
+c21
+xM2,half,xM2,half,iM,eQ.op_normal,eQ.op_normal_flip,c92}
else{long
part1=half;long
-part2=cN>0?cN:-cN;size_t
-part1_pos=y8
+part2=cL>0?cL:-cL;size_t
+part1_pos=y6
part1
-tX1
+cE1
size_t
-part2_pos=y8
+part2_pos=y6
part2
-tX1
-FPO(iM3(iR3,"Subdivide(%ld: %ld, %ld)\n",value,half,otherhalf));c01
-part1_pos,part1,part2_pos,part2,iB,cN>0?eU.op_normal:eU.op_inverse,cN>0?eU.op_normal_flip:eU.op_inverse_flip,iS2}
+cE1
+FPO(iC3(iG3,"Subdivide(%ld: %ld, %ld)\n",value,half,otherhalf));c21
+part1_pos,part1,part2_pos,part2,iM,cL>0?eQ.op_normal:eQ.op_inverse,cL>0?eQ.op_normal_flip:eQ.op_inverse_flip,c92}
size_t
-l04=tY1
-cS2
-value,l04);iB.DumpContents()n31
-l04;}
-tZ1
-c01
+iQ3=cG1
+xP2
+value,iQ3);iM.DumpContents()i1
+iQ3;}
+xL1
+c21
size_t
apos,long
aval,size_t
bpos,long
bval
-lF2
-iF2
-cumulation_opcode,iF2
-cumulation_opcode_flip,yM1{int
-a_needed=iB
-lL2
+iQ1
+x83
+cumulation_opcode,x83
+cumulation_opcode_flip,xI1{int
+a_needed=iM
+lP2
aval);int
-yC3=iB
-lL2
+xU3=iM
+lP2
bval);bool
-lM2
-tO3
-#define DUP_BOTH() do{if(apos<bpos){size_t tmp=apos;apos=bpos;bpos=tmp;lM2=!lM2;}FPO(iM3(iR3,"-> "iX3 iX3"op\n",(unsigned)apos,(unsigned)bpos));iI1 apos);iI1 apos==bpos?tY1:bpos);}while(0)
-#define DUP_ONE(p) do{FPO(iM3(iR3,"-> "iX3"op\n",(unsigned)p));iI1 p);}while(0)
-if(a_needed>0){if(yC3>0){nL2}
-e63
-bpos!=tY1)nL2
-else{lN2
-lM2=!lM2;}
-}
+flipped
+eW3
+#define DUP_BOTH() do{if(apos<bpos){size_t tmp=apos;apos=bpos;bpos=tmp e41 FPO(iC3(iG3,"-> " iO3 iO3"op\n",(unsigned)apos,(unsigned)bpos));iN1 apos);iN1 apos==bpos?cG1:bpos);}while(0)
+#define DUP_ONE(p) do{FPO(iC3(iG3,"-> " iO3"op\n",(unsigned)p));iN1 p);}while(0)
+if(a_needed>0){if(xU3>0){nM2}
+cJ3
+bpos!=cG1)nM2
+else{x02
+e41}
}
-lJ2
-yC3>0){if(apos!=tY1)nL2
+iP1
+xU3>0){if(apos!=cG1)nM2
else
DUP_ONE(bpos);}
-e63
-apos==bpos&&apos==tY1)lN2
-iR2
-tY1&&bpos==yD3
-2){FPO(iM3(iR3,"-> op\n"));lM2=!lM2;}
-iR2
-yD3
-2&&bpos==tY1)FPO(iM3(iR3,"-> op\n"));iR2
-tY1)DUP_ONE(bpos);lJ2
-bpos==tY1){lN2
-lM2=!lM2;}
+cJ3
+apos==bpos&&apos==cG1)x02;iP1
+apos==cG1&&bpos==xV3
+2){FPO(iC3(iG3,"-> op\n"))e41
+iP1
+apos==xV3
+2&&bpos==cG1)FPO(iC3(iG3,"-> op\n"));iP1
+apos==cG1)DUP_ONE(bpos);iP1
+bpos==cG1){x02
+e41
else
-nL2}
-yE3
-lM2?cumulation_opcode_flip:cumulation_opcode,2);}
-tZ1
-cD1
+nM2}
+yB1
+flipped?cumulation_opcode_flip:cumulation_opcode,2);}
+xL1
+cH1
long
-count,cI&eU,yM1{while
-eL3<256){int
-yA3
-xH1::powi_table[count]lM3&128){half&=127;cD1
-half,eU,iS2
+count,cG&eQ,xI1{while
+cW3<256){int
+xR3
+xK1::powi_table[count]xZ3&128){half&=127;cH1
+half
+e63
count/=half;}
else
-yF3
+xY3
if
-eL3==1)return;if(!eL3&1)){yE3
-cSqr,1);cD1
-count/2,eU,iS2}
-else{iI1
-tY1);cD1
-count-1,eU,iS2
-yE3
+cW3==1)return;if(!cW3&1)){yB1
+cSqr,1);cH1
+count/2
+e63}
+else{iN1
+cG1);cH1
+count-1
+e63
+yB1
cMul,2);}
}
}
-lF3
-xH1{tZ1
+l33
+xK1{xL1
x01
long
-count,cI&eU,yM1{if
-eL3==0)lH2
-eU.basevalue);else{bool
+count,cG&eQ,xI1{if
+cW3==0)t71
+eQ.basevalue);else{bool
t22
-tO3
+eW3
if
-eL3<0){t22=true;count=-count;}
-if(false)cD1
-count,eU,iS2
-lJ2
+cW3<0){t22=true;count=-count;}
+if(false)cH1
+count
+e63
+iP1
count>1){PowiCache
-iB;l41
-count,iB,1);size_t
-xK1=synth.GetStackTop();iB.Start(tY1);FPO(iM3(iR3,"Calculating result for %ld...\n",count));size_t
-xN2=y8
+iM;lB1
+count,iM,1);size_t
+xO1=synth.GetStackTop();iM.Start(cG1);FPO(iC3(iG3,"Calculating result for %ld...\n",count));size_t
+xN2=y6
count
-tX1
+cE1
size_t
-n_excess=yD3
-xK1;if(n_excess>0||xN2!=xK1-1){synth.DoPopNMov(xK1-1,xN2);}
+n_excess=xV3
+xO1;if(n_excess>0||xN2!=xO1-1){synth.DoPopNMov(xO1-1,xN2);}
}
-if(t22)yE3
-eU.op_flip,1);}
+if(t22)yB1
+eQ.op_flip,1);}
}
}
#endif
#ifndef FPOptimizer_ValueRangeHH
#define FPOptimizer_ValueRangeHH
-t5{lF3
-lP3{iM
-e12
+t5{l33
+l73{l01
+e72
Comp{}
-;i31>e12
+;tP1>e72
Comp<nB
-cLess>xZ3<n9
-cLessOrEq>xZ3<=n9
-cGreater>xZ3>n9
-cGreaterOrEq>xZ3>=n9
-cEqual>xZ3==n9
-cNEqual>xZ3!=b;}
+cLess>l83<nA
+cLessOrEq>l83<=nA
+cGreater>l83>nA
+cGreaterOrEq>l83>=nA
+cEqual>l83==nA
+i51>l83!=b;}
}
;}
-xW3
-e12
-cJ1{iV2
+tK1
+e72
+cI1
+l14
val;bool
-known;cJ1():val(),known(false){}
-cJ1
-cG1
-v):val(v),known(true){xI1
-void
-set
-cG1
-v){known=true;val=v
-lL3
-set(iV2(iJ1(iV2),cJ1
-y9)val=iI2
-void
-set(iV2(iJ1
-cG1),cJ1
-y9)val=iI2
-iM
-void
-set_if(iV2
-v
-tG1
-iJ1(iV2),cJ1
-y9&&lP3::Comp<Compare>()(val,v))val=iI2
-iM
+known;cI1():val(),known(false){}
+cI1(tV1):val(v),known(true){y81
+l93
+tV1){known=true;val=v;}
+l93
+xW3
+Value_t),cI1
+y7)val=iE2
+l93
+xW3
+const
+Value_t&),cI1
+y7)val=iE2
+l01
void
set_if
-cG1
-v
-tG1
-iJ1
-cG1),cJ1
-y9&&lP3::Comp<Compare>()(val,v))val=iI2}
-nJ1
-e12
-range{cJ1
-xK
+cX3
+v,xW3
+Value_t),cI1
+y7&&l73::Comp<Compare>()(val,v))val=iE2
+l01
+void
+set_if(tV1,xW3
+const
+Value_t&),cI1
+y7&&l73::Comp<Compare>()(val,v))val=iE2}
+yO1
+e72
+range{cI1
+xF
min,max;range():min(),max(){}
-range(iV2
-mi,iV2
+range
+cX3
+mi,Value_t
ma):min(mi),max(ma){}
-range(bool,iV2
+range(bool,Value_t
ma):min(),max(ma){}
-range(iV2
+range
+cX3
mi,bool):min(mi),max(){}
void
set_abs();void
set_neg();}
-nJ1
+yO1
bool
IsLogicalTrueValue
-cH1
-c23&p
-tR2
-nJ1
+iS1
+yD3&p,bool
+abs)yO1
bool
IsLogicalFalseValue
-cH1
-c23&p
-tR2;}
+iS1
+yD3&p,bool
+abs);}
#endif
#ifndef FPOptimizer_RangeEstimationHH
#define FPOptimizer_RangeEstimationHH
t5{enum
-TriTruthValue{IsAlways,IsNever,Unknown}
-nJ1
-c23
-iN
-lC2
-tree)nJ1
+TriTruthValue{iF2,xX3,Unknown}
+yO1
+yD3
+CalculateResultBoundaries
+iS1
+eR
+yO1
bool
IsLogicalValue
-cH1
-e62
-nJ1
+iS1
+eR
+yO1
TriTruthValue
GetIntegerInfo
-cH1
-e62
-nJ1
-xL1
+iS1
+eR
+yO1
+xP1
GetEvennessInfo
-cH1
-e62{if(!tree
-i61)return
-Unknown;yJ1=eC3;if(isEvenInteger(value
-nF3
+iS1
+eR{if(!tree
+tD1)return
+Unknown;yL1=tree
+x41;if(nB
+isEvenInteger(value
+y13
+nB
isOddInteger(value
-nG3
-xW3
-xL1
+y23
+tK1
+xP1
GetPositivityInfo
-cH1
-e62{c23
-p=iN
-tree
-eY3
-p
-n51&&p
-tF2>=iV2(nF3
+iS1
+eR{yD3
+p=CalculateResultBoundaries(tree);if(p
+yI&&p
+yM>=e62
+y13
p
-yN
-known
-lH1
-nG3
-xW3
-xL1
+e61
+l61
+y23
+tK1
+xP1
GetLogicalValue
-lQ3
-tree
-tR2{c23
-p=iN
-tree
-eY3
-IsLogicalTrueValue(p,abs
-nF3
+iS1
+nP1
+bool
+abs){yD3
+p=CalculateResultBoundaries(tree);if(IsLogicalTrueValue(p,abs
+y13
IsLogicalFalseValue(p,abs
-nG3}
+y23}
#endif
#ifndef FPOptimizer_ConstantFoldingHH
#define FPOptimizer_ConstantFoldingHH
-t5{tZ1
-ConstantFolding(e62;}
+t5{xL1
+ConstantFolding(eR;}
#endif
-lF3{using
-lF3
+l33{using
+l33
FUNCTIONPARSERTYPES;using
-t5;e12
-ComparisonSetBase{enum{t93=0x1,Eq_Mask=0x2,Le_Mask=0x3,tA3=0x4,tB3=0x5,Ge_Mask=0x6}
+t5;e72
+ComparisonSetBase{enum{eB3=0x1,Eq_Mask=0x2,Le_Mask=0x3,eC3=0x4,eD3=0x5,Ge_Mask=0x6}
;static
int
Swap_Mask(int
-m)yR(m&Eq_Mask)|((m&t93)?tA3:0)|((m&tA3)?t93:0);}
+m)yP(m&Eq_Mask)|((m&eB3)?eC3:0)|((m&eC3)?eB3:0);}
enum
-c11{Ok,BecomeZero,BecomeOne,xP2
-xF3
-nW2{cond_or,iK2,iL2,iM2}
+c31{Ok,BecomeZero,BecomeOne,n91}
+;enum
+x12{cond_or,iG2,iH2,iI2}
;}
-nJ1
-e12
+yO1
+e72
ComparisonSet:public
-ComparisonSetBase{e12
-t32{eJ
-a;eJ
+ComparisonSetBase{e72
+t32{yZ2
+a
+tX
b;int
relationship;t32():a(),b(),relationship(){}
}
-;std
-xV3<t32>eK;e12
-Item{eJ
+;eO3
+t32>tH;e72
+Item{yZ2
value;bool
-c52;Item():value(),c52(false){}
+cA2;Item():value(),cA2(false){}
}
-;std
-xV3<Item>cK1;int
-xM1;ComparisonSet():eK(),cK1(),xM1(0){}
-c11
+;eO3
+Item>cJ1;int
+xQ1;ComparisonSet():tH(),cJ1(),xQ1(0){}
+c31
AddItem
-lQ3
+iR1
a,bool
-c52,nW2
+cA2,x12
type){for
-iA1
-c=0;c<cK1.tF3;++c)if(cK1[c].value
-xF
-a)){if(c52!=cK1[c].c52){iQ
-cW1
+iZ1
+c=0;c<cJ1
+eJ3;++c)if(cJ1[c].value
+xI
+a)){if(cA2!=cJ1[c].cA2){l11
+cU1
case
-iM2:cK1.erase(cK1.begin()+c);xM1+=1
-n31
-xP2;case
-iK2:case
-iL2:cX1
-eW2
-xP2;}
+iI2:cJ1.erase(cJ1.begin()+c);xQ1
+cB2
+case
+iG2:case
+iH2:cW1}
+eE3
+n91;}
Item
-pole;pole.value=a;pole.c52=c52;cK1.push_back(pole)n31
+pole;pole.value=a;pole.cA2=cA2;cJ1
+c52
+pole)i1
Ok;}
-c11
-AddRelationship(eJ
-a,eJ
+c31
+AddRelationship(yZ2
+a,yZ2
b,int
-tO1,nW2
-type){iQ
-if(tO1==7)cW1
+tY1,x12
+type){l11
+if(tY1==7)cU1
lC
-iM2:if(tO1==7){xM1+=1
-n21
+iI2:if(tY1==7){xQ1
+cB2}
lC
-iK2:case
-iL2:if(tO1==0)cX1
-yF3
-if(!(a.GetHash()<b.GetHash())){a.swap(b);tO1=Swap_Mask(tO1);}
+iG2:case
+iH2:if(tY1==0)cW1
+xY3
+if(!(a.GetHash()<b.GetHash())){a.swap(b);tY1=Swap_Mask(tY1);}
for
-iA1
-c=0;c<eK.tF3;++c){if(eK[c].a
-xF
-a)&&eK[c].b
-xF
-b)){iQ{int
-yQ3=xO2|tO1;if(yQ3==7)cW1
-xO2=yQ3;yF3
+iZ1
+c=0;c<tH
+eJ3;++c){if(tH[c].a
+xI
+a)&&tH[c].b
+xI
+b)){l11{int
+y33=xQ2|tY1;if(y33==7)cU1
+xQ2=y33;xY3
case
-iK2:case
-iL2:{int
-yQ3=xO2&tO1;if(yQ3==0)cX1
-xO2=yQ3;yF3
+iG2:case
+iH2:{int
+y33=xQ2&tY1;if(y33==0)cW1
+xQ2=y33;xY3
case
-iM2:{int
-newrel_or=xO2|tO1;int
-xR2=xO2&tO1;lP2
-5&&xR2==0){xO2=tB3
-n21
-lP2
-7&&xR2==0){xM1+=1;eK.erase(eK.begin()+c)n21
-lP2
-7&&xR2==Eq_Mask){xO2=Eq_Mask;xM1+=1
-n21
-eR2}
-return
-xP2;}
+iI2:{int
+newrel_or=xQ2|tY1;int
+xR2=xQ2&tY1;lQ2
+5&&xR2==0){xQ2=eD3
+i1
+n91;}
+lQ2
+7&&xR2==0){xQ1+=1;tH.erase(tH.begin()+c)i1
+n91;}
+lQ2
+7&&xR2==Eq_Mask){xQ2=Eq_Mask;xQ1
+cB2}
+yA1}
+eE3
+n91;}
}
t32
-comp;comp.a=a;comp.b=b;comp.relationship=tO1;eK.push_back(comp)n31
+comp;comp.a=a;comp.b=b;comp.relationship=tY1;tH
+c52
+comp)i1
Ok;}
}
-;nR1
-iV2,xK3
+;nN1
+Value_t,x93
CondType>bool
-ConstantFolding_LogicCommon(eJ&tree,CondType
-xA1,bool
+ConstantFolding_LogicCommon(nP1
+CondType
+xF1,bool
xS2){bool
should_regenerate
-tO3
+eW3
ComparisonSet
-xK
-comp;nB1{xK3
-c6
-c11
-eM3=c6
-Ok;lC2
-atree=t33;switch(atree
-nC
-y33
+xF
+comp;x51{x93
+c8
+c31
+cY3=c8
+Ok;iT1&atree=xW
+a);e23
+atree
+nC){case
cEqual
lG
-Eq_Mask,xA1);lC
-cNEqual
+Eq_Mask
+e12
+i51
lG
-tB3,xA1);lC
+eD3
+e12
cLess
lG
-t93,xA1);lC
+eB3
+e12
cLessOrEq
lG
-Le_Mask,xA1);lC
+Le_Mask
+e12
cGreater
lG
-tA3,xA1);lC
+eC3
+e12
cGreaterOrEq
lG
-Ge_Mask,xA1);lC
-cNot:eM3
-yO1
+Ge_Mask
+e12
+cNot:cY3
+cV1
l8
-0),true,xA1);lC
-cNotNot:eM3
-yO1
+0),true
+e12
+cNotNot:cY3
+cV1
l8
-0),false,xA1);break;c73
-if(xS2||IsLogicalValue(atree))eM3
-yO1,false,xA1);l73
-eM3){ReplaceTreeWithZero:xO
-0)n31
-true;ReplaceTreeWithOne:xO
-1);nV
-c6
+0),false,xF1);break;yF3
+if(xS2||IsLogicalValue(atree))cY3
+cV1,false,xF1);c73(cY3){ReplaceTreeWithZero:nU
+0)i1
+true;ReplaceTreeWithOne:nU
+1);nZ
+c8
Ok:lC
-c6
+c8
BecomeZero
-eL
-c6
-BecomeOne:i6
-c6
-xP2:c41
-yF3}
+t7
+c8
+BecomeOne:iD
+c8
+n91:c61
+xY3}
if(should_regenerate){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Before ConstantFolding_LogicCommon: "
-yA1
+cV2<<"Before ConstantFolding_LogicCommon: "
+cR
#endif
-if(xS2){tree.DelParams(t43{for
-iY{lC2
-atree=lE2
-a
-eY3
-IsLogicalValue(atree))eK2}
+if(xS2){tree.DelParams();}
+else{for
+l41{iT1&atree=xW
+a);if(IsLogicalValue(atree))iZ);}
+}
for
-iA1
-a=0;a<comp.cK1.tF3;++a){if(comp.cK1[a].c52
-iJ2
-cNot);r.c5
-r
-cK
-r);}
-lJ2!xS2
-iJ2
-cNotNot);r.c5
-r
-cK
-r
-t43
-tree.c5}
+iZ1
+a=0;a<comp.cJ1
+eJ3;++a){if(comp.cJ1[a].cA2
+lA3
+cNot);r.c7
+r.lR2
+iP1!xS2
+lA3
+cNotNot);r.c7
+r.lR2
+else
+tree.c7}
for
-iA1
-a=0;a<comp.eK.tF3;++a
-iJ2
-cNop);switch(comp.eK[a
-eA
-y33
-c6
-t93:r
-xD
+iZ1
+a=0;a<comp.tH
+eJ3;++a
+lA3
+cNop);e23
+comp.tH[a
+eE){case
+c8
+eB3:r
+iH
cLess);lC
-c6
+c8
Eq_Mask:r
-xD
+iH
cEqual);lC
-c6
-tA3:r
-xD
+c8
+eC3:r
+iH
cGreater);lC
-c6
+c8
Le_Mask:r
-xD
+iH
cLessOrEq);lC
-c6
-tB3:r
-xD
-cNEqual);lC
-c6
+c8
+eD3:r
+iH
+i51);lC
+c8
Ge_Mask:r
-xD
+iH
cGreaterOrEq
-cT2
+e02
r
-yP1
-comp.eK[a].a);r
-yP1
-comp.eK[a].b);r
-cK
-r);}
-if(comp.xM1!=0)tree.yC
-iV2(comp.xM1)));
+c91
+comp.tH[a].a);r
+c91
+comp.tH[a].b);r.lR2
+if(comp.xQ1!=0)tree.yA
+e62
+comp.xQ1)));
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"After ConstantFolding_LogicCommon: "
-yA1
+cV2<<"After ConstantFolding_LogicCommon: "
+cR
#endif
-return
-true;}
-return
-tR3
-xN1
-ConstantFolding_AndLogic(iS3(tree.GetOpcode()==cAnd||tree.GetOpcode()==cAbsAnd)n31
+lD2
+eE3
+t23
+yP1
+ConstantFolding_AndLogic(iM3(tree.GetOpcode()==cAnd||tree.GetOpcode()==cAbsAnd)i1
nI
-iK2,true);}
-xN1
-ConstantFolding_OrLogic(iS3(tree.GetOpcode()==cOr||tree.GetOpcode()==cAbsOr)n31
+iG2,true);}
+yP1
+ConstantFolding_OrLogic(iM3(tree.GetOpcode()==cOr||tree.GetOpcode()==cAbsOr)i1
nI
cond_or,true);}
-xN1
-ConstantFolding_AddLogicItems(iS3(tree.GetOpcode()==cAdd)n31
+yP1
+ConstantFolding_AddLogicItems(iM3(tree.GetOpcode()==cAdd)i1
nI
-iM2,false);}
-xN1
-ConstantFolding_MulLogicItems(iS3(tree.GetOpcode()==cMul)n31
+iI2,false);}
+yP1
+ConstantFolding_MulLogicItems(iM3(tree.GetOpcode()==cMul)i1
nI
-iL2,false);}
+iH2,false);}
}
#include <vector>
#include <map>
#include <algorithm>
-lF3{using
-lF3
+l33{using
+l33
FUNCTIONPARSERTYPES;using
-t5;e12
+t5;e72
CollectionSetBase{enum
-xR1{Ok,xP2}
+xR1{Ok,n91}
;}
-nJ1
-e12
+yO1
+e72
CollectionSet:public
-CollectionSetBase{e12
-c21{eJ
-value;eJ
+CollectionSetBase{e72
+c41{yZ2
+value
+tX
xT2;bool
-cX;c21():value(),xT2(),cX(false){}
-c21
-lQ3
-v,lC2
-f):value(v),xT2(f),cX(false){}
+e0;c41():value(),xT2(),e0(false){}
+c41
+iR1
+v,iT1&f):value(v),xT2(f),e0(false){}
}
-;std::multimap<fphash_t,c21>iC;typedef
-xK3
-std::multimap<fphash_t,c21>::yV3
-xS1;CollectionSet():iC(){}
+;std::multimap<fphash_t,c41>iN;typedef
+x93
+std::multimap<fphash_t,c41>::y83
+xS1;CollectionSet():iN(){}
xS1
FindIdenticalValueTo
-lQ3
+iR1
value){fphash_t
hash=value.GetHash();for(xS1
-i=iC.xU2
-hash);i!=iC.cY1
-hash;++i){cC1
-xF
+i=iN.xU2
+hash);i!=iN.cX1
+hash;++i){cD1
+xI
i
-e82.value
-nE3
-i;}
-return
-iC.end();}
+eC2.value
+y03
+i;eE3
+iN.end();}
bool
Found
-cH1
-xS1&b)yR
-b!=iC.end();}
+iS1
+xS1&b)yP
+b!=iN.end();}
xR1
AddCollectionTo
-lQ3
+iR1
xT2,const
-xS1&into_which){c21&c=into_which
-e82;if(c.cX)c.xT2
-c9
-xT2);else{eJ
+xS1&into_which){c41&c=into_which
+eC2;if(c.e0)c.xT2
+cS
+xT2);else{yZ2
add;add
-xD
+iH
cAdd);add
-yP1
+c91
c.xT2);add
-c9
-xT2);c.xT2.swap(add);c.cX=true;}
-return
-xP2;}
+cS
+xT2);c.xT2.swap(add);c.e0=true;eE3
+n91;}
xR1
-nX2
-lQ3
-value,lC2
-xT2){const
+x22
+iR1
+value,iT1&xT2){const
fphash_t
hash=value.GetHash();xS1
-i=iC.xU2
-hash);for(;i!=iC.cY1
+i=iN.xU2
+hash);for(;i!=iN.cX1
hash;++i){if(i
-e82.value
-xF
+eC2.value
+xI
value
-nE3
+y03
AddCollectionTo(xT2,i);}
-iC.yR3,std::make_pair(hash,c21(value,xT2)))n31
+iN.y43,std::make_pair(hash,c41(value,xT2)))i1
Ok;}
xR1
-nX2
-lQ3
-a)yR
-nX2(a,nF1
+x22
+iR1
+a)yP
+x22(a,nA1
1)));}
}
-nJ1
-e12
+yO1
+e72
ConstantExponentCollection{typedef
-eH
-yT3;typedef
-std::x31
-xV2;std
-xV3<xV2>data;ConstantExponentCollection():data(){}
+eK
+y63;typedef
+std::x71
+xV2;eO3
+xV2>data;ConstantExponentCollection():data(){}
void
MoveToSet_Unique
-cG1
-eB1&eC1){data.push_back(std::x31(eB1()));data.back()tE3.swap(eC1
-lI3
+iS1
+Value_t&eP1&eQ1){data
+c52
+std::x71(eP1()));data.back().second.swap(eQ1
+cN2
MoveToSet_NonUnique
-cG1
-eB1&eC1){xK3
-std
-xV3<xV2>::yV3
+iS1
+Value_t&eP1&eQ1){x93
+eO3
+xV2>::y83
i=std::xU2
-data.iN2
-data.end(),exponent,Compare1st()eY3
-i!=data.cY1
-xG2{i
-e82.yR3
-e82.end(),eC1.iN2
-eC1.end()t43{data.yR3,std::x31
-t62,eC1));}
+data.iJ2
+data.end(),exponent,Compare1st());if(i!=data.cX1
+exponent){i
+eC2.y43
+eC2.end(),eQ1.iJ2
+eQ1.end());}
+else{data.y43,std::x71(exponent,eQ1));}
}
bool
-Optimize(){bool
+iA2{bool
changed
-tO3
-std::sort(data.iN2
+eW3
+std::sort(data.iJ2
data.end(),Compare1st());redo:for
-iA1
-a=0;a<data.tF3;++a
-tJ2
+iZ1
+a=0;a
+eR3
+a)l14
exp_a=data[a
-tC3
-cA3
-exp_a
-tG1
-1))cP2;for
-iA1
-b=a+1;b<data.tF3;++b
-tJ2
+eH3;lG3
+exp_a,e62
+1)))yA1
+for
+iZ1
+b=a+1;b
+eR3
+b)l14
exp_b=data[b
-tC3
-iU2
+eH3
+iK2
xW2=exp_b-exp_a;if(xW2>=fp_abs(exp_a))break
-iU2
-exp_diff_still_probable_integer=xW2*iV2(16
-eY3
-t42
+iK2
+exp_diff_still_probable_integer=xW2*e62
+16);if(t42
exp_diff_still_probable_integer)&&!(t42
exp_b)&&!t42
-xW2))){yT3&a_set=lQ2;yT3&b_set=data[b
-tD3;
+xW2))){y63&a_set=lS2;y63&b_set=data[b
+eI3;
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Before ConstantExponentCollection iteration:\n"
-;t52
-cout);
+cV2<<"Before ConstantExponentCollection iteration:\n"
+;Dump(cV2);
#endif
-if(isEvenInteger(exp_b)&&!isEvenInteger(xW2+exp_a)){eJ
+if(isEvenInteger(exp_b)&&!isEvenInteger(xW2+exp_a)nQ
tmp2;tmp2
-tH3
-tmp2
-iO3
+iH
+cMul);tmp2
+iF1
b_set);tmp2
-eT1
-t81
+iW1
+tX
+tmp;tmp
+iH
cAbs);tmp
-yP1
+c91
tmp2);tmp
-eT1
-b_set.t73
-1);b_set[0].i72}
-a_set.insert(a_set.end(),b_set.iN2
-b_set.end());yT3
-b_copy=b_set;data.erase(data.begin()+b);MoveToSet_NonUnique(xW2,b_copy);x62
+iW1;b_set
+xF3
+1);b_set[0
+tQ3
+tmp);}
+a_set.insert(a_set.end(),b_set.iJ2
+b_set.end());y63
+b_copy=b_set;data.erase(data.begin()+b);MoveToSet_NonUnique(xW2,b_copy);yS1
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"After ConstantExponentCollection iteration:\n"
-;t52
-cout);
+cV2<<"After ConstantExponentCollection iteration:\n"
+;Dump(cV2);
#endif
-cZ}
-eW2
+cJ}
+}
+eE3
changed;}
#ifdef DEBUG_SUBSTITUTIONS
void
-t52
-ostream&out){for
-iA1
-a=0;a<data.tF3;++a){out.precision(12);out<<data[a
-tC3<<": "
-;i81
-lQ2.tF3;++b){if(b>0)out<<'*'i13(lQ2[b],out);}
+Dump(std::ostream&out){for
+iZ1
+a=0;a
+eR3
+a){out.precision(12);out<<data[a
+eH3<<": "
+;e11
+lS2
+eJ3;++b){if(b>0)out<<'*'
+iL2
+lS2[b],out);}
out<<std::endl;}
}
#endif
}
-nJ1
+yO1
static
-eJ
-x41
-eJ&value,bool&xH
-y13
+yZ2
+x81
+yZ2&value,bool&xK
+yY3
value
-nC
-y33
-cPow:{eJ
-e92
+nC){case
+cPow:{yZ2
+eD2
value
l8
-1);value.y81
-n31
+1);value.y91
+i1
exponent;}
case
-cRSqrt:value.y81;xH=true
-n31
-nF1-0.5));case
-cInv:value.y81;xH=true
-n31
-nF1-1));c73
-yF3
+cRSqrt:value.y91;xK=true
+i1
+nA1-0.5))t83
+cInv:value.y91;xK=true
+i1
+nA1-1));yF3
+xY3
return
-nF1
+nA1
1));}
-cA1
+cB1
void
-eD1
-eV1&mul,lC2
-tree,lC2
-xT2,bool&c31
-bool&xH){nB1{eJ
-value
-y91
-a));eJ
-exponent(x41
-value,xH)eY3!xT2
-i61||xT2
-nC1!=iV2(1.0)){eJ
-cZ1;cZ1
-tH3
-cZ1
-c9
-xG2;cZ1
-c9
-xT2);cZ1
-eT1
-exponent.swap(cZ1);}
+eR1
+eS1&mul,const
+nP1
+iT1&xT2,bool&c51
+bool&xK){for
+iZ1
+a=0;a<yC++a
+nQ
+value(xW
+a))tX
+exponent(x81
+value,xK));if(!xT2
+tD1||xT2
+x41!=e62
+1.0)nQ
+cY1;cY1
+iH
+cMul);cY1
+cS
+tU2
+cY1
+cS
+xT2);cY1
+iW1
+eX3.swap(cY1);}
#if 0 /* FIXME: This does not work */
-cC1
+cD1
nC==cMul){if(1){bool
exponent_is_even=exponent
-i61&&isEvenInteger
-t62
-nC1);i81
-value.tP3{bool
-tmp
-tO3
-eJ
+tD1&&isEvenInteger(exponent
+x41);e11
+value.eZ3{bool
+tmp=false
+tX
val(value
l8
-b));eJ
-exp(x41
-val,tmp)eY3
-exponent_is_even||(exp
-i61&&isEvenInteger(exp
-nC1))){eJ
-cZ1;cZ1
-tH3
-cZ1
-c9
-xG2;cZ1
-yP1
-exp);cZ1.ConstantFolding(eY3!cZ1
-i61||!isEvenInteger(cZ1
-nC1)){goto
+b))tX
+exp(x81
+val,tmp));if(exponent_is_even||(exp
+tD1&&isEvenInteger(exp
+x41))nQ
+cY1;cY1
+iH
+cMul);cY1
+cS
+tU2
+cY1
+c91
+exp);cY1.ConstantFolding();if(!cY1
+tD1||!isEvenInteger(cY1
+x41)){goto
cannot_adopt_mul;}
}
}
}
-eD1
-mul,value,exponent,c31
-xH
-t43
+eR1
+mul,value,exponent,c51
+xK);}
+else
cannot_adopt_mul:
#endif
-{if(mul.nX2(value,xG2==CollectionSetBase::xP2)c41}
+{if(mul.x22(value,exponent)==CollectionSetBase::n91)c61}
}
}
-xN1
-ConstantFolding_MulGrouping(e62{bool
-xH
-tO3
+yP1
+ConstantFolding_MulGrouping(eR{bool
+xK
+eW3
bool
should_regenerate
-tO3
-eV1
-mul;eD1
-mul,tree,nF1
-1)),c31
-xH);typedef
-std::pair<eJ,eH>eE1;typedef
-std::multimap<fphash_t,eE1>cL1;cL1
-tD;xX2
-eV1::xS1
-j=mul.iC.yU3
-j!=mul.iC.end();++j){eJ&value=j
-e82.value;eJ&e92
+eW3
+eS1
+mul;eR1
+mul
+cU3,nA1
+1)),c51
+xK);typedef
+std::pair<yZ2,eK>eT1;typedef
+std::multimap<fphash_t,eT1>cK1;cK1
+iJ;for(x93
+eS1::xS1
+j=mul.iN.y73
+j!=mul.iN.end();++j
+nQ&value=j
+eC2.value
+tX&eD2
j
-e82.xT2;if(j
-e82.cX)exponent
-eT1
-const
+eC2.xT2;if(j
+eC2.e0)exponent
+iW1;const
fphash_t
-eF1=exponent.GetHash();xK3
-cL1::yV3
-i=tD.xU2
-eF1);for(;i!=tD.cY1
-eF1;++i)if(i
-e82.first
-xF
-xG2){if(!exponent
-i61||!e01
-nC1
-tG1
-1)))c41
+eU1=exponent.GetHash();x93
+cK1::y83
+i=iJ.xU2
+eU1);for(;i!=iJ.cX1
+eU1;++i)if(i
+eC2.first
+xI
+exponent)){if(!exponent
+tD1||!cZ1
+x41,e62
+1)))c61
i
-e82
-tE3.push_back(value);goto
+eC2.second
+c52
+value);goto
skip_b;}
-tD.yR3,std::make_pair(eF1,std::make_pair
-t62,eH
-iA1(1),value))));skip_b:;}
+iJ.y43,std::make_pair(eU1,std::make_pair(exponent,eK
+iZ1(1),value))));skip_b:;}
#ifdef FP_MUL_COMBINE_EXPONENTS
ConstantExponentCollection
-xK
-e11;xX2
-cL1::yV3
-j,i=tD.yU3
-i!=tD.end();i=j){j=i;++j;eE1&list=i
-e82;if(list.first
-l71
-e92
+xF
+e01;for(x93
+cK1::y83
+j,i=iJ.y73
+i!=iJ.end();i=j){j=i;++j;eT1&list=i
+eC2;x32.lV1
+eD2
list.first
-nC1;if(!t62==xD1)e11.MoveToSet_Unique
-t62,list
-iO2;tD.erase(i);}
+x41;if(!(exponent==xG1)e01.MoveToSet_Unique(exponent,list
+iB2
+iJ.erase(i);}
}
-if(e11.Optimize())c41
+if(e01.iA2)c61
#endif
-if(should_regenerate){eJ
-before=tree;before.l61
+if(should_regenerate
+nQ
+before=tree;before.lD1
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Before ConstantFolding_MulGrouping: "
-i13(before
-lT2"\n"
+cV2<<"Before ConstantFolding_MulGrouping: "
+iL2
+before
+lE2"\n"
;
#endif
-tree.DelParams();xX2
-cL1::yV3
-i=tD.yU3
-i!=tD.end();++i){eE1&list=i
-e82;
+tree.DelParams();for(x93
+cK1::y83
+i=iJ.y73
+i!=iJ.end();++i){eT1&list=i
+eC2;
#ifndef FP_MUL_COMBINE_EXPONENTS
-if(list.first
-l71
-e92
+x32.lV1
+eD2
list.first
-nC1;if
-t62==xD1
-continue;if(e01
-xE3
+x41;if(exponent==xG1
+yA1
+if(cZ1
+nH2
tree.AddParamsMove(list
-iO2;eR2}
+iB2
+yA1}
+}
#endif
-eJ
+yZ2
mul;mul
-tH3
-mul
-iO3
+iH
+cMul);mul
+iF1
list
-iO2;mul
-eT1
-if(xH&&list.first
-i51
-list.first
-nC1==iV2(1)/iV2(3)){eJ
+iB2
+mul
+iW1;if(xK&&list.first
+tD1){x32
+x41==e62
+1)/e62
+3)nQ
cbrt;cbrt
-xD
-cCbrt);cbrt.e4
-cbrt
-cK
-cbrt
-xW
-0.5)){eJ
+iH
+cCbrt);cbrt.e8
+cbrt.lT2
+cbrt);yA1
+cV
+0.5)nQ
sqrt;sqrt
-xD
-cSqrt);sqrt.e4
-sqrt
-cK
-sqrt
-xW-0.5)){eJ
+iH
+cSqrt);sqrt.e8
+sqrt.lT2
+sqrt);yA1
+cV-0.5)nQ
rsqrt;rsqrt
-xD
-cRSqrt);rsqrt.e4
-rsqrt
-cK
-rsqrt
-xW-1)){eJ
+iH
+cRSqrt);rsqrt.e8
+rsqrt.lT2
+rsqrt);yA1
+cV-1)nQ
inv;inv
-xD
-cInv);inv.e4
-inv
-cK
-inv);eR2}
-eJ
+iH
+cInv);inv.e8
+inv.lT2
+inv);yA1}
+}
+yZ2
pow;pow
-xD
-cPow);pow.e4
+iH
+cPow);pow.e8
pow
-yP1
-list.first);pow
-cK
+c91
+list.first);pow.lT2
pow);}
#ifdef FP_MUL_COMBINE_EXPONENTS
-tD.clear()yM3
-0;a<i3.tF3;++a
-tJ2
-e92
-i3[a
-tC3;if(e01
-xE3
-tree.AddParamsMove(i3[a]iO2;eR2
-eJ
+iJ.clear(iY1
+0;a<iB
+eJ3;++a)l14
+eD2
+iB[a
+eH3;if(cZ1
+nH2
+tree.AddParamsMove(iB[a]iB2
+yA1}
+yZ2
mul;mul
-tH3
+iH
+cMul);mul
+iF1
+iB[a]iB2
mul
-iO3
-i3[a]iO2;mul
-eT1
-eJ
+iW1
+tX
pow;pow
-xD
-cPow);pow.e4
-pow.yC
-xG2);pow
-cK
+iH
+cPow);pow.e8
+pow.yA
+exponent));pow.lT2
pow);}
#endif
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"After ConstantFolding_MulGrouping: "
-yA1
+cV2<<"After ConstantFolding_MulGrouping: "
+cR
#endif
return!tree
-xF
-before);}
-return
-tR3
-xN1
-ConstantFolding_AddGrouping(e62{bool
+xI
+before);eE3
+t23
+yP1
+ConstantFolding_AddGrouping(eR{bool
should_regenerate
-tO3
-eV1
-add;nB1{if
-y91
-a)nC==cMul
-cP2;if(add.nX2
-y91
-a))==CollectionSetBase::xP2)c41}
-std::eV2
-remaining(eM);size_t
-tE=0;nB1{lC2
-mulgroup=t33;if
-lR3
-nC==cMul){i81
-yQ1
-tP3{if
-lR3
+eW3
+eS1
+add;x51{if(xW
+a)nC==cMul)yA1
+if(add.x22(xW
+a))==CollectionSetBase::n91)c61}
+cY2
+lU2
+l51);size_t
+tD=0;x51{iT1&mulgroup=xW
+a);if
+eH2
+nC==cMul){e11
+cA1
+eZ3{if
+eH2
l8
-b)i61
-cP2;xK3
-eV1::xS1
+b)tD1)yA1
+x93
+eS1::xS1
c=add.FindIdenticalValueTo
-lR3
+eH2
l8
-b)eY3
-add.Found(c)){eJ
+b));if(add.Found(c)nQ
tmp
-lR3
-yA
-CloneTag());tmp
-tK2
+eH2
+y8
+CloneTag());tmp.i91
b);tmp
-eT1
-add.AddCollectionTo(tmp,c);c41
+iW1;add.AddCollectionTo(tmp,c);c61
goto
done_a;}
}
-remaining[a]=true;tE+=1;done_a:;}
+lU2[a]=true;tD+=1;done_a:;}
}
-if(tE>0){if(tE>1){std
-xV3<std::pair<eJ,size_t> >nU;std::multimap<fphash_t,size_t>eG1;bool
-lS3
-tO3
-nB1
-iC1{i81
-t33.tP3{lC2
-p=t33
-l8
+if(tD>0){if(tD>1){eO3
+std::pair<yZ2,size_t> >nY;std::multimap<fphash_t,size_t>eV1;bool
+lB3
+eW3
+x51
+if(lU2[a]){e11
+xW
+a).eZ3{iT1&p=xW
+a)l8
b);const
fphash_t
p_hash=p.GetHash();for(std::multimap<fphash_t,size_t>::const_iterator
-i=eG1.xU2
-p_hash);i!=eG1.cY1
-p_hash;++i){if(nU[i
-e82
-tC3
-xF
-p)){nU[i
-e82
-tD3+=1;lS3=true;goto
+i=eV1.xU2
+p_hash);i!=eV1.cX1
+p_hash;++i){if(nY[i
+eC2
+eH3
+xI
+p)){nY[i
+eC2
+eI3+=1;lB3=true;goto
found_mulgroup_item_dup;}
}
-nU.push_back(std::make_pair(p,size_t(1)));eG1.insert(std::make_pair(p_hash,nU.tF3-1));found_mulgroup_item_dup:;}
-}
-if(lS3){eJ
-eA2;{size_t
-max=0;for
-iA1
-p=0;p<nU.tF3;++p)if(nU[p
-tD3<=1)nU[p
-tD3=0;else{nU[p
-tD3*=nU[p
-tC3.y22;if(nU[p
-tD3>max){eA2=nU[p
-tC3;max=nU[p
-tD3;}
+nY
+c52
+std::make_pair(p,size_t(1)));eV1.insert(std::make_pair(p_hash,nY
+eJ3-1));found_mulgroup_item_dup:;}
}
-}
-eJ
+if(lB3
+nQ
+eE2;{size_t
+max=0
+eK3
+p=0;p<nY
+eJ3;++p)if(nY[p
+eI3<=1)nY[p
+eI3=0;else{nY[p
+eI3*=nY[p
+eH3
+nP2;if(nY[p
+eI3>max){eE2=nY[p
+eH3;max=nY[p
+eI3;}
+}
+}
+yZ2
group_add;group_add
-xD
+iH
cAdd);
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Duplicate across some trees: "
-i13(eA2
-lT2" in "
-yA1
+cV2<<"Duplicate across some trees: "
+iL2
+eE2
+lE2" in "
+cR
#endif
-nB1
-iC1
-i81
-t33.tP3
-if(eA2
-xF
-t33
-l8
-b))){eJ
-tmp
-y91
-a)yA
-CloneTag());tmp
-tK2
+x51
+if(lU2[a])e11
+xW
+a).eZ3
+if(eE2
+xI
+xW
+a)l8
+b))nQ
+tmp(xW
+a)y8
+CloneTag());tmp.i91
b);tmp
-eT1
-group_add
-yP1
-tmp);remaining[a]tO3
-yF3
+iW1;group_add
+c91
+tmp);lU2[a]eW3
+xY3
group_add
-eT1
-eJ
+iW1
+tX
group;group
-tH3
-group
-yP1
-eA2);group
-yP1
+iH
+cMul);group
+c91
+eE2);group
+c91
group_add);group
-eT1
-add.nX2(group);c41}
+iW1;add.x22(group);c61}
}
-nB1
-iC1{if(add.nX2
-y91
-a))==CollectionSetBase::xP2)c41}
+x51
+if(lU2[a]){if(add.x22(xW
+a))==CollectionSetBase::n91)c61}
}
if(should_regenerate){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Before ConstantFolding_AddGrouping: "
-yA1
-#endif
-tree.DelParams();xX2
-eV1::xS1
-j=add.iC.yU3
-j!=add.iC.end();++j){eJ&value=j
-e82.value;eJ&coeff=j
-e82.xT2;if(j
-e82.cX)coeff
-eT1
-if(coeff
-i51
-cB3
+cV2<<"Before ConstantFolding_AddGrouping: "
+cR
+#endif
+tree.DelParams();for(x93
+eS1::xS1
+j=add.iN.y73
+j!=add.iN.end();++j
+nQ&value=j
+eC2.value
+tX&coeff=j
+eC2.xT2;if(j
+eC2.e0)coeff
+iW1;if(coeff
+tD1){lG3
coeff
-nC1,xD1
-cP2
-cA3
+x41,xG1)yA1
+lG3
coeff
-nC1
-xE3
-lP1
-value);eR2}
-eJ
+x41
+nH2
+tree
+c91
+value);yA1}
+}
+yZ2
mul;mul
-tH3
-mul
-yP1
+iH
+cMul);mul
+c91
value);mul
-yP1
-coeff);mul
-cK
-mul);}
+c91
+coeff);mul.e33
+yB
+e8}
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"After ConstantFolding_AddGrouping: "
-yA1
+cV2<<"After ConstantFolding_AddGrouping: "
+cR
#endif
-return
-true;}
-return
-tR3}
-lF3{using
-lF3
+lD2
+eE3
+t23}
+l33{using
+l33
FUNCTIONPARSERTYPES;using
t5
-nJ1
+yO1
bool
-ConstantFolding_IfOperations(iS3(tree.GetOpcode()==cIf||tree.GetOpcode()==cAbsIf);for(;;){lT3
-nC==cNot){tI3
-cIf);lE2
-0).xY2
-0)lR2
-eO3.swap
-y91
-2)t43
-lT3
-cS1{tI3
-yW3;lE2
-0).xY2
-0)lR2
-eO3.swap
-y91
-2)t43
-yJ3
-tM
-0),i01==yW3)l92
-tree.xY2
-1));nV
-lC3
-tree.xY2
-2));nV
-lT1
-lT3
-nC==cIf||lE2
-0)nC==yW3{eJ
-cond=lE2
-0);eJ
-lU3;lU3
-t53==cIf?cNotNot:cAbsNotNot);lU3
-xZ2
-1));ConstantFolding(lU3);eJ
-lV3;lV3
-t53==cIf?cNotNot:cAbsNotNot);lV3
-xZ2
-2));ConstantFolding(lV3
-eY3
-lU3
-i61||lV3
-i61){eJ
-eV;eV
-t53);eV
-xZ2
-1));eV.nJ
-1));eV.nJ
-2));eV
-eT1
-eJ
-eW;eW
-t53);eW
-xZ2
-2));eW.nJ
-1));eW.nJ
-2));eW
-eT1
-tree
-t53);cM1
+ConstantFolding_IfOperations(iM3(tree.GetOpcode()==cIf||tree.GetOpcode()==cAbsIf);for(;;){if(c93==cNot){tD2
+cIf);xW
+0).eF2
+0)c43
+xW
+1).swap(xW
+2));}
+iP1
+xW
+0)cQ1{tD2
+t03;xW
+0).eF2
+0)c43
+xW
+1).swap(xW
+2));}
+else
+yV3
+lY1
+0),t72==t03
+tN1
+tree.eF2
+1));nZ
+l03
+tree.eF2
+2));nZ
+lZ1
+if(c93==cIf||c93==cAbsIf
+nQ
+cond=xW
+0)tX
+lC3;lC3
+tE2==cIf?cNotNot:cAbsNotNot);lC3
+xX2
+1));ConstantFolding(lC3)tX
+lD3;lD3
+tE2==cIf?cNotNot:cAbsNotNot);lD3
+xX2
+2));ConstantFolding(lD3);if(lC3
+tD1||lD3
+tD1
+nQ
+eT;eT
+tE2);eT
+xX2
+1));eT
+tX3
+eT.nJ
+2));eT
+iW1
+tX
+else_tree
+tS1
+tE2)tS1
+xX2
+2))tS1.nJ
+1))tS1.nJ
+2))tS1
+cY
+cond
+nC
+xT1
0,cond
-lR2
-tree.nG1
-1,eV);tree.nG1
-2,eW)xJ2}
-if
-y91
-1)nC==lE2
-2)nC&&y91
-1)nC==cIf||eO3
-nC==yW3){eJ&iE2=eO3;eJ&leaf2=lE2
-2
-eY3
-iE2
l8
-0)xC1
-0))&&c93
-1))||iE2
-l8
-2)xC1
-2)))){eJ
-eV;eV
-iP2
-eV.nJ
-0));eV
-c9
-iE2
-l8
-1));eV
-c9
-leaf2
-l8
-1));eV
-eT1
-eJ
-eW;eW
-iP2
-eW.nJ
-0));eW
-c9
-iE2
+0)yB
+nB1
+1,eT
+yB
+nB1
+2,else_tree
+yQ2}
+if(xW
+1)nC==xW
+2)nC&&(xW
+1)nC==cIf||xW
+1)nC==t03
+nQ&x53=xW
+1)tX&leaf2=xW
+2);if(x53
l8
-2));eW
-c9
-leaf2
+0)nN2
+0))&&x61
+1))||x53
l8
-2));eW
-iU
-SetParam(0,iE2
-lR2
-tree.nG1
-1,eV);tree.nG1
-2,eW)xJ2
+2)nN2
+2)))nQ
+eT;eT
+nO2;eT
+tY3
+eT
+xY2
+1));eT
+xZ2
+1));eT
+iW1
+tX
+else_tree
+tS1
+nO2
+tS1.nJ
+0))tS1
+xY2
+2))tS1
+xZ2
+2))tS1
+cY
+x53
+nC
+xT1
+0
+cB3
+0)yB
+nB1
+1,eT
+yB
+nB1
+2,else_tree
+yQ2
if
-c93
-1))&&iE2
+x61
+1))&&x53
l8
-2)xC1
-2))){eJ
-eX;eX
-iP2
-eX.AddParamMove
-y91
-0));eX
-c9
-iE2
-lR2
-eX
-c9
-leaf2
-lR2
-eX
-iU
-nG1
-0,eX);cM1
-2,iE2
-l8
-2));cM1
-1,iE2
-l8
-1))xJ2
+2)nN2
+2))nQ
+eU;eU
+nO2;eU
+c91
+xW
+0));eU
+xY2
+0));eU
+xZ2
+0));eU
+cY
+x53
+nC
+yB
+nB1
+0,eU
+xT1
+2
+cB3
+2)xT1
+1
+cB3
+1)yQ2
if
-c93
-2))&&iE2
+x61
+2))&&x53
l8
-2)xC1
-1))){eJ
-eB2;eB2
-xD
-leaf2
-nC==cIf?cNot:cZ3);eB2
-c9
+2)nN2
+1))nQ
+eI2;eI2
+iH
leaf2
-lR2
-eB2
-eT1
-eJ
-eX;eX
-iP2
-eX.AddParamMove
-y91
-0));eX
-c9
-iE2
-lR2
-eX
-yP1
-eB2);eX
-iU
-nG1
-0,eX);cM1
-2,iE2
-l8
-2));cM1
-1,iE2
-l8
-1))xJ2}
-eJ&xX=eO3;eJ&y6=lE2
+nC==cIf?cNot:cC3);eI2
+xZ2
+0));eI2
+iW1
+tX
+eU;eU
+nO2;eU
+c91
+xW
+0));eU
+xY2
+0));eU
+c91
+eI2);eU
+cY
+x53
+nC
+yB
+nB1
+0,eU
+xT1
2
-eY3
-xX
-xF
-y6)){tree.xY2
-1))xJ2
+cB3
+2)xT1
+1
+cB3
+1)yQ2}
+yZ2&xV=xW
+1)tX&y4=xW
+2);if(xV
+xI
+y4)){tree.eF2
+1)yQ2
const
OPCODE
-op1=xX
+op1=xV
nC;const
OPCODE
-op2=y6
-nC;if
-eN3
-op2){if(xX
-cE1
-1){eJ
+op2=y4
+nC;y93
+op2){if(xV.e91
+1
+nQ
lO
-0));lW3
-lR2
-tQ3
-n4
-if(xX
-cE1
-2&&y6
-cE1
-2){if(xX
+0));y02
+0))c71()n4
+if(xV.e91
+2&&y4.e91
+2){if(xV
l8
-0)xF
-y6
+0)xI
+y4
l8
-0))){eJ
-param0=xX
+0))nQ
+param0=xV
l8
-0);eJ
+0)tX
lO
-1));lW3
-l8
-1));tQ3;lP1
+1));y02
+1))c71
+t8
param0)n4
-if(xX
+if(xV
l8
-1)xF
-y6
+1)xI
+y4
l8
-1))){eJ
-param1=xX
+1))nQ
+param1=xV
l8
-1);eJ
+1)tX
lO
-0));lW3
-lR2
-tQ3;lP1
-nE1);lP1
-param1)xJ2}
-if
-eN3
-yZ3
+0));y02
+0))c71
+t8
+n81
+c81
+param1
+yQ2}
+y93
+yA3
cMul
-lS2
+lV2
cAnd
-lS2
+lV2
cOr
-lS2
+lV2
cAbsAnd
-lS2
+lV2
cAbsOr
-lS2
+lV2
cMin
-lS2
-cMax){eH
-lX3;yZ{for
-iA1
-b=y6.xF1
-b-->0;){if
-c62
-y6
+lV2
+cMax){eK
+lE3;c2{for
+iZ1
+b=y4.l91
+b-->0;){if(xV
+lF3
+y4
l8
-b))){if(lX3
-cT3){xX.l61
-y6.l61}
-lX3.push_back(xX
-x13
-y6
-tK2
-b);xX
-t31
-cT2}
-}
-if(!lX3
-cT3){xX
-eT1
-y6.Rehash()l7
-op1);tree
-iO3
-lX3)n4}
+b))){if(lE3
+eU3){xV.t13
+lD1}
+lE3
+c52
+xV
+n93
+y4.i91
+b);xV.i91
+a
+e02}
}
-if
-eN3
-yZ3
-cMul||eN3
-cAnd
-nT1
-y6))||eN3
-cOr
-nT1
-y6))){yZ
-if
-c62
-y6)){xX.l61
-xX
-t31);xX
-eT1
-eJ
-cO1=y6;y6=tF
-op1==yZ3
+if(!lE3
+eU3){xV
+iW1;y4
+iW1
+l7
+op1
+yB
+SetParamsMove(lE3)n4}
+}
+y93
+yA3
+cMul||(op1==cAnd&&IsLogicalValue(y4))||(op1==cOr&&IsLogicalValue(y4))){c2
+if(xV
+lF3
+y4)){xV.lD1
+xV.i91
+a);xV
+iW1
+tX
+cL1=y4;y4=tE
+op1==yA3
cOr
-tE2
-op1);lP1
-cO1)n4}
-if(eN3
-cAnd
-lS2
-cOr)&&op2==cNotNot){eJ&lY3=y6
-l8
-0);yZ
-if
-c62
-lY3)){xX.l61
-xX
-t31);xX
-eT1
-eJ
-cO1=lY3;y6=tF
+t52
op1
-yY3
-op1);lP1
-cO1)n4}
-if(op2==cAdd||op2==cMul||(op2==cAnd
-nT1
-xX))||(op2==cOr
-nT1
-xX))){for
-iA1
-a=y6
-n41
-y6
-l8
-a)xF
-xX)){y6.l61
-y6
-t31);y6
-eT1
-eJ
-cP1=xX;xX=tF
-op2==cAdd||op2
-yY3
-op2);lP1
-cP1)n4}
-if((op2==cAnd||op2==cOr)&&op1==cNotNot){eJ&lZ3=xX
+c81
+cL1)n4}
+if((op1==cAnd
+lV2
+cOr)&&op2==cNotNot
+nQ&lH3=y4
l8
-0)yM3
-y6
-n41
-y6
+0);c2
+if(xV
+lF3
+lH3)){xV.lD1
+xV.i91
+a);xV
+iW1
+tX
+cL1=lH3;y4=tE
+op1==cOr
+t52
+op1
+c81
+cL1)n4}
+if(op2==cAdd||op2==cMul||(op2==cAnd&&IsLogicalValue(xV))||(op2==cOr&&IsLogicalValue(xV))){for
+iZ1
+a=y4
+iY
+y4
+lF3
+xV)){y4.t13
+i91
+a);y4
+iW1
+tX
+cM1=xV;xV=tE
+op2==cAdd||op2==cOr
+t52
+op2
+c81
+cM1)n4}
+if((op2==cAnd||op2==cOr)&&op1==cNotNot
+nQ&lI3=xV
l8
-a)xF
-lZ3)){y6.l61
-y6
-t31);y6
-eT1
-eJ
-cP1=lZ3;xX=tF
+0
+iY1
+y4
+iY
+y4
+lF3
+lI3)){y4.t13
+i91
+a);y4
+iW1
+tX
+cM1=lI3;xV=tE
+op2==cOr
+t52
op2
-yY3
-op2);lP1
-cP1)n4}
-return
-tR3}
+c81
+cM1)n4
+eE3
+t23}
#include <limits>
-lF3{using
-lF3
+l33{using
+l33
FUNCTIONPARSERTYPES;using
t5
-nJ1
+yO1
int
-maxFPExponent()yR
+maxFPExponent()yP
std::numeric_limits
-xK::max_exponent;}
-xN1
-x51
-iV2
-base,iV2
-xG2{if(base<xD1
-return
-true
-cA3
-base,xD1||cB3
-base
-tG1
-1))cL
+xF::max_exponent;}
+yP1
+x91
+Value_t
+base,Value_t
+exponent){if(base<xG1
+lD2
+lG3
+base,xG1||lJ3
+base,e62
+1))cQ
return
-exponent>=iV2(maxFPExponent
-xK())/fp_log2(base);}
-xN1
-ConstantFolding_PowOperations(iS3(tree.GetOpcode()==cPow);nR&&eO3
-l71
-const_value
-t03
-lR,tH);xO
-const_value)n31
-tR3
-tM2
-cB3
-tH
-xE3
-tree.xY2
-0))xJ2
-nR&&cB3
+exponent>=e62
+maxFPExponent
+xF())/fp_log2(base);}
+yP1
+ConstantFolding_PowOperations(iM3(tree.GetOpcode()==cPow);nP&&xW
+1).lV1
+const_value=t33
+lR,xW
+i8);nU
+const_value)i1
+t23
+if(eI1
+lJ3
+xW
+i8
+nH2
+tree.eF2
+0)yQ2
+nP&&lJ3
lR
-xE3
-xO
-1)n31
-tR3
-nR&&eO3
-nC==cMul){bool
-y02=false
-iU2
-lU2=lR;eJ
-mulgroup=eO3
-yM3
+nH2
+nU
+1)i1
+t23
+nP&&xW
+1)nC==cMul){bool
+y12=false
+iK2
+lW2=lR
+tX
+mulgroup=xW
+1
+iY1
mulgroup
-n41
+iY
mulgroup
l8
-a)l71
+a).lV1
imm=mulgroup
l8
-a)nC1;{if(x51
-lU2,imm))break
-iU2
-lV2
-t03
-lU2,imm)cA3
-lV2,xD1)break;if(!y02){y02=true;yQ1
-l61}
-lU2=lV2;yQ1
-DelParam(a
-cT2}
-if(y02){yQ1
-Rehash();
+a)x41;{if(x91
+lW2,imm))break
+iK2
+lX2=t33
+lW2,imm);lG3
+lX2,xG1)break;if(!y12){y12=true;cA1
+lD1}
+lW2=lX2;cA1
+i91
+a
+e02}
+if(y12){cA1
+e33);
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Before pow-mul change: "
-yA1
+cV2<<"Before pow-mul change: "
+cR
#endif
-lE2
-0).Become(e21
-lU2));eO3.Become
-lR3);
+xW
+0).Become(eA1
+lW2));xW
+1).Become
+eH2);
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"After pow-mul change: "
-yA1
+cV2<<"After pow-mul change: "
+cR
#endif
}
}
-tM2
-lE2
-0)nC==cMul
-tJ2
-lW2=tH
-iU2
-y12=1.0;bool
-y02
-tO3
-eJ&mulgroup=lE2
-0)yM3
+if(eI1
+c93==cMul)l14
+lY2=xW
+i8
+iK2
+y22=1.0;bool
+y12=false
+tX&mulgroup=xW
+0
+iY1
mulgroup
-n41
+iY
mulgroup
l8
-a)l71
+a).lV1
imm=mulgroup
l8
-a)nC1;{if(x51
-imm,lW2))break
-iU2
-eH1
-t03
-imm,lW2)cA3
-eH1,xD1)break;if(!y02){y02=true;yQ1
-l61}
-y12*=eH1;yQ1
-DelParam(a
-cT2}
-if(y02){yQ1
-Rehash();eJ
-eS3;eS3
-xD
-cPow);eS3
-iO3
-tree.l02));eS3.n62
-tree
-tH3
-lP1
-eS3);i83
-e21
-y12))xJ2}
-lT3
-nC==cPow&&eO3
-i61&&lE2
+a)x41;{if(x91
+imm,lY2))break
+iK2
+eW1=t33
+imm,lY2);lG3
+eW1,xG1)break;if(!y12){y12=true;cA1
+lD1}
+y22*=eW1;cA1
+i91
+a
+e02}
+if(y12){cA1
+e33)tX
+cZ3;cZ3
+iH
+cPow);cZ3
+iF1
+tree.lJ2));cZ3.yC2
+yB
+eL3
+cMul
+c81
+cZ3
+yB
+AddParam(eA1
+y22)yQ2}
+if(xW
+0)i12
+eI1
+xW
0)l8
-1)l71
-a=lE2
+1).lV1
+a=xW
0)l8
-1)nC1
-iU2
-b=tH
-iU2
-c=a*b;if(isEvenInteger(a)&&!isEvenInteger(c)){eJ
-n03;n03
-xD
-cAbs);n03.nJ
-0)lR2
-n03
-eT1
-tree.nG1
-0,n03
-t43
-cM1
-0,lE2
-0)lR2
-cM1
-1,e21
-c));}
-return
-tR3}
-lF3{using
-lF3
+i8
+iK2
+b=xW
+i8
+iK2
+c=a*b;if(isEvenInteger(a)&&!isEvenInteger(c)nQ
+lK3;lK3
+iH
+cAbs);lK3.nJ
+0)c43
+lK3.e33
+yB
+nB1
+0,lK3);}
+else
+tree.SetParam(0,xW
+0)l8
+0)xT1
+1,eA1
+c));eE3
+t23}
+l33{using
+l33
FUNCTIONPARSERTYPES;using
-t5;e12
+t5;e72
l5{enum
-eC2{MakeFalse=0,MakeTrue=1,t72=2,n23=3,MakeNotNotP0=4,MakeNotNotP1=5,MakeNotP0=6,MakeNotP1=7,xB=8
-xF3
-lX2{Never=0,Eq0=1,Eq1=2,c03=3,c13=4}
-;eC2
-if_identical;eC2
-lY2
-4];e12{eC2
-what:4;lX2
+eJ2{MakeFalse=0,MakeTrue=1,t62=2,lN3=3,MakeNotNotP0=4,MakeNotNotP1=5,MakeNotP0=6,MakeNotP1=7,xJ=8}
+;enum
+lZ2{Never=0,Eq0=1,Eq1=2,yB3=3,yC3=4}
+;eJ2
+if_identical;eJ2
+n02
+4];e72{eJ2
+what:4;lZ2
when:4;}
-iK1,iL1,iM1,iN1
-nJ1
-eC2
+l02,l12,l22,l32
+yO1
+eJ2
Analyze
-lQ3
-a,lC2
-b
-e83{if(a
-xF
+iR1
+xC3
+eX1)const{if(a
+xI
b
-nE3
-if_identical;c23
-p0=iN
-a);c23
-p1=iN
-b);eR3
-known&&p1
-n51){eR3
-val<p1
-tF2&&lY2
-0]i4
-0];eR3
-val<=p1
-tF2&&lY2
-1]i4
+y03
+if_identical;yD3
+tY
+a);yD3
+p1=CalculateResultBoundaries(b);if(p0
+e61&&p1
+yI){if(p0
+nL3<p1
+yM&&n02
+0]iC
+0];if(p0
+nL3<=p1
+yM&&n02
+1]iC
1];}
if
-iC3
+cN3
p1
-xF2{if(p0
-tF2>p1
-yN
-val&&lY2
-2]i4
-2];if(p0
-tF2>=p1
-yN
-val&&lY2
-3]i4
-3];}
-if(IsLogicalValue(a)){if(iK1
-tP2
-iK1.when,p1
-nE3
-iK1.what;if(iM1
-tP2
-iM1.when,p1
-nE3
-iM1.what;}
-if(IsLogicalValue(b)){if(iL1
-tP2
-iL1.when,p0
-nE3
-iL1.what;if(iN1
-tP2
-iN1.when,p0
-nE3
-iN1.what;}
-return
-xB;}
-cA1
+e61){if(p0
+yM>p1
+nL3&&n02
+2]iC
+2];if(p0
+yM>=p1
+nL3&&n02
+3]iC
+3];}
+if(IsLogicalValue(a)){if(l02
+nN3
+l02.when,p1
+y03
+l02.what;if(l22
+nN3
+l22.when,p1
+y03
+l22.what;}
+if(IsLogicalValue(b)){if(l12
+nN3
+l12.when,p0
+y03
+l12.what;if(l32
+nN3
+l32.when,p0
+y03
+l32.what;eE3
+xJ;}
+cB1
bool
-TestCase(lX2
+TestCase(lZ2
when,const
-c23&p){if(!p
-n51||!p
-yN
-known
-cL
-switch(when
-y33
-Eq0
-nV1==iV2(0.0)&&e13==p
-tF2;case
-Eq1
-nV1==iV2(1.0)&&e13==e13;case
-c03
-nV1>y21&&e13<=iV2(1);case
-c13
-nV1>=y21
-lH1
-1);c73;}
-return
-tR3}
-;lF3
+yD3&p){if(!p
+yI||!p
+e61
+cQ
+e23
+when){case
+Eq0:nO3==e62
+0.0)t43==p
+yM
+t83
+Eq1:nO3==e62
+1.0)t43==p
+nL3
+t83
+yB3:nO3>xH1
+t43<=e62
+1)t83
+yC3:nO3>=xH1
+l61
+1);yF3;eE3
+t23}
+;l33
RangeComparisonsData{static
const
l5
Data[6]={{l5
-c51,{l5::tU
-xB,l5::tU
-xB
-iT
+lL3
+i3
+xJ,l5::i3
+xJ
+lF1
Eq1
-iW
+nT1
Eq1
-nX1
+nU1
Eq0
-nY1
+nV1
Eq0}
-eI1
-c51,l5::xB,l5
-c51,l5::xB
-iT
+}
+,{l5::x42
+lM3
+xJ,l5
+lM3
+xJ
+lF1
Eq0
-iW
+nT1
Eq0
-nX1
+nU1
Eq1
-nY1
+nV1
Eq1}
-eI1
-c51,l5::t72,l5::tU
-MakeFalse
-nX1
-c03
-iW
-c13
-yD
-cC
-yD
-n13{l5::xB,l5
-c51,l5::tU
-n23
-nX1
-c13
-iW
-c03
-yD
-cC
-eI1::tU
-tU
-n13
-l5::t72
-iT
-c13
-nY1
-c03
-yD
-cC
-yD
-n13{l5::tU
-n23,l5::xB,l5
-c51
-iT
-c03
-nY1
-c13
-yD
-cC}
}
+,{l5::x42
+lM3
+t62,l5::i3
+MakeFalse
+nU1
+yB3
+nT1
+yC3
+yY,{l5
+lL3
+xJ,l5
+lM3
+i3
+lN3
+nU1
+yC3
+nT1
+yB3
+yY,{l5::x42::i3
+i3
+MakeTrue,l5::t62
+lF1
+yC3
+nV1
+yB3
+yY,{l5
+lL3
+i3
+lN3,l5::xJ,l5
+nC1
+lF1
+yB3
+nV1
+yC3
+yY}
;}
-xN1
-ConstantFolding_Comparison(e62{using
-lF3
-RangeComparisonsData;assert(tree.GetOpcode()>=cEqual&&tree.GetOpcode()<=cGreaterOrEq);switch(Data[i01-cEqual].Analyze
-y91
-0),eO3)y33
-l5::MakeFalse:xO
-0);nV
+yP1
+ConstantFolding_Comparison(eR{using
+l33
+RangeComparisonsData;assert(tree.GetOpcode()>=cEqual&&tree.GetOpcode()<=cGreaterOrEq);e23
+Data[t72-cEqual].Analyze(xW
+0),xW
+1))){case
+l5::MakeFalse:nU
+0);nZ
l5
-c51:xO
-1)yN3
-n23:tI3
-cEqual)yN3
-t72:tI3
-cNEqual)yN3
-MakeNotNotP0:tI3
-cNotNot)yO3
-1)yN3
-MakeNotNotP1:tI3
-cNotNot)yO3
-0)yN3
-MakeNotP0:tI3
-cNot)yO3
-1)yN3
-MakeNotP1:tI3
-cNot)yO3
-0)yN3
-xB:;}
-if
-y91
-1)i61)switch
-y91
-0)nC
-y33
+nC1:nU
+1
+nY3
+lN3:tD2
+cEqual
+nY3
+t62:tD2
+i51
+nY3
+MakeNotNotP0:tD2
+cNotNot
+yB
+i91
+1
+nY3
+MakeNotNotP1:tD2
+cNotNot
+yB
+i91
+0
+nY3
+MakeNotP0:tD2
+cNot
+yB
+i91
+1
+nY3
+MakeNotP1:tD2
+cNot
+yB
+i91
+0
+nY3
+xJ:;}
+if(xW
+1)tD1)e23
+c93){case
cAsin:lM
-fp_sin
-c53
+fp_sin(xW
+iP2
cAcos:lM
-fp_cos
-tG));tI3
-i01==cLess?cGreater:i01==cLessOrEq?cGreaterOrEq:i01==cGreater?cLess:i01==cGreaterOrEq?cLessOrEq:i01);nV
+fp_cos(xW
+i8))yB
+eL3
+t72==cLess?cGreater:t72==cLessOrEq?cGreaterOrEq:t72==cGreater?cLess:t72==cGreaterOrEq?cLessOrEq:t72);nZ
cAtan:lM
-fp_tan
-c53
+fp_tan(xW
+iP2
cLog:lM
-fp_exp
-c53
+fp_exp(xW
+iP2
cSinh:lM
-fp_asinh
-c53
-cTanh:if(fp_less(fp_abs
-tG
-xE3
+fp_asinh(xW
+iP2
+cTanh:if(fp_less(fp_abs(xW
+i8)nH2
lM
-fp_atanh
-tG))xJ2
-break;c73
-yF3
+fp_atanh(xW
+i8))yQ2
+break;yF3
+xY3
return
-tR3}
+t23}
#include <list>
#include <algorithm>
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
-FUNCTIONPARSERTYPES;lF3{
+l33
+FUNCTIONPARSERTYPES;l33{
#ifdef DEBUG_SUBSTITUTIONS
yE
double
d){union{double
d;uint_least64_t
-h;}
-t82
-d=d;lM1
h
-nZ1
+c42
+d=d;lR1
+h
+nX1
#ifdef FP_SUPPORT_FLOAT_TYPE
yE
float
f){union{float
f;uint_least32_t
-h;}
-t82
-f=f;lM1
h
-nZ1
+c42
+f=f;lR1
+h
+nX1
#endif
#ifdef FP_SUPPORT_LONG_DOUBLE_TYPE
yE
double
ld){union{long
double
-ld;e12{uint_least64_t
-a;iF2
+ld;e72{uint_least64_t
+a;x83
short
b;}
-s;}
-t82
-ld=ld;lM1
+s
+c42
+ld=ld;lR1
s.b<<data.s.a
-nZ1
+nX1
#endif
#ifdef FP_SUPPORT_LONG_INT_TYPE
yE
long
ld){o<<"("
<<std::hex<<ld
-nZ1
+nX1
#endif
#endif
}
nE)){}
lN
const
-iV2&i
-yA
-xO3
+Value_t&i
+y8
+xD3
nE
-i)){data
-x7
+i
+x52
#ifdef __GXX_EXPERIMENTAL_CXX0X__
lN
-iV2&&i
-yA
-xO3
+Value_t&&i
+y8
+xD3
nE
-std::move(i))){data
-x7
+tF2
+i)x52
#endif
lN
-iF2
+x83
v
-yA
+y8
VarTag
nE
-l03,v
-xQ2
-xB2
+iU2,v
+x52
+lN
+iU1
o
-yA
+y8
OpcodeTag
nE
o
-xQ2
-xB2
-o,iF2
+x52
+lN
+iU1
+o,x83
f
-yA
+y8
FuncOpcodeTag
nE
o,f
-xQ2
-lC2
-b
-yA
+x52
+lN
+const
+eX1
+y8
CloneTag
nE*b.data)){}
-xW3
-eJ::~CodeTree(){}
+tK1
+yZ2::~c02(){}
lB
-ReplaceWithImmed
-cG1
-i){
+ReplaceWithImmed(tX1{
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Replacing "
-i13(*this
-eY3
-IsImmed())OutFloatHex(std::cout,GetImmed()lT2" with const value "
-<<i;OutFloatHex(std::cout,i
-lT2"\n"
+cV2<<"Replacing "
+iL2*this);if(IsImmed())OutFloatHex(cV2,GetImmed()lE2" with const value "
+<<i;OutFloatHex(cV2,i
+lE2"\n"
;
#endif
data=new
-xH2
-xK(i);}
-xW3
-e12
-ParamComparer{iG2()lQ3
-a,lC2
-b
-e83{if(a.y22!=b.y22)return
-a.y22<b.y22
-n31
+xK2
+xF(i);}
+tK1
+e72
+ParamComparer{iD2()iR1
+xC3
+eX1)const{if(a
+nP2!=b
+nP2)return
+a
+nP2<b
+nP2
+i1
a.GetHash()<b.GetHash();}
}
-xR3
-xH2
-xK::Sort(y13
-Opcode
-y33
+;xL1
+xK2
+xF::Sort(yY3
+Opcode){case
cAdd:case
cMul:case
cMin:case
cAbsOr:case
cHypot:case
cEqual:case
-cNEqual:std::sort(iY2
-iN2
-iY2
+i51:std::sort(iR2
+iJ2
+iR2
end(),ParamComparer
-xK());lC
+xF());lC
cLess
lY
cGreater;}
cGreaterOrEq
lY
cLessOrEq;}
-break;c73
-yF3}
+break;yF3
+xY3}
lB
AddParam
-lQ3
-param){xY.push_back(param);}
+iR1
+param){y1
+c52
+param);}
lB
-AddParamMove(eJ¶m){xY.push_back(eJ());xY.back().swap(param);}
+AddParamMove(yZ2¶m){y1
+c52
+yZ2());y1.back().swap(param);}
lB
SetParam
-iA1
-which,lC2
-b)nW1
+iZ1
+which,const
+eX1)nW1
which
-iX2
-xY[which]=b;}
+iQ2
+y1[which]=b;}
lB
-nG1
+nB1
size_t
-which,eJ&b)nW1
+which,eX1)nW1
which
-iX2
-xY[which
-i63
+iQ2
+y1[which
+tQ3
b);}
lB
AddParams
-cH1
-nK){xY.insert(xY.end(),lZ2.iN2
-lZ2.end());}
+iS1
+nK){y1.insert(y1.end(),n12.iJ2
+n12.end());}
lB
AddParamsMove(nK){size_t
-endpos=xY.tF3,added=lZ2.tF3;xY.t73
-endpos+added,eJ());for
-iA1
-p=0;p<added;++p)xY[endpos+p
-i63
-lZ2[p]);}
+endpos=y1
+eJ3,added=n12
+eJ3;y1
+xF3
+endpos+added,yZ2())eK3
+p=0;p<added;++p)y1[endpos+p
+tQ3
+n12[p]);}
lB
AddParamsMove(nK,size_t
-n02)nW1
-n02
-iX2
-DelParam(n02);AddParamsMove(tA1}
+n22)nW1
+n22
+iQ2
+i91
+n22);AddParamsMove(tO1}
lB
SetParams
-cH1
-nK){eH
-tmp(tA1
-xY.i72}
+iS1
+nK){eK
+tmp(tO1
+y1.swap(tmp);}
lB
-SetParamsMove(nK){xY.swap(tA1
-lZ2.clear();}
+SetParamsMove(nK){y1.swap(tO1
+n12.clear();}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
lB
-SetParams(eH&&lZ2){SetParamsMove(tA1}
+SetParams(eK&&n12){SetParamsMove(tO1}
#endif
lB
-DelParam
-iA1
-index){eH&Params=xY;
+i91
+size_t
+index){eK&Params=y1;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-iY2
-erase(iY2
+iR2
+erase(iR2
begin()+index);
#else
-Params[index].data=0;for
-iA1
-p=index;p+1<xX3;++p)Params[p].data.UnsafeSetP(&*Params[p+1
-iX2
-Params[xX3-1].data.UnsafeSetP(0);iY2
-t73
-xX3-1);
+t63
+index].data=0
+eK3
+p=index;p+1<iS2;++p)t63
+p].data.UnsafeSetP(&*t63
+p+1
+iQ2
+t63
+iS2-1].data.UnsafeSetP(0);iR2
+resize(iS2-1);
#endif
}
lB
-DelParams(){xY.clear();}
-xN1
-eJ::IsIdenticalTo
-lQ3
-b
-e83{if(&*data==&*b.data)return
+DelParams(){y1.clear();}
+yP1
+yZ2::IsIdenticalTo
+iS1
+eX1)const{if(&*data==&*b.data)return
true
-n31
+i1
data->IsIdenticalTo(*b.data);}
-xN1
-xH2
-xK::IsIdenticalTo
-cH1
-xH2
-xK&b
-e83{if(Hash!=b.Hash
-cL
-if(Opcode!=tK3
-cL
-switch(Opcode
-y33
+yP1
+xK2
+xF::IsIdenticalTo
+iS1
+xK2
+xF&b)const{if(Hash!=b.Hash
+cQ
+if(Opcode!=b.Opcode
+cQ
+e23
+Opcode){case
cImmed:return
-cB3
-Value,tL3;case
-l03:return
-l22==b.l12
+lJ3
+Value,b.Value)t83
+iU2:return
+lL2==b.lK2
case
cFCall:case
-cPCall:if(l22!=b.l22
-cL
-break;c73
-yF3
-if(xX3!=b.xX3
-cL
+cPCall:if(lL2!=b.lL2
+cQ
+break;yF3
+xY3
+if(iS2!=b.iS2
+cQ
for
-iA1
-a=0;a<xX3;++a){if(!Params[a]xF
-b.Params[a])cL}
-return
-true;}
+iZ1
+a=0;a<iS2;++a){if(!iT2
+xI
+b.iT2)cQ}
+lD2}
lB
Become
-lQ3
-b){if(&b!=this&&&*data!=&*b.data){DataP
-tmp=b.data;l61
-data.i72}
+iS1
+eX1){if(&b!=this&&&*data!=&*b.data){DataP
+tmp=b.data;lD1
+data.swap(tmp);}
}
lB
CopyOnWrite(){if(GetRefCount()>1)data=new
-xH2
-xK(*data);}
-xW3
-eJ
-eJ::GetUniqueRef(){if(GetRefCount()>1)return
-eJ(*this,CloneTag())n31*this;}
-tX):yT
+xK2
+xF(*data);}
+tK1
+yZ2
+yZ2::GetUniqueRef(){if(GetRefCount()>1)return
+yZ2(*this,CloneTag())i1*this;}
+i4):yS
cNop
-t92(),n8
-tX
-const
-xH2&b):yT
-tK3
-t92(tL3,l22(b.cQ1,Params(b.Params),Hash(b.Hash),Depth(b.Depth),tP1
-b.l32){}
-tX
+iR3),n8
+i4
const
-iV2&i):yT
+xK2&b):yS
+b.Opcode
+iR3
+b.Value),lL2(b.cO1,t53
+b.Params),Hash(b.Hash),Depth(b.Depth
+eB1
+b.lM2){}
+i4
+tX1:yS
cImmed
-t92(i),n8
+iR3
+i),n8
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-tX
-xH2
-xK&&b):yT
-tK3
-t92
-c72
-tL3),l22(b.cQ1,Params
-c72
-b.Params)),Hash(b.Hash),Depth(b.Depth),tP1
-b.l32){}
-tX
-iV2&&i):yT
+i4
+xK2
+xF&&b):yS
+b.Opcode
+iR3
+tF2
+b.Value)),lL2(b.cO1,t53
+tF2
+b.Params)),Hash(b.Hash),Depth(b.Depth
+eB1
+b.lM2){}
+i4
+Value_t&&i):yS
cImmed
-t92
-c72
+iR3
+tF2
i)),n8
#endif
-tX
-xB2
-o):yT
+i4
+iU1
+o):yS
o
-t92(),n8
-tX
-xB2
-o,iF2
-f):yT
+iR3),n8
+i4
+iU1
+o,x83
+f):yS
o
-t92(),l22(f),Params(),Hash(),Depth(1),tP1
+iR3),lL2(f),t53),Hash(),Depth(1
+eB1
0){}
}
#endif
#include <set>
#include <iostream>
using
-lF3
+l33
FUNCTIONPARSERTYPES;
#ifdef FUNCTIONPARSER_SUPPORT_DEBUGGING
-lF3{tZ1
-n12(nO,std
-c7&done,std::ostream&o){nB1
-n12
-l64
-done,o);std::ostringstream
+l33{xL1
+tZ1
+nO,std
+c9&done,std::ostream&o){x51
+tZ1
+xW
+a),done,o);std::ostringstream
buf
-i13(tree,buf);done[tree.GetHash()].insert(buf.str());}
+iL2
+tree,buf);done[nJ2].insert(buf.str());}
}
#endif
t5{
#ifdef FUNCTIONPARSER_SUPPORT_DEBUGGING
-tZ1
-DumpHashes(cF){std
-c7
-done;n12(tree,done,o);for(std
-c7::const_iterator
-i=done.yU3
+xL1
+DumpHashes(cE){std
+c9
+done;tZ1
+tree,done,o);for(std
+c9::const_iterator
+i=done.y73
i!=done.end();++i){const
-std::set<std
-cC3>&flist=i
-e82;if(flist.tF3!=1)o<<"ERROR - HASH COLLISION?\n"
-;for(std::set<std
-cC3>::const_iterator
-j=flist.yU3
+std::set<eM3>&flist=i
+eC2;if(flist
+eJ3!=1)o<<"ERROR - HASH COLLISION?\n"
+;for(std::set<eM3>::const_iterator
+j=flist.y73
j!=flist.end();++j){o<<'['<<std::hex<<i->first.hash1<<','<<i->first.hash2<<']'<<std::dec;o<<": "
<<*j<<"\n"
;}
}
}
-tZ1
-DumpTree(cF){nH3
-iQ3;switch(i01
-y33
-cImmed:o<<eC3
-c63
-l03:o<<"Var"
-<<(tree.GetVar()-l03)c63
-cAdd:iQ3"+"
+xL1
+DumpTree(cE){e32
+iF3;e23
+t72){case
+cImmed:o<<tree
+x41
+t73
+iU2:o<<"Var"
+<<(tree.GetVar()-iU2)t73
+cAdd:iF3"+"
;lC
-cMul:iQ3"*"
+cMul:iF3"*"
;lC
-cAnd:iQ3"&"
+cAnd:iF3"&"
;lC
-cOr:iQ3"|"
+cOr:iF3"|"
;lC
-cPow:iQ3"^"
-;break;c73
-iQ3;o<<c83
-i01);l83
-cFCall||i01==cPCall)o<<':'<<tree.GetFuncNo();}
-o<<'(';if(eM<=1&&sep2[1])o<<(sep2+1)<<' ';nB1{if(a>0)o<<' 'i13
-l64
-o
-eY3
-a+1<eM)o<<sep2;}
+cPow:iF3"^"
+;break;yF3
+iF3;o<<FP_GetOpcodeName(t72);cZ2
+cFCall||t72==cPCall)o<<':'<<tree.GetFuncNo();}
+o<<'(';if
+l51<=1&&sep2[1])o<<(sep2+1)<<' ';x51{if(a>0)o<<' '
+iL2
+xW
+a),o);if(a+1<tree.GetParamCount())o<<sep2;}
o<<')';}
-tZ1
-DumpTreeWithIndent(cF,const
-std
-cC3&indent){o<<'['<<std::hex<<(void*)(&tree.l02))<<std::dec<<','<<tree.GetRefCount()<<']';o<<indent<<'_';switch(i01
-y33
+xL1
+DumpTreeWithIndent(cE,const
+eM3&indent){o<<'['<<std::hex<<(void*)(&tree.lJ2))<<std::dec<<','<<tree.GetRefCount()<<']';o<<indent<<'_';e23
+t72){case
cImmed:o<<"cImmed "
-<<eC3;o<<'\n'c63
-l03:o<<"VarBegin "
-<<(tree.GetVar()-l03);o<<'\n'n31;c73
-o<<c83
-i01);l83
-cFCall||i01==cPCall)o<<':'<<tree.GetFuncNo();o<<'\n';}
-nB1{std
-cC3
-ind=indent;for
-iA1
-p=0;p<ind.tF3;p+=2)if(ind[p]=='\\')ind[p]=' ';ind+=(a+1<eM)?" |"
+<<tree
+x41;o<<'\n'
+t73
+iU2:o<<"VarBegin "
+<<(tree.GetVar()-iU2);o<<'\n'
+i1;yF3
+o<<FP_GetOpcodeName(t72);cZ2
+cFCall||t72==cPCall)o<<':'<<tree.GetFuncNo();o<<'\n';}
+x51{eM3
+ind=indent
+eK3
+p=0;p<ind
+eJ3;p+=2)if(ind[p]=='\\')ind[p]=' ';ind+=(a+1<tree.GetParamCount())?" |"
:" \\"
-;DumpTreeWithIndent
-l64
-o,ind);}
+;DumpTreeWithIndent(xW
+a),o,ind);}
o<<std::flush;}
#endif
}
#endif
using
-lF3
-l21;using
-lF3
+l33
+lA1;using
+l33
FUNCTIONPARSERTYPES;
#include <cctype>
-lF3
-l21{iF2
+l33
+lA1{x83
ParamSpec_GetDepCode
-cH1
-e42&b
-y13
-b.first
-y33
-tG3:{cO*s=(cO*)b
-tE3
-n31
+iS1
+eA2&b
+yY3
+b.first){case
+ParamHolder:{cM*s=(cM*)b.second
+i1
s->depcode;}
case
-SubFunction:{cP*s=(cP*)b
-tE3
-n31
+SubFunction:{cN*s=(cN*)b.second
+i1
s->depcode;}
-c73
yF3
+xY3
return
0;}
-tZ1
+xL1
DumpParam
-cH1
-e42&yG2
+iS1
+eA2&yA2
std::ostream&o){static
const
char
,"b"
,"c"
}
-;iF2
+;x83
y32
-0;switch(yH2.first
-y33
+0;e23
+lX3.first){case
NumConstant:{const
ParamSpec_NumConstant
-xK
-yK3
-cH1
+xF¶m=*iS1
ParamSpec_NumConstant
-xK*c61
-using
-lF3
-FUNCTIONPARSERTYPES;o.precision(12);o<<yL3
-constvalue;yF3
-case
-tG3:{cO
-yK3(cO*c61
-o<<ParamHolderNames[yL3
-index];y32
-yL3
-constraints;yF3
+xF*tF1;using
+l33
+FUNCTIONPARSERTYPES;o.precision(12);o<<param.constvalue;xY3
case
-SubFunction:{cP
-yK3(cP*c61
-y32
-yL3
-constraints;yF
+ParamHolder:{cM&yU3
+cM*tF1;o<<ParamHolderNames[param.index];y32
+param.constraints;xY3
+case
+SubFunction:{cN&yU3
+cN*tF1;y32
+param.constraints;yF
GroupFunction){if
-y23
-l81==cNeg){o<<"-"
+yZ3
+lG1==cNeg){o<<"-"
;n2}
-lJ2
-yL3
-l81==cInv){o<<"/"
+iP1
+param.lG1==cInv){o<<"/"
;n2}
-else{std
-cC3
-opcode=c83(xB2)yL3
-l81).substr(1)yM3
-0;a<opcode.tF3;++a)opcode[a]=(char)std::toupper(opcode[a]);o<<opcode<<"( "
+else{eM3
+opcode=FP_GetOpcodeName((iU1)param.lG1).substr(1
+iY1
+0;a<opcode
+eJ3;++a)opcode[a]=(char)std::toupper(opcode[a]);o<<opcode<<"( "
;n2
o<<" )"
;}
}
-else{o<<'('<<c83(xB2)yL3
-l81)<<' ';yF
+else{o<<'('<<FP_GetOpcodeName((iU1)param.lG1)<<' ';yF
PositionalParams)o<<'[';yF
SelectedParams)o<<'{';n2
if
-y23
+yZ3
data.n1!=0)o<<" <"
-<<yL3
-data.n1<<'>';yF
+<<iH3.n1<<'>';yF
PositionalParams)o<<"]"
;yF
SelectedParams)o<<"}"
;o<<')';}
-yF3
-l73
-ImmedConstraint_Value(constraints&ValueMask)y33
+xY3
+c73(ImmedConstraint_Value(constraints&ValueMask)){case
ValueMask:lC
Value_AnyNum:lC
-nY2:o<<"@E"
+x62:o<<"@E"
;lC
Value_OddInt:o<<"@O"
;lC
-tS1:o<<"@I"
+i11:o<<"@I"
;lC
Value_NonInteger:o<<"@F"
;lC
-eJ1:o<<"@L"
-;yJ3
-ImmedConstraint_Sign(constraints&SignMask)y33
+eY1:o<<"@L"
+;yV3
+ImmedConstraint_Sign(constraints&SignMask)){case
SignMask:lC
Sign_AnySign:lC
-nH1:o<<"@P"
+nD1:o<<"@P"
;lC
-eK1:o<<"@N"
-;yJ3
-ImmedConstraint_Oneness(constraints&OnenessMask)y33
+eZ1:o<<"@N"
+;yV3
+ImmedConstraint_Oneness(constraints&OnenessMask)){case
OnenessMask:lC
Oneness_Any:lC
Oneness_One:o<<"@1"
;lC
Oneness_NotOne:o<<"@M"
-;yJ3
-ImmedConstraint_Constness(constraints&ConstnessMask)y33
+;yV3
+ImmedConstraint_Constness(constraints&ConstnessMask)){case
ConstnessMask:lC
-tR1:if(yH2.first==tG3){cO
-yK3(cO*c61
-if
-y23
-index<2)yF3
+i01:if(lX3.first==ParamHolder){cM&yU3
+cM*tF1;if
+yZ3
+index<2)xY3
o<<"@C"
;lC
Constness_NotConst:o<<"@V"
;lC
-Oneness_Any:yF3}
-tZ1
+Oneness_Any:xY3}
+xL1
DumpParams
-nT2
-paramlist,iF2
-count,std::ostream&o){for(eQ1=0;a<count;++a){if(a>0)o<<' ';const
-e42¶m=e81
-xK(paramlist,a);DumpParam
-xK(param,o);iF2
-depcode=ParamSpec_GetDepCode(param
-eY3
-depcode!=0)o<<"@D"
+lT1
+paramlist,x83
+count,std::ostream&o){for
+lT1
+a=0;a<count;++a){if(a>0)o<<' ';const
+eA2¶m=ParamSpec_Extract
+xF(paramlist,a);DumpParam
+xF(param,o);x83
+depcode=ParamSpec_GetDepCode(param);if(depcode!=0)o<<"@D"
<<depcode;}
}
}
#include <algorithm>
using
-lF3
-l21;using
-lF3
-FUNCTIONPARSERTYPES;lF3{cO
+l33
+lA1;using
+l33
+FUNCTIONPARSERTYPES;l33{cM
plist_p[37]={{2,0,0x0}
-nP
+nT
0,0x4}
-nP
-nH1,0x0}
-nP
-eK1|Constness_NotConst,0x0}
-nP
+nT
+nD1,0x0}
+nT
+eZ1|Constness_NotConst,0x0}
+nT
Sign_NoIdea,0x0}
-nP
-eJ1,0x0}
+nT
+eY1,0x0}
,{3,Sign_NoIdea,0x0}
,{3,0,0x0}
-,{3,eJ1,0x0}
+,{3,eY1,0x0}
,{3,0,0x8}
,{3,Value_OddInt,0x0}
,{3,Value_NonInteger,0x0}
-,{3,nY2,0x0}
-,{3,nH1,0x0}
-,{0,eK1|lV{0,lV{0,nH1|lV{0,nY2|lV{0,tR1,0x1}
-,{0,tS1|nH1|lV{0,tT1
-tR1,0x1}
-,{0,tT1
-lV{0,Oneness_One|lV{0,eJ1|lV{1,lV{1,nY2|lV{1,tT1
-lV{1,tS1|lV{1,nH1|lV{1,eK1|lV{6,0,0x0}
+,{3,x62,0x0}
+,{3,nD1,0x0}
+,{0,eZ1|lV{0,lV{0,nD1|lV{0,x62|lV{0,i01,0x1}
+,{0,i11|nD1|lV{0,i21
+i01,0x1}
+,{0,i21
+lV{0,Oneness_One|lV{0,eY1|lV{1,lV{1,x62|lV{1,i21
+lV{1,i11|lV{1,nD1|lV{1,eZ1|lV{6,0,0x0}
,{4,0,0x0}
-,{4,tS1,0x0}
-,{4,lV{4
-tU3
-5,0,0x0}
+,{4,i11,0x0}
+,{4,lV{4,0,0x16}
+,{5,0,0x0}
,{5,lV}
-nJ1
-e12
+yO1
+e72
plist_n_container{static
const
ParamSpec_NumConstant
-xK
+xF
plist_n[20];}
-nJ1
+yO1
const
ParamSpec_NumConstant
-xK
+xF
plist_n_container
-xK::plist_n[20]={{iV2(-2
-tY-1
-tY-0.5
-tY-0.25
-tY
+xF::plist_n[20]={{e62-2
+i5-1
+i5-0.5
+i5-0.25
+i5
0
-tA2
+tG2
fp_const_deg_to_rad
-xK(tA2
+xF(tG2
fp_const_einv
-xK(tA2
+xF(tG2
fp_const_log10inv
-xK(tY
+xF(i5
0.5
-tA2
+tG2
fp_const_log2
-xK(tY
+xF(i5
1
-tA2
+tG2
fp_const_log2inv
-xK(tY
+xF(i5
2
-tA2
+tG2
fp_const_log10
-xK(tA2
+xF(tG2
fp_const_e
-xK(tA2
+xF(tG2
fp_const_rad_to_deg
-xK(tA2-fp_const_pihalf
-xK(),xT1{y21,xT1{fp_const_pihalf
-xK(),xT1{fp_const_pi
-xK(),xT1}
-;cP
-plist_s[517]={{{1,15,tS2
-398,tS2
-477,tS2
+xF(tG2-fp_const_pihalf
+xF(),xU1{xH1,xU1{fp_const_pihalf
+xF(),xU1{fp_const_pi
+xF(),xU1}
+;cN
+plist_s[517]={{{1,15,tH2
+398,tH2
+477,tH2
15,cNeg,GroupFunction,0}
-,tR1,0x1}
-,{{1,15,y42
+,i01,0x1
+lR3
+15,y42
24,y42
465,y42
466,y42
498,cInv,lT
2,327995
-xE
+x9
l0
2,48276
-xE
+x9
l6
260151
-xE
+x9
l6
470171
-xE
+x9
l6
169126
-xE
+x9
l6
48418
-xE
+x9
l6
1328
-xE
+x9
l6
283962
-xE
+x9
l6
169275
-xE
+x9
l6
39202
-xE
+x9
l6
283964
-xE
+x9
l6
283973
-xE
+x9
l6
476619
-xE
+x9
l6
296998
-xE
+x9
l6
47
-xE
+x9
SelectedParams,0}
,0,0x4
nH
161839
-xE
+x9
l6
25036
-xE
+x9
l6
35847
-xE
+x9
l6
60440
-xE
+x9
l6
30751
-xE
+x9
l6
270599
-xE
+x9
l6
60431
-xE
+x9
l6
259119
-xE
+x9
l6
183474
-xE
+x9
l6
332066
-xE
+x9
l6
7168
-xE
+x9
l6
197632
-xE
+x9
l6
291840
-xE
+x9
l6
283648
-xE
+x9
l6
238866
-xE
+x9
l6
239902
-xE
+x9
l6
31751
-xE
+x9
l6
244743
-xE
+x9
l6
384022
-xE
+x9
SelectedParams,0}
,0,0x4
nH
385262
-xE
+x9
l6
386086
-xE
+x9
l6
393254
-xE
+x9
SelectedParams,0}
,0,0x5
nH
393254
-xE
+x9
l6
386095
-xE
+x9
l6
387312
-xE
+x9
l6
18662
-xE
+x9
l6
61670
-xE
+x9
l6
387397
-xE
+x9
l6
247855
-xE
+x9
SelectedParams,0}
,0,0x1
nH
342063
-xE
+x9
l6
297007
-xE
+x9
l6
15820
-xE
+x9
l6
393263
-xE
+x9
l6
393263
-xE
+x9
SelectedParams,0}
,0,0x5
nH
161847
-xE
+x9
l6
258103
-xE
+x9
l6
249073
-xE
+x9
l6
249076
-xE
-iD
+x9
+iO
0,0
-xE
+x9
nF
0,0
-tU1
+i31
1,45
-xE
+x9
nF
1,53
-xE
+x9
nF
1,54
-xE
+x9
nF
1,55
-xE
+x9
nF
1,56
-xE
+x9
nF
1,26
-xE
+x9
nF
1,259
-tJ
-1}
-tU3{1,253
-xE
+eK2
+0x16
+lR3
+253
+x9
nF
1,272
-tU1
+i31
1,323
-tJ
-1}
-tU3{1,0
-xE
+eK2
+0x16
+lR3
+0
+x9
nF
1,21
-xE
+x9
nF
1,447
-tJ
-1}
-lA2
+eK2
+0x4
+lR3
449
-tJ
-1}
-lA2
+eK2
+0x4
+lR3
0
-tJ
-1}
-lA2
+eK2
+0x4
+lR3
0
tJ
2}
-lA2
+,0,0x4
+lR3
15
-xE
+x9
nF
1,24
tJ
,0,0x0
nH
58392
-tU1
+i31
0,0
tJ
1}
-,nH1,0x0
+,nD1,0x0
nH
24591
-yI3
+lS3
33807
-yI3
+lS3
48143
-yI3
+lS3
285720
-yI3
+lS3
290840
-yI3
+lS3
305152,l9
312400,l9
39202,l9
24583,l9
31751,l9
405511,l9
-321551,xU1
+321551
+iV2
327713,l9
322596,l9
88361,l9
286727,l9
90127,l9
131087,l9
-296976,tB1
+296976,tQ1
324623,l1
0x14
nH
332815,l1
0x10}
-,{{3,7340056,tB1
+,{{3,7340056,tQ1
289092,l9
-92176,xU1
+92176
+iV2
337935
-lB2
-7340060,l1
-tT2
+e31
+7340060
+lO3
7340176,l9
338959
-lB2
-7340061,xU1
+e31
+7340061
+iV2
7206,l9
-xJ3
+x63
l9
357414,l9
368678,l9
370745,l1
0x7}
,{{3,7340177,l9
-39277,tB1
-426398,l1
-tT2
-40272286,xU1
-490910,l1
-tT2
-40336798,xU1
+39277,tQ1
+426398
+lO3
+40272286
+iV2
+490910
+lO3
+40336798
+iV2
50600,l9
-426462,xU1
-490974,xU1
+426462
+iV2
+490974
+iV2
370726,l1
0x6
nH
0x6
nH
428070
-lB2
-40336862,xU1
+e31
+40336862
+iV2
38378,l9
50671
-lB2
+e31
47662080,l9
477184,l9
568320,l9
39279,l1
0x4}
,{{3,15779238,l9
-39338,tB1
+39338,tQ1
436262,l9
508966,l9
-39409,tB1
-296998,tB1
+39409,tQ1
+296998,tQ1
35847,l9
-15,tB1
+15,tQ1
377894,l9
386063,l1
0x1
57,l9
7456,l9
15674
-lB2
+e31
67579935,l9
39237,l9
58768,l9
62924,l9
121856,l9
15760
-lB2
+e31
64009216,l1
0x0}
-,{{0,0,xG
-0,0,iL
-2,e31
-2,e41
-3,e31
-3,e41
-38,xG
-1,38,iL
-14,xG
-1,57,xG
-1,16,eD2
+,{{0,0,xL
+0,0,iW
+2,eC1
+2,eD1
+3,eC1
+3,eD1
+38,xL
+1,38,iW
+14,xL
+1,57,xL
+1,16,eL2
0x0
nH
-471103,eD2
-0x1}
-,{{1,303,xG
-1,323,cE3
+471103,eL2
+0x1
+lR3
+303,xL
+1,323,yH3
0x0
nH
-471363,eD2
-0x16}
-,{{1,293,e31
-294,e41
-295,xG
-1,296,iL
-400,xG
-1,0,xG
-1,460,xG
-1,465,xG
-1,16,eD2
-0x1}
-,{{1,57,cE3
-0x1}
-,{{1,0,iL
-21,xG
-1,15,eD2
+471363,eL2
+0x16
+lR3
+293,eC1
+294,eD1
+295,xL
+1,296,iW
+400,xL
+1,0,xL
+1,460,xL
+1,465,xL
+1,16,eL2
+0x1
+lR3
+57,yH3
+0x1
+lR3
+0,iW
+21,xL
+1,15,eL2
0x0
nH
-24591,xG
-1,24,iL
-517,cE3
+24591,xL
+1,24,iW
+517,yH3
0x0
nH
46095,lK
33807,lK
50200,lK
62509,lK
-50176,lF,178176,eL1
-tV3
+50176,lF,178176,t21
+tF3
283648,lF,19456,lF,27648,lF,89088,lF,86016,lF,488448,lF,14342,lF,58375,lF,46147
-xZ
+xX
46151,lF,284679,lF,7183,lF,46159
-xZ
+xX
38993
-xZ
-50265,lF,50249,lF,283808,lF,284835,lF,24822,lF,10240,lF,11264,lF,7170,lF,xJ3
-lF,17408,lF,164864,lF,237568,lF,242688,eL1
+xX
+50265,lF,50249,lF,283808,lF,284835,lF,24822,lF,10240,lF,11264,lF,7170,lF,x63
+lF,17408,lF,164864,lF,237568,lF,242688,t21
0x14
nH
-476160,lF,25607,lF,121871,lF,50252,lF,39374,lF,50183,lF,7192,lF,121887,lF,252979,lF,46155,lF,38919,lF,50267,lF,50268,lF,50253,lF,46190,lF,50295,lF,7563,eL1
+476160,lF,25607,lF,121871,lF,50252,lF,39374,lF,50183,lF,7192,lF,121887,lF,252979,lF,46155,lF,38919,lF,50267,lF,50268,lF,50253,lF,46190,lF,50295,lF,7563,t21
0x10
nH
416811,lF,416819,lF,40046,lF,46191
-xZ
+xX
415795,lF,40047
-xZ
-415787,lF,39015,eL1
+xX
+415787,lF,39015,t21
0x5
nH
39326
-xZ
-39326,lF,39332,eL1
+xX
+39326,lF,39332,t21
0x5
nH
39333
-cW2
+cC2
50590
-xZ
+xX
50590,lF,39338
-xZ
-39338,lF,39335,eL1
+xX
+39338,lF,39335,t21
0x5
nH
15786
-xZ
+xX
146858,lF,39372,lF,39379,lF,39380,lF,39390
-xZ
+xX
50654
-xZ
-50654,lF,24,eL1
+xX
+50654,lF,24,t21
0x6
nH
-62,lF,24,lF,62,eL1
+62,lF,24,lF,62,t21
0x6
nH
43,lF,43
-xZ
+xX
51,lF,51
-xZ
+xX
50269,lF,50176
-xZ
+xX
50270,lF,39159,lF,39183
-xZ
+xX
7168
-xZ
+xX
31744,lF,99328,lF,31746,lF,100376,lF,39409
-xZ
+xX
39411
-xZ
+xX
39411,lF,39420,lF,39420
-xZ
-15,lF,39025,eL1
+xX
+15,lF,39025,t21
0x5
nH
39422,lF,16384,lF,62853,lF,15360,lF,15
-cW2
+cC2
16,lF,7183
-cW2
+cC2
7172
-l14
-yX1}
-,nH1,0x0
+tW2
+y71,nD1,0x0
nH
24591
-l14
+tW2
lT
2,50200
-l14
+tW2
lT
2,63521
-l14
+tW2
lT
2,62500
-l14
+tW2
lT
2,50453
-l14
+tW2
lT
-2,62488,cPow
-eP3
-tS3
-7,tS3
-194,tS3
+2,62488
+tW2
+lT
+1,0,t93
+7,t93
+194,t93
0,cAcos
-tT3
+tA3
cAcosh
-tT3
+tA3
cAsin
-tT3
+tA3
cAsinh
-nQ
+nS
119,cAsinh
-tT3
+tA3
cAtan
-eW1
+t11
306176,cAtan2
-eW1
-xJ3
+t11
+x63
cAtan2
-tT3
+tA3
cAtanh
-nQ
+nS
246,cCeil
-tT3
-cCeil,l13
-0,c92
-0,cCos,l13
-7,c92
-91,c92
-92,c92
-119,c92
-236,c92
-255,c92
-214,l23
-236,l23
-464,l23
-0,cCosh,l13
-0,l23
+tA3
+cCeil
+tB3
+0,cD2
+0,cCos
+tB3
+7,cD2
+91,cD2
+92,cD2
+119,cD2
+236,cD2
+255,cD2
+214,iW2
+236,iW2
+464,iW2
+0,cCosh
+tB3
+0,iW2
0,cExp
-nQ
+nS
7,cExp
-nQ
+nS
91,cExp
-tT3
-cF3
-7,cF3
-91,cF3
+tA3
+yI3
+7,yI3
+91,yI3
246,cFloor
-tT3
+tA3
cFloor,lA
0x4
nH
309540,cHypot
-eW1
+t11
316708,cHypot
-eW1
+t11
316724,cHypot,l0
-3,32513024,y52
+3,32513024,eM2
34627584
-n61
-31493120,y52
+iL
+31493120,eM2
89213952
-n61
+iL
149042176
-n61
+iL
246647808
-n61
+iL
301234176
-n61
+iL
494360576
-n61
+iL
498558976
-n61
+iL
62933520
-n61
-62933520,y52
+iL
+62933520,eM2
62933526
-n61
-62933526,y52
+iL
+62933526,eM2
24670208
-n61
+iL
579378176
-n61
+iL
573578240
-n61
+iL
32513024
-n61
+iL
566254592
-n61
+iL
7900160
-n61
+iL
588822528,cIf
-nQ
+nS
119,cInt
-nQ
-246
-cA2
-0
-cA2
-7
-cA2
-31
-cA2
-194
-cA2
-363
-cA2
+nS
+246,tI2
+0,tI2
+7,tI2
+31,tI2
+194,tI2
+363,tI2
15,cLog,lT
-1,24,cLog
-eP3
-cLog10
-tT3
+1,24,cLog,lT
+1,0,cLog10
+tA3
cLog2
-eW1
-xJ3
+t11
+x63
cMax
-eW1
+t11
35847,cMax
-eW1
+t11
30751,cMax
-tT3
+tA3
cMax,AnyParams,1}
,0,0x4
nH
-xJ3
+x63
cMin
-eW1
+t11
35847,cMin
-eW1
+t11
30751,cMin
-tT3
+tA3
cMin,AnyParams,1}
,0,0x4
nH
-24591,cMin
-eP3
-nZ2
-7,nZ2
-91,nZ2
-92,nZ2
-119,nZ2
-149,nZ2
+24591,cMin,lT
+1,0,x72
+7,x72
+91,x72
+92,x72
+119,x72
+149,x72
231,cSin,lA
-0x5}
-,{{1,246,nZ2
-255,nZ2
-254,nZ2
-0,cSin,l13
+0x5
+lR3
+246,x72
+255,x72
+254,x72
+0,cSin
+tB3
273,cSin,lA
-0x1}
-,{{1,214,y62
-231,cSinh,lA
-0x5}
-,{{1,246,y62
+0x1
+lR3
+214,y52
+231,tD3
+lA
+0x5
+lR3
+246,y52
+254,y52
+255,y52
+464,y52
+0,cSinh
+tB3
+0,y52
+15,cSqrt,lT
+1,0,cTan
+tA3
+cTan
+tB3
+115,cTan
+tB3
+116
+tC3
+231
+tC3
+246
+tC3
+273
+tC3
+254
+tC3
+255,cTan
+tA3
+y62
+0,cTanh
+tB3
+213,y62
+231,y62
+246,y62
254,y62
255,y62
-464,y62
-0,cSinh,l13
-0,y62
-15,cSqrt
-eP3
-cB2
-0,cTan,l13
-115,cTan,l13
-116,cB2
-231,cB2
-246,cB2
-273,cB2
-254,cB2
-255,cB2
-0,y92
-0,cTanh,l13
-213,y92
-231,y92
-246,y92
-254,y92
-255,y92
0,cTrunc
-eW1
+t11
15384,cSub,lT
2,15384,cDiv,lT
2,476626,cDiv,lT
-2,121913,tU2
-xJ3
-n42
-lA
-tV3
-xJ3
-tU2
-31744,n42
-lA
+2,121913,tJ2
+x63
+lP3
+tF3
+x63
+tJ2
+31744,lP3
0x20
nH
-31751,n42
-lA
+31751,lP3
0x24
nH
-31751,tU2
-121913,eM1
-l0
-2,xJ3
+31751,tJ2
+121913,i51
+t11
+x63
cLess,lA
-tV3
+tF3
41984,cLess,lA
0x4
nH
41984,cLess
-eW1
+t11
7,cLess
-eW1
-xJ3
+t11
+x63
cLessOrEq
-eW1
+t11
296182,cLessOrEq
-eW1
+t11
7168
-lJ3,lA
-tV3
+tV2,lA
+tF3
41984
-lJ3,lA
+tV2,lA
0x4
nH
41984
-lJ3
-eW1
+tV2
+t11
7
-lJ3
-eW1
-xJ3
-yB
+tV2
+t11
+x63
+y9
l0
2,296182,cGreaterOrEq
-tT3
-n22
-245,n22
-7,n22
-550,n22
-553,n22
-554,n22
-556,n22
-31,n22
-559,n22
-15,n22
+tA3
+n32
+245,n32
+7,n32
+550,n32
+553,n32
+554,n32
+556,n32
+31,n32
+559,n32
+15,n32
560,cNot
-eW1
-7706,n33
-xJ3
-n33
-35847,n33
-30751,n33
-463903,n33
-466975,cAnd,iD
+t11
+7706,lT3
+x63
+lT3
+35847,lT3
+30751,lT3
+463903,lT3
+466975,cAnd,iO
0,0,cAnd,nF
-2,xJ3
-eT3
-7706,eT3
-35847,eT3
-463903,eT3
-466975,eT3
-30751,cOr,iD
-1,0,n32
-91,n32
-131,n32
-245,n32
-215,n32
+2,x63
+e03
+7706,e03
+35847,e03
+463903,e03
+466975,e03
+30751,cOr,iO
+1,0,n42
+91,n42
+131,n42
+245,n42
+215,n42
246,cDeg
-nQ
+nS
246,cRad
-eW1
-xJ3
+t11
+x63
cAbsAnd,l6
-xJ3
-cAbsOr,iD
-1,0,cZ3
-tT3
+x63
+cAbsOr,iO
+1,0,cC3
+tA3
cAbsNotNot,l0
-3,32513024,cL3
+3,32513024,yT3
lA
0x0}
,}
;}
-lF3
-l21{const
+l33
+lA1{const
Rule
-grammar_rules[262]={{ProduceNewTree,17,1,0,{1,0,cAbs,eE2
-409,{1,146,cAtan,eE2
+grammar_rules[262]={{ProduceNewTree,17,1,0,{1,0,cAbs,eN2
+409,{1,146,cAtan,eN2
403
-nP
-1324,cG3
-eE2
+nT
+1324,cAtan2,eN2
405
-nP
-307201,cG3
-l2
-c22
+nT
+307201,cAtan2
+eL
253174
-nP
-255224,cG3
-l2
-c22
+nT
+255224,cAtan2
+eL
259324
-nP
-257274,cG3
-eE2
+nT
+257274,cAtan2,eN2
152,{1,252,cCeil
-iO
-486,{1,68,tW2
-482,{1,122,tW2
-483,{1,124,tW2
-151,{1,125,tW2
-419,{1,123,tW2
+i7
+486,{1,68
+yH2
+482,{1,122
+yH2
+483,{1,124
+yH2
+151,{1,125
+yH2
+419,{1,123
+yH2
0,{1,403,cCos,l2
2,1,246,{1,252,cCos,l2
-18,1,0,{1,400,tW2
+18,1,0,{1,400
+yH2
301,{1,406,cCosh,l2
2,1,246,{1,252,cCosh,l2
18,1,0,{1,400,cCosh
-iO
-458,{1,121,cFloor,eE2
-150,{1,252,cFloor,tW3
-156,{3,7382016,eB
-549,{3,8430592,eB
-556,{3,8436736,eB
-157,{3,42998784,eB
-550,{3,42999808,eB
-562,{3,43039744,eB
-557,{3,49291264,eB
-538,{3,49325056,eB
-469,{3,1058318,eB
-473,{3,1058324,eB
-473,{3,9438734,eB
+i7
+458,{1,121,cFloor,eN2
+150,{1,252,cFloor,tG3
+156,{3,7382016,eF
+549,{3,8430592,eF
+556,{3,8436736,eF
+157,{3,42998784,eF
+550,{3,42999808,eF
+562,{3,43039744,eF
+557,{3,49291264,eF
+538,{3,49325056,eF
+469,{3,1058318,eF
+473,{3,1058324,eF
+473,{3,9438734,eF
469,{3,9438740,cIf,l2
0,3,32542225,{3,36732434,cIf,l2
-0,3,32542231,{3,36732440,cIf,tX3
-573,{3,32513026,cIf,tX3
-515,{3,455505423,cIf,tX3
+0,3,32542231,{3,36732440,cIf,yR3
+573,{3,32513026,cIf,yR3
+515,{3,455505423,cIf,yR3
515,{3,433506837,cIf
-iO
-78,{1,256,tY3
-69,{1,258,tY3
-404,{1,72,tY3
+i7
+78,{1,256,cLog
+i7
+69,{1,258,cLog
+i7
+404,{1,72,cLog
+i7
159,{1,147,cLog,l2
0,1,0
-nP
+nT
487425,cMax
l3
16,1,445
-nP
-cH3
+nT
+yJ3
cMax
l3
0,1,0
-nP
+nT
483329,cMin
l3
16,1,446
-nP
-cH3
-cMin,c0
+nT
+yJ3
+cMin,c3
0,1,153
-nP
+nT
24832
-l14
-tW3
+tW2
+tG3
153
-nP
+nT
25854
-l14
-tW3
+tW2
+tG3
154
-nP
+nT
129039
-nX3
+tW2
+xV1
32055
-nX3
+tW2
+xV1
32056
-nX3
+tW2
+xV1
32057
-tV2
-166288
-nP
+tW2
+l2
+0,2,166288
+nT
32137
-nX3
+tW2
+xV1
33082
-tV2
-7168
-nP
+tW2
+l2
+0,2,7168
+nT
12688
-tV2
-7434
-nP
-12553
-y72
+tW2
+l2
+0,2,7434
+nT
+12553,tX2
435
-nP
-46146
-y72
+nT
+46146,tX2
436
-nP
-46154
-y72
+nT
+46154,tX2
437
-nP
-46150
-y72
+nT
+46150,tX2
169
-nP
-83983
-y72
+nT
+83983,tX2
168
-nP
-130082
-y72
+nT
+130082,tX2
175
-nP
+nT
133154
-y82
+tW2
+tI3
476160
-nP
+nT
471055
-y82
+tW2
+tI3
274432
-nP
+nT
273423
-y82
+tW2
+tI3
251904
-nP
+nT
266274
-y82
+tW2
+tI3
251904
-nP
-263186
-y72
-171,{1,252,cC2
-421,{1,68,cC2
-151,{1,122,cC2
-419,{1,124,cC2
-170,{1,125,cC2
-482,{1,123,cC2
-0,{1,405,cC2
+nT
+263186,tX2
+171,{1,252,cE2
+421,{1,68,cE2
+151,{1,122,cE2
+419,{1,124,cE2
+170,{1,125,cE2
+482,{1,123,cE2
+0,{1,405,cE2
172,{1,252,cSinh
-iO
+i7
328,{1,404,cSinh
-iO
-173,{1,252,l34
-0,{1,408,l34
-176,{1,410,l34
+i7
+173,{1,252,tJ3
+0,{1,408,tJ3
+176,{1,410,tJ3
177,{1,252,cTanh,l2
0,1,442
-nP
-449551,tZ
+nT
+449551,i6
1,441
-nP
-cH3
-tZ
+nT
+yJ3
+i6
1,167
-nP
-268549,tZ
+nT
+268549,i6
1,181
-nP
-276749,tZ
+nT
+276749,i6
1,180
-nP
-276500
-iD3
-190770
-nP
-189622
-iD3
-194748
-nP
-193723
-iD3
-202943
-nP
-196795
-iD3
-59699
-nP
-298148
-iD3
-59714
-nP
-325815
-iD3
-59724
-nP
+nT
+276500,i6
+2,190770
+nT
+189622,i6
+2,194748
+nT
+193723,i6
+2,202943
+nT
+196795,i6
+2,59699
+nT
+298148,i6
+2,59714
+nT
+325815,i6
+2,59724
+nT
343224
-xE
-c0
+x9
+c3
2,1,337,{1,333
tJ
1
-l33
+tF
336,{1,338
tJ
1}
}
-l44
-2,1,340
-nP
-1363,i0
+,{ReplaceParams,2,1,340
+nT
+1363
+nR
342
-nP
-1365,i0
+nT
+1365
+nR
463
-nP
-472524,i0
+nT
+472524
+nR
47
-nP
-356711,i0
+nT
+356711
+nR
349
-nP
-200751,i0
+nT
+200751
+nR
360
-nP
-199727,i0
+nT
+199727
+nR
480
-nP
-207053,i0
+nT
+207053
+nR
481
-nP
-208077,i0
+nT
+208077
+nR
417
-nP
-211144,i0
+nT
+211144
+nR
209
-nP
-211145,i0
+nT
+211145
+nR
418
-nP
-215240,i0
+nT
+215240
+nR
212
-nP
-212329,i0
+nT
+212329
+nR
204
-nP
-373097,i0
+nT
+373097
+nR
211
-nP
-372944,i0
+nT
+372944
+nR
217
-nP
-201944,i0
+nT
+201944
+nR
221
-nP
-223448,i0
+nT
+223448
+nR
367
-nP
-508329,i0
+nT
+508329
+nR
219
-nP
-508126,i0
+nT
+508126
+nR
224
-nP
-225705,i0
+nT
+225705
+nR
223
-nP
-225776,i0
+nT
+225776
+nR
365
-nP
-230825,i0
+nT
+230825
+nR
426
-nP
-377057,i0
+nT
+377057
+nR
497
-nP
-377054,i0
+nT
+377054
+nR
497
-nP
-204201,i0
+nT
+204201
+nR
426
-nP
-375280,i0
+nT
+375280
+nR
224
-nP
+nT
375006,cAdd
l3
2,2,407781
-nP
+nT
233698,cAdd
l3
2,2,59763
-nP
-233842,tZ
+nT
+233842,i6
1,372
-nP
-1397,lQ1
+nT
+1397,lW1
95
-nP
-24705,lQ1
+nT
+24705,lW1
96
-nP
-24708,lQ1
+nT
+24708,lW1
444
-nP
-449551,lQ1
+nT
+449551,lW1
443
-nP
-cH3
-lQ1
+nT
+yJ3
+lW1
100
-nP
-101750,lQ1
+nT
+101750,lW1
108
-nP
-106821,lQ1
+nT
+106821,lW1
105
-nP
+nT
103749
-nA2
+lU3
0,2,110607
-nP
+nT
108869
-nA2
+lU3
0,2,107535
-nP
+nT
109893,lJ
0
-l33
+tF
112
-nP
+nT
111634,cMul,SelectedParams,0
-l33
+tF
567,{1,52,lJ
1
-l33
+tF
568,{1,42,lJ
1}
}
-l44
-2,1,467
-nP
+,{ReplaceParams,2,1,467
+nT
45516
-iV
+xA
356
-nP
+nT
51555
-iV
+xA
468
-nP
+nT
49612
-iV
+xA
357
-nP
+nT
47459
-iV
+xA
429
-nP
+nT
438699
-iV
+xA
432
-nP
+nT
441774
-iV
+xA
486
-nP
+nT
498726
-iV
+xA
494
-nP
+nT
504870
-iV
+xA
382
-nP
+nT
435579
-iV
+xA
497
-nP
+nT
435709
-iV
+xA
426
-nP
+nT
508287
-iV
+xA
414
-nP
+nT
500092
-iV
+xA
499
-nP
+nT
352744
-iV
+xA
345
-nP
+nT
367092
-iV
+xA
381
-nP
+nT
425318
-iV
+xA
478
-nP
+nT
425460
-iV
+xA
47
-nP
+nT
512501
-iV
+xA
505
-nP
+nT
355817
-iV
+xA
47
-nP
+nT
516598
-iV
+xA
507
-nP
+nT
518182
-iV
+xA
508
-nP
+nT
358896
-iV
+xA
351
-nP
+nT
388605
-iV
+xA
511
-nP
+nT
360939
-iV
+xA
503
-nP
+nT
354788
-iV
+xA
514
-nP
+nT
525350
-iV
+xA
510
-nP
+nT
394342
-iV
+xA
386
-nP
+nT
351346
-nA2
+lU3
2,2,363004
-nP
+nT
361968
-nA2
+lU3
16,1,117
-nP
+nT
1157
-nA2
+lU3
16,1,118
-nP
+nT
1158
-nA2
+lU3
16,1,402
-nP
+nT
411024
-nA2
+lU3
16,2,58768
-nP
+nT
1472
-nA2
+lU3
16,2,15760
-nP
+nT
1474
-nA2
+lU3
17,1,0,{1,400
-nA2
+lU3
17,1,57,{1,14,lJ
+0}
+}
+,{ProduceNewTree,4,1,538
+nT
+41,lQ3
+yK3
0
-l91
-4
-n43
-41,n42
-l4
-4,1,0
-nP
-5167,n42
-yA2
+nT
+5167,lQ3
+cH
41984
-nP
-409641,cEqual
-c4
-n42
-yA2
-eY
-n42
-l43
-n42
-l2
-xB1
-24849
-tN2
-iE
-tN2
-n63
-281873
-tN2
-lA1
-tN2
-lB1
-n42
-l4
-4
-y43
-41,eM1
-l4
-4
-n43
-5167,eM1
-yA2
+e22
+lQ3
+cH
+tU
+lQ3
+cH
+eV
+lQ3
+cH
+eW
+cEqual
+cN1
+24849,cEqual
+eL
+tV
+cEqual
+eL
+n52
+281873,cEqual
+eL
+iP
+cEqual
+eL
+lH1
+lQ3
+yK3
+562
+nT
+41,i51,yK3
+538
+nT
+5167,i51,cH
41984
-nP
-409641,cNEqual
-c4
-eM1
-yA2
-eY
-eM1
-l43
-eM1
-l2
-xB1
-24849,eM1
-l2
-cI3
-eM1
-l2
-c22
-n63
-281873,eM1
-l2
-c22
-lA1,eM1
-l2
-c22
-lB1
-cNEqual
-c4
-eO1
-16,2,eY
-eO1
-16
-eI
-cLess,eE2
+e22
+i51,cH
+tU
+i51,cH
+eV
+i51,cH
+eW
+i51
+cN1
+24849,i51
+eL
+tV
+i51
+eL
+n52
+281873,i51
+eL
+iP
+i51
+eL
+lH1
+i51,cH
+tU
+yN3
+eV
+yN3
+eW
+cLess,eN2
571
-nP
-46080,eO1
-xB1
-24832,eO1
-c22
-yT1,eO1
-cI3
-eO1
-cJ3
-eO1
-c22
-xW1,eO1
-c22
-lA1,eO1
-c22
-lB1
-cLess,l4
-20
-y43
-409641,cLess
-c4
-t6
-16,2,eY
-t6
-16
-eI
-cLessOrEq,eE2
+nT
+46080,cLess
+cN1
+24832,cLess
+eL
+xW1
+cLess
+eL
+tV
+cLess
+eL
+n52
+tK3
+cLess
+eL
+nY1
+cLess
+eL
+iP
+cLess
+eL
+lH1
+cLess,yL3
+562
+e22
+yN3
+tU
+n62
+cH
+eV
+n62
+cH
+eW
+n62
+eN2
565
-nP
-409615,t6
-xB1
-24832,t6
-c22
-yT1,t6
-cI3
-t6
-cJ3
-t6
-c22
-xW1,t6
-c22
-lA1,t6
-c22
-lB1
-cLessOrEq,l4
-20
-y43
-409647,cLessOrEq
-c4
-lK3
-yA2
-eY
-lK3
-l43
-lK3
-eE2
+nT
+409615,cLessOrEq
+cN1
+24832,cLessOrEq
+eL
+xW1
+cLessOrEq
+eL
+tV
+cLessOrEq
+eL
+n52
+tK3
+cLessOrEq
+eL
+nY1
+cLessOrEq
+eL
+iP
+cLessOrEq
+eL
+lH1
+n62
+yL3
+562
+nT
+409647,n62
+cH
+tU
+cF2
+eV
+cF2
+eW
+cGreater,eN2
539
-nP
+nT
409615
-eP
-529654
-nP
+tV2
+cN1
24832
-eP
-yT1
-eP
-iE
-eP
-n63
-281856
-eP
+tV2
+eL
xW1
-eP
-lA1
-eP
-lB1
-lK3
-l4
-20
-n43
-409647
-lJ3
-c4
-yB
-yA2
-eY
-yB
-l43
-yB
-eE2
+cGreater
+eL
+tV
+cGreater
+eL
+n52
+281856
+tV2
+eL
+nY1
+cGreater
+eL
+iP
+cGreater
+eL
+lH1
+cGreater,yL3
+538
+nT
+409647,cF2
+tU
+y9
+cH
+eV
+y9
+cH
+eW
+y9
+eN2
572
-nP
-46080,yB
-l2
-xB1
-24832,yB
-l2
-c22
-yT1,yB
-l2
-cI3
-yB
-l2
-cJ3
-yB
-l2
-c22
-xW1,yB
-l2
-c22
-lA1,yB
-l2
-c22
-lB1
-yB
-l4
-20
-n43
-409641,yB
-l4
-4,1,519,{1,137,cNot,tX3
+nT
+46080,y9
+nQ2
+529654
+nT
+24832,y9
+nQ2
+xW1
+y9
+nQ2
+tV
+y9
+nQ2
+n52
+tK3
+y9
+nQ2
+nY1
+y9
+nQ2
+iP
+y9
+nQ2
+lH1
+y9
+yL3
+538
+e22
+y9
+yK3
+519,{1,137,cNot,yR3
571,{1,2,cNot,l2
0,1,452
-nP
-cH3
-n73
-0,2,537097,{3,547892744,cAnd,c0
+nT
+yJ3
+lV3
+0,2,537097,{3,547892744,cAnd,c3
16,1,566,{1,5,cAnd,AnyParams,1}
}
-l44
-16,1,569
-nP
-13314,n73
+,{ReplaceParams,16,1,569
+nT
+13314,lV3
16,1,544
-nP
-553498,n73
+nT
+553498,lV3
16,1,546
-nP
-462369,n73
+nT
+462369,lV3
16,1,548
-nP
-466465,n73
+nT
+466465,lV3
0,1,457
-nP
-cH3
+nT
+yJ3
xX1
570
-nP
+nT
13314,xX1
563
-nP
+nT
8197,xX1
541
-nP
+nT
553498,xX1
542
-nP
+nT
462369,xX1
543
-nP
+nT
466465,xX1
564
-nP
-143365,cOr,c0
-4,1,525,{1,137,cK3
-tX3
-572,{1,2,cK3
+nT
+143365,cOr,c3
+4,1,525,{1,137,yS3
+yR3
+572,{1,2,yS3
l4
-17,1,0,{1,0,cK3
-eE2
-537,{1,256,cAbsNotNot,c0
-18,1,531,{1,254,cAbsNotNot,c0
-0,1,572,{3,43039744,cL3
-tW3
-571,{3,49325056,cL3
-tX3
-454,{3,32513586,cL3
+17,1,0,{1,0,yS3
+eN2
+537,{1,256,cAbsNotNot,c3
+18,1,531,{1,254,cAbsNotNot,c3
+0,1,572,{3,43039744,yT3
+tG3
+571,{3,49325056,yT3
+yR3
+454,{3,32513586,yT3
l2
-16,3,32542225,{3,36732434,cL3
-yX1}
-}
+16,3,32542225,{3,36732434,yT3
+y71}
,}
-;e12
-grammar_optimize_abslogical_type{y2
+;e72
+grammar_optimize_abslogical_type{y3
9
-cS
+cT
grammar_optimize_abslogical_type
grammar_optimize_abslogical={9,{34,192,228,238,242,247,254,260,261}
}
;}
-e12
-grammar_optimize_ignore_if_sideeffects_type{y2
+e72
+grammar_optimize_ignore_if_sideeffects_type{y3
59
-cS
-grammar_optimize_ignore_if_sideeffects_type
-grammar_optimize_ignore_if_sideeffects={59,{0,20,21,22,23,24,25,26,cQ
-iO1
-78,cR
cT
-e12
-grammar_optimize_nonshortcut_logical_evaluation_type{y2
+grammar_optimize_ignore_if_sideeffects_type
+grammar_optimize_ignore_if_sideeffects={59,{0,20,21,22,23,24,25,26,cO
+l42
+78,cP
+cU
+e72
+grammar_optimize_nonshortcut_logical_evaluation_type{y3
56
-cS
+cT
grammar_optimize_nonshortcut_logical_evaluation_type
-grammar_optimize_nonshortcut_logical_evaluation={56,{0,25,cQ
-iO1
-78,cR
+grammar_optimize_nonshortcut_logical_evaluation={56,{0,25,cO
+l42
+78,cP
241,243,244,245,246,248,249,250,251,252,253,255,256,257,258,259}
}
;}
-e12
-grammar_optimize_recreate_type{y2
+e72
+grammar_optimize_recreate_type{y3
22
-cS
+cT
grammar_optimize_recreate_type
grammar_optimize_recreate={22,{18,55,56,57,80,81,82,83,84,85,117,118,120,121,130,131,132,133,134,135,136,137}
}
;}
-e12
-grammar_optimize_round1_type{y2
+e72
+grammar_optimize_round1_type{y3
125
-cS
+cT
grammar_optimize_round1_type
-grammar_optimize_round1={125,{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,19,25,cQ
-37,38,iO1
-45,46,47,48,49,50,51,52,53,54,58,59,60,61,62,63,64,65,66,67,68,69,70,71,78,79,80,81,82,83,84,85,86,87,88,93,94,95,96,97,98,99,100,101,117,118,119,120,121,122,123,124,125,126,127,128,129,138,160,161,162,163,164,165,166,167,168,169,178,179,180,200,204,212,216,224,236,237,239,240,cT
-e12
-grammar_optimize_round2_type{y2
+grammar_optimize_round1={125,{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,19,25,cO
+37,38,l42
+45,46,47,48,49,50,51,52,53,54,58,59,60,61,62,63,64,65,66,67,68,69,70,71,78,79,80,81,82,83,84,85,86,87,88,93,94,95,96,97,98,99,100,101,117,118,119,120,121,122,123,124,125,126,127,128,129,138,160,161,162,163,164,165,166,167,168,169,178,179,180,200,204,212,216,224,236,237,239,240,cU
+e72
+grammar_optimize_round2_type{y3
103
-cS
+cT
grammar_optimize_round2_type
-grammar_optimize_round2={103,{0,15,16,17,25,cQ
-39,40,iO1
-45,46,47,48,49,50,51,52,53,54,59,60,72,73,78,79,86,87,88,89,90,91,92,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,119,122,123,124,125,126,127,128,139,159,160,161,162,163,164,165,166,167,168,169,178,179,180,200,204,212,216,224,236,237,239,240,cT
-e12
-grammar_optimize_round3_type{y2
+grammar_optimize_round2={103,{0,15,16,17,25,cO
+39,40,l42
+45,46,47,48,49,50,51,52,53,54,59,60,72,73,78,79,86,87,88,89,90,91,92,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,119,122,123,124,125,126,127,128,139,159,160,161,162,163,164,165,166,167,168,169,178,179,180,200,204,212,216,224,236,237,239,240,cU
+e72
+grammar_optimize_round3_type{y3
79
-cS
+cT
grammar_optimize_round3_type
grammar_optimize_round3={79,{74,75,76,77,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,170,171,172,173,174,175,176,177,181,182,183,184,185,186,187,188,189,190,191,193,194,195,196,197,198,199,201,202,203,205,206,207,208,209,210,211,213,214,215,217,218,219,220,221,222,223,225,226,227,229,230,231,232,233,234,235}
}
;}
-e12
-grammar_optimize_round4_type{y2
+e72
+grammar_optimize_round4_type{y3
12
-cS
+cT
grammar_optimize_round4_type
grammar_optimize_round4={12,{18,55,56,57,130,131,132,133,134,135,136,137}
}
;}
-e12
-grammar_optimize_shortcut_logical_evaluation_type{y2
+e72
+grammar_optimize_shortcut_logical_evaluation_type{y3
53
-cS
+cT
grammar_optimize_shortcut_logical_evaluation_type
-grammar_optimize_shortcut_logical_evaluation={53,{0,25,cQ
-iO1
-78,cR
-cT}
-lF3
-l21{xW3
-e42
-e81
-nT2
-paramlist,nA1){index=(paramlist>>(index*10))&1023;if(index>=57)return
-e42(SubFunction,cD2
-plist_s[index-57]eY3
-index>=37)return
-e42(NumConstant,cD2
+grammar_optimize_shortcut_logical_evaluation={53,{0,25,cO
+l42
+78,cP
+cU}
+l33
+lA1{tK1
+eA2
+ParamSpec_Extract
+lT1
+paramlist,lJ1){index=(paramlist>>(index*10))&1023;if(index>=57)return
+eA2(SubFunction,cG2
+plist_s[index-57]);if(index>=37)return
+eA2(NumConstant,cG2
plist_n_container
-xK::plist_n[index-37])n31
-e42(tG3,cD2
+xF::plist_n[index-37])i1
+eA2(ParamHolder,cG2
plist_p[index]);}
}
#ifdef FP_SUPPORT_OPTIMIZER
#include <map>
#include <sstream>
using
-lF3
+l33
FUNCTIONPARSERTYPES;using
-lF3
-l21;using
+l33
+lA1;using
t5;using
-yL1;lF3{nR1
-It,xK3
-T,xK3
-Comp>eP1
+nG1;l33{nN1
+It,x93
+T,x93
+Comp>t31
MyEqualRange(It
first,It
last,const
T&val,Comp
comp){size_t
len=last-first;while(len>0){size_t
-yA3
+xR3
len/2;It
-xG3(first);xG3+=half;if(comp(*xG3,val)){first=xG3;++first;len=len-half-1;}
-lJ2
-comp(val,*xG3)){len=half;}
+x23(first);x23+=half;if(comp(*x23,val)){first=x23;++first;len=len-half-1;}
+iP1
+comp(val,*x23)){len=half;}
else{It
-left(first);{It&eF2=left;It
-last2(xG3);size_t
-len2=last2-eF2;while(len2>0){size_t
+left(first);{It&eO2=left;It
+last2(x23);size_t
+len2=last2-eO2;while(len2>0){size_t
half2=len2/2;It
-cD3(eF2);cD3+=half2;if(comp(*cD3,val)){eF2=cD3;++eF2;len2=len2-half2-1;}
+eN3(eO2);eN3+=half2;if(comp(*eN3,val)){eO2=eN3;++eO2;len2=len2-half2-1;}
else
len2=half2;}
}
first+=len;It
-right(++xG3);{It&eF2=right;It&last2=first;size_t
-len2=last2-eF2;while(len2>0){size_t
+right(++x23);{It&eO2=right;It&last2=first;size_t
+len2=last2-eO2;while(len2>0){size_t
half2=len2/2;It
-cD3(eF2);cD3+=half2;if(comp(val,*cD3))len2=half2;else{eF2=cD3;++eF2;len2=len2-half2-1;}
-eW2
-eP1(left,right);eW2
-eP1(first,first);}
-xW3
-e12
-OpcodeRuleCompare{iG2()lQ3
-tree,iF2
-yB2
-e83{const
-Rule&rule=grammar_rules[yB2]n31
-i01<rule
-cE2.subfunc_opcode;}
-iG2()nT2
-yB2,lC2
-tree
-e83{const
-Rule&rule=grammar_rules[yB2]n31
+eN3(eO2);eN3+=half2;if(comp(val,*eN3))len2=half2;else{eO2=eN3;++eO2;len2=len2-half2-1;}
+}
+eE3
+t31(left,right);}
+eE3
+t31(first,first);}
+tK1
+e72
+OpcodeRuleCompare{iD2()iS1
+nP1
+x83
+y72)const{const
+Rule&rule=grammar_rules[y72]i1
+t72<rule
+yR2.subfunc_opcode;}
+iD2()lT1
+y72,const
+eR
+const{const
+Rule&rule=grammar_rules[y72]i1
rule
-cE2.subfunc_opcode<i01;}
+yR2.subfunc_opcode<t72;}
}
-nJ1
+yO1
bool
-TestRuleAndApplyIfMatch
-cH1
-eT2
-eJ&tree,bool
-c1{MatchInfo
-xK
-info;lX1
-found(false,cW()eY3(rule.lC1
-LogicalContextOnly)&&!c1{tC1
+TestRuleAndApplyIfMatch(t41
+nP1
+bool
+c4{MatchInfo
+xF
+info;n31
+found(false,cZ());if((rule.lI1
+LogicalContextOnly)&&!c4{tR1
if(nB
IsIntType
-xK::nT3){if(rule.lC1
-NotForIntegers)tC1
-e63
-rule.lC1
-OnlyForIntegers)tC1
+xF::nS3){if(rule.lI1
+NotForIntegers)tR1
+cJ3
+rule.lI1
+OnlyForIntegers)tR1
if(nB
IsComplexType
-xK::nT3){if(rule.lC1
-NotForComplex)tC1
-e63
-rule.lC1
-OnlyForComplex)tC1
+xF::nS3){if(rule.lI1
+NotForComplex)tR1
+cJ3
+rule.lI1
+OnlyForComplex)tR1
for(;;){
#ifdef DEBUG_SUBSTITUTIONS
#endif
found=TestParams(rule
-cE2,tree,found.specs,info,true
-eY3
-found.found)break;if(!&*found.specs){fail:;
+yR2
+cU3,found.specs,info,true);if(found.found)break;if(!&*found.specs){fail:;
#ifdef DEBUG_SUBSTITUTIONS
-DumpMatch(rule
-iY3,false);
+DumpMatch
+yG2,false);
#endif
return
-tR3}
+t23}
#ifdef DEBUG_SUBSTITUTIONS
-DumpMatch(rule
-iY3,true);
+DumpMatch
+yG2,true);
#endif
-SynthesizeRule(rule
-iY3)xJ2}
-yL1{xN1
+SynthesizeRule
+yG2
+yQ2}
+nG1{yP1
ApplyGrammar
-cH1
-Grammar&tX2,eJ&tree,bool
-c1{if(tree.GetOptimizedUsing()==&tX2){
+iS1
+Grammar&tK2,nP1
+bool
+c4{if(tree.GetOptimizedUsing()==&tK2){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Already optimized: "
-i13(tree
-lT2"\n"
+cV2<<"Already optimized: "
+iL2
+tree
+lE2"\n"
<<std::flush;
#endif
return
-tR3
+t23
if(true){bool
changed
-tO3
-switch(i01
-y33
+eW3
+e23
+t72){case
cNot:case
cNotNot:case
cAnd:case
cOr:for
-iA1
-a=0;a<tree.x6
-true))x62
+iZ1
+a=0
+tV3
+true))yS1
lC
cIf:case
-cAbsIf:if(ApplyGrammar(tX2,lE2
-0),i01==cIf))x62
+cAbsIf:if(ApplyGrammar(tK2,xW
+0),t72==cIf))yS1
for
-iA1
-a=1;a<tree.x6
-c1)x62
-break;c73
+iZ1
+a=1
+tV3
+c4)yS1
+break;yF3
for
-iA1
-a=0;a<tree.x6
-false))x62}
-if(changed){tree.Mark_Incompletely_Hashed()xJ2}
+iZ1
+a=0
+tV3
+false))yS1}
+if(changed){tree.Mark_Incompletely_Hashed(yQ2}
typedef
const
-iF2
-short*n83;std::pair<n83,n83>range=MyEqualRange(tX2.rule_list,tX2.rule_list+tX2.rule_count,tree,OpcodeRuleCompare
-xK());std
-xV3<iF2
-short>rules;rules.xS3
-range
-tE3-range.first);for
-y5
-if(IsLogisticallyPlausibleParamsMatch(tD1
-cE2,tree))rules.push_back(*r);}
+x83
+short*lW3;std::pair<lW3,lW3>range=MyEqualRange(tK2.rule_list,tK2.rule_list+tK2.rule_count
+cU3,OpcodeRuleCompare
+xF());eO3
+x83
+short>rules;rules.xH3
+range.second-range.first);for
+y0
+if(IsLogisticallyPlausibleParamsMatch(tM1
+yR2
+cU3))rules
+c52*r);}
range.first=!rules
-cT3?&rules[0]:0;range
-tE3=!rules
-cT3?&rules[rules.tF3-1]+1:0;if(range.first!=range
-iO2{
+eU3?&rules[0]:0;range.second=!rules
+eU3?&rules[rules
+eJ3-1]+1:0;if(range.first!=range.second){
#ifdef DEBUG_SUBSTITUTIONS
-if(range.first!=range
-iO2
-yC2"Input ("
-<<c83
-i01)<<")["
-<<eM<<"]"
-;if(c1
-std::cout<<"(Logical)"
-;iF2
-first=iP1,prev=iP1;nH3
+if(range.first!=range.second)cH2"Input ("
+<<FP_GetOpcodeName(t72)<<")["
+<<tree.GetParamCount()<<"]"
+;if(c4
+cV2<<"(Logical)"
+;x83
+first=l52,prev=l52;e32
sep=", rules "
;for
-y5
-if(first==iP1)first=prev=*r;lJ2*r==prev+1)prev=*r;else
-yC2
+y0
+if(first==l52)first=prev=*r;iP1*r==prev+1)prev=*r;else
+cH2
sep<<first;sep=","
-;if(prev!=first)std::cout<<'-'<<prev;first=prev=*r;}
+;if(prev!=first)cV2<<'-'<<prev;first=prev=*r;}
}
-if(first!=iP1)yC2
-sep<<first;if(prev!=first)std::cout<<'-'<<prev;}
-std::cout<<": "
-i13(tree
-lT2"\n"
+if(first!=l52)cH2
+sep<<first;if(prev!=first)cV2<<'-'<<prev;}
+cV2<<": "
+iL2
+tree
+lE2"\n"
<<std::flush;}
#endif
bool
changed
-tO3
+eW3
for
-y5
+y0
#ifndef DEBUG_SUBSTITUTIONS
-if(!IsLogisticallyPlausibleParamsMatch(tD1
-cE2,tree)cP2;
+if(!IsLogisticallyPlausibleParamsMatch(tM1
+yR2
+cU3))yA1
#endif
-if(TestRuleAndApplyIfMatch(tD1,tree,c1){x62
-yF3}
+if(TestRuleAndApplyIfMatch(tM1
+cU3,c4){yS1
+xY3}
if(changed){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Changed."
-<<std::endl;std::cout<<"Output: "
-i13(tree
-lT2"\n"
+cV2<<"Changed."
+<<std::endl;cV2<<"Output: "
+iL2
+tree
+lE2"\n"
<<std::flush;
#endif
-tree.Mark_Incompletely_Hashed()xJ2}
-tree.SetOptimizedUsing(&tX2)n31
-tR3
-xN1
+tree.Mark_Incompletely_Hashed(yQ2}
+tree.SetOptimizedUsing(&tK2)i1
+t23
+yP1
ApplyGrammar
-cH1
-void*p,FPoptimizer_CodeTree::e62
-yR
-ApplyGrammar(*cH1
-Grammar*)p,tree);}
-tZ1
-ApplyGrammars(FPoptimizer_CodeTree::e62{
+iS1
+void*p,FPoptimizer_CodeTree::eR
+yP
+ApplyGrammar(*iS1
+Grammar*)p
+cU3);}
+xL1
+ApplyGrammars(FPoptimizer_CodeTree::eR{
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_round1\n"
+cV2<<iB3"grammar_optimize_round1\n"
;
#endif
n6
grammar_optimize_round1
-n53
+cU3
+nW
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_round2\n"
+cV2<<iB3"grammar_optimize_round2\n"
;
#endif
n6
grammar_optimize_round2
-n53
+cU3
+nW
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_round3\n"
+cV2<<iB3"grammar_optimize_round3\n"
;
#endif
n6
grammar_optimize_round3
-n53
+cU3
+nW
#ifndef FP_ENABLE_SHORTCUT_LOGICAL_EVALUATION
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_nonshortcut_logical_evaluation\n"
+cV2<<iB3"grammar_optimize_nonshortcut_logical_evaluation\n"
;
#endif
n6
grammar_optimize_nonshortcut_logical_evaluation
-n53
+cU3
+nW
#endif
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_round4\n"
+cV2<<iB3"grammar_optimize_round4\n"
;
#endif
n6
grammar_optimize_round4
-n53
+cU3
+nW
#ifdef FP_ENABLE_SHORTCUT_LOGICAL_EVALUATION
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_shortcut_logical_evaluation\n"
+cV2<<iB3"grammar_optimize_shortcut_logical_evaluation\n"
;
#endif
n6
grammar_optimize_shortcut_logical_evaluation
-n53
+cU3
+nW
#endif
#ifdef FP_ENABLE_IGNORE_IF_SIDEEFFECTS
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_ignore_if_sideeffects\n"
+cV2<<iB3"grammar_optimize_ignore_if_sideeffects\n"
;
#endif
n6
grammar_optimize_ignore_if_sideeffects
-n53
+cU3
+nW
#endif
#ifdef DEBUG_SUBSTITUTIONS
-std
-iL3"grammar_optimize_abslogical\n"
+cV2<<iB3"grammar_optimize_abslogical\n"
;
#endif
n6
grammar_optimize_abslogical
-n53
+cU3
+nW
#undef C
}
}
#include <cmath>
#include <memory> /* for auto_ptr */
using
-lF3
+l33
FUNCTIONPARSERTYPES;using
-lF3
-l21;using
+l33
+lA1;using
t5;using
-yL1;lF3{xN1
+nG1;l33{yP1
TestImmedConstraints
-nT2
-bitmask,lC2
-tree
-y13
-bitmask&ValueMask
-y33
+lT1
+bitmask,const
+eR{e23
+bitmask&ValueMask){case
Value_AnyNum:case
ValueMask:lC
-nY2:if(GetEvennessInfo
-eZ3
-n52
+x62:if(GetEvennessInfo
+iS3
+n72
Value_OddInt:if(GetEvennessInfo
-eZ3
-x02
-tS1:if(GetIntegerInfo
-eZ3
-n52
+iS3
+x82
+i11:if(GetIntegerInfo
+iS3
+n72
Value_NonInteger:if(GetIntegerInfo
-eZ3
-x02
-eJ1:if(!IsLogicalValue(tree)cL
-nI1
-SignMask
-y33
+iS3
+x82
+eY1:if(!IsLogicalValue(tree)cQ
+nE1
+SignMask){case
Sign_AnySign:lC
-nH1:if(l01
-n52
-eK1:if(l01
-x02
-Sign_NoIdea:if(l01
+nD1:if(l81
+n72
+eZ1:if(l81
+x82
+Sign_NoIdea:if(l81
Unknown
-cL
-nI1
-OnenessMask
-y33
+cQ
+nE1
+OnenessMask){case
Oneness_Any:case
OnenessMask:lC
-Oneness_One:if(!yN1
-if(!cB3
-fp_abs(eC3)tG1
-1))cL
+Oneness_One:if(!xY1
+if(!lJ3
+fp_abs(tree
+x41),e62
+1))cQ
lC
-Oneness_NotOne:if(!yN1
-if(cB3
-fp_abs(eC3)tG1
-1))cL
-nI1
-ConstnessMask
-y33
+Oneness_NotOne:if(!xY1
+lG3
+fp_abs(tree
+x41),e62
+1))cQ
+nE1
+ConstnessMask){case
Constness_Any:lC
-tR1:if(!yN1
+i01:if(!xY1
lC
-Constness_NotConst:if(yN1
-yF3
-return
-true;}
-i31
-iF2
-extent,iF2
-nbits,xK3
-eG2=iF2
-int>e12
+Constness_NotConst:if(xY1
+xY3
+lD2}
+tP1
+x83
+extent,x83
+nbits,x93
+eP2=x83
+int>e72
nbitmap{private:static
const
-iF2
+x83
bits_in_char=8;static
const
-iF2
-eH2=(cM3
-eG2)*bits_in_char)/nbits;eG2
-data[(extent+eH2-1)/eH2];eX3
+x83
+eQ2=(sizeof(eP2)*bits_in_char)/nbits;eP2
+data[(extent+eQ2-1)/eQ2];e43
void
-inc(nA1,int
-by=1){data[pos(index)]+=by*eG2(1<<yD2);xI1
+inc(lJ1,int
+by=1){data[pos(index)]+=by*eP2(1<<y82);y81
void
-dec(nA1){inc(index,-1);}
+dec(lJ1){inc(index,-1);}
int
-get(nA1
-yZ1(data[pos(index)]>>yD2)&mask()yH3
-pos(nA1)yR
-index/eH2
-yH3
-shift(nA1)yR
-nbits*(index%eH2)yH3
-mask()yR(1<<nbits)-1
-yH3
-mask(nA1)yR
-mask()<<yD2;}
-}
-;e12
-eJ3{int
+get(lJ1
+c01(data[pos(index)]>>y82)&mask()iT3
+pos(lJ1)yP
+index/eQ2
+iT3
+shift(lJ1)yP
+nbits*(index%eQ2)iT3
+mask()yP(1<<nbits)-1
+iT3
+mask(lJ1)yP
+mask()<<y82;}
+}
+;e72
+Needs{int
SubTrees:8;int
-eV3:8;int
-yE2:8;int
-Immeds:8;nbitmap<l03,2>SubTreesDetail;eJ3(){std::memset(this,0,cM3*this));}
-eJ3
-cH1
-eJ3&b){std::memcpy(this,&b,cM3
-b));}
-eJ3&eA1=cH1
-eJ3&b){std::memcpy(this,&b,cM3
-b))n31*this;}
+Others:8;int
+l62:8;int
+Immeds:8;nbitmap<iU2,2>SubTreesDetail;Needs(){std::memset(this,0,sizeof(*this));}
+Needs
+iS1
+Needs&b){std::memcpy(this,&b,sizeof(b));}
+Needs&eM1=iS1
+Needs&b){std::memcpy(this,&b,sizeof(b))i1*this;}
}
-nJ1
-eJ3
-CreateNeedList_uncached(tC&c32){eJ3
-cN1;for(eQ1=0;a<c32
-yF2;++a){const
-e42&yH2=e81
-xK(c32.param_list,a);switch(yH2.first
-y33
-SubFunction:{cP
-yK3(cP*c61
-yF
-GroupFunction)++cN1.Immeds;else{++cN1.SubTrees;assert(param.data.subfunc_opcode<VarBegin);cN1.SubTreesDetail.inc
-y23
-l81);}
-++cN1.yE2;yF3
+yO1
+Needs
+CreateNeedList_uncached(eX&tL2{Needs
+yQ1;for
+lT1
+a=0;a<params
+y92;++a){const
+eA2&lX3=ParamSpec_Extract
+xF(params.param_list,a);e23
+lX3.first){case
+SubFunction:{cN&yU3
+cN*tF1;yF
+GroupFunction)++yQ1.Immeds;else{++iO2;assert(iH3.subfunc_opcode<VarBegin);yQ1.SubTreesDetail.inc
+yZ3
+lG1);}
+++yQ1.l62;xY3
case
NumConstant:case
-tG3:++cN1.eV3;++cN1.yE2;break;eW2
-cN1;}
-xW3
-eJ3&CreateNeedList(tC&c32){typedef
-std::map<tC*,eJ3>e51;static
-e51
-yV1;e51::yV3
-i=yV1.xU2&c32
-eY3
-i!=yV1.cY1&c32)return
+ParamHolder:++iN2;++yQ1.l62;xY3
+eE3
+yQ1;}
+tK1
+Needs&CreateNeedList(eX&tL2{typedef
+std::map<eX*,Needs>eE1;static
+eE1
+yV1;eE1::y83
+i=yV1.xU2&tL2;if(i!=yV1.cX1&tL2
+return
i
-e82
-n31
-yV1.yR3,std::make_pair(&c32,CreateNeedList_uncached
-xK(c32)))e82;}
-xW3
-eJ
+eC2
+i1
+yV1.y43,std::make_pair(¶ms,CreateNeedList_uncached
+xF(tL2))eC2;}
+tK1
+yZ2
CalculateGroupFunction
-cH1
-e42&yG2
+iS1
+eA2&yA2
const
-tB
+tC
info
-y13
-yH2.first
-y33
+yY3
+lX3.first){case
NumConstant:{const
ParamSpec_NumConstant
-xK
-yK3
-cH1
+xF¶m=*iS1
ParamSpec_NumConstant
-xK*)yH2
-tE3
-n31
+xF*tF1
+i1
CodeTreeImmed
-y23
-constvalue
-i33
-tG3:{cO
-yK3(cO*)yH2
-tE3
-n31
-tM3
-GetParamHolderValueIfFound
-y23
-index
-i33
-SubFunction:{cP
-yK3(cP*c61
-eJ
-nT3;nT3
-xD
-yL3
-l81);nT3.l02).xS3
-yL3
-data
-yF2);for(eQ1=0;a<yL3
-data
-yF2;++a){eJ
-tmp(CalculateGroupFunction(e81
-xK
-y23
-data.param_list,a),info));nT3
-yP1
+yZ3
+constvalue);}
+case
+ParamHolder:{cM&yU3
+cM*tF1
+i1
+info.GetParamHolderValueIfFound
+yZ3
+index);}
+case
+SubFunction:{cN&yU3
+cN*tF1
+tX
+nS3;nS3
+iH
+param.lG1);nS3.lJ2).xH3
+iH3
+y92);for
+lT1
+a=0;a<iH3
+y92;++a
+nQ
+tmp(CalculateGroupFunction
+nF1
+iH3.param_list,a),info));nS3
+c91
tmp);}
-nT3.Rehash()n31
-nT3;eW2
-eJ();}
-}
-yL1{xN1
-IsLogisticallyPlausibleParamsMatch(tC&c32,lC2
-tree){eJ3
-cN1(CreateNeedList
-xK(c32));size_t
-tZ3=c8
-if(tZ3<size_t(cN1.yE2))n93}
+nS3
+iW1
+i1
+nS3;}
+eE3
+yZ2();}
+}
+nG1{yP1
+IsLogisticallyPlausibleParamsMatch(eX¶ms,const
+eR{Needs
+yQ1(CreateNeedList
+xF(tL2);size_t
+tL3=yC
+if(tL3<size_t(yQ1.l62))tM2
for
-iA1
-a=0;a<tZ3;++a){iF2
-opcode=t33
-nC;switch(opcode
-y33
-cImmed:if(cN1.Immeds>0)eU3
-Immeds;else
-eU3
-eV3;lC
-l03:case
+iZ1
+a=0;a<tL3;++a){x83
+opcode=xW
+a)nC;e23
+opcode){case
+cImmed:if(yQ1.Immeds>0)--yQ1.Immeds;else--iN2;lC
+iU2:case
cFCall:case
-cPCall:eU3
-eV3;break;c73
-assert(opcode<VarBegin);if(cN1.SubTrees>0&&cN1.SubTreesDetail.get(opcode)>0){eU3
-SubTrees;cN1.SubTreesDetail.dec(opcode
-t43
-eU3
-eV3;}
-}
-if(cN1.Immeds>0||cN1.SubTrees>0||cN1.eV3>0)n93}
-if(c32.match_type!=AnyParams){if(0||cN1.SubTrees<0||cN1.eV3<0)n93
-eW2
-true;}
-xW3
-lX1
+cPCall:--iN2;break;yF3
+assert(opcode<VarBegin);if(iO2>0&&yQ1.SubTreesDetail.get(opcode)>0){--iO2;yQ1.SubTreesDetail.dec(opcode);}
+else--iN2;}
+}
+if(yQ1.Immeds>0||iO2>0||iN2>0)tM2
+if(params.match_type!=AnyParams){if(0||iO2<0||iN2<0)tM2}
+lD2}
+tK1
+n31
TestParam
-cH1
-e42&yG2
-lC2
-tree,const
-cW&start_at
-tJ3
-y13
-yH2.first
-y33
+iS1
+eA2&yA2
+const
+nP1
+const
+cZ&start_at,tC
+info
+yY3
+lX3.first){case
NumConstant:{const
ParamSpec_NumConstant
-xK
-yK3
-cH1
+xF¶m=*iS1
ParamSpec_NumConstant
-xK*c61
-if(!yN1
-iV2
-imm=eC3;switch
-y23
-modulo
-y33
+xF*tF1;if(!xY1
+Value_t
+imm=tree
+x41;switch
+yZ3
+modulo){case
Modulo_None:lC
-Modulo_Radians:imm=e93
-imm,yO
-imm<xD1
+Modulo_Radians:imm=cK3
+imm,yK
+imm<xG1
imm
-yP
+yN
if(imm>fp_const_pi
-xK())imm-=fp_const_twopi
-xK(cT2
+xF())imm-=fp_const_twopi
+xF(e02
return
-cB3
-imm,yL3
-constvalue
-i33
-tG3:{cO
-yK3(cO*c61
-if(!x0
+lJ3
+imm,param.constvalue);}
+case
+ParamHolder:{cM&yU3
+cM*tF1;if(!x3
return
-tM3
-SaveOrTestParamHolder
-y23
-index,tree
-i33
-SubFunction:{cP
-yK3(cP*c61
-yF
-GroupFunction){if(!x0
-eJ
-xY1=CalculateGroupFunction(yG2
+info.SaveOrTestParamHolder
+yZ3
+index
+cU3);}
+case
+SubFunction:{cN&yU3
+cN*tF1;yF
+GroupFunction){if(!x3
+yZ2
+xZ1=CalculateGroupFunction(yA2
info);
#ifdef DEBUG_SUBSTITUTIONS
-DumpHashes(xY1
-lT2*cH1
-void**)&xY1
-nC1;std::cout<<"\n"
-;std::cout<<*cH1
-void**)&eC3;std::cout<<"\n"
+DumpHashes(xZ1
+lE2*iS1
+void**)&xZ1
+x41;cV2<<"\n"
+;cV2<<*iS1
+void**)&tree
+x41;cV2<<"\n"
;DumpHashes(tree
-lT2"Comparing "
-i13(xY1
-lT2" and "
-i13(tree
-lT2": "
-;std::cout<<(xY1
-xF
+lE2"Comparing "
+iL2
+xZ1
+lE2" and "
+iL2
+tree
+lE2": "
+;cV2<<(xZ1
+xI
tree)?"true"
:"false"
-lT2"\n"
+lE2"\n"
;
#endif
return
-xY1
-xF
+xZ1
+xI
tree);}
-e63!&*start_at){if(!x0
-if(i01!=yL3
-l81
-cL}
-return
+cJ3!eK1){if(!x3
+if(t72!=param.lG1
+cQ
+eE3
TestParams
-y23
-data,tree,start_at,info,false);}
-eW2
-tR3
-xW3
-e12
-iX
-x72
+yZ3
+data
+cU3,start_at,info,false);}
+}
+eE3
+t23
+tK1
+e72
+l31
+x92
MatchInfo
-xK
-info;iX():start_at(),info(){}
+xF
+info;l31():start_at(),info(){}
}
-nJ1
+yO1
class
-MatchPositionSpec_PositionalParams:xE1
-iX
-xK>{eX3
-l53
+MatchPositionSpec_PositionalParams:nQ1
+l31
+xF>{e43
+iX2
MatchPositionSpec_PositionalParams
-iA1
-n
-yB1
-iX
-xK>(n){}
+iZ1
+n):eF1
+l31
+xF>(n){}
}
-;e12
-iQ1
-x72
-iQ1():start_at(){}
+;e72
+l72
+x92
+l72():start_at(){}
}
;class
-yG:xE1
-iQ1>{eX3
-iF2
-trypos;l53
+yG:nQ1
+l72>{e43
+x83
+trypos;iX2
yG
-iA1
-n
-yB1
-iQ1>(n),trypos(0){}
+iZ1
+n):eF1
+l72>(n),trypos(0){}
}
-nJ1
-lX1
-TestParam_AnyWhere
-cH1
-e42&yG2
-lC2
-tree,const
-cW&start_at
-tJ3,std::eV2&used,bool
-eY2{xR<yG>x5;tY2
-yG
-eU2
-a=x5->trypos;goto
-retry_anywhere_2
-tC2
-yG(eM);a=0;}
-for(;a<c8++a){if(used[a]cP2;retry_anywhere
-i03=TestParam(yG2
-t33,(i02);iB1
-used[a]=true
-iP
-a);x5->trypos=a
+yO1
n31
-lX1(true,&*x5);}
+TestParam_AnyWhere
+iS1
+eA2&yA2
+const
+nP1
+const
+cZ&start_at,tC
+info,cY2&used,bool
+iX1{xP<yG>x8;x83
+xA2(yG*)eK1;a=x8->trypos;goto
+retry_anywhere_2;cO2
+yG
+l51);a=0;}
+tM3
+yC++a){if(used[a])yA1
+retry_anywhere
+yW3
+TestParam(yA2
+xW
+a)xS3);yP3
+used[a]=true;if(iX1
+info.SaveMatchedParamIndex(a);x8->trypos=a
+i1
+n31(true,&*x8);}
}
retry_anywhere_2
-i23
+yX3
goto
-retry_anywhere;eW2
-tR3
-xW3
-e12
-yC1
-x72
+retry_anywhere;}
+eE3
+t23
+tK1
+e72
+yD1
+x92
MatchInfo
-xK
-info;std::eV2
-used;l53
-yC1
-iA1
-tZ3):start_at(),info(),used(tZ3){}
+xF
+info;cY2
+used;iX2
+yD1
+iZ1
+tL3):start_at(),info(),used(tL3){}
}
-nJ1
+yO1
class
-MatchPositionSpec_AnyParams:xE1
-yC1
-xK>{eX3
-l53
+MatchPositionSpec_AnyParams:nQ1
+yD1
+xF>{e43
+iX2
MatchPositionSpec_AnyParams
-iA1
+iZ1
n,size_t
-m
-yB1
-yC1
-xK>(n,yC1
-xK(m)){}
+m):eF1
+yD1
+xF>(n,yD1
+xF(m)){}
}
-nJ1
-lX1
-TestParams(tC&nN,lC2
-tree,const
-cW&start_at
-tJ3,bool
-eY2{if(nN.match_type!=AnyParams){if(xV!=eM
-cL}
-if(!IsLogisticallyPlausibleParamsMatch(nN,tree))n93
-l73
-nN.match_type
-y33
-PositionalParams:{xR<cG>x5;tY2
-cG
-eU2
-a=xV-1;goto
-lD1
-tC2
-cG(xV);a=0;}
-for(;a
-eX2{lG2=info;retry_positionalparams
-i03=TestParam(cU
-a),t33,(i02);iB1
-eR2}
-lD1
-i23
-info=lG2;goto
-retry_positionalparams;}
-if(a>0){--a;goto
-lD1;}
-info=eD3
+yO1
n31
-tR3
-if(eY2
-for(tZ2
+TestParams(eX&nN,const
+nP1
+const
+cZ&start_at,tC
+info,bool
+iX1{if(nN.match_type!=AnyParams){if(xT!=tree.GetParamCount()cQ}
+if(!IsLogisticallyPlausibleParamsMatch(nN
+cU3))tM2
+e23
+nN.match_type){case
+PositionalParams:{xP<cF>x8;x83
+xA2(cF*)eK1;a=xT-1;goto
+lK1;cO2
+cF(xT);a=0;}
tM3
-SaveMatchedParamIndex(a)n31
-lX1(true,&*x5
-i33
+xT;++a){(yQ3=info;retry_positionalparams
+yW3
+TestParam(cW
+a),xW
+a)xS3);yP3
+yA1}
+}
+lK1
+yX3
+info=(yQ3;goto
+retry_positionalparams;}
+if(a>0){--a;goto
+lK1;}
+info=c12
+i1
+t23
+if(iX1
+tN3
+info.SaveMatchedParamIndex(a)i1
+n31(true,&*x8);}
+case
SelectedParams:case
-AnyParams:{xR<t7>x5;std::eV2
-used(eM);std
-xV3<iF2>l63(xV);std
-xV3<iF2>yI2(xV);for(tZ2{const
-e42
-yH2=cU
-a);l63[a]=ParamSpec_GetDepCode(yH2);}
-{iF2
-b=0;for(tZ2
-if(l63[a]!=0)yI2[b++]=a;for(tZ2
-if(l63[a]==0)yI2[b++]=a;}
-tY2
-t7
-eU2
-if(xV==0){a=0;goto
+AnyParams:{xP<t6>x8;cY2
+used
+l51);eO3
+x83>iY2(xT);eO3
+x83>yB2(xT);tN3{const
+eA2
+lX3=cW
+a);iY2[a]=ParamSpec_GetDepCode(lX3);}
+{x83
+b=0;tN3
+if(iY2[a]!=0)yB2[b++]=a;tN3
+if(iY2[a]==0)yB2[b++]=a;}
+x83
+xA2(t6*)eK1;if(xT==0){a=0;goto
retry_anyparams_4;}
-a=xV-1;goto
-e61
-tC2
-t7(xV,eM);a=0;if(xV!=0){eD3=info;(*x5)[0].used=used;}
+a=xT-1;goto
+eG1;cO2
+t6(xT
+cU3.GetParamCount());a=0;if(xT!=0){c12=info;(*x8)[0].used=used;}
}
-for(;a
-eX2{if(a>0){lG2=info;(*x5)[a].used=used;}
+tM3
+xT;++a){if(a>0){(yQ3=info;(yO3
+used=used;}
retry_anyparams
-i03=TestParam_AnyWhere
-xK(cU
-yI2[a]),tree,(i02,used,eY2;iB1
-eR2}
-e61
-i23
-info=lG2;used=(*x5)[a].used;goto
+yW3
+TestParam_AnyWhere
+xF(cW
+yB2[a])cU3
+xS3,used,iX1;yP3
+yA1}
+}
+eG1
+yX3
+info=(yQ3;used=(yO3
+used;goto
retry_anyparams;}
-e71:if(a>0){--a;goto
-e61;}
-info=eD3
-n31
-tR3
-retry_anyparams_4:if(nN.n1!=0){if(!TopLevel||!tM3
-HasRestHolder(nN.n1)){eH
-cF2;cF2.xS3
-eM);for
-nT2
-b=0;b<c8++b){if(cN3
-cP2;cF2.push_back
-y91
-b));cN3=true
-iP
-b);}
-if(!tM3
-SaveOrTestRestHolder(nN.n1,cF2)){goto
-e71;}
+eH1:if(a>0){--a;goto
+eG1;}
+info=c12
+i1
+t23
+retry_anyparams_4:if(nN.n1!=0){if(!TopLevel||!info.HasRestHolder(nN.n1)){eK
+cI2;cI2.reserve
+l51);for
+lT1
+b=0;b<yC++b){if(used[b])yA1
+cI2
+c52
+xW
+b));used[b]=true;if(iX1
+info.SaveMatchedParamIndex(b);}
+if(!info.SaveOrTestRestHolder(nN.n1,cI2)){goto
+eH1;}
}
-else{iH2&cF2=tM3
-GetRestHolderValues(nN.n1)yM3
-0;a<cF2.tF3;++a){bool
+else{eA3&cI2=info.GetRestHolderValues(nN.n1
+iY1
+0;a<cI2
+eJ3;++a){bool
found
-tO3
+eW3
for
-nT2
-b=0;b<c8++b){if(cN3
-cP2;if(cF2[a]xF
-lE2
-b))){cN3=true
-iP
-b);found=true;yF3}
+lT1
+b=0;b<yC++b){if(used[b])yA1
+if(cI2[a]xI
+xW
+b))){used[b]=true;if(iX1
+info.SaveMatchedParamIndex(b);found=true;xY3}
if(!found){goto
-e71;}
+eH1;}
}
-eW2
-lX1(true,xV?&*x5:0
-i33
-GroupFunction:yF3
+}
+eE3
+n31(true,xT?&*x8:0);}
+case
+GroupFunction:xY3
return
-tR3}
+t23}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
#include <algorithm>
#include <assert.h>
using
t5;using
-yL1;lF3{xW3
-eJ
-xZ1
-const
-e42&yG2
-tB
+nG1;l33{tK1
+yZ2
+yW1
+iS1
+eA2&yA2
+tC
info,bool
inner=true
-y13
-yH2.first
-y33
+yY3
+lX3.first){case
NumConstant:{const
ParamSpec_NumConstant
-xK
-yK3
-cH1
+xF¶m=*iS1
ParamSpec_NumConstant
-xK*)yH2
-tE3
-n31
+xF*tF1
+i1
CodeTreeImmed
-y23
-constvalue
-i33
-tG3:{cO
-yK3(cO*)yH2
-tE3
-n31
-tM3
-GetParamHolderValue
-y23
-index
-i33
-SubFunction:{cP
-yK3(cP*c61
-eJ
-tree;tI3
-yL3
-l81);for(eQ1=0;a<yL3
-data
-yF2;++a){eJ
-nparam=xZ1
-e81
-xK
-y23
-data.param_list,a),info,true);lP1
+yZ3
+constvalue);}
+case
+ParamHolder:{cM&yU3
+cM*tF1
+i1
+info.GetParamHolderValue
+yZ3
+index);}
+case
+SubFunction:{cN&yU3
+cN*tF1
+tX
+tree;tD2
+param.lG1);for
+lT1
+a=0;a<iH3
+y92;++a
+nQ
+nparam=yW1
+nF1
+iH3.param_list,a
+l04
+true
+c81
nparam);}
if
-y23
-data.n1!=0){eH
-trees(tM3
-GetRestHolderValues
-y23
-data.n1));tree.AddParamsMove(trees
-eY3
-eM==1){assert(tree.GetOpcode()==cAdd||tree.GetOpcode()==cMul||tree.GetOpcode()==cMin||tree.GetOpcode()==cMax||tree.GetOpcode()==cAnd||tree.GetOpcode()==cOr||tree.GetOpcode()==cAbsAnd||tree.GetOpcode()==cAbsOr);tree.xY2
+yZ3
+data.n1!=0){eK
+trees(info.GetRestHolderValues
+yZ3
+data.n1)yB
+AddParamsMove(trees);if
+l51==1){assert(tree.GetOpcode()==cAdd||tree.GetOpcode()==cMul||tree.GetOpcode()==cMin||tree.GetOpcode()==cMax||tree.GetOpcode()==cAnd||tree.GetOpcode()==cOr||tree.GetOpcode()==cAbsAnd||tree.GetOpcode()==cAbsOr);tree.eF2
0));}
-lJ2
-eM==0
-y13
-i01
-y33
+else
+if
+l51==0
+yY3
+t72){case
cAdd:case
-cOr:tree=nF1
+cOr:tree=nA1
0));lC
cMul:case
-cAnd:tree=nF1
-1));c73
-yF3}
-}
-if(inner)tree.Rehash()n31
-tree;eW2
-eJ();}
+cAnd:tree=nA1
+1));yF3
+xY3}
+}
+if(inner)tree
+iW1
+i1
+tree;}
+eE3
+yZ2();}
}
-yL1{tZ1
-SynthesizeRule
-cH1
-eT2
-eJ&tree
-tJ3
-y13
-rule.ruletype
-y33
-ProduceNewTree:{tree.Become(xZ1
-e81
-lE1
-0),info,false)cT2
+nG1{xL1
+SynthesizeRule(t41
+nP1
+tC
+info
+yY3
+rule.ruletype){case
+ProduceNewTree:{tree.Become(yW1
+nF1
+rule.t51
+0
+l04
+false)e02
case
-ReplaceParams:c73{std
-xV3<iF2>list=tM3
-GetMatchedParamIndexes();std::sort(list.iN2
-list.end())yM3
-list.tF3;a-->0;)tree
-tK2
-list[a]);for(eQ1=0;a<rule.repl_param_count;++a){eJ
-nparam=xZ1
-e81
-lE1
-a),info,true);lP1
+ReplaceParams:yF3{eO3
+x83>list=info.GetMatchedParamIndexes();std::sort(list.iJ2
+list.end()iY1
+list
+eJ3;a-->0;)tree.i91
+list[a]);for
+lT1
+a=0;a<rule.repl_param_count;++a
+nQ
+nparam=yW1
+nF1
+rule.t51
+a
+l04
+true
+c81
nparam);}
-yF3}
+xY3}
}
}
#endif
#include <sstream>
#include <cstring>
using
-lF3
+l33
FUNCTIONPARSERTYPES;using
-lF3
-l21;using
+l33
+lA1;using
t5;using
-yL1;lF3
-l21{tZ1
-DumpMatch
-cH1
-eT2
-lC2
-tree,const
-tB
+nG1;l33
+lA1{xL1
+DumpMatch(t41
+const
+nP1
+const
+tC
info,bool
-DidMatch,std::ostream&o){DumpMatch(rule
-iY3,DidMatch?l24"match"
-:l24"mismatch"
+DidMatch,std::ostream&o){DumpMatch
+yG2,DidMatch?iX3"match"
+:iX3"mismatch"
,o);}
-tZ1
-DumpMatch
-cH1
-eT2
-lC2
-tree,const
-tB
-info,nH3
-i43,std::ostream&o){static
+xL1
+DumpMatch(t41
+const
+nP1
+const
+tC
+info,e32
+tO3,std::ostream&o){static
const
char
ParamHolderNames[][2]={"%"
,"b"
,"c"
}
-;o<<i43<<" (rule "
+;o<<tO3<<" (rule "
<<(&rule-grammar_rules)<<")"
<<":\n Pattern : "
-;{e42
+;{eA2
tmp;tmp.first=SubFunction;ParamSpec_SubFunction
tmp2;tmp2.data=rule
-cE2;tmp
-tE3=cD2
+yR2;tmp.second=cG2
tmp2;DumpParam
-xK(tmp,o);}
+xF(tmp,o);}
o<<"\n Replacement: "
;DumpParams
-lE1
-rule.repl_param_count,o);o<<"\n"
-;o<<" Tree : "
-i13(tree,o);o<<"\n"
-;if(!std::strcmp(i43,l24"match"
-))DumpHashes(tree,o)yM3
-0;a<tM3
-cE
-tF3;++a){if(!tM3
-paramholder_matches[a].IsDefined()cP2;o<<" "
+xF(rule.t51
+rule.repl_param_count,o)iV3
+o<<" Tree : "
+iL2
+tree,o)iV3
+if(!std::strcmp(tO3,iX3"match"
+))DumpHashes(tree,o
+iY1
+0;a<info.cA
+eJ3;++a){if(!info.cA[a].nX2)yA1
+o<<" "
<<ParamHolderNames[a]<<" = "
-i13(tM3
-paramholder_matches[a],o);o<<"\n"
-;}
-i81
-tM3
-lQ.tF3;++b){if(!tM3
-lQ[b
-tC3
-cP2
-yM3
-0;a<tM3
-lQ[b
-tD3.tF3;++a){o<<" <"
+iL2
+info.cA[a],o)iV3}
+e11
+info.lQ
+eJ3;++b){if(!iW3
+eH3)yA1
+for
+iZ1
+a=0;a<iW3
+eI3
+eJ3;++a){o<<" <"
<<b<<"> = "
-i13(tM3
-lQ[b
-tD3[a],o);o<<std::endl;}
+iL2
+iW3
+eI3[a],o);o<<std::endl;}
}
o<<std::flush;}
}
#include <algorithm>
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
-FUNCTIONPARSERTYPES;lF3{xN1
-MarkIncompletes(FPoptimizer_CodeTree::e62{if(tree.Is_Incompletely_Hashed(tI1;bool
-iR1
-tO3
-nB1
-iR1|=MarkIncompletes
-y91
-a)eY3
-iR1)tree.Mark_Incompletely_Hashed()n31
-iR1;}
-tZ1
-FixIncompletes(FPoptimizer_CodeTree::e62{if(tree.Is_Incompletely_Hashed()){nB1
-FixIncompletes
-y91
-a));tree
-eT1}
+l33
+FUNCTIONPARSERTYPES;l33{yP1
+MarkIncompletes(FPoptimizer_CodeTree::eR{if(tree.Is_Incompletely_Hashed())lD2
+bool
+l82
+eW3
+x51
+l82|=MarkIncompletes(xW
+a));if(l82)tree.Mark_Incompletely_Hashed()i1
+l82;}
+xL1
+FixIncompletes(FPoptimizer_CodeTree::eR{if(tree.Is_Incompletely_Hashed()){x51
+FixIncompletes(xW
+a)yB
+e33);}
}
}
t5{lB
-Sort()tN3
+Sort()iZ3
Sort();}
lB
-Rehash(bool
+e33
+bool
constantfolding){if(constantfolding)ConstantFolding(*this);else
Sort();data
-x7
-xW3
-e12
-cA{cO3
-iV2
-cP3
-yD1=0;
+xC
+tK1
+e72
+cB
+c03
+Value_t
+c13
+yE1=0;
#if 0
long
double
-value=Value;e5=crc32::calc(cH1
-iF2
-char*)&value,cM3
-value));key^=(key<<24);
+value=Value;e9=crc32::calc(iS1
+x83
+char*)&value,sizeof(value));key^=(key<<24);
#elif 0
-union{e12{iF2
+union{e72{x83
char
-filler1[16]iU2
-v;iF2
+filler1[16]iK2
+v;x83
char
filler2[16];}
-buf2;e12{iF2
+buf2;e72{x83
char
-filler3[cM3
-iV2)+16-c
-M3
-x91)];e5;}
+filler3[sizeof
+cX3)+16-sizeof(xE1)];e9;}
buf1;}
-data;memset(&data,0,cM3
-data));data.buf2.v=Value;e5=data.buf1.key;
+data;memset(&data,0,sizeof(data));data.buf2.v=Value;e9=data.buf1.key;
#else
int
exponent
-iU2
-nM2=std::frexp(Value,&xG2;e5=nT2
-t62+0x8000)&0xFFFF
-eY3
-nM2<0){nM2=-nM2;key=key^0xFFFF;}
+iK2
+nR2=std::frexp(Value,&tU2
+e9=lT1(exponent+0x8000)&0xFFFF);if(nR2<0){nR2=-nR2;key=key^0xFFFF;}
else
-key+=0x10000;nM2-=iV2(0.5);key<<=39;key|=lY1(nM2+nM2)*iV2(1u<<31))<<8;
+key+=0x10000;nR2-=yF2;key<<=39;key|=n51(nR2+nR2)*e62
+1u<<31))<<8;
#endif
lP
#ifdef FP_SUPPORT_COMPLEX_NUMBERS
-nR1
+nN1
T
-cG2
-std::complex<T> >{cO3
-std::complex<T>cP3
-cA<T>::nA3
-cH2,Value.real());nB
+cJ2
+std::complex<T> >c03
+std::complex<T>c13
+cB<T>::lY3
+cK2,Value.real());nB
fphash_t
-temp;cA<T>::nA3
-temp,Value.imag());yD1^=temp.hash2;cH2.hash2^=temp.hash1;}
+temp;cB<T>::lY3
+temp,Value.imag());yE1^=temp.hash2;cK2.hash2^=temp.hash1;}
}
;
#endif
#ifdef FP_SUPPORT_LONG_INT_TYPE
-i31
-cG2
-long>{yH
+tP1
+cJ2
+long>yD
long
-Value){e5=Value;lP
+Value){e9=Value;lP
#endif
#ifdef FP_SUPPORT_GMP_INT_TYPE
-i31
-cG2
-GmpInt>{cO3
+tP1
+cJ2
+GmpInt>c03
GmpInt
-cP3
-e5=Value.toInt();lP
+c13
+e9=Value.toInt();lP
#endif
-tZ1
-xH2
-xK::Recalculate_Hash_NoRecursion(){fphash_t
-cH2(lY1
-Opcode)<<56,Opcode*iP3(0x1131462E270012B));Depth=1;switch(Opcode
-y33
-cImmed:{cA
-xK::nA3
-cH2,Value
-cT2
+xL1
+xK2
+xF::Recalculate_Hash_NoRecursion(){fphash_t
+cK2(n51
+Opcode)<<56,Opcode*iE3(0x1131462E270012B));Depth=1;e23
+Opcode){case
+cImmed:{cB
+xF::lY3
+cK2,Value
+e02
case
-l03:{yD1|=lY1
-cQ1<<48
-lF1((lY1
-cQ1)*11)^iP3(0x3A83A83A83A83A0);yF3
+iU2:{yE1|=n51
+cO1<<48
+lL1((n51
+cO1)*11)^iE3(0x3A83A83A83A83A0);xY3
case
cFCall:case
-cPCall:{yD1|=lY1
-cQ1<<48
-lF1((~lY1
-cQ1)*7)^3456789;}
-c73{size_t
-eR1=0
-yM3
-0;a<xX3;++a){if(iZ2
-y22>eR1)eR1=iZ2
-y22;yD1+=((iZ2
-i12
-hash1*(a+1))>>12)lF1
-iZ2
-i12
+cPCall:{yE1|=n51
+cO1<<48
+lL1((~n51
+cO1)*7)^3456789;}
+yF3{size_t
+t61=0
+e73
+0;a<iS2;++a){if(iT2
+nP2>t61)t61=iT2
+nP2;yE1+=((iT2.tN2
+hash1*(a+1))>>12)lL1
+iT2.tN2
hash1
-lF1(3)*iP3(0x9ABCD801357);cH2.hash2*=iP3(0xECADB912345)lF1(~iZ2
-i12
+lL1(3)*iE3(0x9ABCD801357);cK2.hash2*=iE3(0xECADB912345)lL1(~iT2.tN2
hash2)^4567890;}
-Depth+=eR1;}
+Depth+=t61;}
}
-if(Hash!=cH2){Hash=cH2;l32=0;}
+if(Hash!=cK2){Hash=cK2;lM2=0;}
}
lB
-FixIncompleteHashes(){MarkIncompletes(*this);FixIncompletes(*this);}
+tE3{MarkIncompletes(*this);FixIncompletes(*this);}
}
#endif
#include <cmath>
#include <cassert>
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
-FUNCTIONPARSERTYPES;lF3{using
+l33
+FUNCTIONPARSERTYPES;l33{using
t5
-nJ1
+yO1
bool
x01
-lC2
-tree,long
+const
+nP1
+long
count,const
-xH1::SequenceOpCode
-xK&eU,xH1
-yG3&synth,size_t
+xK1::SequenceOpCode
+xF&eQ,xK1::eP3&synth,size_t
max_bytecode_grow_length);static
const
-e12
+e72
SinCosTanDataType{OPCODE
whichopcode;OPCODE
-inverse_opcode;enum{nominator,nN2,inverse_nominator,lG1}
+inverse_opcode;enum{eR2,nS2,nZ1,lM1}
;OPCODE
codes[4];}
SinCosTanData[12]={{cTan,cCot,{cSin,cCos,cCsc,cSec}
}
,{cCsc,cSin,{cCot,cCos,cTan,cSec}
}
-,{cI2{cSinh,cCosh,cJ2,{cSinh,cNop,{cI2
+,{cL2{tD3
+cCosh,cM2,{tD3
+cNop,{cL2
cNop,cCosh}
}
-,{cCosh,cNop,{cSinh,cI2
+,{cCosh,cNop,{tD3
+cL2
cNop}
}
-,{cNop,cTanh,{cCosh,cSinh,cJ2,{cNop,cSinh,{cNop,cTanh,cCosh,cNop}
+,{cNop,cTanh,{cCosh,tD3
+cM2,{cNop,tD3{cNop,cTanh,cCosh,cNop}
}
-,{cNop,cCosh,{cTanh,cSinh,cJ2}
+,{cNop,cCosh,{cTanh,tD3
+cM2}
;}
t5{lB
-SynthesizeByteCode(std
-xV3<iF2>&ByteCode,std
-xV3
-xK&Immed,size_t&stacktop_max){
+SynthesizeByteCode(eO3
+x83>&eN1,std
+xM3
+xF&Immed,size_t&stacktop_max){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Making bytecode for:\n"
-;iR
+cV2<<"Making bytecode for:\n"
+;l21
#endif
while(RecreateInversionsAndNegations()){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"One change issued, produced:\n"
-;iR
+cV2<<"One change issued, produced:\n"
+;l21
#endif
-FixIncompleteHashes();using
-yL1;using
-lF3
-l21;const
-void*g=cD2
-grammar_optimize_recreate;while(ApplyGrammar(*cH1
-Grammar*)g,*this)){FixIncompleteHashes();}
+tE3;using
+nG1;using
+l33
+lA1;const
+void*g=cG2
+grammar_optimize_recreate;while(ApplyGrammar(*iS1
+Grammar*)g,*this)){tE3;}
}
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Actually synthesizing, after recreating inv/neg:\n"
-;iR
+cV2<<"Actually synthesizing, after recreating inv/neg:\n"
+;l21
#endif
-xH1
-yG3
-synth;SynthesizeByteCode(synth,false);synth.Pull(ByteCode,Immed,stacktop_max);}
+xK1::eP3
+synth;SynthesizeByteCode(synth,false
+iM2.Pull(eN1,Immed,stacktop_max);}
lB
-SynthesizeByteCode(xH1
-yG3&synth,bool
-MustPopTemps
-e83{y01*this))yR;}
+SynthesizeByteCode(xK1::eP3&synth,bool
+MustPopTemps)const{y01*this))yP;}
for
-iA1
+iZ1
a=0;a<12;++a){const
-SinCosTanDataType&data=SinCosTanData[a];if(data.whichopcode!=cNop)iD1!=data.whichopcode
-cP2;CodeTree
-nB3;nB3.lN1
-nB3
-cQ3
-inverse_opcode);nB3.n62
-y01
-nB3)){synth.l11
+SinCosTanDataType&data=SinCosTanData[a];if(data.whichopcode!=cNop)iC1!=data.whichopcode)yA1
+c02
+lZ3;lZ3.xA1);lZ3
+iH
+data.inverse_opcode);lZ3.yC2);y01
+lZ3)){synth.tQ
else
-iD1!=cInv
-cP2;if(GetParam(0)nC!=data.inverse_opcode
-cP2;y01
-GetParam(0))){synth.l11
+iC1!=cInv)yA1
+if(GetParam(0)nC!=data.inverse_opcode)yA1
+y01
+GetParam(0))){synth.tQ
size_t
-found[4];i81
-4;++b){CodeTree
-tree;if(data.i53]==cNop){tI3
-cInv);CodeTree
-nC3;nC3.lN1
-nC3
-cQ3
-i53^2]);nC3.n62
-lP1
-nC3
-t43{tree.lN1
-tree
-cQ3
-i53]);}
-tree.n62
-found[b]=synth.xU3
+found[4];e11
+4;++b){c02
+tree;if(data.tP3]==cNop){tD2
+cInv);c02
+n03;n03.xA1);n03
+iH
+data.tP3^2]);n03.yC2
+c81
+n03);}
+else{tree.xA1
+yB
+eL3
+data.tP3]);}
+tree.yC2);found[b]=synth.xK3
tree);}
-if(found[data.yJ2!=tL
-nN2]y4
-yJ2);n81
-nN2
-i5
+if(found[data.eR2
+e3
+nS2
+tG
+eR2]iM2.yT
+nS2]);yB1
cDiv
-nK1
-yJ2!=tL
-lG1]y4
-yJ2);n81
-lG1
-i5
+tW
+eR2
+e3
+lM1
+tG
+eR2]iM2.yT
+lM1]);yB1
cMul
-nK1
-lR1!=tL
-lG1]y4
-lR1);n81
-lG1
-i5
+tW
+nZ1
+e3
+lM1
+tG
+nZ1]iM2.yT
+lM1]);yB1
cRDiv
-nK1
-lR1!=tL
-nN2]y4
-lR1);n81
-nN2
-i5
-cMul,2,1);synth.l11
+tW
+nZ1
+e3
+nS2
+tG
+nZ1]iM2.yT
+nS2]);yB1
+cMul,2,1
+iM2.tQ
size_t
-n_subexpressions_synthesized=SynthCommonSubExpressions(iS2
-switch(iS1{case
-l03:synth.PushVar(GetVar());lC
-cImmed:lH2
+n_subexpressions_synthesized=SynthCommonSubExpressions(c92
+e23
+l92{case
+iU2:synth.PushVar(GetVar());lC
+cImmed:t71
GetImmed());lC
cAdd:case
cMul:case
cAnd:case
cOr:case
cAbsAnd:case
-cAbsOr:iD1==cMul){bool
-cR3
-tO3
-yI
-lS1
-i61&&isLongInteger(lS1
-nC1)){c82=makeLongInteger(lS1
-nC1);CodeTree
-tmp(*this,xK3
-CodeTree::CloneTag());tmp
-t31);tmp
-eT1
-if(x01
-tmp,value,xH1::tN1
-xK::AddSequence,synth,MAX_MULI_BYTECODE_LENGTH)){cR3=true;yF3}
-}
-if(cR3)yF3
+cAbsOr:iC1==cMul){bool
+c23
+eW3
+yH
+lX1
+tD1&&isLongInteger(lX1
+x41)){c11=makeLongInteger(lX1
+x41);c02
+tmp(*this,x93
+c02::CloneTag());tmp.i91
+a);tmp
+iW1;if(x01
+tmp,value,xK1::tU1
+xF::AddSequence,synth,MAX_MULI_BYTECODE_LENGTH)){c23=true;xY3}
+}
+if(c23)xY3
int
-yE1=0;std::eV2
-done(GetParamCount(),false);CodeTree
-iF;iF
-xD
-iS1;for(;;){bool
+yF1=0;cY2
+done(GetParamCount(),false);c02
+iQ;iQ
+iH
+l92;for(;;){bool
found
-tO3
-yI
-done[a]cP2;if(synth.IsStackTop(lS1)){found=true;done[a]=true;lS1.n7
-iF
-c9
-lS1
-eY3++yE1>1){synth
-yJ
-2);iF.Rehash(false)cI1
-iF);yE1=yE1-2+1;}
+eW3
+yH
+done[a])yA1
+if(synth.IsStackTop(lX1)){found=true;done[a]=true;lX1.n7
+iQ
+cS
+lX1);if(++yF1>1){yU
+2);iQ.yC2)yC1
+iQ);yF1=yF1-2+1;}
}
}
-if(!found)yF3
-yI
-done[a]cP2;lS1.n7
-iF
-c9
-lS1
-eY3++yE1>1){synth
-yJ
-2);iF.Rehash(false)cI1
-iF);yE1=yE1-2+1;}
+if(!found)xY3
+yH
+done[a])yA1
+lX1.n7
+iQ
+cS
+lX1);if(++yF1>1){yU
+2);iQ.yC2)yC1
+iQ);yF1=yF1-2+1;}
}
-if(yE1==0
-y13
-iS1{case
+if(yF1==0
+yY3
+l92{case
cAdd:case
cOr:case
-cAbsOr:lH2
+cAbsOr:t71
0);lC
cMul:case
cAnd:case
-cAbsAnd:lH2
+cAbsAnd:t71
1);lC
cMin:case
-cMax:lH2
-0);break;c73
-yF3++yE1;}
-assert(n_stacked==1);yF3
+cMax:t71
+0);break;yF3
+xY3++yF1;}
+assert(n_stacked==1);xY3
case
-cPow:{lG3
-p0=GetParam(0);lG3
-p1=GetParam(1
-eY3!p1
-i61||!isLongInteger
-eH3)||!x01
+cPow:{tW1
+p0
+i42
+0);tW1
+p1
+i42
+1);if(!p1
+tD1||!isLongInteger
+cR3||!x01
p0,makeLongInteger
-eH3),xH1::tN1
-xK::MulSequence,synth,MAX_POWI_BYTECODE_LENGTH)){p0.n7
+cR3,xK1::tU1
+xF::MulSequence,synth,MAX_POWI_BYTECODE_LENGTH)){p0.n7
p1.n7
-synth
-yJ
-2);i91
+yU
+2);e21
cIf:case
-cAbsIf:{xK3
-xH1
-yG3::IfData
-ifdata;GetParam(0).n7
-synth.SynthIfStep1(ifdata,iS1;GetParam(1).n7
-synth.SynthIfStep2(ifdata);GetParam(2).n7
-synth.SynthIfStep3(ifdata
-cT2
+cAbsIf:{x93
+xK1::eP3::IfData
+ifdata;GetParam(0)e93
+SynthIfStep1(ifdata,l92;GetParam(1)e93
+SynthIfStep2(ifdata);GetParam(2)e93
+SynthIfStep3(ifdata
+e02
case
cFCall:case
cPCall:{for
-iA1
-a=0;a<xF1++a)lS1.n7
-synth
-yJ
-nT2)GetParamCount());yE3
-nK2|GetFuncNo(),0,0
-cT2
-c73{for
-iA1
-a=0;a<xF1++a)lS1.n7
-synth
-yJ
-nT2)GetParamCount()cT2}
-synth.StackTopIs(*this
-eY3
-MustPopTemps&&n_subexpressions_synthesized>0){size_t
-top=synth.GetStackTop();synth.DoPopNMov(top-1-n_subexpressions_synthesized,top-1);}
+iZ1
+a=0;a<l91++a)lX1.n7
+yU
+lT1)GetParamCount());yB1
+0x80000000u|GetFuncNo(),0,0
+e02
+yF3{for
+iZ1
+a=0;a<l91++a)lX1.n7
+yU
+lT1)GetParamCount()e02}
+synth.StackTopIs(*this);if(MustPopTemps&&n_subexpressions_synthesized>0){size_t
+top=synth.GetStackTop(iM2.DoPopNMov(top-1-n_subexpressions_synthesized,top-1);}
}
}
-lF3{xN1
+l33{yP1
x01
-lC2
-tree,long
+const
+nP1
+long
count,const
-xH1::SequenceOpCode
-xK&eU,xH1
-yG3&synth,size_t
+xK1::SequenceOpCode
+xF&eQ,xK1::eP3&synth,size_t
max_bytecode_grow_length){if
-eL3!=0){xH1
-yG3
+cW3!=0){xK1::eP3
backup=synth;tree.n7
size_t
-bytecodesize_backup=synth.GetByteCodeSize();xH1::x01
-count,eU,iS2
+bytecodesize_backup=synth.GetByteCodeSize();xK1::x01
+count
+e63
size_t
-bytecode_grow_amount=synth.GetByteCodeSize()-bytecodesize_backup;if(bytecode_grow_amount>max_bytecode_grow_length){synth=backup
-n31
-tR3
-return
-true;}
-else{xH1::x01
-count,eU,synth)xJ2}
+bytecode_grow_amount=synth.GetByteCodeSize()-bytecodesize_backup;if(bytecode_grow_amount>max_bytecode_grow_length){synth=backup
+i1
+t23
+lD2}
+else{xK1::x01
+count,eQ,synth
+yQ2}
}
#endif
#include <cmath>
#include <cassert>
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
-FUNCTIONPARSERTYPES;lF3{using
+l33
+FUNCTIONPARSERTYPES;l33{using
t5;
-#define FactorStack std xV3
+#define FactorStack std xM3
const
-e12
-PowiMuliType{iF2
-opcode_square;iF2
-opcode_cumulate;iF2
-opcode_invert;iF2
-opcode_half;iF2
+e72
+PowiMuliType{x83
+opcode_square;x83
+opcode_cumulate;x83
+opcode_invert;x83
+opcode_half;x83
opcode_invhalf;}
iseq_powi={cSqr,cMul,cInv,cSqrt,cRSqrt}
-,iseq_muli={iP1
-xE
-cNeg,iP1,iP1}
-nJ1
-iV2
-eS1
-cH1
-PowiMuliType&cS3,const
+,iseq_muli={l52
+x9
+cNeg,l52,l52}
+yO1
+Value_t
+cP1
+const
+PowiMuliType&c33,const
std
-xV3<iF2>&xP1,n72&stack
-tO2
-1);while(IP<limit){if(iT1==cS3.opcode_square){if(!isInteger
-xO1
-2;yW
-opcode_invert){nT3=-nT3;yW
-opcode_half){if
-iT2>y21&&isEvenInteger
-xO1
-iV2(0.5);yW
-opcode_invhalf){if
-iT2>y21&&isEvenInteger
-xO1
-iV2(-0.5);++IP;eR2
+nA3,n82&stack)eQ3
+1);while(IP<limit){if(n13
+c33.opcode_square){if(!t42
+eT3
+2;yZ
+opcode_invert){nS3=-nS3;yZ
+opcode_half){if(nS3>xH1&&isEvenInteger(eT3
+yF2;yZ
+opcode_invhalf){if(nS3>xH1&&isEvenInteger(eT3
+e62-0.5);++IP;yA1}
size_t
-x12=IP
-iU2
-lhs(1
-eY3
-iT1==cFetch){nA1=nD2;if(index<y1||size_t(index-y1)>=iV1){IP=x12;yF3
-lhs=stack[index-y1];goto
-yK2;}
-if(iT1==cDup){lhs=nT3;goto
-yK2;yK2:eX1
-nT3);++IP
-iU2
-subexponent=eS1(cS3
-tS
-if(IP>=limit||iT1!=cS3.opcode_cumulate){IP=x12;yF3++IP;stack.pop_back();nT3+=lhs*subexponent;eR2
-yF3
+xB2=IP
+iK2
+lhs(1);if(n13
+cFetch){lJ1=n43;if(index<y2||size_t(index-y2)>=lB2){IP=xB2;xY3
+lhs=stack[index-y2];goto
+yD2;}
+if(n13
+cDup){lhs=nS3;goto
+yD2;yD2:t91
+nS3);++IP
+iK2
+subexponent=cP1
+c33
+iK
+if(IP>=limit||eN1[IP]!=c33.opcode_cumulate){IP=xB2;xY3++IP;stack.pop_back();nS3+=lhs*subexponent;yA1}
+xY3
return
-nT3;}
-xW3
-iV2
+nS3;}
+tK1
+Value_t
ParsePowiSequence
-cH1
+iS1
std
-xV3<iF2>&xP1){n72
-stack;eX1
-iV2(1))n31
-eS1(iseq_powi
-tS}
-xW3
-iV2
+nA3){n82
+stack;t91
+e62
+1))i1
+cP1
+iseq_powi
+iK}
+tK1
+Value_t
ParseMuliSequence
-cH1
+iS1
std
-xV3<iF2>&xP1){n72
-stack;eX1
-iV2(1))n31
-eS1(iseq_muli
-tS}
-xW3
+nA3){n82
+stack;t91
+e62
+1))i1
+cP1
+iseq_muli
+iK}
+tK1
class
-CodeTreeParserData{eX3
-l53
+CodeTreeParserData{e43
+iX2
CodeTreeParserData(bool
k_powi):stack(),clones(),keep_powi(k_powi){}
void
Eat
-iA1
-tZ3,OPCODE
-opcode){eJ
-xI;xI
-xD
-opcode);eH
-c32=Pop(tZ3)tQ1
-c32
-eY3!keep_powi)switch(opcode
-y33
-cTanh:{eJ
+iZ1
+tL3,OPCODE
+opcode
+nQ
+xM;xM
+iH
+opcode);eK
+params=Pop(tL3
+yR1
+tL2;if(!keep_powi)e23
+opcode){case
+cTanh:{yZ2
sinh,cosh;sinh
-xD
+iH
cSinh);sinh
-c9
-xI
-lR2
+cS
+xM
+c43
sinh
-eT1
-cosh
-xD
+iW1;cosh
+iH
cCosh);cosh
-yP1
-xI
-lR2
+c91
+xM
+c43
cosh
-eT1
-eJ
+iW1
+tX
pow;pow
-xD
+iH
cPow);pow
-yP1
-cosh);pow.yC
-iV2(-1)));pow
-eT1
-xI
-tH3
-xI.nG1
-0,sinh);xI
-yP1
+c91
+cosh);pow.yA
+nU2));pow
+iW1;xM
+iH
+cMul);xM.nB1
+0,sinh);xM
+c91
pow
-cT2
+e02
case
-cTan:{eJ
+cTan:{yZ2
sin,cos;sin
-xD
+iH
cSin);sin
-c9
-xI
-lR2
+cS
+xM
+c43
sin
-eT1
-cos
-xD
+iW1;cos
+iH
cCos);cos
-yP1
-xI
-lR2
+c91
+xM
+c43
cos
-eT1
-eJ
+iW1
+tX
pow;pow
-xD
+iH
cPow);pow
-yP1
-cos);pow.yC
-iV2(-1)));pow
-eT1
-xI
-tH3
-xI.nG1
-0,sin);xI
-yP1
+c91
+cos);pow.yA
+nU2));pow
+iW1;xM
+iH
+cMul);xM.nB1
+0,sin);xM
+c91
pow
-cT2
+e02
case
-cPow:{lC2
-p0=xI
+cPow:{iT1&p0=xM
l8
-0);lC2
-p1=xI
+0);iT1&p1=xM
l8
-1
-eY3
-p1
-nC==cAdd){eH
-mulgroup(p1.GetParamCount())yM3
-0;a<p1.xF1++a){eJ
+1);if(p1
+nC==cAdd){eK
+mulgroup(p1.GetParamCount()iY1
+0;a<p1.l91++a
+nQ
pow;pow
-xD
+iH
cPow);pow
-c9
+cS
p0);pow
-c9
+cS
p1
-x13
+n93
pow
-eT1
-mulgroup[a
-i63
+iW1;mulgroup[a
+tQ3
pow);}
-xI
-xD
-cMul)tQ1
-nN3;}
-yF3
-c73
+xM
+iH
+cMul
+yR1
+mulgroup);}
+xY3
yF3
-xI.Rehash(!keep_powi);iU1,false);
+xY3
+xM.e33!keep_powi);lA2,false);
#ifdef DEBUG_SUBSTITUTIONS
-eZ1<<tZ3<<", "
-<<c83
-opcode)<<"->"
-<<c83
-xI
+iA1<<tL3<<", "
+<<FP_GetOpcodeName(opcode)<<"->"
+<<FP_GetOpcodeName(xM
nC)<<": "
-iV3
-xI
-tT
-xI);
+iK3
+xM);iB1
+xM);
#endif
-eX1
-xI
-lI3
+t91
+xM
+cN2
EatFunc
-iA1
-tZ3,OPCODE
-t83
-iF2
-funcno){eJ
-xI=CodeTreeFuncOp
-xK(t83
-funcno);eH
-c32=Pop(tZ3)tQ1
-c32);xI.n62
+iZ1
+tL3,OPCODE
+opcode,x83
+funcno
+nQ
+xM=CodeTreeFuncOp
+xF(opcode,funcno);eK
+params=Pop(tL3
+yR1
+tL2;xM.yC2);
#ifdef DEBUG_SUBSTITUTIONS
-eZ1<<tZ3<<", "
-iV3
-xI
-tT
-xI);
-#endif
-iU1);eX1
-xI
-lI3
-AddConst(yJ1){eJ
-xI=CodeTreeImmed(value);iU1);Push(xI
-lI3
+iA1<<tL3<<", "
+iK3
+xM);iB1
+xM);
+#endif
+lA2);t91
+xM
+cN2
+AddConst(yL1
+nQ
+xM=CodeTreeImmed(value);lA2);Push(xM
+cN2
AddVar
-nT2
-varno){eJ
-xI=CodeTreeVar
-xK(varno);iU1);Push(xI
-lI3
-SwapLastTwoInStack(){eY1
+lT1
+varno
+nQ
+xM=CodeTreeVar
+xF(varno);lA2);Push(xM
+cN2
+SwapLastTwoInStack(){tA1
1
-i63
-eY1
-2]lI3
-Dup(){Fetch(iV1-1
-lI3
+tQ3
+tA1
+2]cN2
+Dup(){Fetch(lB2-1
+cN2
Fetch
-iA1
+iZ1
which){Push(stack[which]);}
-nR1
+nN1
T>void
Push(T
tree){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<iV3
-tree
-tT
+cV2<<iK3
+tree);iB1
tree);
#endif
-eX1
+t91
tree
-lI3
+cN2
PopNMov
-iA1
+iZ1
target,size_t
-source){stack[target]=stack[source];stack.t73
+source){stack[target]=stack[source];stack
+xF3
target+1);}
-eJ
-yL2{clones.clear();eJ
-nT3(stack.back());stack.t73
-iV1-1)n31
-nT3;}
-eH
+yZ2
+yE2{clones.clear()tX
+nS3(stack.back());stack
+xF3
+lB2-1)i1
+nS3;}
+eK
Pop
-iA1
-n_pop){eH
-nT3(n_pop);for
-nT2
-n=0;n<n_pop;++n)nT3[n
-i63
-eY1
+iZ1
+n_pop){eK
+nS3(n_pop);for
+lT1
+n=0;n<n_pop;++n)nS3[n
+tQ3
+tA1
n_pop+n]);
#ifdef DEBUG_SUBSTITUTIONS
for
-iA1
-n=n_pop;n-->0;){eZ1
-i13
-iT2[n]tT
-nT3[n]);}
+iZ1
+n=n_pop;n-->0;){iA1
+iL2
+nS3[n]);iB1
+nS3[n]);}
#endif
-stack.t73
-iV1-n_pop)n31
-nT3;}
+stack
+xF3
+lB2-n_pop)i1
+nS3;}
size_t
-GetStackTop(yZ1
-iV1;}
+GetStackTop(c01
+lB2;}
private:void
-FindClone(eJ&,bool=true)yR;}
-private:eH
-stack;std::multimap<fphash_t,eJ>clones;bool
+FindClone(yZ2&,bool=true)yP;}
+private:eK
+stack;std::multimap<fphash_t,yZ2>clones;bool
keep_powi;private:CodeTreeParserData
-cH1
-CodeTreeParserData&);CodeTreeParserData&eA1=cH1
+iS1
+CodeTreeParserData&);CodeTreeParserData&eM1=iS1
CodeTreeParserData&);}
-nJ1
-e12
-IfInfo{eJ
-eI2;eJ
+yO1
+e72
+IfInfo{yZ2
+eS2
+tX
thenbranch;size_t
-endif_location;IfInfo():eI2(),thenbranch(),endif_location(){}
+endif_location;IfInfo():eS2(),thenbranch(),endif_location(){}
}
;}
t5{lB
GenerateFrom
-cH1
-xK3
+iS1
+x93
FunctionParserBase
-xK::Data&xH3,bool
-keep_powi){eH
-xC2;xC2.xS3
-xH3.mVariablesAmount);for
-nT2
-n=0;n<xH3.mVariablesAmount;++n){xC2.push_back(CodeTreeVar
-xK(n+l03));}
-GenerateFrom(xH3,xC2,keep_powi);}
+xF::Data&x33,bool
+keep_powi){eK
+xH2;xH2.xH3
+x33.mVariablesAmount);for
+lT1
+n=0;n<x33.mVariablesAmount;++n){xH2
+c52
+CodeTreeVar
+xF(n+iU2));}
+GenerateFrom(x33,xH2,keep_powi);}
lB
GenerateFrom
-cH1
-xK3
+iS1
+x93
FunctionParserBase
-xK::Data&xH3,const
-x1&xC2,bool
+xF::Data&x33,const
+x5&xH2,bool
keep_powi){const
+eO3
+x83>&eN1=x33.mByteCode;const
std
-xV3<iF2>&ByteCode=xH3.mByteCode;const
-std
-xV3
-xK&Immed=xH3.mImmed;
+xM3
+xF&Immed=x33.mImmed;
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"ENTERS GenerateFrom()\n"
+cV2<<"ENTERS GenerateFrom()\n"
;
#endif
CodeTreeParserData
-xK
-sim(keep_powi);std
-xV3<IfInfo
-xK>eG;for
-iA1
-IP=0,DP=0;;++IP){i22:while(!eG
-cT3&&(eG.e6==IP||(IP<i8
-tF3&&iT1==cJump&&eG.tE1.IsDefined()))){CodeTree
-elsebranch=sim.yL2
-nB2
-eG.back().eI2)nB2
-eG.tE1)nB2
-elsebranch);tQ2
-3,cIf);eG.pop_back();}
-if(IP>=i8
-tF3)break;iF2
-opcode=iT1;if((opcode==cSqr||opcode==cDup||(opcode==cInv&&!IsIntType
-xK::nT3)||opcode==cNeg||opcode==cSqrt||opcode==cRSqrt||opcode==cFetch)){size_t
+xF
+sim(keep_powi);eO3
+IfInfo
+xF>eJ
+eK3
+IP=0,DP=0;;++IP){tO2:while(!eJ
+eU3&&(eJ.eA==IP||(IP<n41&&n13
+cJump&&eJ
+e81.nX2))){c02
+elsebranch=sim.yE2
+nA2
+eJ.back().eS2)nA2
+eJ
+e81)nA2
+elsebranch)yR
+3,cIf);eJ.pop_back();}
+if(IP>=n41)break;x83
+opcode=eN1[IP];if(eS3
+cSqr||opcode==cDup||eS3
+cInv&&!IsIntType
+xF::nS3)||opcode==cNeg||opcode==cSqrt||opcode==cRSqrt||opcode==cFetch)){size_t
was_ip=IP
-iU2
-e92
+iK2
+eD2
ParsePowiSequence
-xK(ByteCode,IP,eG
-cT3?i8
-tF3:eG.e6,sim.xM
-1);if
-t62!=iV2(1.0)){xL
+xF(eN1,IP,eJ
+eU3?n41:eJ.eA,sim.xH
+1);if(exponent!=e62
+1.0)){xG
exponent
-xD2;goto
-i22;}
-if(opcode==cDup||opcode==cFetch||opcode==cNeg
-tJ2
+iU3);goto
+tO2;}
+if
+eS3
+cDup||opcode==cFetch||opcode==cNeg)l14
xT2=ParseMuliSequence
-xK(ByteCode,IP,eG
-cT3?i8
-tF3:eG.e6,sim.xM
-1
-eY3
-xT2!=iV2(1.0)){xL
-xT2)y3
-cMul);goto
-i22;}
+xF(eN1,IP,eJ
+eU3?n41:eJ.eA,sim.xH
+1);if(xT2!=e62
+1.0)){xG
+xT2)yR
+2,cMul);goto
+tO2;}
}
IP=was_ip;}
-if(n82>=l03){nA1=opcode-l03
-nB2
-xC2[index]t43{switch(n82
-y33
+if(nB2>=iU2){lJ1=opcode-iU2
+nA2
+xH2[index]);}
+else{e23
+nB2){case
cIf:case
-cAbsIf:{eG.t73
-eG.tF3+1);CodeTree
-res(sim.yL2);eG.back().eI2.swap(res);eG.e6=i8
-tF3;IP+=2;eR2
+cAbsIf:{eJ
+xF3
+eJ
+eJ3+1);c02
+res(sim.yE2);eJ.back().eS2.swap(res);eJ.eA=n41;IP+=2;yA1}
case
-cJump:{CodeTree
-res(sim.yL2);eG.tE1.swap(res);eG.e6=lE3
-IP+1]+1;IP+=2;eR2
+cJump:{c02
+res(sim.yE2);eJ
+e81.swap(res);eJ.eA=eN1[IP+1]+1;IP+=2;yA1}
case
-cImmed:xL
+cImmed:xG
Immed[DP++]);lC
cDup:sim.Dup();lC
cNop:lC
-cFCall:{iF2
-funcno=nD2;assert(funcno<fpdata.mFuncPtrs.size());iF2
-c32=xH3.mFuncPtrs[funcno].mParams;sim.EatFunc(c32,n82,funcno
-cT2
+cFCall:{x83
+funcno=n43;assert(funcno<fpdata.mFuncPtrs.size());x83
+params=x33.mFuncPtrs
+n53
+mParams;sim.EatFunc(params,nB2,funcno
+e02
case
-cPCall:{iF2
-funcno=nD2;assert(funcno<fpdata.iT3.size());const
+cPCall:{x83
+funcno=n43;assert(funcno<fpdata.iI3.size());const
FunctionParserBase
-xK&p=*xH3.iT3[funcno].mParserPtr;iF2
-c32=xH3.iT3[funcno].mParams;x1
-paramlist=sim.Pop(c32);CodeTree
-i32;i32.GenerateFrom(*p.mData,paramlist)nB2
-i32
-cT2
+xF&p=*x33.iI3
+n53
+mParserPtr;x83
+params=x33.iI3
+n53
+mParams;x5
+paramlist=sim.Pop(tL2;c02
+tP2;tP2.GenerateFrom(*p.mData,paramlist)nA2
+tP2
+e02
case
-cInv:xL
+cInv:xG
1
-cQ2
+c32
cDiv);lC
-cNeg:nC2
-cNeg);break;xL
+cNeg
+nC2
+cNeg);break;xG
0
-cQ2
+c32
cSub);lC
-cSqr:xL
+cSqr:xG
2
-xD2;lC
-cSqrt
-e72
-t01
-cRSqrt
-e72-t01
-cCbrt
-e72
-1)/iV2(3)xD2;lC
-cDeg:xL
+xN1
+cSqrt:xG
+yF2
+xN1
+cRSqrt:xG
+e62-0.5)xN1
+cCbrt:xG
+e62
+1)/e62
+3)xN1
+cDeg:xG
fp_const_rad_to_deg
-eU1
-cRad:xL
+xF())yG1
+cRad:xG
fp_const_deg_to_rad
-eU1
-cExp:cR1)goto
-iQ2;xL
+xF())yG1
+cExp:iR)goto
+yM3;xG
fp_const_e
-xK()cQ2
+xF()c32
cPow);lC
-cExp2:cR1)goto
-iQ2;xL
+cExp2:iR)goto
+yM3;xG
2.0
-cQ2
+c32
cPow);lC
-cCot:nC2
-cTan
-nW
-cCsc:nC2
-cSin
-nW
-cSec:nC2
-cCos
-nW
+cCot
+nC2
+cTan);iR)x1
+cCsc
+nC2
+cSin);iR)x1
+cSec
+nC2
+cCos);iR)x1
cInt:
#ifndef __x86_64
-cR1){nC2
-cInt
-cT2
+iR)n23
+1,cInt
+e02
#endif
-xL
-iV2(0.5))nD3
+xG
+yF2)tQ2
+yR
+1,cFloor);lC
+cLog10
nC2
-cFloor);lC
-cLog10:nC2
-cX3
+c53
fp_const_log10inv
-eU1
-cLog2:nC2
-cX3
+xF())yG1
+cLog2
+nC2
+c53
fp_const_log2inv
-eU1
-eF3:iZ3
-cX3
+xF())yG1
+cQ3:n33
+c53
fp_const_log2inv
-xK());tQ2
+xF())yR
3,cMul);lC
-cHypot:xL
+cHypot:xG
2
-xD2;i73
-xL
+iU3);tS3
+xG
2
-xD2
-nD3
-xL
-iV2(t01
-cSinCos:sim.Dup();nC2
-cSin);iZ3
+iU3)tQ2;xG
+yF2
+xN1
+cSinCos:sim.Dup()yR
+1,cSin);n33
cCos);lC
-cSinhCosh:sim.Dup();nC2
-cSinh);iZ3
+cSinhCosh:sim.Dup()yR
+1,cSinh);n33
cCosh);lC
-cRSub:i73
+cRSub:tS3
case
-cSub:cR1){tQ2
+cSub:iR)n23
2,cSub
-cT2
-xL-1)y3
-cMul)nD3
-lC
-cRDiv:i73
+e02
+xG-1)yR
+2,cMul)tQ2;lC
+cRDiv:tS3
case
-cDiv:cR1||IsIntType
-xK::nT3){tQ2
+cDiv:iR||IsIntType
+xF::nS3)n23
2,cDiv
-cT2
-xL-1
-xD2
-y3
-cMul);lC
+e02
+xG-1
+iU3)yG1
cAdd:case
cMul:case
cMod:case
cEqual:case
cLess:case
cGreater:case
-cNEqual:case
+i51:case
cLessOrEq:case
cGreaterOrEq:case
cAnd:case
cOr:case
cAbsAnd:case
-cAbsOr:tQ2
-2,t11
+cAbsOr:sim.Eat(2,tB1
lC
cNot:case
cNotNot:case
-cZ3:case
-cAbsNotNot:nC2
-t11
+cC3:case
+cAbsNotNot
+nC2
+tB1
lC
-cFetch:sim.Fetch(nD2);lC
-cPopNMov:{iF2
-stackOffs_target=nD2;iF2
-stackOffs_source=nD2;sim.PopNMov(stackOffs_target,stackOffs_source
-cT2
-c73
-iQ2:;iF2
+cFetch:sim.Fetch(n43);lC
+cPopNMov:{x83
+stackOffs_target=n43;x83
+stackOffs_source=n43;sim.PopNMov(stackOffs_target,stackOffs_source
+e02
+yF3
+yM3:;x83
funcno=opcode-cAbs;assert(funcno<FUNC_AMOUNT);const
-FuncDefinition&func=Functions[funcno];tQ2
-func.c32,t11
-yF3}
+FuncDefinition&func=Functions[funcno]yR
+func.params,tB1
+xY3}
}
-Become(sim.yL2);
+Become(sim.yE2);
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Produced tree:\n"
-;iR
+cV2<<"Produced tree:\n"
+;l21
#endif
}
}
#ifdef FP_SUPPORT_OPTIMIZER
#include <assert.h>
#define FP_MUL_COMBINE_EXPONENTS
-lF3{using
-lF3
+l33{using
+l33
FUNCTIONPARSERTYPES;using
t5
-nJ1
+yO1
static
void
-AdoptChildrenWithSameOpcode(e62{
+AdoptChildrenWithSameOpcode(eR{
#ifdef DEBUG_SUBSTITUTIONS
bool
-nO2
-tO3
+nT2
+eW3
#endif
for
-iY
-if
-y91
-a)nC==i01){
+l41
+if(xW
+a)nC==t72){
#ifdef DEBUG_SUBSTITUTIONS
-if(!nO2)yC2"Before assimilation: "
-yA1
-nO2=true;}
+if(!nT2)cH2"Before assimilation: "
+cR
+nT2=true;}
#endif
-tree.AddParamsMove
-y91
-a).GetUniqueRef().l02),a);}
+tree.AddParamsMove(xW
+a).GetUniqueRef().lJ2),a);}
#ifdef DEBUG_SUBSTITUTIONS
-if(nO2)yC2"After assimilation: "
-yA1}
+if(nT2)cH2"After assimilation: "
+cR}
#endif
}
}
-t5{tZ1
-ConstantFolding(e62{tree.Sort();
+t5{xL1
+ConstantFolding(eR{tree.Sort();
#ifdef DEBUG_SUBSTITUTIONS
-void*cY3=0;std::cout<<"["
-<<(&cY3)<<"]Runs ConstantFolding for: "
-yA1
+void*c63=0;cV2<<"["
+<<(&c63)<<"]Runs ConstantFolding for: "
+cR
DumpHashes(tree
-lT2
+lE2
std::flush;
#endif
if(false){redo:;tree.Sort();
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"["
-<<(&cY3)<<"]Re-runs ConstantFolding: "
-yA1
+cV2<<"["
+<<(&c63)<<"]Re-runs ConstantFolding: "
+cR
DumpHashes(tree);
#endif
}
-if(i01!=cImmed){c23
-p=iN
-tree
-eY3
-p
-n51&&p
-nP2
-tF2==e13){xO
+if(t72!=cImmed){yD3
+p=CalculateResultBoundaries(tree);if(p
+yI&&p
+e61&&p
+yM==p
+tG1{nU
p
-tF2);nD}
-if(false){ReplaceTreeWithOne:xO
-iV2(1));goto
-do_return;ReplaceTreeWithZero:xO
-xD1;goto
+yM);nD}
+if(false){ReplaceTreeWithOne:nU
+e62
+1));goto
+do_return;ReplaceTreeWithZero:nU
+xG1;goto
do_return;ReplaceTreeWithParam0:
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Before replace: "
-;std::cout<<std::hex<<'['lD2
-hash1<<','lD2
+cV2<<"Before replace: "
+;cV2<<std::hex<<'['
+eJ1
+hash1<<','
+eJ1
hash2<<']'<<std::dec
-yA1
+cR
#endif
-tree.xY2
+tree.eF2
0));
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"After replace: "
-;std::cout<<std::hex<<'['lD2
-hash1<<','lD2
+cV2<<"After replace: "
+;cV2<<std::hex<<'['
+eJ1
+hash1<<','
+eJ1
hash2<<']'<<std::dec
-yA1
+cR
#endif
-cZ
-l73
-i01
-y33
+cJ
+c73(t72){case
cImmed:lC
-l03:lC
+iU2:lC
cAnd:case
-cAbsAnd:eQ
+cAbsAnd
+cK
bool
-c2
-tO3
+c5
+eW3
for
-iY{if(!yX3
-a)))c2=true;cW3
-a),i01==cAbsAnd)y33
-IsNever
-eL
-IsAlways:tree
-t31);lC
-lT1
-l73
-eM
-y33
-0:i6
-1:tI3
-i01==cAnd?cNotNot:cAbsNotNot);cZ
+l41{if(!c83
+a)))c5=true;cA3
+a),t72==cAbsAnd)){case
+xX3
+t7
+iF2:iZ);lC
+lZ1
c73
-l83
-cAnd||!c2)if(ConstantFolding_AndLogic(eJ2
-i91
+l51){case
+0:iD
+1:tD2
+t72==cAnd?cNotNot:cAbsNotNot);cJ
+yF3
+cZ2
+cAnd||!c5)if(ConstantFolding_AndLogic(tB2
+e21
cOr:case
-cAbsOr:eQ
+cAbsOr
+cK
bool
-c2
-tO3
+c5
+eW3
for
-iY{if(!yX3
-a)))c2=true;cW3
-a),i01==cAbsOr))l92
-i6
-lC3
-tree
-t31);lC
-lT1
-l73
-eM
-y33
-0
-eL
-1:tI3
-i01==cOr?cNotNot:cAbsNotNot);cZ
+l41{if(!c83
+a)))c5=true;cA3
+a),t72==cAbsOr)tN1
+iD
+l03
+iZ);lC
+lZ1
c73
-l83
-cOr||!c2)if(ConstantFolding_OrLogic(eJ2
-i91
+l51){case
+0
+t7
+1:tD2
+t72==cOr?cNotNot:cAbsNotNot);cJ
+yF3
+cZ2
+cOr||!c5)if(ConstantFolding_OrLogic(tB2
+e21
cNot:case
-cZ3:{iF2
-lZ1
-0;switch
-y91
-0)nC
-y33
-cEqual:lZ1
-cNEqual;lC
-cNEqual:lZ1
+cC3:{x83
+n61
+0;e23
+c93){case
+cEqual:n61
+i51;lC
+i51:n61
cEqual;lC
-cLess:lZ1
+cLess:n61
cGreaterOrEq;lC
-cGreater:lZ1
+cGreater:n61
cLessOrEq;lC
-cLessOrEq:lZ1
+cLessOrEq:n61
cGreater;lC
-cGreaterOrEq:lZ1
+cGreaterOrEq:n61
cLess;lC
-cNotNot:lZ1
+cNotNot:n61
cNot;lC
-cNot:lZ1
+cNot:n61
cNotNot;lC
-cZ3:lZ1
+cC3:n61
cAbsNotNot;lC
-cAbsNotNot:lZ1
-cZ3;break;c73
-yF3
-if(opposite){tI3
-OPCODE(opposite));tree.SetParamsMove
-y91
-0).GetUniqueRef().l02));cZ
-l73
-tM
-0),tree
-cS1
-y33
-IsAlways
-eL
-lC3
-i6
-lT1
-l83
-cNot&&GetPositivityInfo
-y91
-0))==IsAlways)tI3
-cZ3);lT3
-nC==cIf||lE2
-0)nC==yW3{eJ
-l93=lE2
-0);lC2
-ifp1=l93
+cAbsNotNot:n61
+cC3;break;yF3
+xY3
+if(opposite){tD2
+OPCODE(opposite)yB
+SetParamsMove(xW
+0).GetUniqueRef().lJ2));cJ
+c73(lY1
+0)cU3
+cQ1){case
+iF2
+t7
+l03
+iD
+lZ1
+cZ2
+cNot&&GetPositivityInfo(xW
+0))==iF2)tD2
+cC3);if(c93==cIf||c93==cAbsIf
+nQ
+iZ2=xW
+0);iT1&ifp1=iZ2
l8
-1);lC2
-ifp2=l93
+1);iT1&ifp2=iZ2
l8
-2
-eY3
-ifp1
+2);if(ifp1
nC
-lA3
+iY3
ifp1
-cS1{tree
-xJ
+cQ1
+cD3
ifp1
-nC==cNot?cNotNot:cAbsNotNot
-cU3
-lR2
-cV3
-eJ
-p2;p2
-iP2
-p2
-e03
-tN
+nC==cNot?cNotNot:cAbsNotNot);tR2
+c43
+n63)cE3
+nO2;p2
+tT3
+iI
if(ifp2
nC
-lA3
+iY3
ifp2
-cS1{tree
-xJ
-i01
-cU3);cV3
-eJ
-p2;p2
-xD
+cQ1
+cD3
+t72);tR2);n63)cE3
+iH
ifp2
nC==cNot?cNotNot:cAbsNotNot);p2
-e03
+tT3
l8
-0)tN
-i91
+0)iI
+e21
cNotNot:case
-cAbsNotNot:{if(yX3
-0)))nY3
-cW3
-0),i01==cAbsNotNot)y33
-IsNever
-eL
-IsAlways:i6
-lT1
-l83
-cNotNot&&GetPositivityInfo
-y91
-0))==IsAlways)tI3
-cAbsNotNot);lT3
-nC==cIf||lE2
-0)nC==yW3{eJ
-l93=lE2
-0);lC2
-ifp1=l93
+cAbsNotNot:{if(c83
+0)))n73
+cA3
+0),t72==cAbsNotNot)){case
+xX3
+t7
+iF2:iD
+lZ1
+cZ2
+cNotNot&&GetPositivityInfo(xW
+0))==iF2)tD2
+cAbsNotNot);if(c93==cIf||c93==cAbsIf
+nQ
+iZ2=xW
+0);iT1&ifp1=iZ2
l8
-1);lC2
-ifp2=l93
+1);iT1&ifp2=iZ2
l8
-2
-eY3
-ifp1
+2);if(ifp1
nC
-lA3
+iY3
ifp1
-cS1{cM1
-0,l93
-lR2
-i83
-ifp1);eJ
-p2;p2
-iP2
-p2
-e03
-tN
+cQ1{tree.SetParam(0,iZ2
+l8
+0)yB
+AddParam(ifp1)cE3
+nO2;p2
+tT3
+iI
if(ifp2
nC
-lA3
+iY3
ifp2
-cS1{tree
-xJ
-i01
-cU3);cV3
-tree
-e03);tI3
-l93
-nC);cZ}
-i91
+cQ1
+cD3
+t72);tR2);n63
+yB
+AddParam(ifp2
+yB
+eL3
+iZ2
+nC);cJ}
+e21
cIf:case
-cAbsIf:{if(ConstantFolding_IfOperations(eJ2
-yF3
+cAbsIf:{if(ConstantFolding_IfOperations(tB2
+xY3
case
-cMul:{NowWeAreMulGroup:;AdoptChildrenWithSameOpcode(tree)iU2
-nL1=iV2(1);size_t
-iW1=0;bool
-nM1
-tO3
-nB1{if(!lE2
-t21
-continue
-iU2
-immed=t63
-if(immed==xD1
+cMul:{NowWeAreMulGroup:;AdoptChildrenWithSameOpcode(tree)iK2
+nH1=e62
+1);size_t
+lC2=0;bool
+nI1
+eW3
+x51{if(!xW
+tC1
+yA1
+Value_t
+immed=xW
+a)x41;if(immed==xG1
goto
-ReplaceTreeWithZero;nL1*=immed;++iW1;}
-if(iW1>1||(iW1==1&&cB3
-nL1
-tG1
-1))))nM1=true;if(nM1){
+ReplaceTreeWithZero;nH1*=immed;++lC2;}
+if(lC2>1||(lC2==1&&lJ3
+nH1,e62
+1))))nI1=true;if(nI1){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"cMul: Will add new "
-iU3
-nL1<<"\n"
+cV2<<"cMul: Will add new "
+iJ3
+nH1<<"\n"
;
#endif
for
-iY
-if
-y91
-t21{
+l41
+if(xW
+tC1{
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<" - For that, deleting "
-iU3
-t63
-std::cout<<"\n"
+cV2<<" - For that, deleting "
+iJ3
+xW
+a)x41;cV2<<"\n"
;
#endif
-i93!cB3
-nL1
-tG1
-1)))i83
+tU3(!lJ3
+nH1,e62
+1)))tree
+cS
+eA1
+nH1));c73
+l51){case
+0:iD
+1:n73
+yF3
+if(ConstantFolding_MulGrouping(tB2
+if(ConstantFolding_MulLogicItems(tB2
e21
-nL1));l73
-eM
-y33
-0:i6
-1:nY3
-c73
-if(ConstantFolding_MulGrouping(eJ2
-if(ConstantFolding_MulLogicItems(eJ2
-i91
-cAdd:eQ
-iV2
-nE2=0.0;size_t
-iW1=0;bool
-nM1
-tO3
-nB1{if(!lE2
-t21
-continue
-iU2
-immed=t63
-nE2+=immed;++iW1;}
-if(iW1>1||(iW1==1&&nE2==xD1)nM1=true;if(nM1){
-#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"cAdd: Will add new "
-iU3
-nE2<<"\n"
-;std::cout<<"In: "
+cAdd
+cK
+Value_t
+nD2=0.0;size_t
+lC2=0;bool
+nI1
+eW3
+x51{if(!xW
+tC1
yA1
+Value_t
+immed=xW
+a)x41;nD2+=immed;++lC2;}
+if(lC2>1||(lC2==1&&nD2==xG1)nI1=true;if(nI1){
+#ifdef DEBUG_SUBSTITUTIONS
+cV2<<"cAdd: Will add new "
+iJ3
+nD2<<"\n"
+;cV2<<"In: "
+cR
#endif
for
-iY
-if
-y91
-t21{
+l41
+if(xW
+tC1{
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<" - For that, deleting "
-iU3
-t63
-std::cout<<"\n"
+cV2<<" - For that, deleting "
+iJ3
+xW
+a)x41;cV2<<"\n"
;
#endif
-i93!(nE2==x22)i83
-e21
-nE2));l73
-eM
-y33
+tU3(!(nD2==e62
+0.0)))tree
+cS
+eA1
+nD2));c73
+l51){case
0
-eL
-1:nY3
-c73
-if(ConstantFolding_AddGrouping(eJ2
-if(ConstantFolding_AddLogicItems(eJ2
-i91
-cMin:eQ
+t7
+1:n73
+yF3
+if(ConstantFolding_AddGrouping(tB2
+if(ConstantFolding_AddLogicItems(tB2
+e21
+cMin
+cK
size_t
-yM2=0;c23
-e0;nB1{while(a+1<eM&&t33
-xF
-lE2
-a+1)))tree
-t31+1);c33
-max
-lB3(!e0
-yN
-known||(e13)<e0
-yN
-val)){e0
-yN
-val=e13;e0
-yN
-known=true;yM2=a;}
-}
-if(e0
-xF2
-for
-iY{c33
-min
-lB3
-a!=yM2&&p
-tF2>=e0
-yN
-val)i93
-eM==1){nY3
-i91
-cMax:eQ
+yI2=0;yD3
+e4;x51{while(a+1<tree.GetParamCount()&&xW
+a)xI
+xW
+a+1)))iZ+1);yE3
+max.cF3(!e4
+e61||(p
+tG1<e4
+tG1){e4
+nL3=p
+nL3;e4
+e61=true;yI2=a;}
+}
+if(e4
+e61)for
+l41{yE3
+min.cF3
+a!=yI2&&p
+yM>=e4
+tG1
+tU3
+l51==1){n73
+e21
+cMax
+cK
size_t
-yM2=0;c23
-eZ;nB1{while(a+1<eM&&t33
-xF
-lE2
-a+1)))tree
-t31+1);c33
-min
-lB3(!eZ
-n51||p
-tF2>eZ
-tF2)){eZ
-tF2=p
-tF2;eZ
-n51=true;yM2=a;}
-}
-if(eZ
-n51){for
-iY{c33
-max
-lB3
-a!=yM2&&(e13)<eZ
-tF2){eK2}
+yI2=0;yD3
+eY;x51{while(a+1<tree.GetParamCount()&&xW
+a)xI
+xW
+a+1)))iZ+1);yE3
+min.cF3(!eY
+yI||p
+yM>eY
+yM)){eY
+yM=p
+yM;eY
+yI=true;yI2=a;}
+}
+if(eY
+yI){for
+l41{yE3
+max.cF3
+a!=yI2&&(p
+tG1<eY
+yM){iZ);}
}
-if(eM==1){nY3
-i91
+}
+if
+l51==1){n73
+e21
cEqual:case
-cNEqual:case
+i51:case
cLess:case
cGreater:case
cLessOrEq:case
-cGreaterOrEq:if(ConstantFolding_Comparison(eJ2
+cGreaterOrEq:if(ConstantFolding_Comparison(tB2
lC
-cAbs:{c23
-p0
-tI
+cAbs:{yD3
+tY
+xW
0));if
-tG2
-nY3
-if(p0
-eN{tree
-tH3
-tree.yC
-iV2(1)));goto
+iE
+n73
+if
+iF{tD2
+cMul
+yB
+yA
+e62
+1)));goto
NowWeAreMulGroup;}
-lT3
-nC==cMul){lC2
-p=lE2
-0);eH
-x03;eH
-cK2
-yM3
-0;a<p.xF1++a){p0=iN
+if(c93==cMul){iT1&p=xW
+0);eK
+n83;eK
+cP2
+e73
+0;a<p.l91++a){tY
p
-x13
+n93
if
-tG2{x03.push_back(p
-x13}
-if(p0
-eN{cK2.push_back(p
-x13}
+iE{n83
+c52
+p
+n93}
+if
+iF{cP2
+c52
+p
+n93}
}
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"Abs: mul group has "
-<<x03.tF3<<" pos, "
-<<cK2.tF3<<"neg\n"
+cV2<<"Abs: mul group has "
+<<n83
+eJ3<<" pos, "
+<<cP2
+eJ3<<"neg\n"
;
#endif
-if(!x03
-cT3||!cK2
-cT3){
+if(!n83
+eU3||!cP2
+eU3){
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"AbsReplace-Before: "
-i13(tree
-lT2"\n"
-<<std::flush;DumpHashes(tree
-i42);
+cV2<<"AbsReplace-Before: "
+iL2
+tree
+lE2"\n"
+<<std::flush;DumpHashes
+nV2);
#endif
-eJ
-eW3;eW3
-xD
-cMul)yM3
-0;a<p.xF1++a){p0=iN
+yZ2
+e13;e13
+iH
+cMul
+iY1
+0;a<p.l91++a){tY
p
-x13
-if(tG2||(p0
-eN){}
+n93
+if(iE||iF){}
else
-eW3
-c9
+e13
+cS
p
-x13}
-eW3
-eT1
-eJ
-x23;x23
-xD
-cAbs);x23
-yP1
-eW3);x23
-eT1
-eJ
-y41
+n93}
+e13
+iW1
+tX
+nB3;nB3
+iH
+cAbs);nB3
+c91
+e13);nB3
+iW1
+tX
+iG
cMul);mulgroup
-yP1
-x23);yQ1
-AddParamsMove(x03
-eY3!cK2
-cT3){if(cK2.tF3%2)yQ1
-yC
-iV2(-1)));yQ1
-AddParamsMove(cK2);}
+c91
+nB3);cA1
+AddParamsMove(n83);if(!cP2
+eU3){if(cP2
+eJ3%2)cA1
+yA
+nU2));cA1
+AddParamsMove(cP2);}
tree.Become
-lR3);
+eH2);
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"AbsReplace-After: "
-i13(tree
-i42
-lT2"\n"
-<<std::flush;DumpHashes(tree
-i42);
+cV2<<"AbsReplace-After: "
+;DumpTree
+nV2
+lE2"\n"
+<<std::flush;DumpHashes
+nV2);
#endif
goto
NowWeAreMulGroup;}
}
-yF3
-#define HANDLE_UNARY_CONST_FUNC(funcname) nR){xO funcname(lR));nD
+xY3
+#define HANDLE_UNARY_CONST_FUNC(funcname) nP){nU funcname(lR));nD
case
-cLog:iK3(fp_log);lT3
-nC==cPow){eJ
-pow=lE2
-0
-eY3
-GetPositivityInfo(pow
+cLog:i83(fp_log);if(c93==cPow
+nQ
+pow=xW
+0);if(GetPositivityInfo(pow
l8
-0))==IsAlways){pow.CopyOnWrite()i7
-tree.lU
+0))==iF2)iV1
+t2
+yB
+lU
if(GetEvennessInfo(pow
l8
-1))==IsAlways){pow.l61
-eJ
+1))==iF2)iV1()tX
abs;abs
-xD
+iH
cAbs);abs
-yP1
+c91
pow
-lR2
-abs.Rehash()i7
-pow.nG1
-0,abs);tree.lU}
-else
-lT3
-nC==cAbs){eJ
-pow=lE2
+c43
+abs.Rehash
+t2);pow.nB1
+0,abs
+yB
+lU}
+iP1
+c93==cAbs
+nQ
+pow=xW
0)l8
-0
-eY3
-pow
-nC==cPow){pow.l61
-eJ
+0);if(pow
+nC==cPow)iV1()tX
abs;abs
-xD
+iH
cAbs);abs
-yP1
+c91
pow
-lR2
-abs.Rehash()i7
-pow.nG1
-0,abs);tree.lU}
+c43
+abs.Rehash
+t2);pow.nB1
+0,abs
+yB
+lU}
lC
-cAcosh:iK3(fp_acosh);lC
-cAsinh:iK3(fp_asinh);lC
-cAtanh:iK3(fp_atanh);lC
-cAcos:iK3(fp_acos);lC
-cAsin:iK3(fp_asin);lC
-cAtan:iK3(fp_atan);lC
-cCosh:iK3(fp_cosh);lC
-cSinh:iK3(fp_sinh);lC
-cTanh:iK3(fp_tanh);lC
-cSin:iK3(fp_sin);lC
-cCos:iK3(fp_cos);lC
-cTan:iK3(fp_tan);lC
-cCeil:l54(fp_ceil);lC
-cTrunc:l54(fp_trunc);lC
-cFloor:l54(fp_floor);lC
-cInt:l54(fp_int);lC
-cCbrt:iK3(fp_cbrt);lC
-cSqrt:iK3(fp_sqrt);lC
-cExp:iK3(fp_exp);lC
-cLog2:iK3(fp_log2);lC
-cLog10:iK3(fp_log10);lC
-eF3:if
+cAcosh:i83(fp_acosh);lC
+cAsinh:i83(fp_asinh);lC
+cAtanh:i83(fp_atanh);lC
+cAcos:i83(fp_acos);lC
+cAsin:i83(fp_asin);lC
+cAtan:i83(fp_atan);lC
+cCosh:i83(fp_cosh);lC
+cSinh:i83(fp_sinh);lC
+cTanh:i83(fp_tanh);lC
+cSin:i83(fp_sin);lC
+cCos:i83(fp_cos);lC
+cTan:i83(fp_tan);lC
+cCeil:if(n5
+i83(fp_ceil);lC
+cTrunc:if(n5
+i83(fp_trunc);lC
+cFloor:if(n5
+i83(fp_floor);lC
+cInt:if(n5
+i83(fp_int);lC
+cCbrt:i83(fp_cbrt);lC
+cSqrt:i83(fp_sqrt);lC
+cExp:i83(fp_exp);lC
+cLog2:i83(fp_log2);lC
+cLog10:i83(fp_log10);lC
+cQ3:if
lI
-fp_log2(lR)*tH
-tH2
-cArg:iK3(fp_arg);lC
-cConj:iK3(fp_conj);lC
-cImag:iK3(fp_imag);lC
-cReal:iK3(fp_real);lC
+fp_log2(lR)*xW
+nC3
+cArg:i83(fp_arg);lC
+cConj:i83(fp_conj);lC
+cImag:i83(fp_imag);lC
+cReal:i83(fp_real);lC
cPolar:if
lI
-fp_polar(x32
+fp_polar
+e51
+lC
cMod:if
lI
-e93
-x32
-cAtan2:{c23
-p0
-tI
-yS2
-p1
-tI
-1));nR&&cB3
-lR,xD1){if(p1
-cL2
-p1
-e23
-xD1{xO
+fp_mod
+e51
+lC
+cAtan2:{yD3
+tY
+xW
+yP2
+p1=tZ
+1));nP&&lJ3
+lR,xG1){if(p1
+e61&&(p1
+tG1<xG1{nU
fp_const_pi
-e53
+cH3
if(p1
-n51&&p1
-tF2>=t61
-xD1;nD}
-tM2
-cB3
-tH,xD1){if(p0
-cL2
-p0
-e23
-xD1{xO-fp_const_pihalf
-e53
+yI&&p1
+yM>=tE1
+xG1;nD}
+if(eI1
+lJ3
+xW
+i8,xG1){if(p0
+e61&&(p0
+tG1<xG1{nU-fp_const_pihalf
+cH3
if
-iC3
+cN3
p0
-tF2>xD1{xO
+yM>xG1{nU
fp_const_pihalf
-e53}
+cH3}
if
lI
-fp_atan2(lR,tH));nD
+fp_atan2
+e51
if((p1
-n51&&p1
-tF2>xD1||(p1
-cL2
-p1
-e23
-fp_const_negativezero
-xK())){eJ
-yO2;yO2
-xD
-cPow);yO2.AddParamMove
-y91
-1));yO2.yC
-iV2(-1)));yO2
-eT1
-eJ
-yP2;yP2
-tH3
-yP2.AddParamMove
-y91
-0));yP2
-yP1
-yO2);yP2
-eT1
-tI3
-cAtan);tree.nG1
-0,yP2)yO3
-1);i91
-cPow:{if(ConstantFolding_PowOperations(eJ2
-yF3
+yI&&p1
+yM>xG1||(p1
+e61&&(p1
+tG1<fp_const_negativezero
+xF())nQ
+yJ2;yJ2
+iH
+cPow);yJ2
+c91
+xW
+1));yJ2.yA
+nU2));yJ2
+iW1
+tX
+yK2;yK2
+iH
+cMul);yK2
+c91
+xW
+0));yK2
+c91
+yJ2);yK2
+cY
+cAtan
+yB
+nB1
+0,yK2
+yB
+i91
+1);e21
+cPow:{if(ConstantFolding_PowOperations(tB2
+xY3
case
-cDiv:nR&&eO3
-i61&&tH!=t61
-lR/tH
-tH2
-cInv:nR&&lR!=t61
-iV2(1)/lR
-tH2
+cDiv:nP&&eI1
+xW
+i8!=tE1
+lR/xW
+nC3
+cInv:nP&&lR!=tE1
+e62
+1)/lR);nD
+lC
cSub:if
lI
-lR-tH
-tH2
-cNeg:nR){xO-lR
-tH2
-cRad:nR){xO
-RadiansToDegrees(lR)tH2
-cDeg:nR){xO
-DegreesToRadians(lR)tH2
-cSqr:nR){xO
-lR*lR
-tH2
-cExp2:iK3(fp_exp2);lC
-cRSqrt:nR){xO
-iV2(1)/fp_sqrt(lR)tH2
-cCot:tI2
+lR-xW
+nC3
+cNeg:nP){nU-lR);nD
+lC
+cRad:nP){nU
+RadiansToDegrees
+eG2
+cDeg:nP){nU
+DegreesToRadians
+eG2
+cSqr:nP){nU
+lR*lR);nD
+lC
+cExp2:i83(fp_exp2);lC
+cRSqrt:nP){nU
+e62
+1)/fp_sqrt
+eG2
+cCot:c22
fp_tan(lZ
-cSec:tI2
+cSec:c22
fp_cos(lZ
-cCsc:tI2
+cCsc:c22
fp_sin(lZ
cHypot:if
lI
-fp_hypot(x32
+fp_hypot
+e51
+lC
cRDiv:case
cRSub:case
cDup:case
cNop:case
cJump:lC
cPCall:case
-cFCall:yF3
+cFCall:xY3
do_return:;
#ifdef DEBUG_SUBSTITUTIONS
-std::cout<<"["
-<<(&cY3)<<"]Done ConstantFolding, result: "
-yA1
+cV2<<"["
+<<(&c63)<<"]Done ConstantFolding, result: "
+cR
DumpHashes(tree);
#endif
}
}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
-t5{tZ1
-c23::set_abs(nL
+t5{xL1
+yD3::set_abs(nL
bool
-has_negative=!min.known||min.val<iV2();bool
-has_positive=!t13||iA3>iV2();bool
-crosses_axis=has_negative&&has_positive;cJ1
-xK
-newmax;if(min
-lB3
-t13)newmax.set(fp_max(tV1,tW1
-eY3
-crosses_axis)min.set(iV2());e63
-min
-lB3
-t13)min.set(fp_min(tV1,tW1);lJ2
-min.known)min.set(tV1);else
-min.set(tW1;}
+has_negative=!min.known||min.val<e62);bool
+has_positive=!cG3||max.val>e62);bool
+crosses_axis=has_negative&&has_positive;cI1
+xF
+newmax;if(min.cF3
+cG3)newmax.set(fp_max(i61,i71);if(crosses_axis
+cI3
+e62));cJ3
+min.cF3
+cG3
+cI3
+fp_min(i61,i71);iP1
+min.known
+cI3
+i61);else
+min.set(i71;}
max=newmax;}
-tZ1
-c23::set_neg(){std::swap(min,max);min.val=-min.val;iA3=-iA3;}
-xN1
+xL1
+yD3::set_neg(){std::swap(min,max);min.val=-min.val;max.val=-max.val;}
+yP1
IsLogicalTrueValue
-cH1
-c23&p
-tR2{if(nB
+iS1
+yD3&p,bool
+abs){if(nB
IsIntType
-xK::nT3){if(p
-n51&&p
-tF2>=iV2(1
-tI1;if(!abs&&p
-nP2
-yN
-val<=iV2(-1
-tI1;}
-e63
+xF::nS3){if(p
+yI&&p
+yM>=e62
+1))lD2
+if(!abs&&p
+e61
+t43<=nU2)lD2}
+cJ3
p
-n51&&p
-tF2>=iV2(0.5
-tI1;if(!abs&&p
-nP2
-yN
-val<=iV2(-0.5
-tI1;}
-return
-tR3
-xN1
+yI&&p
+yM>=yF2)lD2
+if(!abs&&p
+e61
+t43<=e62-0.5))lD2
+eE3
+t23
+yP1
IsLogicalFalseValue
-cH1
-c23&p
-tR2{if(nB
+iS1
+yD3&p,bool
+abs){if(nB
IsIntType
-xK::nT3){if(abs)return
-p
-yN
-known
-lH1
+xF::nS3){if(abs)eG3
+e61
+l61
1);else
-return
-p
-n51&&p
-nP2
-tF2>iV2(-1)lH1
+eG3
+yI&&p
+e61&&p
+yM>nU2
+l61
1);}
-e63
-abs)return
-p
-yN
-known
-lH1
+cJ3
+abs)eG3
+e61
+l61
0.5);else
-return
-p
-n51&&p
-nP2
-tF2>iV2(-0.5)lH1
+eG3
+yI&&p
+e61&&p
+yM>e62-0.5)l61
0.5);}
}
}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
+l33
FUNCTIONPARSERTYPES;using
-t5;t5{xW3
-c23
-iN
-lC2
-tree)
+t5;t5{tK1
+yD3
+CalculateResultBoundaries
+iS1
+eR
#ifdef DEBUG_SUBSTITUTIONS_extra_verbose
{using
-lF3
-FUNCTIONPARSERTYPES;c23
+l33
+FUNCTIONPARSERTYPES;yD3
tmp=CalculateResultBoundaries_do(tree
-lT2"Estimated boundaries: "
+lE2"Estimated boundaries: "
;if(tmp
-n51)std::cout<<tmp
-tF2;else
-std::cout<<"-inf"
-;std::cout<<" .. "
+yI)cV2<<tmp
+yM;else
+cV2<<"-inf"
+;cV2<<" .. "
;if(tmp
-xF2
-std::cout<<tmp
-yN
-val;else
-std::cout<<"+inf"
-;std::cout<<": "
-i13(tree
-lT2
+e61)cV2<<tmp
+nL3;else
+cV2<<"+inf"
+;cV2<<": "
+iL2
+tree
+lE2
std::endl
-n31
+i1
tmp;}
-xW3
-c23
-eJ::CalculateResultBoundaries_do
-cH1
-e62
-#endif
-{iG
-yF1(-fp_const_pihalf
-xK(),fp_const_pihalf
-xK());iG
+tK1
+yD3
+yZ2::CalculateResultBoundaries_do
+iS1
+eR
+#endif
+{iS
+yH1(-fp_const_pihalf
+xF(),fp_const_pihalf
+xF());iS
pi_limits(-fp_const_pi
-xK(),fp_const_pi
-xK());iG
-abs_pi_limits(y21,fp_const_pi
-xK());iG
-plusminus1_limits(iV2(-nR3
-using
-lF3
-std;switch(i01
-y33
+xF(),fp_const_pi
+xF());iS
+abs_pi_limits(xH1,fp_const_pi
+xF());iS
+plusminus1_limits(nU2,e62
+1));using
+l33
+std;e23
+t72){case
cImmed:nM
-eC3,eC3);case
+tree
+x41
+cU3
+x41)t83
cAnd:case
cAbsAnd:case
cOr:case
cAbsOr:case
cNot:case
-cZ3:case
+cC3:case
cNotNot:case
cAbsNotNot:case
cEqual:case
-cNEqual:case
+i51:case
cLess:case
cLessOrEq:case
cGreater:case
cGreaterOrEq:{nM
-y21
-tG1
-1)i33
-cAbs:lD
-m.set_abs();tV
-cLog:lD
-x33
-fp_log);m
-x63
-fp_log);tV
-cLog2:lD
-x33
-fp_log2);m
-x63
-fp_log2);tV
-cLog10:lD
-x33
-fp_log10);m
-x63
-fp_log10);tV
-cAcosh:lD
-yK
-template
-set_if<cGreaterOrEq
-t71
-fp_acosh)xQ1
+xH1,e62
+1));}
+case
+cAbs:tW3
+set_abs();tK
+cLog:tW3
+tS2
+fp_log);nD3
+fp_log);tK
+cLog2:tW3
+tS2
+fp_log2);nD3
+fp_log2);tK
+cLog10:tW3
+tS2
+fp_log10);nD3
+fp_log10);tK
+cAcosh:tW3
+min.tL1
cGreaterOrEq
-t71
-fp_acosh);tV
-cAsinh:lD
-yK
-set(fp_asinh);m
-yN
-set(fp_asinh);tV
-cAtanh:lD
-yK
-n3-1),fp_atanh)xQ1
+tH1
+fp_acosh
+tR3
+cGreaterOrEq
+tH1
+fp_acosh);tK
+cAsinh:tW3
+min.set(fp_asinh);tO
+set(fp_asinh);tK
+cAtanh:tW3
+min.n3-1),fp_atanh
+tR3
cLess
-t71
-fp_atanh);tV
+tH1
+fp_atanh);tK
cAcos:lD
-nM(c71&&(c81)<iV2(1))?fp_acos(c81):y21,(x43&&nU3>=iV2(-1))?fp_acos
-nU3:fp_const_pi
-xK()i33
-cAsin:lD
-yK
-n3-1),fp_asin,yF1
-tF2)xQ1
+nM(tO
+cF3(tO
+val)<e62
+1))?fp_acos(tO
+val):xH1,(m
+yI&&(m
+yM)>=nU2)?fp_acos(m
+yM):fp_const_pi
+xF());}
+case
+cAsin:tW3
+min.n3-1),fp_asin,yH1
+yM
+tR3
cLess
-t71
-fp_asin,yF1
-yN
-val);tV
-cAtan:lD
-yK
-set(fp_atan,yF1
-tF2);m
-yN
-set(fp_atan,yF1
-yN
-val);tV
-cAtan2:{nR&&cB3
-lR,xD1)yR
+tH1
+fp_asin,yH1
+tG1;tK
+cAtan:tW3
+min.set(fp_atan,yH1
+yM);tO
+set(fp_atan,yH1
+tG1;tK
+cAtan2:{nP&&lJ3
+lR,xG1)yP
abs_pi_limits;}
-tM2
-cB3
-tH,xD1)yR
-yF1;}
-return
+if(eI1
+lJ3
+xW
+i8,xG1)yP
+yH1;eE3
pi_limits;}
case
cSin:lD
bool
-x11=!x43||!c71||(c81-yK
-val)>=(yO
-x11)eR
-iV2
-min=e93
-yK
-val,yO
-min<xD1
+x11=!m
+yI||!tO
+known||(tO
+val-m
+yM)>=(yK
+x11)tM
+Value_t
+min=cK3
+m
+yM,yK
+min<xG1
min
-yP
-iV2
-max=e93
-c81,yO
-max<xD1
+yN
+Value_t
+max=cK3
+tO
+val,yK
+max<xG1
max
-yP
+yN
if(max<min)max
-yP
+yN
bool
-y11=(min<=fp_const_pihalf
-xK()&&max>=fp_const_pihalf
-xK());bool
-nN1=(min<=cD&&max>=cD
-eY3
-y11&&nN1)eR
-if(nN1)nM
-iV2(-1)lK2
-if(y11)nM
-eL2
-tG1
+y21=(min<=fp_const_pihalf
+xF()&&max>=fp_const_pihalf
+xF());bool
+nJ1=(min<=cD&&max>=cD);if(y21&&nJ1)tM
+if(nJ1)nM
+nU2,nW2
+if(y21)nM
+yL2
+e62
1));nM
-eL2
-lK2}
+yL2
+nW2}
case
cCos:lD
-if(x43)yK
+if(m
+yI)m
+yM+=fp_const_pihalf
+xF();if(xI2
+tO
val+=fp_const_pihalf
-xK(eY3
-c71)c81+=fp_const_pihalf
-xK();bool
-x11=!x43||!c71||(c81-yK
-val)>=(yO
-x11)eR
-iV2
-min=e93
-yK
-val,yO
-min<xD1
+xF();bool
+x11=!m
+yI||!tO
+known||(tO
+val-m
+yM)>=(yK
+x11)tM
+Value_t
+min=cK3
+m
+yM,yK
+min<xG1
min
-yP
-iV2
-max=e93
-c81,yO
-max<xD1
+yN
+Value_t
+max=cK3
+tO
+val,yK
+max<xG1
max
-yP
+yN
if(max<min)max
-yP
+yN
bool
-y11=(min<=fp_const_pihalf
-xK()&&max>=fp_const_pihalf
-xK());bool
-nN1=(min<=cD&&max>=cD
-eY3
-y11&&nN1)eR
-if(nN1)nM
-iV2(-1)lK2
-if(y11)nM
-eL2
-tG1
+y21=(min<=fp_const_pihalf
+xF()&&max>=fp_const_pihalf
+xF());bool
+nJ1=(min<=cD&&max>=cD);if(y21&&nJ1)tM
+if(nJ1)nM
+nU2,nW2
+if(y21)nM
+yL2
+e62
1));nM
-eL2
-lK2}
+yL2
+nW2}
+case
+cTan:{nM);}
case
-cTan:{nM
-i33
cCeil:lD
-c91
+tO
+i81
cFloor:lD
-tH1
-tV
+m
+yI1
+tK
cTrunc:lD
-tH1
-c91
+m
+yI1
+tO
+i81
cInt:lD
-tH1
-c91
-cSinh:lD
-yK
-set(fp_sinh);m
-yN
-set(fp_sinh);tV
-cTanh:lD
-yK
-set(fp_tanh,plusminus1_limits.min);m
-yN
-set(fp_tanh,plusminus1_limits.max);tV
+m
+yI1
+tO
+i81
+cSinh:tW3
+min.set(fp_sinh);tO
+set(fp_sinh);tK
+cTanh:tW3
+min.set(fp_tanh,plusminus1_limits.min);tO
+set(fp_tanh,plusminus1_limits.max);tK
cCosh:lD
-if(x43){if(c71){if(yK
-val>=y21&&c81>=xD1{yK
-val
-xU}
-lJ2
-nU3<y21&&c81>=xD1{iV2
+if(m
+yI){if(xI2{if(m
+yM>=xH1&&tO
+val>=xG1{m
+yM
+xS}
+iP1(m
+yM)<xH1&&tO
+val>=xG1
+l14
tmp
-xU
-if(tmp>c81)c81=tmp;yK
-val=iV2(1
-t43{yK
-val
-xU
-std::swap(yK
-val,c81);}
-}
-e63
-yK
-val>=xD1{m
-t0
-yK
-val=fp_cosh
-nU3;}
+xS
+if(tmp>tO
+val)tO
+val=tmp;m
+yM=e62
+1);}
else{m
-t0
-yK
-val=iV2(1);}
+yM
+xS
+std::swap(m
+yM,tO
+val);}
+}
+cJ3
+m
+yM>=xG1{m.tL
+m
+yM=fp_cosh(m
+yM);}
+else{m.tL
+m
+yM=e62
+1);}
}
}
-else{x43=true;yK
-val=iV2(1
-eY3
-c71){yK
-val=fp_cosh(c81);m
-t0}
+else{m
+yI=true;m
+yM=e62
+1);if(xI2{m
+yM=fp_cosh(tO
+val);m.tL}
else
-m
-t0}
-tV
+m.tL}
+tK
cIf:case
-cAbsIf:{c23
-res1
-tI
-1));c23
-res2
-tI
-2)eY3!res2
-n51)res1
-n51
-tO3
-lJ2
+cAbsIf:{yD3
+res1=tZ
+1));yD3
+res2=tZ
+2));if(!res2
+yI)res1
+yI
+eW3
+iP1
res1
-n51&&(res2
-tF2)<res1
-tF2)res1
-tF2=res2
-tF2;if(!res2
-xF2
+yI&&(res2
+yM)<res1
+yM)res1
+yM=res2
+yM;if(!res2
+e61)res1.tL
+iP1
res1
-t0
-lJ2
+e61&&(res2
+tG1>res1
+tG1
res1
-cL2
-res2
-yN
-val)>res1
-yN
-val)res1
-yN
-val=res2
-yN
-val
-n31
+nL3=res2
+nL3
+i1
res1;}
case
cMin:{bool
-iH
-tO3
+iT
+eW3
bool
-iI
-tO3
-c43;x2
+iU
+eW3
+e83;x7
m
-tI
-a)eY3!x43)iH
-x53
-n51||nU3<nK3)nK3=yK
-val;if(!c71)iI
-x53
-yN
-known||(c81)<nL3)nL3=c81;}
-if(iH)nM3
-iI)nT3
-t0
+tZ3
+m
+yI)iT
+iN3
+yI||(m
+yM)<nF3)nF3=m
+yM;if(!xI2
+iU
+iN3
+e61||(tO
+val)<nG3
+nH3=tO
+val;}
+if(iT)nK3
+iU)nQ3
return
-nT3;}
-case
+nR3
cMax:{bool
-iH
-tO3
+iT
+eW3
bool
-iI
-tO3
-c43;x2
+iU
+eW3
+e83;x7
m
-tI
-a)eY3!x43)iH
-x53
-n51||yK
-val>nK3)nK3=yK
-val;if(!c71)iI
-x53
-yN
-known||c81>nL3)nL3=c81;}
-if(iH)nM3
-iI)nT3
-t0
+tZ3
+m
+yI)iT
+iN3
+yI||m
+yM>nF3)nF3=m
+yM;if(!xI2
+iU
+iN3
+e61||tO
+val>nG3
+nH3=tO
+val;}
+if(iT)nK3
+iU)nQ3
return
-nT3;}
-case
-cAdd:{c43(y21,xD1;x2
-item
-tI
-a)eY3
-item
-n51)nK3+=item
-tF2;else
-nM3
+nR3
+cAdd:{e83(xH1,xG1;x7
+item=tZ
+a));if(item
+yI)nF3+=item
+yM;else
+nK3
item
-xF2
-nL3+=item
-yN
-val;else
-nT3
-t0
-if(!nP3&&!nT3
-xF2
-yF3
-if
-iT2
-n51&&nQ3&&nK3>nL3)std::swap
-iT2
-tF2,nL3)n31
-nT3;}
-case
-cMul:{e12
+e61)nH3+=item
+nL3;else
+nQ3
+if(!nI3&&!nJ3)xY3
+if(nI3&&nJ3&&nF3>nG3
+std::swap(nF3,nG3
+i1
+nR3
+cMul:{e72
Value{enum
-x73{eA3,iX1,iW2}
-;x73
-tK
-iU2
-value;Value(x73
-t):tK(t),value(0){}
-Value(iV2
-v):tK(eA3),value(v){}
+nT3{tT2,lG2,PlusInf}
+;nT3
+eB
+iK2
+value;Value(nT3
+t):eB(t),value(0){}
+Value
+cX3
+v):eB(tT2),value(v){}
bool
-cM2
-yZ1
-tK==iX1||cU2
-value<xD1
-lL3
-eA1*=cH1
-Value&rhs){if
-cU2
-rhs.tK==eA3)value*=rhs.value;else
-tK=(cM2)!=rhs.cM2)?iX1:iW2);}
-iG2<cH1
+cQ2
+c01
+eB==lG2||(eB==tT2&&value<xG1;}
+void
+eM1*=iS1
+Value&rhs){if(eB==tT2&&rhs.eB==tT2)value*=rhs.value;else
+eB=(cQ2)!=rhs.cQ2)?lG2:PlusInf);}
+iD2<iS1
Value&rhs
-yZ1(tK==iX1&&rhs.tK!=iX1)||cU2(rhs.tK==iW2||(rhs.tK==eA3&&value<rhs.value)));}
+c01(eB==lG2&&rhs.eB!=lG2)||(eB==tT2&&(rhs.eB==PlusInf||(rhs.eB==tT2&&value<rhs.value)));}
}
-;e12
-yG1{Value
-yQ2,yR2;yG1():yQ2(Value::iW2),yR2(Value::iX1){}
+;e72
+yJ1{Value
+yN2,yO2;yJ1():yN2(Value::PlusInf),yO2(Value::lG2){}
void
-xE2
+xJ2
Value
-eB3,const
-Value&value2){eB3*=value2;if(eB3<yQ2)yQ2=eB3;if(yR2<eB3)yR2=eB3;}
+cM3,const
+Value&value2){cM3*=value2;if(cM3<yN2)yN2=cM3;if(yO2<cM3)yO2=cM3;}
}
-;c43(iV2(nR3
-x2
+;e83(nM3
+x7
item
-tI
-a)eY3!item
-n51&&!item
-xF2
-nM);Value
-x83=nP3?Value
-iT2.min.lU1
-iX1);Value
-x93=nQ3?Value
-iT2
-yN
-lU1
-iW2);Value
-xA3=item
-n51?Value(item.min.lU1
-iX1);Value
-xB3=item
-yN
-known?Value(item
-yN
-lU1
-iW2);yG1
-range
-tL2
-x83,xA3)tL2
-x83,xB3)tL2
-x93,xA3)tL2
-x93,xB3
-eY3
-range.yQ2.tK==Value::eA3)nK3=range.yQ2.value;else
-nM3
-range.yR2.tK==Value::eA3)nL3=range.yR2.value;else
-nT3
-t0
-if(!nP3&&!nT3
-xF2
-yF3
-if
-iT2
-n51&&nQ3&&nK3>nL3)std::swap
-iT2
-tF2,nL3)n31
-nT3;}
-case
-cMod:{c23
-x
-tI
-yS2
-y
-tI
-1)eY3
-y
-xF2{if(y
-yN
-val>=xD1{if(!x
-n51||(x
-tF2)<xD1
+tZ3
+item
+yI&&!item
+e61)nM);Value
+iP3=nI3?Value(nF3):xC2
+lG2);Value
+nU3=nJ3?Value(nG3:xC2
+PlusInf);Value
+nV3=item
+yI?Value(item
+yM):xC2
+lG2);Value
+nW3=item
+e61?Value(item
+tG1:xC2
+PlusInf);yJ1
+range;range.xJ2
+iP3,nV3);range.xJ2
+iP3,nW3);range.xJ2
+nU3,nV3);range.xJ2
+nU3,nW3);if(range.yN2.eB==Value::tT2)nF3=range.yN2.value;else
+nK3
+range.yO2.eB==Value::tT2)nH3=range.yO2.value;else
+nQ3
+if(!nI3&&!nJ3)xY3
+if(nI3&&nJ3&&nF3>nG3
+std::swap(nF3,nG3
+i1
+nR3
+cMod:{yD3
+x=tZ
+yP2
+y=tZ
+1));if(y
+e61){if(y
+nL3>=xG1{if(!x
+yI||(x
+yM)<xG1
nM-y
-yN
-val,y
-yN
-val);iB3
-y21,y
-yN
-val);}
-e63!x
-yN
-known||(x
-yN
-val)>=xD1
+nL3,y
+tG1;i03
+xH1,y
+tG1;}
+cJ3!x
+e61||(x
+tG1>=xG1
nM
y
-yN
-val,-y
-yN
-val);iB3
+nL3,-y
+tG1;i03
y
-yN
-val,fp_const_negativezero
-xK());}
+nL3,fp_const_negativezero
+xF());}
}
-iB3
-i33
-cPow:{tM2
-tH==xD1{nM
-iV2(nR3}
-nR&&lR==xD1{nM
-y21,xD1;}
-nR&&cB3
+i03);}
+case
+cPow:{if(eI1
+xW
+i8==xG1{nM
+nM3}
+nP&&lR==xG1{nM
+xH1,xG1;}
+nP&&lJ3
lR
-xE3
+nH2
nM
-iV2(nR3}
-tM2
-tH>y21&&GetEvennessInfo
-y91
-1))==IsAlways
-tJ2
-e92
-tH;c23
-tmp
-tI
-yS2
-nT3;nP3=true;nK3=0;if(tmp
-n51&&tmp
-tF2>=xD1
-nK3
-t03
+nM3}
+if(eI1
+xW
+i8>xH1&&GetEvennessInfo(xW
+1))==iF2)l14
+eD2
+xW
+i8;yD3
+tmp=tZ
+yP2
+nS3;nI3=true;nF3=0;if(tmp
+yI&&tmp
+yM>=xG1
+nF3=t33
tmp
-tF2,xG2;lJ2
+yM,tU2
+iP1
tmp
-yN
-known&&tmp
-yN
-val<=xD1
-nK3
-t03
+e61&&tmp
+nL3<=xG1
+nF3=t33
tmp
-yN
-val,xG2;nT3
-t0
+nL3,tU2
+nQ3
if(tmp
-n51&&tmp
-xF2{nQ3=true;nL3=fp_max(fp_abs(tmp
-tF2),fp_abs(tmp
-yN
-val));nL3=fp_pow
-iT2
-yN
-val,xG2;}
-return
-nT3;}
-c23
-p0
-tI
-yS2
-p1
-tI
+yI&&tmp
+e61){nJ3=true;nH3=fp_max(fp_abs(tmp
+yM),fp_abs(tmp
+tG1);nH3=t33
+nH3,tU2
+eE3
+nS3;}
+yD3
+tY
+xW
+yP2
+p1=tZ
1));TriTruthValue
-p0_positivity=iC3(p0
-tF2)>=xD1?IsAlways:(p0
-cL2
-p0
-e23
-y21?lC3
+p0_positivity=cN3(p0
+yM)>=xG1?iF2:(p0
+e61&&(p0
+tG1<xH1?l03
Unknown);TriTruthValue
-cN2=GetEvennessInfo
-y91
+cR2=GetEvennessInfo(xW
1));TriTruthValue
-t1=Unknown;switch(p0_positivity)l92
-t1=IsAlways;lC
-lC3{t1=cN2;yF3
-c73
-switch(cN2)l92
-t1=IsAlways;lC
-lC3
+eZ=Unknown;e23
+p0_positivity
+tN1
+eZ=iF2;lC
+l03{eZ=cR2;xY3
+yF3
+e23
+cR2
+tN1
+eZ=iF2;lC
+l03
lC
-Unknown:{tM2!isInteger
-tG&&tH>=xD1{t1=IsAlways;}
-yF3}
-l73
-t1)l92{iV2
-min=y21;if
-iC3
+Unknown:{if(eI1!t42
+xW
+i8)&&xW
+i8>=xG1{eZ=iF2;}
+xY3}
+c73(eZ
+tN1
+l14
+min=xH1;if
+cN3
p1
-n51){min
-t03
-p0
-tF2,p1
-tF2
-eY3
+yI){min=t33
p0
-tF2<y21&&(!p1
-yN
-known||p1
-yN
-val>=xD1&&min>=xD1
-min=y21;}
+yM,p1
+yM);if(p0
+yM<xH1&&(!p1
+e61||p1
+nL3>=xG1&&min>=xG1
+min=xH1;}
if
-iC3
+cN3
p0
-tF2>=y21&&p0
-yN
-known&&p1
-xF2{iV2
-max
-t03
+yM>=xH1&&p0
+e61&&p1
+e61)l14
+max=t33
p0
-yN
-val,p1
-yN
-val
-eY3
-min>max)std::swap(min,max);nM
+nL3,p1
+tG1;if(min>max)std::swap(min,max);nM
min,max);}
nM
-min,false
-i33
-lC3{nM
+min,false);}
+case
+l03{nM
false,fp_const_negativezero
-xK());}
-c73{yF3
-i91
-cNeg:lD
-m.set_neg();tV
-cSub:{yM
-cNeg);iE3
-1));tmp
-xD
-cAdd);tmp.nJ
-0));tmp
-yP1
+xF());}
+yF3{xY3
+e21
+cNeg:tW3
+set_neg();tK
+cSub:yJ
+cNeg);tmp2
+tX3
+tmp
+iH
+cAdd);tmp
+tY3
+tmp
+c91
tmp2
-y53
-cInv:{cO2-1
-yT2
-cDiv:{yM
-cInv);iE3
-1));tmp
-xD
-x71
+i0
+cInv:{c02
+lW-1))i0
+cDiv:yJ
+cInv);tmp2
+tX3
+tmp
+iH
+xC1
AddParamMove(tmp2
-y53
-cRad:{t81
-x71
-yC
+i0
+cRad:yV
+xC1
+yA
fp_const_rad_to_deg
-xK(yT2
-cDeg:{t81
-x71
-yC
+xF())i0
+cDeg:yV
+xC1
+yA
fp_const_deg_to_rad
-xK(yT2
-cSqr:{cO2
-2
-yT2
-cExp:{t81
-cPow);tmp.yC
+xF())i0
+cSqr:{c02
+lW
+2))i0
+cExp:yV
+cPow);tmp.yA
fp_const_e
-xK()));tmp.nJ
-0)y53
-cExp2:{t81
-cPow);tmp.yC
-x42
+xF()));tmp.nJ
+0)i0
+cExp2:yV
+cPow);tmp.yA
+nX3
tmp.nJ
-0)y53
-cCbrt:lD
-yK
-set(fp_cbrt);m
-yN
-set(fp_cbrt);tV
+0)i0
+cCbrt:tW3
+min.set(fp_cbrt);tO
+set(fp_cbrt);tK
cSqrt:lD
-if(x43)yK
-val=nU3<y21?0:fp_sqrt
-nU3;if(c71)c81=(c81)<y21?0:fp_sqrt(c81);tV
-cRSqrt:{cO2-0.5
-yT2
-cHypot:{eJ
-xsqr,ysqr,add,sqrt;xsqr.nJ
-0));xsqr.yC
-x42
-ysqr.nJ
-1));ysqr.yC
-x42
+if(m
+yI)m
+yM=(m
+yM)<xH1?0:fp_sqrt(m
+yM);if(xI2
+tO
+val=(tO
+val)<xH1?0:fp_sqrt(tO
+val);tK
+cRSqrt:{c02
+lW-0.5))i0
+cHypot:{yZ2
+xsqr,ysqr,add,sqrt;xsqr
+tY3
+xsqr.yA
+nX3
+ysqr
+tX3
+ysqr.yA
+nX3
xsqr
-xD
+iH
cPow);ysqr
-xD
+iH
cPow);add
-yP1
+c91
xsqr);add
-yP1
+c91
ysqr);add
-xD
+iH
cAdd);sqrt
-yP1
+c91
add);sqrt
-xD
-cSqrt)n31
-iN
-sqrt
-i33
-eF3:{yM
-cLog2);iE3
-0));tmp
-tH3
+iH
+cSqrt)i1
+CalculateResultBoundaries(sqrt);}
+case
+cQ3:yJ
+cLog2);tmp2
+tY3
tmp
-yP1
+iH
+cMul);tmp
+c91
tmp2);tmp.nJ
-1)y53
-cCot:{yM
-cTan)x3
+1)i0
+cCot:yJ
+cTan)x6
lH
-cSec:{yM
-cCos)x3
+cSec:yJ
+cCos)x6
lH
-cCsc:{yM
-cSin)x3
-iN
-tmp);}
+cCsc:yJ
+cSin)x6
+CalculateResultBoundaries(tmp);}
lC
cRDiv:case
cRSub:case
cSinhCosh:case
cNop:case
cJump:case
-l03:lC
+iU2:lC
cArg:case
cConj:case
cImag:case
cReal:case
cPolar:lC
cPCall:lC
-cFCall:yF3
+cFCall:xY3
nM);}
-xW3
+tK1
TriTruthValue
GetIntegerInfo
-cH1
-e62{switch(i01
-y33
+iS1
+eR{e23
+t72){case
cImmed:return
t42
-eC3)?IsAlways:IsNever;case
+tree
+x41)?iF2:xX3
+t83
cFloor:case
cCeil:case
cTrunc:case
cInt:return
-IsAlways;case
+iF2
+t83
cAnd:case
cOr:case
cNot:case
cNotNot:case
cEqual:case
-cNEqual:case
+i51:case
cLess:case
cLessOrEq:case
cGreater:case
cGreaterOrEq:return
-IsAlways;case
+iF2
+t83
cIf:{TriTruthValue
-a=GetIntegerInfo
-y91
+a=GetIntegerInfo(xW
1));TriTruthValue
-b=GetIntegerInfo
-y91
-2)eY3
-a==b)return
+b=GetIntegerInfo(xW
+2));if(a==b)return
a
-nV2
+xO2
case
cAdd:case
cMul:{for
-iY
-if(GetIntegerInfo
-y91
-a))!=IsAlways)return
+l41
+if(GetIntegerInfo(xW
+a))!=iF2)return
Unknown
-n31
-IsAlways;}
-c73
+i1
+iF2;}
yF3
+xY3
return
Unknown;}
-xN1
+yP1
IsLogicalValue
-cH1
-e62{switch(i01
-y33
+iS1
+eR{e23
+t72){case
cImmed:return
-cB3
-eC3,xD1||cB3
-eC3
-tG1
-1));case
+lJ3
+tree
+x41,xG1||lJ3
+tree
+x41,e62
+1))t83
cAnd:case
cOr:case
cNot:case
cNotNot:case
cAbsAnd:case
cAbsOr:case
-cZ3:case
+cC3:case
cAbsNotNot:case
cEqual:case
-cNEqual:case
+i51:case
cLess:case
cLessOrEq:case
cGreater:case
-cGreaterOrEq:nV
+cGreaterOrEq:nZ
cMul:{for
-iY
-if(!yX3
-a))cL
-return
-true;}
+l41
+if(!c83
+a))cQ
+lD2}
case
cIf:case
-cAbsIf:yR
-yX3
-1))nT1
-lE2
+cAbsIf:yP
+c83
+1))&&c83
2));}
-c73
yF3
+xY3
return
-tR3}
+t23}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
+l33
FUNCTIONPARSERTYPES;
-#if defined(__x86_64) || __cplusplus < 201100
+#if defined(__x86_64) || !defined(FP_SUPPORT_CPLUSPLUS11_MATH_FUNCS)
# define CBRT_IS_SLOW
#endif
#if defined(DEBUG_POWI) || defined(DEBUG_SUBSTITUTIONS)
#include <cstdio>
#endif
-lF3
-xH1{extern
+l33
+xK1{extern
const
-iF2
+x83
char
powi_table[256];}
-lF3{using
+l33{using
t5
-nJ1
+yO1
bool
IsOptimizableUsingPowi(long
immed,long
-penalty=0){xH1
-yG3
-synth;synth.PushVar(l03);size_t
-bytecodesize_backup=synth.GetByteCodeSize();xH1::x01
-immed,xH1::tN1
-xK::MulSequence,iS2
+penalty=0){xK1::eP3
+synth;synth.PushVar(iU2);size_t
+bytecodesize_backup=synth.GetByteCodeSize();xK1::x01
+immed,xK1::tU1
+xF::MulSequence,c92
size_t
bytecode_grow_amount=synth.GetByteCodeSize()-bytecodesize_backup
-n31
+i1
bytecode_grow_amount<size_t(MAX_POWI_BYTECODE_LENGTH-penalty);}
-tZ1
-ChangeIntoRootChain(eJ&tree,bool
-lD3,long
-i52,long
-i62){while(i62>0){t81
-cCbrt);iF3
-tmp
-eT1
-tree.i72--i62;}
-while(i52>0){t81
-cSqrt
-eY3
-lD3){tmp
-xD
-cRSqrt);lD3
-tO3}
-iF3
-tmp
-eT1
-tree.i72--i52;}
-if(lD3){t81
-cInv);iF3
-tree.i72}
+xL1
+ChangeIntoRootChain(nP1
+bool
+l13,long
+tY2,long
+tZ2){while(tZ2>0
+t82
+cCbrt);t92);tmp.e33
+xD2--tZ2;}
+while(tY2>0
+t82
+cSqrt);if(l13){tmp
+iH
+cRSqrt);l13
+eW3}
+t92);tmp.e33
+xD2--tY2;}
+if(l13
+t82
+cInv);t92
+xD2}
}
-xW3
-e12
+tK1
+e72
RootPowerTable{static
const
-iV2
+Value_t
RootPowers[(1+4)*(1+3)];}
-nJ1
+yO1
const
-iV2
-t8(1+4)*(1+3)]={iV2(1)lS
-iG3
-iG3
-2*iG3
-i11)lS
+Value_t
+t9(1+4)*(1+3)]={e62
+1)lS
+2)lS
+2*2)lS
+2*2*2)lS
+2*2*2*2)lS
+3)lS
3*2)lS
3*2*2)lS
-3*i11*2*i11*3
-cV2
-2
-cV2
-2*2
-cV2
-i11*3*2*i11*3*3
-cV2
-3*2
-cV2
-3*2*2
-cV2
-3*i11*3*3*2*2*2*2)}
-;e12
+3*2*2*2)lS
+3*2*2*2*2)lS
+3*3)lS
+3*3*2
+yG3
+yG3*2
+yG3*2*2)lS
+3*3*3
+eY2
+eY2*2
+eY2*2*2
+eY2*2*2*2)}
+;e72
PowiResolver{static
const
-iF2
+x83
MaxSep=4;static
-xC3
-MaxOp=5;typedef
+x03
+i13=5;typedef
int
-eE3;typedef
+cO3;typedef
long
-xI3;typedef
+x43;typedef
long
-tW;e12
-yU2{yU2():n_int_sqrt(0),n_int_cbrt(0),sep_list(),lV1(0){}
+tP;e72
+yS2{yS2():n_int_sqrt(0),n_int_cbrt(0),sep_list(),n01(0){}
int
n_int_sqrt;int
n_int_cbrt;int
-tL1
-MaxSep];tW
-lV1;}
-nJ1
+tT1
+MaxSep];tP
+n01;}
+yO1
static
-yU2
-CreatePowiResult(iV2
-xG2{yU2
-nT3;eE3
-t9=FindIntegerFactor(xG2;if(t9==0){
+yS2
+CreatePowiResult
+cX3
+exponent){yS2
+nS3;cO3
+tA=FindIntegerFactor(tU2
+if(tA==0){
#ifdef DEBUG_POWI
-i82"no factor found for %Lg\n"
-,yK1
-xG2;
+i02"no factor found for %Lg\n"
+,(cP3);
#endif
return
-nT3;}
-nT3.lV1=y31
-exponent,t9);xI3
-eM2=EvaluateFactorCost(t9,0,0,0)+cB
-nT3.lV1);int
-iH3=0;int
-iI3=0;int
-mul_count=0;
+nS3;}
+nS3.n01=y31
+exponent,tA);x43
+eT2=EvaluateFactorCost(tA,0,0,0)+cC
+nS3.n01);int
+s_count=0;int
+i23=0;int
+nZ3=0;
#ifdef DEBUG_POWI
-i82"orig = %Lg\n"
-,yK1
-xG2;i82"plain factor = "
-iW3"%ld\n"
-,(int)t9,(long)eM2);
+i02"orig = %Lg\n"
+,(cP3);i02"plain factor = "
+iL3"%ld\n"
+,(int)tA,(long)eT2);
#endif
for
-nT2
+lT1
n_s=0;n_s<MaxSep;++n_s){int
-x9=0;xI3
-yI1=eM2;eE3
-yW1=t9;for(int
-s=1;s<MaxOp*4;++s){
+xD=0;x43
+yK1=eT2;cO3
+yX1=tA;for(int
+s=1;s<i13*4;++s){
#ifdef CBRT_IS_SLOW
-if(s>=MaxOp)break;
+if(s>=i13)break;
#endif
int
-n_sqrt=s%MaxOp;int
-n_cbrt=s/MaxOp;if(n_sqrt+n_cbrt>4
-cP2
-iU2
-lI1=exponent;lI1-=t8
-s];i41=FindIntegerFactor(lI1
-eY3
-xT2!=0){tW
-xP=y31
-lI1,xT2);xI3
-cost=EvaluateFactorCost(xT2,iH3+n_sqrt,iI3+n_cbrt,mul_count+1)+cB
-xP);
+n_sqrt=s%i13;int
+n_cbrt=s/i13;if(n_sqrt+n_cbrt>4)yA1
+Value_t
+lN1=exponent;lN1-=t9
+s];iE1=FindIntegerFactor(lN1);if(xT2!=0){tP
+xN=y31
+lN1,xT2);x43
+cost=EvaluateFactorCost(xT2,s_count+n_sqrt,i23+n_cbrt,nZ3+1)+cC
+xN);
#ifdef DEBUG_POWI
-i82"Candidate sep %u (%d*sqrt %d*cbrt)factor = "
-iW3"%ld (for %Lg to %ld)\n"
-,s,n_sqrt,n_cbrt,xT2,(long)cost,yK1
-lI1,(long)xP);
+i02"Candidate sep %u (%d*sqrt %d*cbrt)factor = "
+iL3"%ld (for %Lg to %ld)\n"
+,s,n_sqrt,n_cbrt,xT2,(long)cost
+cX2
+lN1,(long)xN);
#endif
-if(cost<yI1){x9=s;yW1=xT2;yI1=cost;}
+if(cost<yK1){xD=s;yX1=xT2;yK1=cost;}
}
}
-if(!x9)break;
+if(!xD)break;
#ifdef DEBUG_POWI
-i82"CHOSEN sep %u (%d*sqrt %d*cbrt)factor = "
-iW3"%ld, exponent %Lg->%Lg\n"
-,x9,x9%MaxOp,x9/MaxOp,yW1,yI1,yK1(xG2,yK1
-t62-t8
-x9]));
-#endif
-nT3.tL1
-n_s]=x9;exponent-=t8
-x9];iH3+=x9%MaxOp;iI3+=x9/MaxOp;eM2=yI1;t9=yW1;mul_count+=1;}
-nT3.lV1=y31
-exponent,t9);
+i02"CHOSEN sep %u (%d*sqrt %d*cbrt)factor = "
+iL3"%ld, exponent %Lg->%Lg\n"
+,xD,xD%i13,xD/i13,yX1,yK1
+cX2(exponent)cX2(exponent-t9
+xD]));
+#endif
+nS3.tT1
+n_s]=xD
+eX3-=t9
+xD];s_count+=xD%i13;i23+=xD/i13;eT2=yK1;tA=yX1;nZ3+=1;}
+nS3.n01=y31
+exponent,tA);
#ifdef DEBUG_POWI
-i82"resulting exponent is %ld (from exponent=%Lg, best_factor=%Lg)\n"
-,nT3.lV1,yK1
-exponent,yK1
-t9);
-#endif
-while(t9%2==0){++nT3
-tD2;t9/=2;}
-while(t9%3==0){++nT3.n_int_cbrt;t9/=3;}
-return
-nT3;}
+i02"resulting exponent is %ld (from exponent=%Lg, best_factor=%Lg)\n"
+,nS3.n01,(cP3
+cX2
+tA);
+#endif
+while(tA%2==0){++nS3
+e52;tA/=2;}
+while(tA%3==0){++nS3.n_int_cbrt;tA/=3;eE3
+nS3;}
private:static
-xI3
-cB
-tW
-xP){static
+x43
+cC
+tP
+xN){static
std::map
-cR2
-iB;if(xP<0){xI3
+cS2
+iM;if(xN<0){x43
cost=22
-n31
-cost+cB-xP);}
+i1
+cost+cC-xN);}
std::map
-cR2::yV3
-i=iB.xU2
-xP
-eY3
-i!=iB.cY1
-xP)return
+cS2::y83
+i=iM.xU2
+xN);if(i!=iM.cX1
+xN)return
i
-e82;std::pair
-cR2
-nT3(xP,0.0);xI3&cost=nT3
-tE3;while(xP>1){int
-xT2=0;if(xP<256){xT2=xH1::powi_table[xP];if(xT2&128)xT2&=127;else
+eC2;std::pair
+cS2
+nS3(xN,0.0);x43&cost=nS3.i63
+while(xN>1){int
+xT2=0;if(xN<256){xT2=xK1::powi_table[xN];if(xT2&128)xT2&=127;else
xT2=0;if(xT2&64)xT2=-(xT2&63)-1;}
-if(xT2){cost+=cB
-xT2);xP/=xT2;eR2
-if(!(xP&1)){xP/=2;cost+=6;}
-else{cost+=7;xP-=1;}
+if(xT2){cost+=cC
+xT2);xN/=xT2;yA1}
+if(!(xN&1)){xN/=2;cost+=6;}
+else{cost+=7;xN-=1;}
}
-iB.yR3,nT3)n31
+iM.y43,nS3)i1
cost;}
-cA1
-tW
+cB1
+tP
y31
-yJ1,i41)yR
-makeLongInteger(value*iV2(xT2));}
-cA1
+yL1,iE1)yP
+makeLongInteger(value*e62
+xT2));}
+cB1
bool
-yR1
-yJ1,i41
-tJ2
-v=value*iV2(xT2)n31
+yM1
+yL1,iE1)l14
+v=value*e62
+xT2)i1
isLongInteger(v);}
-cA1
-eE3
-FindIntegerFactor(yJ1){i41=(2*2*2*2);
+cB1
+cO3
+FindIntegerFactor(yL1){iE1=(2*2*2*2);
#ifdef CBRT_IS_SLOW
#else
xT2*=(3*3*3);
#endif
-eE3
-nT3=0;if(yR1
-value,xT2)){nT3=xT2;while((xT2%2)==0&&yR1
-value,xT2/2))nT3=xT2/=2;while((xT2%3)==0&&yR1
-value,xT2/3))nT3=xT2/=3;}
+cO3
+nS3=0;if(yM1
+value,xT2)){nS3=xT2;while((xT2%2)==0&&yM1
+value,xT2/2))nS3=xT2/=2;while((xT2%3)==0&&yM1
+value,xT2/3))nS3=xT2/=3;}
#ifdef CBRT_IS_SLOW
-if
-iT2==0){if(yR1
+if(nS3==0){if(yM1
value,3
-nE3
+y03
3;}
#endif
return
-nT3;}
+nS3;}
static
int
EvaluateFactorCost(int
xT2,int
s,int
c,int
-nmuls){xC3
-xD3=6;
+nmuls){x03
+x13=6;
#ifdef CBRT_IS_SLOW
-xC3
-eN2=25;
+x03
+eU2=25;
#else
-xC3
-eN2=8;
+x03
+eU2=8;
#endif
int
-nT3=s*xD3+c*eN2;while(xT2%2==0){xT2/=2;nT3+=xD3;}
-while(xT2%3==0){xT2/=3;nT3+=eN2;}
-nT3+=nmuls
-n31
-nT3;}
+nS3=s*x13+c*eU2;while(xT2%2==0){xT2/=2;nS3+=x13;}
+while(xT2%3==0){xT2/=3;nS3+=eU2;}
+nS3+=nmuls
+i1
+nS3;}
}
;}
-t5{xN1
-eJ::RecreateInversionsAndNegations(bool
+t5{yP1
+yZ2::RecreateInversionsAndNegations(bool
prefer_base2){bool
changed=false
-yM3
-0;a<xF1++a)if(lS1.RecreateInversionsAndNegations(prefer_base2))x62
-if(changed){exit_changed:Mark_Incompletely_Hashed()xJ2
-switch(iS1{case
-cMul:{eH
-nF2;eJ
-nG2,cT1;if(true){bool
-nO1=false
-iU2
-x52=0;yP3
-yV2
-0)cX2
-tO
-iJ3
-nO1=true;x52=tO
-1)nC1;yF3}
-if(nO1
-tJ2
-immeds=1.0;yP3
-i61){immeds*=powgroup
-nC1;t41}
+e73
+0;a<l91++a)if(lX1.RecreateInversionsAndNegations(prefer_base2))yS1
+if(changed){exit_changed:Mark_Incompletely_Hashed(yQ2
+e23
+l92{case
+cMul:{eK
+nE2
+tX
+nF2,cR1;if(true){bool
+nK1=false
+iK2
+xE2=0
+e73
+tI1
+i12
+tI
+0)i22
+tI
+1)tD1){nK1=true;xE2=tI
+i8;xY3}
+if(nK1)l14
+immeds=1.0
+e73
+tI1
+tD1){immeds*=powgroup
+x41;yN1}
for
-iJ-->0;){eJ&powgroup=lS1;if(powgroup
-yV2
-0)cX2
-tO
-iJ3
-eJ&log2=tO
-0);log2.l61
+iZ1
+a=l91
+a-->0;nQ&powgroup=lX1;if(powgroup
+i12
+tI
+0)i22
+tI
+1)tD1
+nQ&log2=tI
+0);log2.lD1
log2
-xD
-eF3);log2.yC
-fp_pow(immeds
-tG1
-1)/x52)));log2
-eT1
-yF3}
+iH
+cQ3);log2.yA
+t33
+immeds,e62
+1)/xE2)));log2
+iW1;xY3}
}
}
-yP3
-yV2
-iJ3
-lC2
-exp_param=tO
-1)iU2
-e92
+for
+iZ1
+a=tI1
+i12
+tI
+1)tD1){iT1&exp_param=tI
+1)iK2
+eD2
exp_param
-nC1;if(e01
-tG1-1))){l61
-nF2.push_back(lS1
-lR2
-t41
-lJ2
-exponent<y21&&t42
-xG2){eJ
-iK;iK
-xD
-cPow);iK
-c9
-tO
-0));iK.yC-xG2);iK
-eT1
-nF2.push_back(iK);l61
-t41}
-lJ2
+x41;if(cZ1,nU2)){lD1
+nE2
+c52
+lX1
+c43
+yN1
+iP1
+exponent<xH1&&t42
+exponent)nQ
+iV;iV
+iH
+cPow);iV
+cS
+tI
+0));iV.yA-exponent));iV
+iW1;nE2
+c52
+iV);lD1
+yN1}
+iP1
powgroup
-cX2!nG2.t91
-nG2=tO
-0);l61
-t41
-lJ2
+i22!nF2.nX2){nF2=tI
+0);lD1
+yN1
+iP1
powgroup
-nC==eF3&&!cT1.t91
-cT1=powgroup;l61
-t41}
-if(!nF2
-cT3){x62
-eJ
-i21;i21
-tH3
-i21
-iO3
-nF2);i21
-eT1
-eJ
-y41
-cMul);yQ1
+nC==cQ3&&!cR1.nX2){cR1=powgroup;lD1
+yN1}
+if(!nE2
+eU3){changed=true
+tX
+cF1;cF1
+iH
+cMul);cF1
+iF1
+nE2);cF1
+iW1
+tX
+iG
+cMul);cA1
SetParamsMove
-eF
-if(yQ1
+eM
+if(cA1
IsImmed()&&fp_equal
-lR3
-nC1
-xE3
+eH2
+x41
nH2
-cInv)eO
-i21);}
-e63
-yQ1
-y22>=i21.y22){nH2
-cDiv)eO
-nN3
-eO
-i21
-t43{nH2
-cRDiv)eO
-i21)eO
-nN3;}
+eL3
+cInv)tN
+cF1);}
+cJ3
+cA1
+GetDepth()>=cF1
+nP2
+tC2
+cDiv
+iG1
+tN
+cF1);}
+else{eL3
+cRDiv)tN
+cF1
+iG1;}
}
}
-if(nG2.t91
-eJ
-y41
-iS1;yQ1
+if(nF2.nX2
+nQ
+iG
+l92;cA1
SetParamsMove
-eF
-while(yQ1
-RecreateInversionsAndNegations(prefer_base2))yQ1
-FixIncompleteHashes();nH2
-eF3)eO
-nG2)eO
-nN3;x62}
-if(cT1.t91
-eJ
-y41
+eM
+while(cA1
+RecreateInversionsAndNegations(prefer_base2))cA1
+tE3;eL3
+cQ3)tN
+nF2
+iG1;yS1}
+if(cR1.nX2
+nQ
+iG
cMul);mulgroup
-yP1
-cT1
+c91
+cR1
l8
-1));yQ1
+1));cA1
AddParamsMove
-eF
-while(yQ1
-RecreateInversionsAndNegations(prefer_base2))yQ1
-FixIncompleteHashes();DelParams();nH2
-eF3)eO
-cT1
+eM
+while(cA1
+RecreateInversionsAndNegations(prefer_base2))cA1
+tE3;DelParams();eL3
+cQ3)tN
+cR1
l8
-0))eO
-nN3;x62
-i91
-cAdd:{eH
-iA2;for
-iJ-->0;)if(eG3
-cMul){nV3
-y51:;eJ&mulgroup=x82
+0)iG1;yS1
+e21
+cAdd:{eK
+i32
+e73
+l91
+a-->0;)if(eY3
+cMul){nG2
+y41:tX&mulgroup=cT2
for
-iA1
-b=yQ1
-xF1
+iZ1
+b=cA1
+l91
b-->0;){if
-lR3
+eH2
l8
-b)l71
+b).lV1
xT2=mulgroup
l8
-b)nC1
-cA3
-xT2
-i92
-y51;}
-yQ1
-l61
-yQ1
-DelParam(b);nW3
-lJ2
-cB3
+b)x41;lG3
xT2
-tG1-2)))xC
-y51;}
-yQ1
-l61
-yQ1
-DelParam(b);yQ1
-yC
-x42
-nW3}
-}
-if(t2){yQ1
-tA
-nN3;t41}
-lJ2
-eG3
+xU
+y41;}
+cA1
+lD1
+cA1
+i91
+b
+tA2
+iP1
+lJ3
+xT2,e62-2)))eN
+y41;}
+cA1
+lD1
+cA1
+i91
+b);cA1
+yA
+e62
+2))tA2}
+}
+if(t0){cA1
+tB
+mulgroup);yN1}
+iP1
+eY3
cDiv&&!IsIntType
-xK::nT3){nV3
-y61:;eJ&i21=x82
-if(i21
+xF::nS3){nG2
+y51:tX&cF1=cT2
+if(cF1
l8
-0)i51
-cB3
-i21
+0)tD1){lG3
+cF1
l8
-0)nC1
-i92
-y61;}
-i21.l61
-i21
-tK2
-0);i21
-xD
-cInv);nW3}
-if(t2)xC
-y61;}
-i21.tA
-i21);t41}
-lJ2
-eG3
+0)x41
+xU
+y51;}
+cF1.lD1
+cF1.i91
+0);cF1
+iH
+cInv
+tA2}
+if(t0)eN
+y51;}
+cF1.tB
+cF1);yN1}
+iP1
+eY3
cRDiv&&!IsIntType
-xK::nT3){nV3
-x81:;eJ&i21=x82
-if(i21
+xF::nS3){nG2
+xD1:tX&cF1=cT2
+if(cF1
l8
-1)i51
-cB3
-i21
+1)tD1){lG3
+cF1
l8
-1)nC1
-i92
-x81;}
-i21.l61
-i21
-tK2
-1);i21
-xD
-cInv);nW3}
-if(t2)xC
-x81;}
-i21.tA
-i21);t41}
-if(!iA2
-cT3){
+i8
+xU
+xD1;}
+cF1.lD1
+cF1.i91
+1);cF1
+iH
+cInv
+tA2}
+if(t0)eN
+xD1;}
+cF1.tB
+cF1);yN1}
+if(!i32
+eU3){
#ifdef DEBUG_SUBSTITUTIONS
-i82"Will make a Sub conversion in:\n"
-);fflush(stdout);iR
+i02"Will make a Sub conversion in:\n"
+);fflush(stdout);l21
#endif
-eJ
-yW2;yW2
-xD
-cAdd);yW2
-iO3
-iA2);yW2
-eT1
-eJ
-cU1;cU1
-xD
-cAdd);cU1
-iO3
-l02));cU1
-eT1
-if(cU1
-i61&&cB3
-cU1
-nC1,xD1){nH2
-cNeg);e7);}
-e63
-cU1.y22==1){nH2
-cRSub);e7)eO
-cU1);}
-lJ2
-yW2
-nC==cAdd){nH2
-cSub)eO
-cU1);e7
-lR2
-for
-iA1
-a=1;a<yW2.xF1++a){eJ
-eO2;eO2
-xD
-cSub);eO2
-iO3
-l02));eO2.Rehash(false)eO
-eO2);e7
-x13}
-}
-else{nH2
-cSub)eO
-cU1);e7);}
+yZ2
+yT2;yT2
+iH
+cAdd);yT2
+iF1
+i32);yT2
+iW1
+tX
+cS1;cS1
+iH
+cAdd);cS1
+iF1
+lJ2));cS1
+iW1;if(cS1
+tD1&&lJ3
+cS1
+x41,xG1
+tC2
+cNeg);eC);}
+cJ3
+cS1
+nP2==1
+tC2
+cRSub);eC)eV3}
+iP1
+yT2
+nC==cAdd
+tC2
+cSub)eV3
+eC
+l8
+0)iY1
+1;a<yT2.l91++a
+nQ
+eV2;eV2
+iH
+cSub);eV2
+iF1
+lJ2));eV2.yC2)tN
+eV2);eC
+n93}
+}
+else{eL3
+cSub)eV3
+eC);}
}
#ifdef DEBUG_SUBSTITUTIONS
-i82"After Sub conversion:\n"
-);fflush(stdout);iR
+i02"After Sub conversion:\n"
+);fflush(stdout);l21
#endif
-i91
-cPow:{lC2
-p0=GetParam(0);lC2
-p1=GetParam(1
-eY3
-p1
-i51
-p1
-nC1!=y21&&!t42
+e21
+cPow:{iT1&p0
+i42
+0);iT1&p1
+i42
+1);if(p1
+tD1){if(p1
+x41!=xH1&&!t42
p1
-nC1)){eC
-yU2
-r=eC
+x41)){eG
+yS2
+r=eG
CreatePowiResult(fp_abs
-eH3)eY3
-r.lV1!=0){bool
-iY1
-tO3
-if
-eH3<y21&&r.tL1
+cR3);if(r.n01!=0){bool
+lH2
+eW3
+if(p1
+x41<xH1&&r.tT1
0]==0&&r
-tD2>0){iY1=true;}
+e52>0){lH2=true;}
#ifdef DEBUG_POWI
-i82"Will resolve powi %Lg as powi(chain(%d,%d),%ld)"
-,yK1
+i02"Will resolve powi %Lg as powi(chain(%d,%d),%ld)"
+cX2
fp_abs
-eH3),r
-tD2,r.n_int_cbrt,r.lV1);for
-nT2
-n=0;n<eC
+cR3,r
+e52,r.n_int_cbrt,r.n01);for
+lT1
+n=0;n<eG
MaxSep;++n){if(r
-nS3==0)break;int
+i52==0)break;int
n_sqrt=r
-nS3%eC
-MaxOp;int
+i52%eG
+i13;int
n_cbrt=r
-nS3/eC
-MaxOp;i82"*chain(%d,%d)"
+i52/eG
+i13;i02"*chain(%d,%d)"
,n_sqrt,n_cbrt);}
-i82"\n"
+i02"\n"
);
#endif
-eJ
-cY2=GetParam(0);eJ
-yX2=cY2;yX2.l61
-ChangeIntoRootChain(yX2,iY1,r
-tD2,r.n_int_cbrt);yX2
-eT1
-eJ
-pow;if(r.lV1!=1){pow
-xD
+yZ2
+cU2
+i42
+0)tX
+yU2=cU2;yU2.lD1
+ChangeIntoRootChain(yU2,lH2,r
+e52,r.n_int_cbrt);yU2
+iW1
+tX
+pow;if(r.n01!=1){pow
+iH
cPow);pow
-yP1
-yX2);pow.yC
-iV2(r.lV1))t43
-pow.swap(yX2);eJ
+c91
+yU2);pow.yA
+e62
+r.n01)));}
+else
+pow.swap(yU2)tX
mul;mul
-tH3
-mul
-yP1
+iH
+cMul);mul
+c91
pow);for
-nT2
-n=0;n<eC
+lT1
+n=0;n<eG
MaxSep;++n){if(r
-nS3==0)break;int
+i52==0)break;int
n_sqrt=r
-nS3%eC
-MaxOp;int
+i52%eG
+i13;int
n_cbrt=r
-nS3/eC
-MaxOp;eJ
-eP2=cY2;eP2.l61
-ChangeIntoRootChain(eP2,false,n_sqrt,n_cbrt);eP2
-eT1
-mul
-yP1
-eP2);}
-if
-eH3<y21&&!iY1){mul
-eT1
-nH2
-cInv);nG1
-0,mul);DelParam(1
-t43{nH2
-cMul);SetParamsMove(mul.l02));}
+i52/eG
+i13
+tX
+eW2=cU2;eW2.lD1
+ChangeIntoRootChain(eW2,false,n_sqrt,n_cbrt);eW2
+iW1;mul
+c91
+eW2);}
+if(p1
+x41<xH1&&!lH2){mul
+iW1;eL3
+cInv);nB1
+0,mul);i91
+1);}
+else{eL3
+cMul);SetParamsMove(mul.lJ2));}
#ifdef DEBUG_POWI
-iR
+l21
#endif
-x62
-yF3}
+yS1
+xY3}
}
if(GetOpcode()==cPow&&(!p1
-i61||!isLongInteger
-eH3)||!IsOptimizableUsingPowi
-xK(makeLongInteger
-eH3)))){if(p0
-i61&&p0
-nC1>x22{if(prefer_base2
-tJ2
-yY2=fp_log2(p0
-nC1)cA3
-yY2
-xE3
-DelParam(0
-t43{n0
-e21
-yY2)tF1
-c9
-p1
-tF1
-eT1
-nG1
-nD1}
+tD1||!isLongInteger
+cR3||!IsOptimizableUsingPowi
+xF(makeLongInteger
+cR3))){if(p0
+tD1&&p0
+x41>e62
+0.0)){if(prefer_base2)l14
+yV2=fp_log2(p0
+x41);lG3
+yV2
nH2
-cExp2);x62}
-else{iV2
-yY2=fp_log(p0
-nC1)cA3
-yY2
-xE3
-DelParam(0
-t43{n0
-e21
-yY2)tF1
-c9
+i91
+0);}
+else{n0
+eA1
+yV2))eX3
+cS
p1
-tF1
-eT1
-nG1
-nD1}
+t81
+nB1
+t1}
+eL3
+cExp2);yS1}
+else
+l14
+yV2=fp_log(p0
+x41);lG3
+yV2
nH2
-cExp);x62}
+i91
+0);}
+else{n0
+eA1
+yV2))eX3
+cS
+p1
+t81
+nB1
+t1}
+eL3
+cExp);yS1}
}
-lJ2
-GetPositivityInfo(p0)==IsAlways){if(prefer_base2){eJ
+iP1
+GetPositivityInfo(p0)==iF2){if(prefer_base2
+nQ
log;log
-xD
+iH
cLog2);log
-c9
+cS
p0);log
-eT1
-n0
-p1
-tF1
-yP1
+iW1;n0
+p1)eX3
+c91
log
-tF1
-eT1
-nH2
-cExp2);nG1
-nD1
-x62}
-else{eJ
+t81
+eL3
+cExp2);nB1
+t1
+yS1}
+else{yZ2
log;log
-xD
+iH
cLog);log
-c9
+cS
p0);log
-eT1
-n0
-p1
-tF1
-yP1
+iW1;n0
+p1)eX3
+c91
log
-tF1
-eT1
-nH2
-cExp);nG1
-nD1
-x62}
+t81
+eL3
+cExp);nB1
+t1
+yS1}
}
-i91
-cDiv:{if(GetParam(0)i61&&cB3
-GetParam(0)nC1
-xE3
+e21
+cDiv:{if(GetParam(0)tD1&&lJ3
+GetParam(0)x41
nH2
-cInv);DelParam(0);}
-yF3
-c73
+eL3
+cInv);i91
+0);}
+xY3
yF3
+xY3
if(changed)goto
exit_changed
-n31
+i1
changed;}
}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
using
-lF3
-FUNCTIONPARSERTYPES;lF3{using
+l33
+FUNCTIONPARSERTYPES;l33{using
t5;class
-e43{size_t
-nP1;size_t
-eD;size_t
-eE;size_t
-lJ1;size_t
+eF3{size_t
+nL1;size_t
+eH;size_t
+eI;size_t
+lO1;size_t
t3;size_t
t4;size_t
-n01;eX3
-e43():nP1(0),eD(0),eE(0),lJ1(0),t3(0),t4(0),n01(0){}
+n71;e43
+eF3():nL1(0),eH(0),eI(0),lO1(0),t3(0),t4(0),n71(0){}
void
-t23
+i43
OPCODE
-op){nP1+=1;e33
-cCos)++eD;e33
-cSin)++eE;e33
-cSec)++eD;e33
-cCsc)++eE;e33
-cTan)++lJ1;e33
-cCot)++lJ1;e33
-cSinh)++t4;e33
-cCosh)++t3;e33
-cTanh)++n01;}
-size_t
-GetCSEscore
-e73
+op){nL1+=1
+i33
+cCos)++eH
+i33
+cSin)++eI
+i33
+cSec)++eH
+i33
+cCsc)++eI
+i33
+cTan)++lO1
+i33
+cCot)++lO1
+i33
+cSinh)++t4
+i33
+cCosh)++t3
+i33
+cTanh)++n71;}
size_t
-nT3=nP1
-n31
-nT3;}
+GetCSEscore()const{size_t
+nS3=nL1
+i1
+nS3;}
int
-NeedsSinCos
-e73
-bool
-y71=(nP1==(eD+eE+lJ1)eY3(lJ1&&(eE||eD))||(eE&&eD)){if(y71)return
+NeedsSinCos()const{bool
+y61=(nL1==(eH+eI+lO1));if((lO1&&(eI||eH))||(eI&&eH)){if(y61)return
1
-n31
-2;}
-return
+i1
+2;eE3
0;}
int
-NeedsSinhCosh
-e73
-bool
-y71=(nP1==(t3+t4+n01)eY3(n01&&(t4||t3))||(t4&&t3)){if(y71)return
+NeedsSinhCosh()const{bool
+y61=(nL1==(t3+t4+n71));if((n71&&(t4||t3))||(t4&&t3)){if(y61)return
1
-n31
-2;}
-return
+i1
+2;eE3
0;}
size_t
-MinimumDepth
-e73
-size_t
-n_sincos=std::min(eD,eE);size_t
-n_sinhcosh=std::min(t3,t4
-eY3
-n_sincos==0&&n_sinhcosh==0)return
+MinimumDepth()const{size_t
+n_sincos=std::min(eH,eI);size_t
+n_sinhcosh=std::min(t3,t4);if(n_sincos==0&&n_sinhcosh==0)return
2
-n31
+i1
1;}
}
-nJ1
+yO1
class
TreeCountType:public
-std::multimap<fphash_t,std::pair<e43,eJ> >{}
-xR3
-FindTreeCounts(tK1&nI2,lC2
-tree,OPCODE
-x92,bool
-skip_root=false){cV
+std::multimap<fphash_t,std::pair<eF3,yZ2> >{}
+;xL1
+FindTreeCounts(tJ1&nI2,const
+nP1
+OPCODE
+xF2,bool
+skip_root=false){cX
i=nI2.xU2
-tree.GetHash()eY3!skip_root){bool
+nJ2);if(!skip_root){bool
found
-tO3
-for(;i!=nI2.cY1
-tree.GetHash();++i){if(tree
-xF
+eW3
+for(;i!=nI2.cX1
+nJ2;++i){if(tree
+xI
i
-e82
-iO2){i
-e82.first.t23
-x92);found=true;yF3}
-if(!found){e43
-count;count.t23
-x92);nI2.yR3,std::make_pair(tree.GetHash(),std::make_pair
-eL3,tree)));}
+eC2.second)){i
+eC2.first.i43
+xF2);found=true;xY3}
+if(!found){eF3
+count;count.i43
+xF2);nI2.y43,std::make_pair(nJ2,std::make_pair
+cW3
+cU3)));}
}
-nB1
-FindTreeCounts(nI2,t33,i01);}
-e12
-yU{bool
+x51
+FindTreeCounts(nI2,xW
+a),t72);}
+e72
+yW{bool
BalanceGood;bool
FoundChild;}
-nJ1
-yU
-lK1
-lC2
-root,lC2
-child){if(root
-xF
-child)){yU
-nT3={true,true}
-n31
-nT3;}
-yU
-nT3={true,false}
+yO1
+yW
+lP1
+iT1&root,iT1&cS3{if(root
+xI
+cS3){yW
+nS3={true,true}
+i1
+nS3;}
+yW
+nS3={true,false}
;if(root
nC==cIf||root
-nC==yW3{yU
-cond=lK1
+nC==t03{yW
+cond=lP1
root
l8
-0
-nO3
-yU
-xX=lK1
+0),cS3;yW
+xV=lP1
root
l8
-1
-nO3
-yU
-y6=lK1
+1),cS3;yW
+y4=lP1
root
l8
-2
-nO3
-if
-y03||xX
-yV||y6
-yV){nT3
-yV=true;}
-nT3
-e8=((xX
-yV==y6
-yV)||y03
-cZ2&&(cond
-e8||(xX
-yV&&y6
-yV))&&(xX
-e8||y03
-cZ2&&(y6
-e8||y03
-cZ2;}
+2),cS3;if
+l23||xV
+yX||y4
+yX){nS3
+yX=true;}
+nS3
+eD=((xV
+yX==y4
+yX)||l23
+i62)&&(cond
+eD||(xV
+yX&&y4
+yX))&&(xV
+eD||l23
+i62)&&(y4
+eD||l23
+i62);}
else{bool
-iE1
-tO3
+iH1
+eW3
bool
-nQ1
-tO3
-for
-iA1
-b=root.GetParamCount(),a=0;a<b;++a){yU
-tmp=lK1
+nM1=false
+eK3
+b=root.GetParamCount(),a=0;a<b;++a){yW
+tmp=lP1
root
l8
-a
-nO3
-if(tmp
-yV)nT3
-yV=true;if(tmp
-e8==false)iE1=true;lJ2
+a),cS3;if(tmp
+yX)nS3
+yX=true;if(tmp
+eD==false)iH1=true;iP1
tmp
-yV)nQ1=true;}
-if(iE1&&!nQ1)nT3
-e8
-tO3}
-return
-nT3;}
-xN1
-nZ3
-lQ3
-within,lC2
-tree,const
-xH1
-yG3&synth,const
-tK1&nI2){for
-iA1
-b=eM,a=0;a<b;++a){lC2
-leaf=t33;cV
-synth_it;xX2
-tK1::const_iterator
-i=nI2.yU3
-i!=nI2.end();++i){if(i->first!=leaf.GetHash()cP2;const
-e43&occ
-nQ2
+yX)nM1=true;}
+if(iH1&&!nM1)nS3
+eD
+eW3
+eE3
+nS3;}
+yP1
+cW2
+iR1
+i53
+const
+nP1
+const
+xK1::eP3&synth,const
+tJ1&nI2){for
+iZ1
+b=tree.GetParamCount(),a=0;a<b;++a){iT1&leaf=xW
+a);cX
+synth_it;for(x93
+tJ1::const_iterator
+i=nI2.y73
+i!=nI2.end();++i){if(i->first!=leaf.GetHash())yA1
+const
+eF3&occ
+nY2
first;size_t
-score=occ.GetCSEscore();lC2
-candidate
-nQ2
-second;if(tM1
-candidate)cP2;if(leaf.y22<occ.MinimumDepth()cP2;if(score<2
-cP2;if(lK1
-within,leaf)e8==false
-cP2
-xJ2
-if(nZ3(within,leaf,synth,nI2
-tI1;}
-return
-tR3
-xN1
-nJ2
-lQ3
-yS3,lC2
-expr){i71
-yS3
-l8
-a)xF
-expr
-tI1;i71
-nJ2(yS3
+score=occ.GetCSEscore();iT1&candidate
+nY2
+i63
+if(lF2
+candidate))yA1
+if(leaf
+nP2<occ.MinimumDepth())yA1
+if(score<2)yA1
+if(lP1
+i53
+leaf)eD==false)continue
+l43
+if(cW2(i53
+leaf,synth,nI2))lD2
+eE3
+t23
+yP1
+iI1
+iT1&y53,iT1&expr){yY1
+y53
+lF3
+expr))lD2
+yY1
+iI1
+y53
l8
a),expr
-tI1
-n31
-tR3
-xN1
+y03
+true
+i1
+t23
+yP1
GoodMomentForCSE
-lQ3
-yS3,lC2
-expr){if(yS3
-nC==cIf)return
-true;i71
-yS3
-l8
-a)xF
-expr
-tI1;size_t
-iB2=0;i71
-nJ2(yS3
+iR1
+y53,iT1&expr){if(y53
+nC==cIf)lD2
+yY1
+y53
+lF3
+expr))lD2
+size_t
+i72=0;yY1
+iI1
+y53
l8
-a),expr))++iB2
-n31
-iB2!=1;}
+a),expr))++i72
+i1
+i72!=1;}
}
-t5{xW3
+t5{tK1
size_t
-eJ::SynthCommonSubExpressions(xH1::yM1
-const{if(GetParamCount()==0)return
+yZ2::SynthCommonSubExpressions(xK1::xI1
+const{if(e91
+0)return
0;size_t
-stacktop_before=synth.GetStackTop();tK1
+stacktop_before=synth.GetStackTop();tJ1
nI2;FindTreeCounts(nI2,*this,GetOpcode(),true);for(;;){size_t
-yZ2=0;
+yW2=0;
#ifdef DEBUG_SUBSTITUTIONS_CSE
-std::cout<<"Finding a CSE candidate, root is:"
-<<std::endl;DumpHashes(*this);
+cV2<<"Finding a CSE candidate, root is:"
+<<std::y11*this);
#endif
-cV
-cs_it(nI2.end());for(cV
-j=nI2.yU3
-j!=nI2.end();){cV
+cX
+cs_it(nI2.end());for(cX
+j=nI2.y73
+j!=nI2.end();){cX
i(j++);const
-e43&occ
-nQ2
+eF3&occ
+nY2
first;size_t
-score=occ.GetCSEscore();lC2
-tree
-nQ2
-second;
+score=occ.GetCSEscore();iT1&tree
+nY2
+i63
#ifdef DEBUG_SUBSTITUTIONS_CSE
-std::cout<<"Score "
+cV2<<"Score "
<<score<<":\n"
<<std::flush;DumpTreeWithIndent(tree);
#endif
-if(tM1
-tree))xT
-if(tree.y22<occ.MinimumDepth())xT
-if(score<2)xT
-if(lK1*this,tree)e8==false)xT
-if(nZ3(*this,tree,synth,nI2)){eR2
-if(!GoodMomentForCSE(*this,tree))xT
-score*=tree.y22;if(score>yZ2){yZ2=score;cs_it=i;}
-}
-if(yZ2<=0){
+if(lF2
+tree))xZ
+if(tree
+nP2<occ.MinimumDepth())xZ
+if(score<2)xZ
+if(lP1*this
+cU3)eD==false)xZ
+if(cW2(*this
+cU3,synth,nI2)){yA1}
+if(!GoodMomentForCSE(*this
+cU3))xZ
+score*=tree
+nP2;if(score>yW2){yW2=score;cs_it=i;}
+}
+if(yW2<=0){
#ifdef DEBUG_SUBSTITUTIONS_CSE
-std::cout<<"No more CSE candidates.\n"
+cV2<<"No more CSE candidates.\n"
<<std::flush;
#endif
-yF3
-lC2
-tree=cs_it
-e82
-tE3;
+xY3
+iT1&tree=cs_it
+eC2.i63
#ifdef DEBUG_SUBSTITUTIONS_CSE
-std::cout<<l24"Common Subexpression:"
-i13
-xK(tree
-lT2
+cV2<<iX3"Common Subexpression:"
+;DumpTree
+xF(tree
+lE2
std::endl;
#endif
#if 0
int
-lW1=occ.NeedsSinCos();int
-i1=occ.NeedsSinhCosh();eJ
-iC2,iD2,c02,c12;if(lW1){iC2
-eQ2
-iC2
-xD
-cSin);iC2
-eT1
-iD2
-eQ2
-iD2
-xD
-cCos);iD2
-eT1
-if(tM1
-iC2)||tM1
-iD2)){if(lW1==2){tJ1
-eR2
-lW1=0;}
+n11=occ.NeedsSinCos();int
+i9=occ.NeedsSinhCosh()tX
+i82,i92,yX2,yY2;if(n11){i82
+eX2
+i82
+iH
+cSin);i82
+iW1;i92
+eX2
+i92
+iH
+cCos);i92
+iW1;if(lF2
+i82)||lF2
+i92))i73==2){nI2.xG2
+yA1}
+n11=0;}
}
-if(i1){c02
-eQ2
-c02
-xD
-cSinh);c02
-eT1
-c12
-eQ2
-c12
-xD
-cCosh);c12
-eT1
-if(tM1
-c02)||tM1
-c12)){if(i1==2){tJ1
-eR2
-i1=0;}
+if(i9){yX2
+eX2
+yX2
+iH
+cSinh);yX2
+iW1;yY2
+eX2
+yY2
+iH
+cCosh);yY2
+iW1;if(lF2
+yX2)||lF2
+yY2)){if(i9==2){nI2.xG2
+yA1}
+i9=0;}
}
#endif
-tree.SynthesizeByteCode(synth,false);tJ1
+tree.SynthesizeByteCode(synth,false);nI2.xG2
#ifdef DEBUG_SUBSTITUTIONS_CSE
-synth.template
-Dump<0>(lT2"Done with Common Subexpression:"
-i13
-xK(tree
-lT2
+synth.x73
+Dump<0>(lE2"Done with Common Subexpression:"
+;DumpTree
+xF(tree
+lE2
std::endl;
#endif
#if 0
-if(lW1){if(lW1==2||i1){synth.e91}
-yE3
-cSinCos,1,2)cI1
-iC2,1)cI1
-iD2,0);}
-if(i1){if(lW1)synth.e91
-if(i1==2){synth.e91}
-yE3
-cSinhCosh,1,2)cI1
-c02,1)cI1
-c12,0);}
+if(n11)i73==2||i9){synth.eL1}
+yB1
+cSinCos,1,2)yC1
+i82,1)yC1
+i92,0);}
+if(i9)i73)synth.eL1
+if(i9==2){synth.eL1}
+yB1
+cSinhCosh,1,2)yC1
+yX2,1)yC1
+yY2,0);}
#endif
-}
-return
-yD3
+eE3
+xV3
stacktop_before;}
}
#endif
#ifdef FP_SUPPORT_OPTIMIZER
-tZ1
-FunctionParserBase
-xK::Optimize(){using
-t5;l61
-eJ
-tree;tree.GenerateFrom(*mData);FPoptimizer_Optimize::ApplyGrammars(tree);std
-xV3<iF2>eI3;std
-xV3
-xK
+tK1
+lU1
+xF::iA2{using
+t5;CopyOnWrite()tX
+tree;tree.GenerateFrom(*mData);FPoptimizer_Optimize::ApplyGrammars(tree);eO3
+x83>cT3;std
+xM3
+xF
immed;size_t
-stacktop_max=0;tree.SynthesizeByteCode(eI3,immed,stacktop_max
-eY3
-mData->mStackSize!=stacktop_max){mData->mStackSize=iF2(stacktop_max);
+stacktop_max=0;tree.SynthesizeByteCode(cT3,immed,stacktop_max);if(mData->mStackSize!=stacktop_max){mData->mStackSize=x83(stacktop_max);
#if !defined(FP_USE_THREAD_SAFE_EVAL) && \
!defined(FP_USE_THREAD_SAFE_EVAL_WITH_ALLOCA)
-mData->mStack.t73
+mData->mStack
+xF3
stacktop_max);
#endif
}
-mData->mByteCode.swap(eI3);mData->mImmed.swap(immed);}
+mData->mByteCode.swap(cT3);mData->mImmed.swap(immed);}
+#define FUNCTIONPARSER_INSTANTIATE_EMPTY_OPTIMIZE(type) tP1>lU1<type>::iA2{}
#ifdef FP_SUPPORT_MPFR_FLOAT_TYPE
-x8
-MpfrFloat
-n11
+i93(MpfrFloat)
#endif
#ifdef FP_SUPPORT_GMP_INT_TYPE
-x8
-GmpInt
-n11
+i93(GmpInt)
#endif
#ifdef FP_SUPPORT_COMPLEX_DOUBLE_TYPE
-x8
-std::complex<double>n11
+i93(std::complex<double>)
#endif
#ifdef FP_SUPPORT_COMPLEX_FLOAT_TYPE
-x8
-std::complex<float>n11
+i93(std::complex<float>)
#endif
#ifdef FP_SUPPORT_COMPLEX_LONG_DOUBLE_TYPE
-x8
-std::complex<long
-double>n11
+i93(std::complex<long
+double>)
+#endif
+#define FUNCTIONPARSER_INSTANTIATE_OPTIMIZE(type) x73 lU1<type>::iA2;
+#ifndef FP_DISABLE_DOUBLE_TYPE
+iA3(double)
+#endif
+#ifdef FP_SUPPORT_FLOAT_TYPE
+iA3(float)
+#endif
+#ifdef FP_SUPPORT_LONG_DOUBLE_TYPE
+iA3(long
+double)
#endif
-FUNCTIONPARSER_INSTANTIATE_TYPES
+#ifdef FP_SUPPORT_LONG_INT_TYPE
+iA3(long)
#endif
+#endif // FP_SUPPORT_OPTIMIZER
#endif