您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ testbit函数代码示例

51自学网 2021-06-03 08:46:14
  C++
这篇教程C++ testbit函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中testbit函数的典型用法代码示例。如果您正苦于以下问题:C++ testbit函数的具体用法?C++ testbit怎么用?C++ testbit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了testbit函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: process_ias_button

// ***************** IAS Button and light ******************void process_ias_button(){    if (loaded737 == 1) {         if (multires > 0) {             if (testbit(multibuf, IAS_BUTTON)) {                 if (xpanelsfnbutton == 1) {                     XPLMCommandOnce(x737mcp_spd_changeover);                 }                 if (xpanelsfnbutton == 0) {                     XPLMCommandOnce(x737mcp_lvlchange_toggle);                     lastappos = 1;                 }             }         }         // Always match x737 glareshield LED         switch (XPLMGetDatai(x737mcp_lvlchange_led)) {             case 1:                 btnleds |= (1<<3);                 break;             case 0:                 btnleds &= ~(1<<3);                 break;         }     } else {        if (multires > 0) {          if(testbit(multibuf,IAS_BUTTON)) {            if(xpanelsfnbutton == 1) {                 if (XPLMGetDatai(AirspeedIsMach) == 1) {                     XPLMSetDatai(AirspeedIsMach, 0);                 } else {                     XPLMSetDatai(AirspeedIsMach, 1);                 }             }             if(xpanelsfnbutton == 0) {                 XPLMCommandOnce(ApIasBtn);                 lastappos = 1;             }          }        }        switch(XPLMGetDatai(ApIasStat)){          case 2:            btnleds |= (1<<3);   // * set bit 3 in btnleds to 1 *            break;          case 1:            if (flashon == 1) {              btnleds |= (1<<3);   // * set bit 3 in btnleds to 1 *            }            if (flashon == 0) {              btnleds &= ~(1<<3);   // * clear bit 3 in btnleds to 0 *            }            break;          case 0:            btnleds &= ~(1<<3);   // * clear bit 3 in btnleds to 0 *            break;        }    }}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:61,


示例2: cleartable

/*** clear collected entries from weaktables*/static void cleartable (GCObject *l) {  while (l) {    Table *h = gco2h(l);    int i = h->sizearray;    lua_assert(testbit(h->marked, VALUEWEAKBIT) ||               testbit(h->marked, KEYWEAKBIT));    if (testbit(h->marked, VALUEWEAKBIT)) {      while (i--) {        TValue *o = &h->array[i];        if (iscleared(o, 0))  /* value was collected? */          setnilvalue(o);  /* remove value */      }    }    i = sizenode(h);    while (i--) {      Node *n = gnode(h, i);      if (!ttisnil(gval(n)) &&  /* non-empty entry? */          (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) {        setnilvalue(gval(n));  /* remove value ... */        removeentry(n);  /* remove entry from table */      }    }    l = h->gclist;  }}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:28,


示例3: shm_print_twin_primes

voidshm_print_twin_primes(int *prime, size_t max_bit) {    size_t i;    for(i = 3; i <= max_bit; i += 2)        if(testbit(prime, i) && testbit(prime, (i - 2)))            printf("%zu %zu/n", (i - 2), i);}
开发者ID:BaxterStockman,项目名称:OSU-CS,代码行数:8,


示例4: love

void love(void){    int n;    while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)	continue;    if (wordtype[wordnumber] == NOUNS) {	if ((testbit(location[position].objects, BATHGOD) || testbit(location[position].objects, NORMGOD)) && wordvalue[wordnumber] == NORMGOD) {	    if (loved) {		printf("Loved./n");		return;	    }	    if (godready >= 2) {		puts("She cuddles up to you, and her mouth starts to work:/n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire/ncaptured her just after the Darkness came. My other sister, Vert, was killed/nby the Dark Lord himself. He took her amulet and warped its power./nYour quest was foretold by my father before he died, but to get the Dark Lord's/namulet you must use cunning and skill. I will leave you my amulet,");		puts("which you may use as you wish. As for me, I am the last goddess of the/nwaters. My father was the Island King, and the rule is rightfully mine.'/n/nShe pulls the throne out into a large bed.");		power++;		pleasure += 15;		ego++;		if (card(injuries, NUMOFINJURIES)) {		    puts("Her kisses revive you; your wounds are healed./n");		    for (n = 0; n < NUMOFINJURIES; n++)			injuries[n] = 0;		    WEIGHT = MAXWEIGHT;		    CUMBER = MAXCUMBER;		}		printf("Goddess:/n");		if (!loved)		    setbit(location[position].objects, MEDALION);		loved = 1;		ourtime += 10;		printf("Loved./n");		zzz();		return;	    } else {		puts("You wish!");		return;	    }	}	if (testbit(location[position].objects, wordvalue[wordnumber])) {	    if (wordvalue[wordnumber] == NATIVE) {		puts("The girl peels off her sarong and indulges you.");		power++;		pleasure += 5;		printf("Girl:/n");		ourtime += 10;		printf("Loved./n");		zzz();	    }	    if (wordvalue[wordnumber] == MAN || wordvalue[wordnumber] == BODY || wordvalue[wordnumber] == ELF || wordvalue[wordnumber] == TIMER)		puts("Kinky!");	    else		puts("It doesn't seem to work.");	} else	    puts("Where's your lover?");    } else	puts("It doesn't seem to work.");}
开发者ID:msharov,项目名称:bsd-games,代码行数:57,


示例5: process_hdg_button

// ***************** HDG Button and light *******************void process_hdg_button(){    if (loaded737 == 1) {        if (multires > 0) {            if (testbit(multibuf, HDG_BUTTON)) {                XPLMCommandOnce(x737mcp_hdg_toggle);                lastappos = 1;            }        }        // Always match x737 glareshield LED        switch (XPLMGetDatai(x737mcp_hdg_led)) {            case 1:                btnleds |= (1<<1);                break;            case 0:                btnleds &= ~(1<<1);                break;        }    } else {        if (multires > 0) {          if(testbit(multibuf,HDG_BUTTON)) {            if(xpanelsfnbutton == 1) {                rhdgf = XPLMGetDataf(MHdg);                XPLMSetDataf(ApHdg, rhdgf);            }            if(xpanelsfnbutton == 0) {                XPLMCommandOnce(ApHdgBtn);                lastappos = 1;            }          }        }                switch(XPLMGetDatai(ApHdgStat)){          case 2:            btnleds |= (1<<1);   // * set bit 1 in btnleds to 1 *            break;          case 1:            if (flashon == 1) {              btnleds |= (1<<1);   // * set bit 1 in btnleds to 1 *	    }else{                 btnleds &= ~(1<<1);   // * clear bit 1 in btnleds to 0 *	    }            break;          case 0:            btnleds &= ~(1<<1);   // * clear bit 1 in btnleds to 0 *            break;        }	if (XPLMGetDatai(ApMstrStat) == 0) {          btnleds &= ~(1<<1);   // * clear bit 1 in btnleds to 0 *	}    }}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:56,


示例6: process_rev_button

// ***************** REV Button and light *******************void process_rev_button(){    if (revbuttonremap == 1) {        if (multires > 0) {          if(testbit(multibuf,REV_BUTTON)) {            XPLMCommandOnce(RevButtonRemapableCmd);            lastappos = 1;          }        }	switch(XPLMGetDatai(ApRevStat)){	  case 2:            btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *            break;          case 1:	    if (flashon == 1) {              btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *	    }else{                  btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *	    }            break;          case 0:            btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *            break;	}     } else {        if (multires > 0) {          if(testbit(multibuf,REV_BUTTON)) {            XPLMCommandOnce(ApRevBtn);            lastappos = 1;          }        }        switch(XPLMGetDatai(ApRevStat)){          case 2:            btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *            break;          case 1:            if (flashon == 1) {              btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *            }else{              btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *            }            break;          case 0:            btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *            break;        }    }}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:52,


示例7: process_vs_button

// ***************** VS Button and light *******************void process_vs_button(){    if (loaded737 == 1) {        if (multires > 0) {            if (testbit(multibuf, VS_BUTTON)) {                XPLMCommandOnce(x737mcp_vs_toggle);                lastappos = 1;            }        }        switch (XPLMGetDatai(x737mcp_vvi_led)) {            case 1:                btnleds |= (1<<5);                break;            case 0:                if (XPLMGetDatai(x737mcp_vvi_armed_led)) {                    if (flashon == 0) {                        btnleds |= (1<<5);                    } else {                        btnleds &= ~(1<<5);                    }                } else {                    btnleds &= ~(1<<5);                }                break;        }    } else {        if (multires > 0) {          if(testbit(multibuf,VS_BUTTON)) {            XPLMCommandOnce(ApVsBtn);            lastappos = 1;          }        }	switch(XPLMGetDatai(ApVsStat)){	  case 2:            btnleds |= (1<<5);   // * set bit 5 in btnleds to 1 *            break;          case 1:	    if (flashon == 0) {              btnleds |= (1<<5);   // * set bit 5 in btnleds to 1 *	    }else{                 btnleds &= ~(1<<5);   // * clear bit 5 in btnleds to 0 *	    }            break;          case 0:            btnleds &= ~(1<<5);   // * clear bit 5 in btnleds to 0 *            break;        }    }}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:51,


示例8: process_flaps_switch

// ***************** Flaps Switch *******************void process_flaps_switch(){    if (XPLMGetDatai(BatPwrOn) == 1) {        if (multires > 0) {	  if(testbit(multibuf,FLAPS_UP_SWITCH)) {	    XPLMCommandOnce(FlapsUp);	           }	  if(testbit(multibuf,FLAPS_DN_SWITCH)) {	    XPLMCommandOnce(FlapsDn);	 	  }        }   }}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:15,


示例9: fill_twins_array

intfill_twins_array(unsigned **twin_pairs, int *map, size_t max_bit){    size_t i, j = 0;    for(i = 0; i <= max_bit; i++) {        if(testbit(map, i) && testbit(map, (i - 2))) {            twin_pairs[j] = xmalloc(sizeof(unsigned) * 2);            twin_pairs[j][0] = i - 2;            twin_pairs[j][1] = i;            j++;        }    }    /* Return the number of pairs stored */    return j;}
开发者ID:BaxterStockman,项目名称:OSU-CS,代码行数:15,


示例10: moveF

void moveF(void) {	uint32_t F=M.AWGdesiredF;    uint8_t i=6;	do {    // Find range        if(F>=pgm_read_dword_near(Powersof10+i)) break;    } while(i--);	uint32_t add=pgm_read_dword_near(Powersof10+i-2);	if(testbit(Misc,negative)) F-=add;	else if(testbit(Misc, bigfont)) F+=add;	else {  // Shortcuts		if(i==2) i=7;        F=pgm_read_dword_near(Powersof10+i-1);    }	M.AWGdesiredF = F;}
开发者ID:YutingYou,项目名称:Xproto-Watch-Firmware,代码行数:15,


示例11: process_alt_button

// ***************** ALT Button and light *******************void process_alt_button(){    if (loaded737 == 1) {        if (multires > 0) {            if (testbit(multibuf, ALT_BUTTON)) {                XPLMCommandOnce(x737mcp_alt_toggle);                lastappos = 1;            }        }        // Always match x737 glareshield LED        switch (XPLMGetDatai(x737mcp_alt_led)) {            case 1:                btnleds |= (1<<4);                break;            case 0:                btnleds &= ~(1<<4);                break;        }    } else {        if (multires > 0) {          if(testbit(multibuf,ALT_BUTTON)) {           XPLMCommandOnce(ApAltBtn);           lastappos = 1;          }        }	switch(XPLMGetDatai(ApAltStat)){	  case 2:            btnleds |= (1<<4);   // * set bit 4 in btnleds to 1 *            break;          case 1:	    if (flashon == 1) {              btnleds |= (1<<4);   // * set bit 4 in btnleds to 1 *	    }else{                  btnleds &= ~(1<<4);   // * clear bit 4 in btnleds to 0 *	    }            break;          case 0:            btnleds &= ~(1<<4);   // * clear bit 4 in btnleds to 0 *            break;	} 		if (XPLMGetDatai(ApMstrStat) == 0) {          btnleds &= ~(1<<4);   // * clear bit 4 in btnleds to 0 *	}    }}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:49,


示例12: LcdInstructionWrite

/*-------------------------------------------------------------------------------Send instruction to the LCD	LcdInstructionWrite (uint8_t u8Instruction)		u8Instruction = Instruction to send to the LCDCHSIZE 2 2469-------------------------------------------------------------------------------*/void LcdInstructionWrite (uint8_t u8Instruction) {    clrbit(LCD_CTRL, LCD_CS);			// Select    clrbit(LCD_CTRL,LCD_RS);            // Instruction mode    USARTD0.DATA= u8Instruction;    while(!testbit(USARTD0.STATUS,6));     // Wait until transmit done    setbit(USARTD0.STATUS,6);}
开发者ID:andreiav,项目名称:XScopes-Firmware,代码行数:12,


示例13: while

/* * Happy Thread *  * Parllel happy process with threads. * each thread gets a unique index */static void *happy_thread (void *arg){	struct happy_data *thread = (struct happy_data*) arg;	int local = 1;	int s;	while (local < thread->num) {		s = pthread_mutex_lock(&mutex_avail);		if (s != 0) {			errEXIT("mutex lock");		}		local = happy_ind;		happy_ind++;		s = pthread_mutex_unlock(&mutex_avail);		if (s != 0) {			errEXIT("mutex lock");		}		if (!testbit(thread->bit_pointer, local)) {			if (happy(local)) {				s = pthread_mutex_lock(&mutex_avail);				if (s != 0) {					errEXIT("mutex lock");				}				total_happy++;				s = pthread_mutex_unlock(&mutex_avail);				if (s != 0) {					errEXIT("mutex lock");				}			}		}	}	pthread_exit((void *) 0);}
开发者ID:armiller,项目名称:cs311_happy,代码行数:41,


示例14: luaC_checkfinalizer

/*** if object 'o' has a finalizer, remove it from 'allgc' list (must** search the list to find it) and link it in 'finobj' list.*/void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {	global_State *g = G(L);	if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */		isfinalized(o) ||                           /* ... or is finalized... */		gfasttm(g, mt, TM_GC) == NULL)                /* or has no finalizer? */	return;  /* nothing to be done */	else {  /* move 'o' to 'finobj' list */	GCObject **p;	GCheader *ho = gch(o);	if (g->sweepgc == &ho->next) {  /* avoid removing current sweep object */		lua_assert(issweepphase(g));		g->sweepgc = sweeptolive(L, g->sweepgc, NULL);	}	/* search for pointer pointing to 'o' */	for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }	*p = ho->next;  /* remove 'o' from root list */	ho->next = g->finobj;  /* link it in list 'finobj' */	g->finobj = o;	l_setbit(ho->marked, SEPARATED);  /* mark it as such */	if (!keepinvariantout(g))  /* not keeping invariant? */		makewhite(g, o);  /* "sweep" object */	else		resetoldbit(o);  /* see MOVE OLD rule */	}}
开发者ID:crazii,项目名称:mameplus,代码行数:29,


示例15: deja_evalue

int deja_evalue(int** newtree, int nb, int** list_tree, int nblist, int nblistmax){  int i, ii, j, jj, k, debut, tot, bitdeb;  int eq, opp, ret;  debut=nblist%nblistmax;  if(nblist<nblistmax) tot=nblist; else tot=nblistmax;  for(i=0;i<tot;i++){    ii=debut-i-1;    if(ii<0) ii+=nblistmax;    bitdeb=ii*(nb-3);    for(j=0;j<nb-3;j++){      for(jj=0;jj<nb-3;jj++){        eq=opp=0;        for(k=0;k<nb;k++){	  ret=testbit(list_tree[k], bitdeb+jj+1);	  if(ret && newtree[k][j]) eq=1;	  else if(ret && !newtree[k][j]) opp=1;	  else if(!ret && newtree[k][j]) opp=1;	  else eq=1;	  if(eq && opp) break; /* branches j (newtree) et jj (listed current tree) differentes */        }        if(k==nb) break; /* branches j et jj identiques : passer a j+1 */      }      if(jj==nb-3) break; /* branche j n'a pas d'identique : passer au listed tree suivant */    }    if(j==nb-3) return 1; /* toutes les branches j ont un identique : deja evalue */   }  return 0;}
开发者ID:argriffing,项目名称:nhml3-unofficial,代码行数:32,


示例16: printssdfa

static voidprintssdfa(int xx_nstates, ss_state *xx_state, int nbits,           labellist *ll, char *msg){    int i, ibit, iarc;    ss_state *yy;    ss_arc *zz;    printf("Subset DFA %s/n", msg);    for (i = 0; i < xx_nstates; i++) {        yy = &xx_state[i];        if (yy->ss_deleted)            continue;        printf(" Subset %d", i);        if (yy->ss_finish)            printf(" (finish)");        printf(" { ");        for (ibit = 0; ibit < nbits; ibit++) {            if (testbit(yy->ss_ss, ibit))                printf("%d ", ibit);        }        printf("}/n");        for (iarc = 0; iarc < yy->ss_narcs; iarc++) {            zz = &yy->ss_arc[iarc];            printf("  Arc to state %d, label %s/n",                zz->sa_arrow,                PyGrammar_LabelRepr(                    &ll->ll_label[zz->sa_label]));        }    }}
开发者ID:10sr,项目名称:cpython,代码行数:31,


示例17: shm_print_primes

voidshm_print_primes(int *prime, size_t max_bit) {    size_t i;    printf("%u/n", 2);    for(i = 3; i <= max_bit; i += 2)        if(testbit(prime, i))            printf("%zu/n", i);}
开发者ID:BaxterStockman,项目名称:OSU-CS,代码行数:8,


示例18: process_trim_wheel

// *************** Trim Wheel *********************void process_trim_wheel(){  int i;        if (multires > 0) {	  if(testbit(multibuf,TRIM_WHEEL_UP)) {	    for(i = 0; i < trimspeed; ++i){              XPLMCommandOnce(PitchTrimUp);	    }	  }		  if(testbit(multibuf,TRIM_WHEEL_DN)) {	    for(i = 0; i < trimspeed; ++i){              XPLMCommandOnce(PitchTrimDn);            }	  }	}}
开发者ID:jlaxson,项目名称:Xsaitekpanels,代码行数:18,


示例19: read

// Waits for a character from the serial port for a certain time, // If no character is received, it returns 0static uint8_t read(void) {    uint16_t timeout=25000; // 250 ms    while(!testbit(USARTE0.STATUS,USART_RXCIF_bp)) {        _delay_us(10);        if(--timeout==0) return 0;    }    return USARTE0.DATA;}
开发者ID:theforest,项目名称:Xproto-Watch-Firmware,代码行数:10,


示例20: imap_lookup

/* return orignal bit value */static int imap_lookup(struct super_block *sb, unsigned int ino){	struct block *block;	int r;	block = minix_get_block(sb, INODE_MAP_BLK(ino));	r = testbit(block->b_data, ino & BITS_PER_BLOCK_MASK);	put_block(block);	return r;}
开发者ID:chobits,项目名称:tinyos,代码行数:10,


示例21: printobjs

printobjs(){	register unsigned int *p = location[position].objects;	register n;	printf("/n");	for (n = 0; n < NUMOFOBJECTS; n++)		if (testbit(p, n) && objdes[n])			puts(objdes[n]);}
开发者ID:Kiddinglife,项目名称:4.4BSD-Lite,代码行数:10,


示例22: main

intmain(int argc, char **argv){	char mainbuf[LINELENGTH];	char *next;	/* Open the score file then revoke setgid privileges */	open_score_file();	setgid(getgid());	initialize(argc < 2 || strcmp(argv[1], "-r"));start:	news();	beenthere[position]++;	if (notes[LAUNCHED])		crash();	/* decrements fuel & crash */	if (matchlight) {		puts("Your match splutters out.");		matchlight = 0;	}	if (!notes[CANTSEE] || testbit(inven, LAMPON) ||	    testbit(location[position].objects, LAMPON)) {		writedes();		printobjs();	} else		puts("It's too dark to see anything in here!");	whichway(location[position]);run:	next = getcom(mainbuf, sizeof mainbuf, ">-: ",	    "Please type in something.");	for (wordcount = 0; next && wordcount < 20; wordcount++)		next = getword(next, words[wordcount], -1);	parse();	switch (cypher()) {	case -1:		goto run;	case 0:		goto start;	default:		exit(1); /* Shouldn't happen */	}	return (1);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:43,


示例23: ucard

intucard(const unsigned int *array){	int     j = 0, n;	for (n = 0; n < NUMOFOBJECTS; n++)		if (testbit(array, n))			j++;	return (j);}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:10,


示例24: zzz

intzzz(){    int oldtime;    register int n;    oldtime = Time;    if ((snooze - Time) < (0.75 * CYCLE)) {        Time += 0.75 * CYCLE - (snooze - Time);        printf("<zzz>");        for (n = 0; n < Time - oldtime; n++)            printf(".");        printf("/n");        snooze += 3 * (Time - oldtime);        if (notes[LAUNCHED]) {            fuel -= (Time - oldtime);            if (location[position].down) {                position = location[position].down;                crash();            }            else                notes[LAUNCHED] = 0;        }        if (OUTSIDE && rnd(100) < 50) {            puts("You are awakened abruptly by the sound of someone nearby.");            switch(rnd(4)) {            case 0:                if (ucard(inven)) {                    n = rnd(NUMOFOBJECTS);                    while(!testbit(inven,n))                        n = rnd(NUMOFOBJECTS);                    clearbit(inven,n);                    if (n != AMULET && n != MEDALION && n != TALISMAN)                        setbit(location[position].objects,n);                    carrying -= objwt[n];                    encumber -= objcumber[n];                }                puts("A fiendish little Elf is stealing your treasures!");                fight(ELF,10);                break;            case 1:                setbit(location[position].objects,DEADWOOD);                break;            case 2:                setbit(location[position].objects,HALBERD);                break;            default:                break;            }        }    }    else        return(0);    return(1);}
开发者ID:JamesHagerman,项目名称:retrobsd,代码行数:55,


示例25: printobjs

voidprintobjs(void){	unsigned int *p = location[position].objects;	int     n;	printf("/n");	for (n = 0; n < NUMOFOBJECTS; n++)		if (testbit(p, n) && objdes[n])			puts(objdes[n]);}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:11,


示例26: init_mouse

/**  * Initialize event device for mouse.  */voidinit_mouse ( void ){  	uint8_t evt[EV_MAX / 8 + 1];	/* get capabilities */	ioctl( fd, EVIOCGBIT( 0, sizeof(evt)), evt );	if ( ! ( testbit( EV_KEY, evt ) &&			 testbit( EV_REL, evt ) ) )	{		fprintf( stderr, "'%s' doesn't seem to be a mouse! look in /proc/bus/input/devices to find the name of your mouse's event device/n", device );		exit( 1 );	}	if ( ioctl( fd, EVIOCGRAB, 1 ) )	{		perror( "EVIOCGRAB" );		exit(1);	}}
开发者ID:original-male,项目名称:lsmi,代码行数:24,


示例27: kiss

void kiss (void){    while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)	continue;    // The goddess must be "taken" first if bathing. This will remove her from the bath and move her into the throne room.    if (wordtype[wordnumber] == NOUNS && wordvalue[wordnumber] == NORMGOD && testbit(location[position].objects, BATHGOD)) {	wordvalue[--wordnumber] = TAKE;	cypher();	return;    }    if (wordtype[wordnumber] == NOUNS) {	if (testbit(location[position].objects, wordvalue[wordnumber])) {	    pleasure++;	    printf("Kissed./n");	    switch (wordvalue[wordnumber]) {		case NORMGOD:		    switch (godready++) {			case 0: puts("She squirms and avoids your advances."); break;			case 1: puts("She is coming around; she didn't fight it as much."); break;			case 2: puts("She's beginning to like it."); break;			default: puts("She's gone limp."); break;		    }		    break;		case NATIVE:		    puts("Her lips are warm and her body robust. She pulls you down to the ground.");		    break;		case TIMER:		    puts("The old man blushes.");		    break;		case MAN:		    puts("The dwarf punches you in the kneecap.");		    break;		default:		    pleasure--;	    }	} else	    puts("I see nothing like that here.");    } else	puts("I'd prefer not to.");}
开发者ID:msharov,项目名称:bsd-games,代码行数:40,


示例28: print_bits

voidprint_bits(int *map, size_t max_bit){    size_t i, j;    for(i = 0, j = 0; i < max_bit; i++, j++) {        if(j == 78) {            //putchar('/n');            j = 0;        }        printf("%zu, %c/n", i, (testbit(map, i) == 1 ? '1' : '0'));    }    //putchar('/n');}
开发者ID:BaxterStockman,项目名称:OSU-CS,代码行数:13,


示例29: use

intuse(void){	while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount)		; /* nothing */	if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&	    position != FINAL) {		puts("The amulet begins to glow.");		if (testbit(inven, MEDALION)) {			puts("The medallion comes to life too.");			if (position == 114) {				location[position].down = 160;				whichway(location[position]);				puts("The waves subside and it is possible to descend to the sea cave now.");				gtime++;				return (-1);			}		}		puts("A light mist falls over your eyes and the sound of purling water trickles in");		puts("your ears.   When the mist lifts you are standing beside a cool stream.");		if (position == 229)			position = 224;		else			position = 229;		gtime++;		notes[CANTSEE] = 0;		return(0);	} else if (position == FINAL)		puts("The amulet won't work in here.");	else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))		printf("Your compass points %s./n", truedirec(NORTH, '-'));	else if (wordvalue[wordnumber] == COMPASS)		puts("You aren't holding the compass.");	else if (wordvalue[wordnumber] == AMULET)		puts("You aren't holding the amulet.");	else		puts("There is no apparent use.");	return (-1);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:39,



注:本文中的testbit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ testcase函数代码示例
C++ test_waitsig函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。