static inline int64_t next_prime(int64_t i) { int64_t j; for(j = p2i(i) + 1; j < SSZ; j++) if(!sieve[j]) return i2p(j); return 0; }
const void *toThd(int tid,int del,int *ser){ const void *tidx; int ti; if( enbugTID64() ){ return i2p(tid); } if( !lTHREADID() ){ if( SIZEOF_tid_t <= sizeof(int) ){ return i2p(tid); } } /* if( (tid & 0x8000) == 0 ){ return (void*)tid; } ti = tid & ~0xFF00; */ ti = tid2ti(tid); if( 0 <= tid && ti < elnumof(tids) ){ tidx = tids[ti].t_tidx; if( del ){ if( tids[ti].t_Stid == *ser ){ tids[ti].t_tidx = (void*)-1; }else{ syslog_ERROR("##toThd unmatch ser: %d %d\n", *ser,tids[ti].t_Stid); } if( lTHREAD() || lTHREADID() ){ porting_dbg("##tid del[%d] %d %llX/%X", ti,tids[ti].t_Stid, p2llu(tidx),tid); if( lTHREADID() ){ dumpTids(); } } }else{ if( ser ){ *ser = tids[ti].t_Stid; } } return tidx; } return i2p(tid); }
int main() { char s[100]; void i2p(char[]); printf("Enter the Infix expression: "); scanf("%s",s); printf("nThe Postfix expression is: "); i2p(s); return 0; }
/** * \fn encodeBlockSimple * \brief mono or stereo */ bool AUDMEncoder_Lavcodec::encodeBlockSimple(int count, uint8_t *dest,int &encoded) { encoded=0; AVPacket pkt; // out av_init_packet(&pkt); pkt.size=5000; pkt.data=dest; if(!count) { return lastBlock(&pkt,encoded); } int gotPacket; int channel=wavheader.channels; _frame->channel_layout=CONTEXT->channel_layout; int nbBlocks=count/channel; _frame->nb_samples=nbBlocks; int er; if( CONTEXT->sample_fmt == AV_SAMPLE_FMT_FLTP) { float *in=i2p(count); // reorder and de-interleave er=avcodec_fill_audio_frame(_frame, channel, AV_SAMPLE_FMT_FLTP, (uint8_t *)in, count*sizeof(float), 0); }else { // s16 dither16(&(tmpbuffer[tmphead]),count,channel); er=avcodec_fill_audio_frame(_frame, channel, AV_SAMPLE_FMT_S16, (uint8_t *)&(tmpbuffer[tmphead]), count*sizeof(uint16_t), 0); } if(er<0) { printError("Fill audio",er); return false; } int nbout = avcodec_encode_audio2(CONTEXT, &pkt,_frame,&gotPacket); if(nbout>=0 && gotPacket) { cprintf("Got %d bytes \n",pkt.size); encoded=pkt.size; } else { printError("Encoding",nbout); return false; } return true; }
static array get_environment_key(array env) { register unsigned int ix; array result = array_new(NULL, NULL); for (ix = 0; ix < env->sz; ix++) { atms_node node = (atms_node)env->arr[ix]; array_append(result, i2p(node->index)); } return result; }
/** * Creates a new DPLL problem for use by the DPLL consistency checker * or the CNF to DNF converter. This function is used internally by * the solvers. * * @param clauses the input set of clauses; * @param variables the number of variables in the CNF. * @returns the newly created DPLL problem. */ dpll_problem dpll_new_problem(tv_clause_list clauses, const unsigned int variables_count) { register unsigned int ix; const_int_list pos; const_int_list neg; dpll_problem problem = (dpll_problem)malloc(sizeof(struct str_dpll_problem)); if (NULL == problem) { return problem; } problem->variables_count = variables_count; if (option_simplify_clauses) { problem->clauses = simplify_clauses(clauses); } else { problem->clauses = clauses; } problem->assigned_variables = 0; problem->current_variable = (unsigned int)-1; problem->consistent = 1; problem->branch_points = 0; problem->satisfied_clauses = 0; problem->randomized = 0; problem->empty_clause = new_tv_clause(new_int_list(), new_int_list()); problem->assignment_history = (unsigned int *)malloc(sizeof(unsigned int) * variables_count); memset(problem->assignment_history, 0, sizeof(unsigned int) * variables_count); problem->satisfied = (unsigned int *)malloc(sizeof(unsigned int) * clauses->sz); problem->labelled = (unsigned int *)malloc(sizeof(unsigned int) * clauses->sz); memset(problem->satisfied, 0, sizeof(unsigned int) * clauses->sz); memset(problem->labelled, 0, sizeof(unsigned int) * clauses->sz); problem->unit_variables_pos = queue_new(NULL, NULL); problem->unit_variables_neg = queue_new(NULL, NULL); problem->unit_variables_pos_map = (unsigned char *)malloc(sizeof(unsigned char) * variables_count); problem->unit_variables_neg_map = (unsigned char *)malloc(sizeof(unsigned char) * variables_count); memset(problem->unit_variables_pos_map, 0, sizeof(unsigned char) * variables_count); memset(problem->unit_variables_neg_map, 0, sizeof(unsigned char) * variables_count); problem->variables = (dpll_variable *)malloc(sizeof(dpll_variable) * variables_count); for (ix = 0; ix < variables_count; ix++) { problem->variables[ix] = new_dpll_variable(); } for (ix = 0; ix < problem->clauses->sz; ix++) { initialize_clause(problem, ix); pos = clauses->arr[ix]->pos; neg = clauses->arr[ix]->neg; if (pos->sz == 0 && neg->sz == 0) { /* Problem is UNSAT due to an empty clause. */ problem->consistent = 0; } if (pos->sz == 1 && neg->sz == 0) { int var = pos->arr[0]; if (problem->variables[var]->pos_filter_clause != NULL) { /* Problem is UNSAT due to arc inconsistency. */ problem->consistent = 0; } if (problem->variables[var]->neg_filter_clause == NULL) { problem->variables[var]->neg_filter_clause = clauses->arr[ix]; queue_push(problem->unit_variables_pos, i2p(var)); problem->unit_variables_pos_map[var] = 1; } } if (neg->sz == 1 && pos->sz == 0) { int var = neg->arr[0]; if (problem->variables[var]->neg_filter_clause != NULL) { /* Problem is UNSAT due to arc inconsistency. */ problem->consistent = 0; } if (problem->variables[var]->pos_filter_clause == NULL) { problem->variables[var]->pos_filter_clause = clauses->arr[ix]; queue_push(problem->unit_variables_neg, i2p(var)); problem->unit_variables_neg_map[var] = 1; } } } return problem; }