static arith_t assignment(int var, int noeval) { union yystype val = yylval; int op = yylex(); arith_t result; char sresult[DIGITS(result) + 1]; if (var != ARITH_VAR) return cond(var, &val, op, noeval); if (op != ARITH_ASS && (op < ARITH_ASS_MIN || op >= ARITH_ASS_MAX)) return cond(var, &val, op, noeval); result = assignment(yylex(), noeval); if (noeval) return result; if (op != ARITH_ASS) result = do_binop(op - 11, arith_lookupvarint(val.name), result); snprintf(sresult, sizeof(sresult), ARITH_FORMAT_STR, result); setvar(val.name, sresult, 0); return result; }
void qml_scenario::registerInterval(qml_interval* itv) { return; if(m_intervals.find(itv) == m_intervals.end()) { m_intervals.insert(itv); auto scd = itv->follows(); auto ecd = itv->precedes(); if(scd && ecd) { auto sev = scd->cond(); auto eev = ecd->cond(); } if(auto iv = itv->interval()) { qml_exec::get(this)->submitCommand([mpl=m_impl,iv] { }); } } }
static void repeatstat (LexState *ls, int line) { /* repeatstat -> REPEAT block UNTIL cond */ FuncState *fs = ls->fs; int repeat_init = luaK_getlabel(fs); expdesc v; BlockCnt bl; enterblock(fs, &bl, 1); next(ls); block(ls); check_match(ls, TK_UNTIL, TK_REPEAT, line); cond(ls, &v); luaK_patchlist(fs, v.f, repeat_init); leaveblock(fs); }
void mul_inst(ARMProc *proc, UWord instruction) { printf("Ejecutaste un mul\n"); Word Rm = get_bits(instruction,0,4); Word Rd = get_bits(instruction,16,4); Word Rs = get_bits(instruction,8,4); Word S = get_bits(instruction,20,0); if(!cond(proc,instruction)){ *proc->r[Rd] = *proc->r[Rm] * *proc->r[Rs]; if(S == 1){ set_status(proc,status_n,get_bits(*proc->r[Rd],31,1)); set_status(proc,status_z,*proc->r[Rd] == 0); } } }
static tactic * mk_qfbv_tactic(ast_manager& m, params_ref const & p, tactic* sat, tactic* smt) { params_ref local_ctx_p = p; local_ctx_p.set_bool("local_ctx", true); params_ref solver_p; solver_p.set_bool("preprocess", false); // preprocessor of smt::context is not needed. params_ref big_aig_p; big_aig_p.set_bool("aig_per_assertion", false); tactic* preamble_st = mk_qfbv_preamble(m, p); tactic * st = main_p(and_then(preamble_st, // If the user sets HI_DIV0=false, then the formula may contain uninterpreted function // symbols. In this case, we should not use the `sat', but instead `smt'. Alternatively, // the UFs can be eliminated by eager ackermannization in the preamble. cond(mk_is_qfbv_eq_probe(), and_then(mk_bv1_blaster_tactic(m), using_params(smt, solver_p)), cond(mk_is_qfbv_probe(), and_then(mk_bit_blaster_tactic(m), when(mk_lt(mk_memory_probe(), mk_const_probe(MEMLIMIT)), and_then(using_params(and_then(mk_simplify_tactic(m), mk_solve_eqs_tactic(m)), local_ctx_p), if_no_proofs(cond(mk_produce_unsat_cores_probe(), mk_aig_tactic(), using_params(mk_aig_tactic(), big_aig_p))))), sat), smt)))); st->updt_params(p); return st; }
void Diffusion::static_flux_value(const FEMesh *mesh, const Element *element, const Flux *flux, const MasterPosition &pt, double time, SmallSystem *fluxdata) const { // first evaluate the concentration gradient std::vector<double> fieldGradient(3); for (SpaceIndex i=0; i<DIM; ++i){ OutputValue outputVal = element->outputFieldDeriv( mesh, *concentration, &i, pt ); fieldGradient[i] = outputVal[0]; } #if DIM==2 // if plane-flux eqn, then dT/dz is kept as a separate out_of_plane field if ( !concentration->in_plane(mesh) ){ OutputValue outputVal = element->outputField( mesh, *concentration->out_of_plane(), pt ); fieldGradient[2] = outputVal[0]; } #endif // now compute the flux elements by the following summation // flux_i = cond(i,j) * dT_j // where 'cond' is the conductivity tensor and dT_j is // jth component of the gradient of the concentration field const SymmMatrix3 cond( conductivitytensor( mesh, element, pt ) ); for(VectorFieldIterator i; !i.end(); ++i) fluxdata->flux_vector_element( i ) -= cond( i.integer(), 0 ) * fieldGradient[0] + cond( i.integer(), 1 ) * fieldGradient[1] + cond( i.integer(), 2 ) * fieldGradient[2]; } // end of 'Diffusion::static_flux_value'
int fib(int n) { int a = 1, b = 1; bool (*cond)(void); cond = obfuscated_condition; if (n == 0) return 1; while (n > 1 && cond() != false ) { --n; int result = a + b; a = b; a +=input; b = result; a -=input; } return b; }
int func_fit(const gsl_vector * x, void * params, gsl_vector * f){ size_t n = ((struct data *)params)->n; double *y = ((struct data *)params)->y; double *t = ((struct data *) params)->t; set_const* C_init = ((struct data *) params)-> Init; double Cs = gsl_vector_get (x, 0); double Co = gsl_vector_get (x, 1); //double Cr = gsl_vector_get(x,2); double b = gsl_vector_get (x, 2); double c = gsl_vector_get (x, 3); //double z = gsl_vector_get(x,5); //double a = gsl_vector_get(x,6); double z = 0.65; //std::cout << cond(5, 15) << " " << uncond(cond(5, 15), 15) << std::endl; set_const *C = C_init; C->name = "Equation dummy constant set"; cond(C, Cs, Co, b, c); //std::cout << C->C_s << C->C_o << C->b << C->c << std::endl; C->C_r = 10.0; C->z = z; C->a = 1.0; /*set_const C("Equation dummy constant set",abs(Cs),Co,sqrt(100.0),b,abs(c),z, [](double f){return 1-f;}, [](double f){return 1.0;}, [=](double f){return eta_o(f);}, [](double f){return 1.0;});*/ /* set_const C("Equation dummy constant set",abs(Cs),abs(Co),sqrt(100.0),abs(b),abs(c),0.65, [](double f){return 1-f;}, [](double f){return 1.0;}, [](double f){return 1.0;}, [](double f){return 1.0;}); */ size_t i; for (i = 0; i < n; i++) { /* Model Yi = A * exp(-lambda * i) + b */ double Yi = EoS::t_E(t[i]/2.0, t[i]/2.0, C)/(D*t[i]) - m_n; //std::cout << i << " " << Yi - y[i]<< std::endl; gsl_vector_set (f, i, abs(Yi - y[i]));//Try abs(Yi-y[i]) } //gsl_vector_set(f, n-1, abs(asymm(0.5, C) - 32.0)); //std::cout << "ASYMM = " << asymm(0.5,C) << std::endl; return GSL_SUCCESS; }
void msrr_inst(ARMProc *proc, UWord instruction) { #ifdef DEBUG printf("Ejecutaste un msrr\n"); #endif UWord mask; Word operand, _bit_immediate, rotate_imm, Rm, field_mask, R, status_mode, byte_mask, byte1, byte2, byte3, byte4; if( !cond(proc, instruction) ) return; _bit_immediate = get_bits(instruction, 0, 8); rotate_imm = get_bits(instruction, 8, 4); Rm = get_bits(instruction, 0, 4); field_mask = get_bits(instruction, 16, 4); R = get_bits(instruction, 22, 1); if( get_bits(instruction, 25, 1, 0)) operand = ror(_bit_immediate, rotate_imm * 2); else operand = Rm; if( (operand & 0x06FFFF00) != 0 ) #ifdef DEBUG printf("UNPREDICTABLE\n"); #endif if( get_bits(field_mask, 0, 1) ) byte1 = 0x000000FF; else byte1 = 0x00000000; if( get_bits(field_mask, 1, 1) ) byte2 = 0x0000FF00; else byte2 = 0x00000000; if( get_bits(field_mask, 2, 1) ) byte3 = 0x00FF0000; else byte3 = 0x00000000; if( get_bits(field_mask, 3, 1) ) byte4 = 0xFF000000; else byte4 = 0x00000000; byte_mask = byte1 | byte2 | byte3 | byte4; status_mode = get_status(proc, status_m); if( !R ){ if( status_mode == mode_fiq || status_mode == mode_irq || status_mode == mode_svc || status_mode == mode_abt || status_mode == mode_und ) if( (operand & 0x01000020) != 0){ #ifdef DEBUG printf("UNPREDICTABLE\n"); #endif }else mask = byte_mask & (0xF8000000 | 0x0000000F); else mask = byte_mask & 0xF8000000; *proc->cpsr = ( *proc->cpsr & ~mask ) | (operand & mask); }else if( proc->spsr != NULL ){ mask = byte_mask & (0xF8000000 | 0x0000000F | 0x01000020); *proc->spsr = (*proc->spsr & ~mask) | (operand & mask); }else{ #ifdef DEBUG printf("UNPREDICTABLE\n"); #endif } }
void DlgCommand::on_btnNewCond_clicked() { DlgCmdCond dlg(this); dlg.exec(); const auto rhs = dlg.getRHS(); const auto lhs = dlg.getLHS(); const auto op = dlg.getOp(); app::Commands::Condition cond(lhs, op, rhs); command_.appendCondition(std::move(cond)); QStringList str; str << lhs << op << rhs; ui_.listConditions->addItem(str.join(" ")); }
void lsm_addr3(ARMProc *proc, UWord instruction, void *result) { ARMAddrLSMReturn *res = result; Word Rn, register_list, W; #ifdef DEBUG printf("Ejecutaste un LSM addr3\n"); #endif Rn = get_bits(instruction, 16, 4); register_list = get_bits(instruction, 0, 16); W = get_bits(instruction, 21, 1); res->start_address = *proc->r[Rn] - (count32(register_list) * 4) + 4; res->end_address = *proc->r[Rn]; if( cond(proc, instruction) && W ) *proc->r[Rn] -= count32(register_list) * 4; }
void cgInstanceOf(IRLS& env, const IRInstruction* inst) { auto const dst = dstLoc(env, inst, 0).reg(); auto const rhs = srcLoc(env, inst, 1).reg(); auto& v = vmain(env); auto const call_classof = [&] (Vreg dest) { cgCallHelper(v, env, CallSpec::method(&Class::classof), {DestType::Byte, dest}, SyncOptions::None, argGroup(env, inst).ssa(0).ssa(1)); return dest; }; if (!inst->src(1)->isA(TCls)) { auto const sf = v.makeReg(); v << testq{rhs, rhs, sf}; cond(v, CC_NZ, sf, dst, [&] (Vout& v) { return call_classof(v.makeReg()); }, [&] (Vout& v) { return v.cns(false); } // rhs is nullptr ); return; } auto const spec = inst->src(1)->type().clsSpec(); if (!spec.cls() || (spec.cls()->attrs() & AttrInterface)) { call_classof(dst); return; } // This essentially inlines Class::classofNonIFace auto const lhs = srcLoc(env, inst, 0).reg(); auto const rhsTmp = v.makeReg(); auto const rhsLen = v.makeReg(); auto const sfVecLen = v.makeReg(); if (sizeof(Class::veclen_t) == 2) { v << loadw{rhs[Class::classVecLenOff()], rhsTmp}; v << movzwq{rhsTmp, rhsLen}; v << cmpwm{rhsTmp, lhs[Class::classVecLenOff()], sfVecLen}; } else if (sizeof(Class::veclen_t) == 4) { v << loadl{rhs[Class::classVecLenOff()], rhsTmp}; v << movzlq{rhsTmp, rhsLen}; v << cmplm{rhsTmp, lhs[Class::classVecLenOff()], sfVecLen}; } else { not_implemented(); } check_subcls(v, sfVecLen, dst, lhs, rhs, rhsLen); }
static void whilestat (LexState *ls, int line) { /* whilestat -> WHILE cond DO block END */ FuncState *fs = ls->fs; int whileinit; int condexit; BlockCnt bl; luaX_next(ls); /* skip WHILE */ whileinit = luaK_getlabel(fs); condexit = cond(ls); enterblock(fs, &bl, 1); checknext(ls, TK_DO); block(ls); luaK_patchlist(fs, luaK_jump(fs), whileinit); check_match(ls, TK_END, TK_WHILE, line); leaveblock(fs); luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ }
bool cVarParser::ParseCondExp(const string& input) { int condEndPos = input.find("?"); string cond(input.begin(), input.begin() + condEndPos); int condNeqPos = cond.find("!="); int condEqPos = cond.find("=="); if (condEqPos == -1 && condNeqPos == -1) { cond += "!="; condNeqPos = cond.find("!="); } if (condEqPos >= 0 || condNeqPos >= 0) { if (!ParseEquality(cond)) { LogFile.eSysLog("error parsing '%s'", input.c_str()); return false; } condOp = (condEqPos >= 0)?condEq:condNeq; } else { LogFile.eSysLog("error parsing '%s'", input.c_str()); return false; } string truefalse(input.begin() + condEndPos + 1, input.end()); int elsePos = truefalse.find(":"); if (elsePos >= 0) { string truePart(truefalse.begin(), truefalse.begin() + elsePos); string falsePart(truefalse.begin() + elsePos + 1, truefalse.end()); if (ParseVar(truePart) && ParseVar(falsePart)) { condvarTrue = Strip(truePart); condvarFalse = Strip(falsePart); type = cVarParser::condition; return true; } } LogFile.eSysLog("error parsing '%s'", input.c_str()); condEqLeft = condEqRight = ""; return false; }
byte fn0C00_0171(Eq_92 * es, Eq_36 * ds, Eq_23 * fs, Eq_23 * gs) { Eq_38 Eq_23::*bx_4 = ds->ptr01C6; ds->w01CE = (gs->*bx_4).w0000; word16 si_24 = (gs->*bx_4).w4000; word16 dx_107 = 0x0000; word16 bp_106 = 0x0000; byte Eq_92::*di_105 = &Eq_92::b0000; word16 cx_110 = 0x00C8; do { word16 cx_50 = 0x0140; di_54 = di_105; bp_55 = bp_106; dx_56 = dx_107; do { byte Eq_92::*di_54; word16 bp_55; word16 dx_56; dx_56 = dx_56 + ds->w01CE; bp_55 = bp_55 + si_24; Eq_140 bx_119 = DPB(bp_55, SLICE(dx_56, byte, 8), 0, 8); byte al_121 = 0x14; do { if (Mem7[fs:bx_119 + Mem7[ds:0x01CC:word16]:byte] != 0x00) break; bx_119 = bx_119 * 0x0002; al_121 = al_121 - 0x04; } while (al_121 != 0x00); es->*di_54 = al_121; di_54 = di_54 + 1; cx_50 = cx_50 - 0x0001; } while (cx_50 != 0x0000); di_105 = di_105 + 0x0140; bp_106 = bp_106 - ds->w01CE; dx_107 = dx_107 + si_24; cx_110 = cx_110 - 0x0001; } while (cx_110 != 0x0000); ds->b01C7 = ds->b01C7 + 0x01; byte v23_113 = ds->b01CD + 0x04; ds->b01CD = v23_113; return cond(v23_113); }
void test_case_1() { value = 0; boost::fibers::scheduler<> sched; boost::fibers::mutex mtx( sched); boost::fibers::condition cond( sched); sched.make_fiber( wait_fn, boost::ref( mtx), boost::ref( cond), boost::fiber::default_stacksize); BOOST_CHECK( sched.run() ); BOOST_CHECK_EQUAL( std::size_t( 1), sched.size() ); BOOST_CHECK_EQUAL( 0, value); BOOST_CHECK( ! sched.run() ); BOOST_CHECK_EQUAL( std::size_t( 1), sched.size() ); BOOST_CHECK_EQUAL( 0, value); BOOST_CHECK( ! sched.run() ); BOOST_CHECK_EQUAL( std::size_t( 1), sched.size() ); BOOST_CHECK_EQUAL( 0, value); sched.make_fiber( notify_one_fn, boost::ref( cond), boost::fiber::default_stacksize); BOOST_CHECK_EQUAL( std::size_t( 2), sched.size() ); BOOST_CHECK_EQUAL( 0, value); BOOST_CHECK( sched.run() ); BOOST_CHECK_EQUAL( std::size_t( 1), sched.size() ); BOOST_CHECK_EQUAL( 0, value); BOOST_CHECK( sched.run() ); BOOST_CHECK_EQUAL( std::size_t( 0), sched.size() ); BOOST_CHECK_EQUAL( 1, value); BOOST_CHECK( ! sched.run() ); BOOST_CHECK_EQUAL( std::size_t( 0), sched.size() ); BOOST_CHECK_EQUAL( 1, value); }
void Diffusion::flux_matrix(const FEMesh *mesh, const Element *el, const ElementFuncNodeIterator &j, const Flux *flux, const MasterPosition &pt, double time, SmallSystem *fluxdata) const { // The atom flux matrix M_{ij} multiplies the vector of nodal // concentrations to give the vector atom current J at point pt. // M_{ij} = -D_{ik} grad_k N_j // J_i = -M_{ij} T_j // where N_j is the shapefunction at node j. // printf("flux"); if (*flux != *atom_flux) { throw ErrProgrammingError("Unexpected flux", __FILE__, __LINE__); } double sf = j.shapefunction( pt ); double dsf0 = j.dshapefunction( 0, pt ); double dsf1 = j.dshapefunction( 1, pt ); #if DIM==3 double dsf2 = j.dshapefunction( 2, pt ); #endif const SymmMatrix3 cond( conductivitytensor( mesh, el, pt ) ); // Loop over flux components. Loop over all components, even if // the flux is in-plane, because the out-of-plane components of // the flux matrix are used to construct the constraint equation. for(VectorFieldIterator i; !i.end(); ++i){ #if DIM==2 // in-plane concentration gradient contributions fluxdata->stiffness_matrix_element( i, concentration, j ) -= cond(i.integer(), 0) * dsf0 + cond(i.integer(), 1) * dsf1; // out-of-plane concentration gradient contribution if(!concentration->in_plane(mesh)) fluxdata->stiffness_matrix_element(i, concentration->out_of_plane(), j) -= cond(i.integer(), 2) * sf; #elif DIM==3 fluxdata->stiffness_matrix_element( i, concentration, j ) -= cond( i.integer(), 0 ) * dsf0 + cond( i.integer(), 1 ) * dsf1 + cond( i.integer(), 2 ) * dsf2; #endif } } // end of 'Diffusion::flux_matrix'
tactic * mk_nra_tactic(ast_manager & m, params_ref const& p) { params_ref p1 = p; p1.set_uint("seed", 11); p1.set_bool("factor", false); params_ref p2 = p; p2.set_uint("seed", 13); p2.set_bool("factor", false); return and_then(mk_simplify_tactic(m, p), mk_nnf_tactic(m, p), mk_propagate_values_tactic(m, p), mk_qe_tactic(m, p), cond(mk_is_qfnra_probe(), or_else(try_for(mk_qfnra_nlsat_tactic(m, p), 5000), try_for(mk_qfnra_nlsat_tactic(m, p1), 10000), mk_qfnra_nlsat_tactic(m, p2)), mk_smt_tactic(p))); }
void strt_inst(ARMProc *proc, UWord instruction) { #ifdef DEBUG printf("Ejecutaste un strt\n"); #endif //Instrucciones de LS ARMAddr *modes = addr_modes_ls(); ARMAddr *mode; ARMAddrLSReturn result; Word Rd; if( !cond(proc, instruction) ) return; mode = fetch_addr(modes, instruction); Rd = get_bits(instruction, 12, 4); if(mode != NULL) mode->execute(proc, instruction, &result); proc->writeWord(proc, result.address, *proc->r[Rd]); }
static int search(Lux::Engine engine, int argc, char* argv[]) { Lux::SortCondition scond(Lux::SORT_SCORE, Lux::DESC); Lux::Paging paging(100); Lux::Condition cond(scond, paging); Lux::Searcher searcher(engine); Lux::ResultSet rs = searcher.search(argv[0], cond); std::cout << "total hits: " << rs.get_total_num() << std::endl; rs.init_iter(); while (rs.has_next()) { Lux::Result r = rs.get_next(); print_line(); std::cout << "[id] " << r.get_id() << std::endl; } return 0; }
void emitIssetG(IRGS& env) { auto const name = topC(env, BCSPOffset{0}); if (!name->isA(TStr)) PUNT(IssetG-NameNotStr); auto const ret = cond( env, [&] (Block* taken) { return gen(env, LdGblAddr, taken, name); }, [&] (SSATmp* ptr) { // Next: global exists return gen(env, IsNTypeMem, TNull, gen(env, UnboxPtr, ptr)); }, [&] { // Taken: global doesn't exist return cns(env, false); } ); destroyName(env, name); push(env, ret); }
PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_new_node_for_insert(const_reference r_val, false_type) { node_pointer p_new_nd = s_node_allocator.allocate(1); cond_dealtor_t cond(p_new_nd); new (const_cast<void* >( static_cast<const void* >(&p_new_nd->m_value))) typename node::value_type(r_val); cond.set_no_action(); ++m_size; return (p_new_nd); }
R ColumnBase::aggregate(T target, std::size_t start, std::size_t end, std::size_t limit, std::size_t* return_ndx) const { condition cond; int c = condition::condition; typedef typename ColumnTypeTraits2<condition, T>::column_type ColType; typedef typename ColumnTypeTraits2<condition, T>::array_type ArrType; if (end == std::size_t(-1)) end = size(); QueryState<R> state; state.init(action, null_ptr, limit); ColType* column = const_cast<ColType*>(static_cast<const ColType*>(this)); SequentialGetter<T> sg(column); bool cont = true; for (size_t s = start; cont && s < end; ) { sg.cache_next(s); size_t end2 = sg.local_end(end); if(util::SameType<T, int64_t>::value) { cont = (static_cast<const Array*>(sg.m_array_ptr))->find(c, action, int64_t(target), s - sg.m_leaf_start, end2, sg.m_leaf_start, reinterpret_cast<QueryState<int64_t>*>(&state)); } else { for(size_t local_index = s - sg.m_leaf_start; cont && local_index < end2; local_index++) { T v = ((ArrType*)(sg.m_array_ptr))->get(local_index); if(cond(v, target)) { cont = (static_cast<QueryState<R>*>(&state))->template match<action, false>(s + local_index , 0, static_cast<R>(v)); } } } s = end2 + sg.m_leaf_start; } if (return_ndx) *return_ndx = state.m_minmax_index; return state.m_state; }
void cgCountWHNotDone(IRLS& env, const IRInstruction* inst) { auto const fp = srcLoc(env, inst, 0).reg(); auto const extra = inst->extra<CountWHNotDone>(); auto& v = vmain(env); auto const base = v.makeReg(); auto const loc = v.cns((extra->count - 1) * 2); auto const cnt = v.cns(0); v << lea{fp[localOffset(extra->first + extra->count - 1)], base}; auto out = doWhile(v, CC_GE, {loc, cnt}, [&] (const VregList& in, const VregList& out) { auto const loc_in = in[0], cnt_in = in[1]; auto const loc_out = out[0], cnt_out = out[1]; auto const sf1 = v.makeReg(); auto const sf2 = v.makeReg(); auto const obj = v.makeReg(); // We depend on this in the test with 0x0E below. static_assert(c_WaitHandle::STATE_SUCCEEDED == 0, ""); static_assert(c_WaitHandle::STATE_FAILED == 1, ""); v << load{base[loc_in * 8], obj}; v << testbim{0x0E, obj[WH::stateOff()], sf1}; cond(v, CC_NZ, sf1, cnt_out, [&] (Vout& v) { auto ret = v.makeReg(); v << incq{cnt_in, ret, v.makeReg()}; return ret; }, [&] (Vout& v) { return cnt_in; } ); // Add 2 to the loop variable because we can only scale by at most 8. v << subqi{2, loc_in, loc_out, sf2}; return sf2; } ); v << copy{out[1], dstLoc(env, inst, 0).reg()}; }
void mls_addr5(ARMProc *proc, UWord instruction, void *result) { ARMAddrMLSReturn *res = result; Word U, Rn, offset_8, immedH, immedL; #ifdef DEBUG printf("Ejecutaste un MLS addr5\n"); #endif U = get_bits(instruction, 23, 1); Rn = get_bits(instruction, 16, 4); immedH = get_bits(instruction, 8, 4); immedL = get_bits(instruction, 0, 4); res->address = *proc->r[Rn]; offset_8 = ( immedH << 4 ) | immedL; if( cond(proc, instruction) ) if( U ) *proc->r[Rn] += offset_8; else *proc->r[Rn] -= offset_8; }
void emitCGetQuietG(IRGS& env) { auto const name = topC(env); if (!name->isA(TStr)) PUNT(CGetQuietG-NonStrName); auto ret = cond( env, [&] (Block* taken) { return gen(env, LdGblAddr, taken, name); }, [&] (SSATmp* ptr) { auto tmp = gen(env, LdMem, TCell, gen(env, UnboxPtr, ptr)); gen(env, IncRef, tmp); return tmp; }, // Taken: LdGblAddr branched here because no global variable exists with // that name. [&] { return cns(env, TInitNull); } ); destroyName(env, name); push(env, ret); }
void emitEmptyG(IRGS& env) { auto const name = topC(env); if (!name->isA(TStr)) PUNT(EmptyG-NameNotStr); auto const ret = cond( env, [&] (Block* taken) { return gen(env, LdGblAddr, taken, name); }, [&] (SSATmp* ptr) { // Next: global exists auto const unboxed = gen(env, UnboxPtr, ptr); auto const val = gen(env, LdMem, TCell, unboxed); return gen(env, XorBool, gen(env, ConvCellToBool, val), cns(env, true)); }, [&] { // Taken: global doesn't exist return cns(env, true); }); destroyName(env, name); push(env, ret); }
void adc_inst(ARMProc *proc, UWord instruction) { #ifdef DEBUG printf("Ejecutaste un adc\n"); #endif //Instrucciones de DP ARMAddr *modes = addr_modes_dp(); ARMAddr *mode; Word S; Word Rn; Word Rd; Word carry; Word last_rd; ARMAddrDPReturn result; if(!cond(proc, instruction)) return; S = get_bits(instruction,20,1); Rn = get_bits(instruction,16,4); Rd = get_bits(instruction,12,4); //---Parte indispensable para obtener el result mode = fetch_addr(modes, instruction); if(mode != NULL) mode->execute(proc, instruction, &result); //--- last_rd = *proc->r[Rd]; *proc->r[Rd] = AddCarryFrom(*proc->r[Rn],result.shifter_operand + get_bits(*proc->cpsr,29,1),&carry); if(S && Rd == 15) { if(proc->cpsr != NULL) { *proc->cpsr = *proc->spsr; } } else if(S == 1) { set_status(proc, status_n, get_bits(*proc->r[Rd], 31, 1)); set_status(proc, status_z, *proc->r[Rd] == 0); set_status(proc, status_c, carry); set_status(proc, status_v, OverflowFrom(last_rd,*proc->r[Rd])); } }
void WorldServer::dumpAISeparated(std::string basicFilePath) { MakeSureDirectoryPathExists(basicFilePath.c_str()); for(unsigned int i=0;i<this->npcData.size();i++) { NPCData* npcData = &this->npcData[i]; AIP* aip = &this->aiData.getValue(npcData->getAIId()); if (aip == nullptr) continue; std::string fileName = (basicFilePath + npcData->getName()); if (i >= 800 && i < 1000) { fileName += " (Summon)"; } CMyFileWriter<char> file((fileName + ".log").c_str(), "a+"); file.clear(); if(aip->getCheckInterval() == 0x00) continue; file.putStringWithVar("%s [MonID: %i | AI-ID: %i]:\n", aip->getFilePath().c_str(), i, aip->getId()); file.putStringWithVar("CheckInterval: %i | DmgTrigger: %i\n", aip->getCheckInterval(), aip->getTriggerDamageAmount()); file.putStringWithVar("BlockCount: %i\n", aip->getBlockCount()); for(unsigned int j=0;j<aip->getBlockCount();j++) { const std::vector<AIP::Record> records = aip->getRecords(j); file.putStringWithVar("\tCurrent Block[%i] records: %i\n", j, records.size()); for(unsigned int k=0;k<records.size();k++) { const AIP::Record& curRec = records.at(k); file.putStringWithVar("\t\tConditionCount: %i\n", curRec.getConditionCount()); for(unsigned int m=0;m<curRec.getConditionCount();m++) { const char* data = curRec.getCondition(m).getData(); AIConditions cond(data); file.putStringWithVar("\t\t\t%s\n", cond.toString().c_str()); } file.putStringWithVar("\t\tActionCount: %i\n", curRec.getActionCount()); for(unsigned int m=0;m<curRec.getActionCount();m++) { const char* data = curRec.getAction(m).getData(); AIActions act(data); file.putStringWithVar("\t\t\t%s\n", act.toString().c_str()); } file.putString("\n\n"); } } file.putString("\n\n"); } }
void smlaw_inst(ARMProc *proc, UWord instruction) { printf("Ejecutaste un smlaw\n"); Word Rm = get_bits(instruction,0,4); Word Rd = get_bits(instruction,16,4); Word Rs = get_bits(instruction,8,4); Word Rn = get_bits(instruction,12,4); Word y = get_bits(instruction,6,1); Word last_rd; Word operand2; if(cond(proc,instruction)){ if(y == 0) operand2 = SignExtend(get_bits(*proc->r[Rs],0,16),16); else operand2 = SignExtend(get_bits(*proc->r[Rs],16,16),16); last_rd = *proc->r[Rd]; *proc->r[Rd] = (*proc->r[Rm] * operand2) + *proc->r[Rn];//TO DO if(OverflowFrom(last_rd,*proc->r[Rn])) set_status(proc,status_q,1); } }