int main() { char szStr[256]; int ctime; ctime=0; ctime=ctime+calcFuncCall(); ctime=ctime+calcAdd(); ctime=ctime+calcSub(); ctime=ctime+calcMul(); ctime=ctime+calcDiv(); ctime=ctime+calcShift(); ctime=ctime+calcFloatAdd(); ctime=ctime+calcFloatSub(); ctime=ctime+calcFloatMul(); ctime=ctime+calcFloatDiv(); ctime=ctime+calcDoubleAdd(); ctime=ctime+calcDoubleSub(); ctime=ctime+calcDoubleMul(); ctime=ctime+calcDoubleDiv(); printf("Spec Time=,%d",ctime); return 0; }
bool calcTerm(double &result, int &curLex, char lexemeString []) { if (!calcMul(result, curLex, lexemeString)) return false; while (curLex == multiplication || curLex == division) { int operation = curLex; double next = 0.0; nextLexeme(curLex, lexemeString); if (!calcMul(next, curLex, lexemeString)) return false; switch (operation) { case multiplication: { result *= next; break; } case division:{ result /= next; break; } } } return true; }
void processData(float* sampleBlockInput, float* sampleBlockOutput, int frames) { float curMax = 0; float outMax = 0; float outMid = 0; float outDelta = 0; float mul = calcMul(); for(int i=0; i<frames; i++) { float I = sampleBlockInput[i*2]; float Q = sampleBlockInput[i*2+1]; float mx = famax(I, Q); if(mx>curMax) curMax = mx; I *= mul; Q *= mul; float out = IQ_decoder(I,Q); float om = fabs(out); if(om>outMax) outMax = om; outMid += out; sampleBlockOutput[i] = out; //sampleBlockOutput[i] = I; } outMid /= frames; for(int i=0; i<frames; i++) { float d = sampleBlockOutput[i] - outMid; outDelta += d*d; } outDelta = sqrt(outDelta)/frames; if((quant_idx++%100)==0) { printf("mul=%e, max=%e , mid=%e delta=%e\n", mul, outMax/mul, outMid/mul, outDelta/mul); //printf("max=%e\n" ,curMax); } pushLastMax(curMax); }
double Intergrate::Operation() { double result; if (oper == '+'){ CalcAdd<double> calcAdd(num1, num2); double result_Add; result = calcAdd.AddRun(); } else if (oper == '-'){ CalcSub<double> calcSub(num1, num2); double result_Sub; result = calcSub.SubRun(); } else if (oper == '*'){ CalcMul<double> calcMul(num1, num2); double result_Mul; result = calcMul.MulRun(); } else if (oper == '/'){ CalcDiv<double> calcDiv(num1, num2); double result_Div; result = calcDiv.DivRun(); } else{ std::cout<<"err"<<std::endl; return 0; } return result; }