/*buddy_alloc_pages - alloc n page from free area and return the first page. * The header page should set page property flag, and the * property field should assign to n which means next * follow n pages has been allocated. */ struct Page* buddy_alloc_pages(size_t n){ assert(n > 0); if(n > nr_free){ return NULL; } struct Page* page = NULL; uint8_t o = get_ord(n * MIN_BLOCK); uint32_t i = 0; while(1){ if( lft(mem[i]) >= o ) i = lc(i); else if( rht(mem[i]) >= o ) i = rc(i); else break; } if( o == ord(mem[i]) ){ set_rht(mem[i], 0); set_lft(mem[i], 0); page = buddy2page(mem[i], i); assert(!PageReserved(page)); SetPageProperty(page); nr_free -= page->property = 1 << (ord(mem[i]) - 2); update(i); } return page; }
int GACPforORGSolverGene::getExp( ) { unsigned i; unsigned nr = theGroup.numberOfGenerators( ); Word w1 = theWord1; Word w2 = theWord2; Word rel = theGroup.relator( ); int *e = new int[nr]; int *er = new int[nr]; for( i=0 ; i<nr ; ++i ) er[i] = e[i] = 0; for( i=0 ; i<w1.length( ) ; ++i ) { int g = ord( w1[i] ); e[ abs(g)-1 ] -= g/abs(g); } for( i=0 ; i<w2.length( ) ; ++i ) { int g = ord( w2[i] ); e[ abs(g)-1 ] += g/abs(g); } for( i=0 ; i<rel.length( ) ; ++i ) { int g = ord( rel[i] ); er[ abs(g)-1 ] += g/abs(g); } int res = ANY; for( i=0 ; i<nr ; ++i ) if( er[i]!=0 ) { res = e[i]/er[i]; break; } for( i=0 ; i<nr ; ++i ) if( res*er[i]!=e[i] ) { res = NOONE; break; } delete []e; delete []er; return res; }
/* * Save an array subscript - returns true if matching bracket found, false * if eof or newline was found. * (Returned string double null terminated) */ static bool arraysub(char **strp) { XString ws; char *wp, c; /* we are just past the initial [ */ unsigned int depth = 1; Xinit(ws, wp, 32, ATEMP); do { c = getsc(); Xcheck(ws, wp); *wp++ = c; if (ord(c) == ord('[')) depth++; else if (ord(c) == ord(']')) depth--; } while (depth > 0 && c && c != '\n'); *wp++ = '\0'; *strp = Xclose(ws, wp); return (tobool(depth == 0)); }
Word Map::imageOf( const Generator& g ) const { if (ord(g) < 0) return generatingImages(-ord(g) - 1).inverse(); else return generatingImages(ord(g) - 1); }
int main(int argc, char **argv) { CellMap ref_des_lst; char *ref_des_fname; char *ref_des; CellMap cust_pn_lst; char *cust_fname; char *cust_pn; CellMap mcg_pn_lst; char *mcg_fname; char *mcg_pn; const char *prgname; int i; int max; FILE *refdes; int arg_list = 9; prgname = esetprogname("ref2mcg"); if (argc < arg_list) eprintf("too few arguments\n%s", usage()); else if (argc > arg_list) eprintf("too many arguments\n%s", usage()); ref_des_fname = argv[1]; ref_des_col = ord(*argv[2]); cust_fname = argv[3]; cust_pn_col = ord(*argv[4]); cust_ref_des_col= ord(*argv[5]); mcg_fname = argv[6]; mcg_pn_col = ord(*argv[7]); mcg_cust_pn_col = ord(*argv[8]); csv_get_col(&ref_des_lst, ref_des_fname, -1, ref_des_col); csv_get_col(&cust_pn_lst, cust_fname, cust_ref_des_col, cust_pn_col); csv_get_col(&mcg_pn_lst, mcg_fname, mcg_cust_pn_col, mcg_pn_col); max = ref_des_lst.ncells; refdes = fopen(ref_des_fname, "rb"); for (i = 0; i < max; i++) { ref_des = ref_des_lst.cells[i].return_field; cust_pn = find_pn(ref_des, &cust_pn_lst); mcg_pn = find_pn(cust_pn, &mcg_pn_lst); print_result(refdes, ref_des, cust_pn, mcg_pn); } fclose(refdes); free_cellmap(&ref_des_lst); free_cellmap(&cust_pn_lst); free_cellmap(&mcg_pn_lst); free((void *)prgname); return 0; }
inline void fifo_exchange_order_book::add_order(const ats::limit_order& order) { if (order.side() == ats::order_side::Buy || order.side() == ats::order_side::BuyCover) { if (book_.best_ask() != nullptr && order.price() >= book_.best_ask()->price) { ats::order_status_filled_message msg(order.id(), order.transact_time, book_.best_ask()->price, order.quantity()); order_status_listener_(msg); } else { const auto* true_l = book_.bid_at(order.price()); const ats::sim::price_level* l = sim_book_.get_level(order.price(), true); if (true_l == nullptr && !book_.bids().empty() && order.price() <= book_.best_bid()->price && order.price() >= book_.bids().crbegin()->first) sim_book_.insert_order(order); else { if (true_l != nullptr && (l == nullptr || !l->is_defined())) { ats::limit_order ord(0, order.symbol(), true_l->quantity, order.side(), ats::order_time_in_force::GTC, order.price()); sim_book_.insert_order(ord); } sim_book_.add_order(order); } } } else { if (book_.best_bid() != nullptr && order.price() <= book_.best_bid()->price) { ats::order_status_filled_message msg(order.id(), order.transact_time, book_.best_bid()->price, order.quantity()); order_status_listener_(msg); } else { const auto* true_l = book_.ask_at(order.price()); const ats::sim::price_level* l = sim_book_.get_level(order.price(), false); if (true_l == nullptr && !book_.asks().empty() && order.price() >= book_.best_ask()->price && order.price() <= book_.asks().crbegin()->first) sim_book_.insert_order(order); else { if (true_l != nullptr && (l == nullptr || !l->is_defined())) { ats::limit_order ord(0, order.symbol(), true_l->quantity, order.side(), ats::order_time_in_force::GTC, order.price()); sim_book_.insert_order(ord); } sim_book_.add_order(order); } } } }
/*buddy_free_pages - Free continous pages start with page.The header page's property flag should be unset, and the property field should assign to zero. */ void buddy_free_pages(struct Page* page){ assert(!PageReserved(page) && PageProperty(page)); uint32_t i = page2buddy(page, get_ord(page->property * MIN_BLOCK)); set_rht(mem[i], ord(mem[i])-1); set_lft(mem[i], ord(mem[i])-1); update(i); nr_free += page->property; ClearPageProperty(page); page->property = 0; }
/* * Return a pointer to the first char past a legal variable name * (returns the argument if there is no legal name, returns a pointer to * the terminating NUL if whole string is legal). */ const char * skip_varname(const char *s, bool aok) { size_t alen; if (s && ctype(*s, C_ALPHX)) { do { ++s; } while (ctype(*s, C_ALNUX)); if (aok && ord(*s) == ord('[') && (alen = array_ref_len(s))) s += alen; } return (s); }
void InsertTrie(TrieTree *T,Record *r) { /* 初始条件: Trie键树T存在,r为待插入的数据元素的指针 */ /* 操作结果: 若T中不存在其关键字等于(*r).key.ch的数据元素, */ /* 则按关键字顺序插r到T中 */ TrieTree p,q,ap; int i=0,j; KeysType K1,K=r->key; if(!*T) /* 空树 */ { *T=(TrieTree)malloc(sizeof(TrieNode)); (*T)->kind=BRANCH; for(i=0;i<LENGTH;i++) /* 指针量赋初值NULL */ (*T)->a.bh.ptr[i]=NULL; p=(*T)->a.bh.ptr[ord(K.ch[0])]=(TrieTree)malloc(sizeof(TrieNode)); p->kind=LEAF; p->a.lf.K=K; p->a.lf.infoptr=r; } else /* 非空树 */ { for(p=*T,i=0;p&&p->kind==BRANCH&&i<K.num;++i) { q=p; p=p->a.bh.ptr[ord(K.ch[i])]; } i--; if(p&&p->kind==LEAF&&p->a.lf.K.num==K.num&&EQ(p->a.lf.K.ch,K.ch)) /* T中存在该关键字 */ return; else /* T中不存在该关键字,插入之 */ { if(!p) /* 分支空 */ { p=q->a.bh.ptr[ord(K.ch[i])]=(TrieTree)malloc(sizeof(TrieNode)); p->kind=LEAF; p->a.lf.K=K; p->a.lf.infoptr=r; } else if(p->kind==LEAF) /* 有不完全相同的叶子 */ { K1=p->a.lf.K; do { ap=q->a.bh.ptr[ord(K.ch[i])]=(TrieTree)malloc(sizeof(TrieNode)); ap->kind=BRANCH; for(j=0;j<LENGTH;j++) /* 指针量赋初值NULL */ ap->a.bh.ptr[j]=NULL; q=ap; i++; }while(ord(K.ch[i])==ord(K1.ch[i])); q->a.bh.ptr[ord(K1.ch[i])]=p; p=q->a.bh.ptr[ord(K.ch[i])]=(TrieTree)malloc(sizeof(TrieNode)); p->kind=LEAF; p->a.lf.K=K; p->a.lf.infoptr=r; } } } }
bool BME280::ReadTrim() { uint8_t ord(0); bool success = true; // Temp. Dig success &= ReadRegister(TEMP_DIG_ADDR, &m_dig[ord], TEMP_DIG_LENGTH); ord += TEMP_DIG_LENGTH; // Pressure Dig success &= ReadRegister(PRESS_DIG_ADDR, &m_dig[ord], PRESS_DIG_LENGTH); ord += PRESS_DIG_LENGTH; // Humidity Dig 1 success &= ReadRegister(HUM_DIG_ADDR1, &m_dig[ord], HUM_DIG_ADDR1_LENGTH); ord += HUM_DIG_ADDR1_LENGTH; // Humidity Dig 2 success &= ReadRegister(HUM_DIG_ADDR2, &m_dig[ord], HUM_DIG_ADDR2_LENGTH); ord += HUM_DIG_ADDR2_LENGTH; #ifdef DEBUG_ON Serial.print("Dig: "); for(int i = 0; i < 32; ++i) { Serial.print(m_dig[i], HEX); Serial.print(" "); } Serial.println(); #endif return success && ord == DIG_LENGTH; }
int main(int ac, char *av) { if (ac == 2) ord(av[1]); puts('\n'); return (0); }
sys_shlfunc() #define sys_shl sys_shlfunc() {register int st,i,v ; st=cre(1); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); while( len_str(st)==0 ){ fprintf ( bstdout, "\n"); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); } while( fst_str(st)!=ord('0') ){ itr_str(st,i,v,cstr_shl[i-1]=chr(v)); cstr_shl[len_str(st)]='\0'; fprintf ( bstdout, "\n"); system(cstr_shl); fprintf ( bstdout, "\n"); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); while( len_str(st)==0 ){ fprintf ( bstdout, "\n"); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); } } }
void LLSideTrayListener::getPanels(const LLSD& event) const { LLSD reply; LLSideTray* tray = mGetter(); // Iterate through the attached tabs. LLSD::Integer ord(0); for (LLSideTray::child_vector_t::const_iterator ati(tray->mTabs.begin()), atend(tray->mTabs.end()); ati != atend; ++ati) { // We don't have access to LLSideTrayTab: the class definition is // hidden in llsidetray.cpp. But as LLSideTrayTab isa LLPanel, use the // LLPanel API. Unfortunately, without the LLSideTrayTab definition, // the compiler doesn't even know this LLSideTrayTab* is an LLPanel*. // Persuade it. LLPanel* tab(tab_cast<LLPanel*>(*ati)); reply[tab->getName()] = getTabInfo(tab).with("attached", true).with("ord", ord); } // Now iterate over the detached tabs. These can also be opened via // SideTray.ShowPanel. ord = 0; for (LLSideTray::child_vector_t::const_iterator dti(tray->mDetachedTabs.begin()), dtend(tray->mDetachedTabs.end()); dti != dtend; ++dti) { LLPanel* tab(tab_cast<LLPanel*>(*dti)); reply[tab->getName()] = getTabInfo(tab).with("attached", false).with("ord", ord); } sendReply(reply, event); }
int trie_word_exists(const char* s, const trie* t) { unsigned char x; if(*s == '\0') return t->present; x = ord(*s); if(t->children[x] == NULL) return 0; return trie_word_exists(s + 1, t->children[x]); }
void LLSideTrayListener::getTabs(const LLSD& event) const { LLSD reply; LLSideTray* tray = mGetter(); LLSD::Integer ord(0); for (LLSideTray::child_list_const_iter_t chi(tray->beginChild()), chend(tray->endChild()); chi != chend; ++chi, ++ord) { LLView* child = *chi; // How much info is important? Toss in as much as seems reasonable for // each tab. But to me, at least for the moment, the most important // item is the tab name. LLSD info; // I like the idea of returning a map keyed by tab name. But as // compared to an array of maps, that loses sequence information. // Address that by indicating the original order in each map entry. info["ord"] = ord; info["visible"] = bool(child->getVisible()); info["enabled"] = bool(child->getEnabled()); info["available"] = child->isAvailable(); reply[child->getName()] = info; } sendReply(reply, event); }
/* * Used to calculate an array index for global()/local(). Sets *arrayp * to true if this is an array, sets *valp to the array index, returns * the basename of the array. May only be called from global()/local() * and must be their first callee. */ static const char * array_index_calc(const char *n, bool *arrayp, uint32_t *valp) { const char *p; size_t len; char *ap = NULL; *arrayp = false; redo_from_ref: p = skip_varname(n, false); if (innermost_refflag == SRF_NOP && (p != n) && ctype(n[0], C_ALPHX)) { struct tbl *vp; char *vn; strndupx(vn, n, p - n, ATEMP); /* check if this is a reference */ varsearch(e->loc, &vp, vn, hash(vn)); afree(vn, ATEMP); if (vp && (vp->flag & (DEFINED | ASSOC | ARRAY)) == (DEFINED | ASSOC)) { char *cp; /* gotcha! */ cp = shf_smprintf(Tf_ss, str_val(vp), p); afree(ap, ATEMP); n = ap = cp; goto redo_from_ref; } } innermost_refflag = SRF_NOP; if (p != n && ord(*p) == ord('[') && (len = array_ref_len(p))) { char *sub, *tmp; mksh_ari_t rval; /* calculate the value of the subscript */ *arrayp = true; strndupx(tmp, p + 1, len - 2, ATEMP); sub = substitute(tmp, 0); afree(tmp, ATEMP); strndupx(n, n, p - n, ATEMP); evaluate(sub, &rval, KSH_UNWIND_ERROR, true); *valp = (uint32_t)rval; afree(sub, ATEMP); } return (n); }
AbelianGroup MalcevSet::mapToQuotient(int k) const { if( ! isBasis ) error("MalcevSet::mapToQuotient: the set must be full"); // The generators of the quotient are basic commutators of weight k. const BasicCommutators& bc = theCollector.commutators(); int numGen = bc.numberOfWeight(k); int firstGen = bc.theFirstOfWeight(k) - 1; // The relators are Malcev basis words of weight k SetOf<Word> relsForAbelian; QuickAssociationsIterator< Generator, PolyWord > iter(theSet); for( ; ! iter.done(); iter.next() ) { // take a word from Malcev basis PolyWord pw = iter.value(); Letter first = pw.firstLetter(); if( ord(first.gen) != firstGen ) continue; //Ok, this is a word from the quotient. Abelianize it. ConstPolyWordIterator iter( pw ); Word w; for(iter.startFromLeft(); ! iter.done(); iter.stepRight() ) { Letter s = iter.thisLetter(); int newgen = ord(s.gen) - firstGen; if( newgen > numGen ) break; s.gen = Generator( newgen ); w *= Word(s); } relsForAbelian.adjoinElement(w); } // make the abelian quotient AbelianGroup abel( FPGroup(numGen, relsForAbelian) ); abel.computeCyclicDecomposition(); return abel; }
void Instantiator::ground(Grounder *g) { typedef std::vector<bool> BoolVec; assert(indices_.size() > 0); int numNew = 0; for(IndexPtrVec::size_type i = 0; i < indices_.size(); ++i) { new_[i] = 2 * indices_[i].hasNew(); if(new_[i]) ++numNew; } BoolVec ord(new_.size(), true); int l = 0; std::pair<bool, bool> matched(true, false); while(l >= 0) { if(matched.first) matched = indices_[l].firstMatch(g, l); else matched = indices_[l].nextMatch(g, l); if(matched.first && !matched.second && new_[l] == 2) { new_[l] = 1; --numNew; } assert(ord[l] || !matched.second); if(!matched.second) ord[l] = false; if(matched.first && numNew > 0) { if(l + 1 == static_cast<int>(indices_.size())) { if(!groundable_->grounded(g)) break; matched.first = false; } else ++l; } else { ord[l] = true; matched.first = false; if(new_[l] == 1) { ++numNew; new_[l] = 2; } --l; } } foreach(uint32_t var, groundable_->vars()) g->unbind(var); foreach(Index &idx, indices_) idx.finish(); }
Record *SearchTrie(TrieTree T,KeysType K) { /* 在键树T中查找关键字等于K的记录。算法9.16 */ TrieTree p; int i; for(p=T,i=0;p&&p->kind==BRANCH&&i<K.num;p=p->a.bh.ptr[ord(K.ch[i])],++i); /* 对K的每个字符逐个查找,*p为分支结点,ord()求字符在字母表中序号 */ if(p&&p->kind==LEAF&&p->a.lf.K.num==K.num&&EQ(p->a.lf.K.ch,K.ch)) /* 查找成功 */ return p->a.lf.infoptr; else /* 查找不成功 */ return NULL; }
void trie_word_insert(const char* s, trie* t) { unsigned char x; if(*s == '\0') { t->present = 1; return; } x = ord(*s); if(t->children[x] == NULL) t->children[x] = create(); trie_word_insert(s + 1, t->children[x]); }
bool CheckPEHeaders::parseResponse(QPointer<RpcData> rd) { if (!ICommand::parseResponse(rd)) return false; try { rpc::CheckPEHeadersResult result; if (!hlp::protobuf::parseBigMessage(result, rd->response->rpc_result())) { msg("%s: rpc::CheckPEHeadersResult::ParseFromString() failed\n", __FUNCTION__); return false; } peValid = result.pe_valid(); if (peValid) { const auto& exps = result.exps(); for (auto it = exps.begin(), end = exps.end(); it != end; ++it) { ExportItem item = { it->ea(), it->ord(), it->name() }; exports.append(item); } const auto& sects = result.sections(); for (auto it = sects.begin(), end = sects.end(); it != end; ++it) { Section s = { it->name(), it->va(), it->v_size(), it->raw(), it->raw_size(), it->characteristics() }; sections.append(s); } } return true; } catch (std::runtime_error e) { msg("%s: Runtime error: %s\n", __FUNCTION__, e.what()); } catch (...) { msg("%s: Unable to parse CheckPEHeadersRequest response\n", __FUNCTION__); } return false; }
/* Return a pointer to the first character past any legal variable name */ const char * skip_wdvarname(const char *s, /* skip array de-reference? */ bool aok) { if (s[0] == CHAR && ctype(s[1], C_ALPHX)) { do { s += 2; } while (s[0] == CHAR && ctype(s[1], C_ALNUX)); if (aok && s[0] == CHAR && ord(s[1]) == ord('[')) { /* skip possible array de-reference */ const char *p = s; char c; int depth = 0; while (/* CONSTCOND */ 1) { if (p[0] != CHAR) break; c = p[1]; p += 2; if (ord(c) == ord('[')) depth++; else if (ord(c) == ord(']') && --depth == 0) { s = p; break; } } } } return (s); }
/* an alternative comparison function */ int cmprStrgs(String s1, String s2) { const char *p1 = s1; const char *p2 = s2; const char *mrk1, *mrk2; while ((tolower(*p1) == tolower(*p2)) && *p1) { p1++; p2++; } if (isdigit(*p1) && isdigit(*p2)) { long v1, v2; if ((*p1 == '0') ||(*p2 == '0')) { while (p1 > s1) { p1--; p2--; if (*p1 != '0') break; } if (!isdigit(*p1)) { p1++; p2++; } } mrk1 = p1; mrk2 = p2; v1 = 0; while(isdigit(*p1)) { v1 = 10*v1+ord(*p1); p1++; } v2 = 0; while(isdigit(*p2)) { v2 = 10*v2+ord(*p2); p2++; } if (v1 == v2) return(p2-mrk2)-(p1-mrk1); return v1 - v2; } if (tolower(*p1) != tolower(*p2)) return (tolower(*p1) - tolower(*p2)); for(p1=s1, p2=s2; (*p1 == *p2) && *p1; p1++, p2++); return (*p1 -*p2); }
void NilpotentGroupRep::mapToClass( PolyWord& pw, int theClass ) const { if( theClass >= nilpotencyClass() ) return; PolyWordIterator iter(pw); for( iter.startFromLeft(); ! iter.done(); ) { if( commutators().weightOf( ord( iter.thisLetter().gen ) ) > theClass ) iter.removeThisLetter(); else iter.stepRight(); } pw.freelyReduce(); }
static void Distribute(SLCell r[],int i,ArrType f,ArrType e) // 算法10.15 { // 静态键表L的r域中记录已按(keys[0],…,keys[i-1])有序。本算法按 // 第i个关键字keys[i]建立RADIX个子表,使同一子表中记录的keys[i]相同。 // f[0..RADIX-1]和e[0..RADIX-1]分别指向各子表中第一个和最后一个记录 int j,p; for(j=0;j<RADIX;++j) f[j]=0; // 各子表初始化为空表 for(p=r[0].next;p;p=r[p].next) { j=ord(r[p].keys[i]); // ord将记录中第i个关键字映射到[0..RADIX-1] if(!f[j]) f[j]=p; else r[e[j]].next=p; e[j]=p; // 将p所指的结点插入第j个子表中 } }
void Distribute(SLCell r[],int i,ArrType f,ArrType e) /* 算法10.15 */ { /* 静态键表L的r域中记录已按(keys[0],...,keys[i-1])有序。本算法按 */ /* 第i个关键字keys[i]建立RADIX个子表,使同一子表中记录的keys[i]相同。 */ /* f[0..RADIX-1]和e[0..RADIX-1]分别指向各子表中第一个和最后一个记录 */ int j,p; for(j=0;j<RADIX;++j) f[j]=0; /* 各子表初始化为空表 */ for(p=r[0].next;p;p=r[p].next) { j=ord(r[p].keys[i]); /* ord将记录中第i个关键字映射到[0..RADIX-1] */ if(!f[j]) f[j]=p; else r[e[j]].next=p; e[j]=p; /* 将p所指的结点插入第j个子表中 */ } }
/* If no solution, check: 1. ret.size() < 3 * Or more precisely, 2. interPnt(ret[0], ret[1]) * in all the lines. (use (l.S - l.F).cross(p - l.F) > 0 */ vector<Line> halfPlaneInter(vector<Line> lines) { int sz = lines.size(); vector<double> ata(sz), ord(sz); for (int i=0; i<sz; i++) { ord[i] = i; pdd d = lines[i].S - lines[i].F; ata[i] = atan2(d.y, d.x); } sort(ALL(ord), [&](int i, int j) { if (abs(ata[i] - ata[j]) < EPS) { return cross(lines[i].S, lines[j].S, lines[i].F) < 0; } return ata[i] < ata[j]; }); vector<Line> fin; for (int i=0; i<sz; i++) { if (!i or fabs(ata[ord[i]] - ata[ord[i-1]]) > EPS) { fin.PB(lines[ord[i]]); } } deque<Line> dq; for (int i=0; i<SZ(fin); i++) { while(SZ(dq) >= 2 and not isin(fin[i], dq[SZ(dq)-2], dq[SZ(dq)-1])) { dq.pop_back(); } while(SZ(dq) >= 2 and not isin(fin[i], dq[0], dq[1])) { dq.pop_front(); } dq.push_back(fin[i]); } while (SZ(dq) >= 3 and not isin(dq[0], dq[SZ(dq)-2], dq[SZ(dq)-1])) { dq.pop_back(); } while (SZ(dq) >= 3 and not isin(dq[SZ(dq)-1], dq[0], dq[1])) { dq.pop_front(); } vector<Line> res(ALL(dq)); return res; }
AbelianWordRep::AbelianWordRep( int numOfGens, const Word& w ) : thePowers( numOfGens ) { int wLen = w.length(); for( int i = 0; i < numOfGens; ++i ) thePowers[i] = 0; for( int i = 0; i < wLen; ++i ) { int gen; if( ( gen = ord(w[i]) ) > 0 ) thePowers[gen-1] += Integer(1); else thePowers[-gen-1] -= Integer(1); } }
bool BME280I2C::ReadRegister ( uint8_t addr, uint8_t data[], uint8_t length ) { uint8_t ord(0); Wire.beginTransmission(m_bme_280_addr); Wire.write(addr); Wire.endTransmission(); Wire.requestFrom(m_bme_280_addr, length); while(Wire.available()) { data[ord++] = Wire.read(); } return ord == length; }
void zprintscaled ( integer s ) { integer delta ; if ( s < 0 ) { putc ( '-' , stdout ); s = - (integer) s ; } fprintf ( stdout , "%ld", (long)s / 65536L ) ; s = 10 * ( s % 65536L ) + 5 ; if ( s != 5 ) { delta = 10 ; putc ( '.' , stdout ); do { if ( delta > 65536L ) s = s + 32768L - ( delta / 2 ) ; putc ( xchr [ord ( '0' ) + ( s / 65536L ) ], stdout ); s = 10 * ( s % 65536L ) ; delta = delta * 10 ; } while ( ! ( s <= delta ) ) ; } }