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

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

51自学网 2021-06-01 20:41:31
  C++
这篇教程C++ FLAG函数代码示例写得很实用,希望能帮到您。

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

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

示例1: bst_add

bool_t bst_add(bst_key_t k, node_t* root, int id){	//fprintf(stderr, "bst add/n");	// node_t* pred;	// node_t* curr;	node_t* new_node;	// operation_t* pred_op;	// operation_t* curr_op;	operation_t* cas_op;	// search_res_t result;	bst_search_result_t* my_result;	while(TRUE) {		//root is now a global pointer to a node, not a node		my_result = bst_find(k, /*&pred, &pred_op, &curr, &curr_op, */root, root, id);		if (my_result->result == FOUND) {			return FALSE;		}		// allocate memory 		// new_node = new Node(k);		new_node = (node_t*) ssalloc(sizeof(node_t));		new_node->key = k;		new_node->op = NULL;		new_node->left = NULL;		new_node->right = NULL;		// fprintf(stderr, "new_node address: %p, 64bit aligned: %d key address %p, left node addr: %p, right node addr: %p, op addr: %p/n", new_node, ((unsigned long)new_node & 7) == 0,&(new_node->key), &(new_node->left), &(new_node->right), &(new_node->op)	 // );		bool_t is_left = (my_result->result == NOT_FOUND_L);		node_t* old;		if (is_left) {			old = my_result->curr->left;		} else {			old = my_result->curr->right;		}		// allocate memory		//cas_op = new child_cas_op_t(is_left, old, new_node)		cas_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t));		cas_op->child_cas_op.is_left = is_left;		cas_op->child_cas_op.expected = old;		cas_op->child_cas_op.update = new_node;		// fprintf(stderr, "cas_op address: %p, is_left address: %p, expected addr: %p, update addr: %p/n", (unsigned long)cas_op, &(cas_op->child_cas_op.is_left), &(cas_op->child_cas_op.expected), &(cas_op->child_cas_op.update)	 // );		if (CAS_PTR(&(my_result->curr->op), my_result->curr_op, FLAG(cas_op, STATE_OP_CHILDCAS)) == my_result->curr_op) {			// legit cast? YES!! verif			bst_help_child_cas(cas_op, my_result->curr/*, root*/);			return TRUE;		}	}}
开发者ID:LPD-EPFL,项目名称:ASCYLIB,代码行数:53,


示例2: check_dirent

static void		check_dirent(struct dirent *ent, t_array *dirs, t_file *file,	t_args *args){	t_file			*tmp;	if (args->args_count < 2)		args->args_count = 2;	if (FLAG(FLAG_RR) && ent->d_type == DT_DIR && !ft_strequ(file->real, ".") &&		!ft_strequ(file->real, "..") && (!FLAG(FLAG_L) ||			(file->stats->st_mode & S_IFMT) != S_IFLNK))	{		tmp = MAL1(t_file);		tmp->name = ft_stringdup(file->name);		tmp->path = ft_stringdup(file->path);		tmp->dir = NULL;		tmp->real = ent->d_name;		tmp->err = 0;		tmp->stats = MAL1(struct stat);		ft_memmove(tmp->stats, file->stats, sizeof(struct stat));		ft_arrayadd(dirs, tmp);	}
开发者ID:Julow,项目名称:ft_ls,代码行数:21,


示例3: mm_init

/* * Initialize: return -1 on error, 0 on success. */int mm_init(void) {    /* Create the initial empty heap */    if ((heap_listp = mem_sbrk(WSIZE + SEG_LEVLL * DSIZE)) == (void *)-1)         return -1;    flist_tbl = heap_listp;    init_free_list();    int table_off = 2 * SEG_LEVLL * WSIZE;    PUT(heap_listp + table_off, PACK(4, 1));     /* Prologue header */     PUT(heap_listp + table_off + 4, PACK(0, 1));     /* Epilogue header */    FLAG(heap_listp + table_off);    FLAG(heap_listp + table_off + 4);                /* set the alloc FLAG in next block */    heap_listp += table_off + 4;    /* Extend the empty heap with a free block of CHUNKSIZE bytes */    char *freeb = extend_heap(CHUNKSIZE/WSIZE);    if (freeb == NULL) {            return -1;    }    return 0;}
开发者ID:cmxcn,项目名称:CSAPP_labs,代码行数:24,


示例4: main

int main(int argc, char **argv){  int flag_all = 0;  int flag_debug = 0;  char *input_file = "";  char *log_level = "";  int i;  program = argv[0];  parse_options(&argc, &argv, OPTIONS(    FLAG('a', "all", flag_all, 1),    FLAG('d', "debug", flag_debug, 1),    PARAMETER('i', "input-file", input_file),    PARAMETER_DEFAULT('l', "log-level", log_level, "error"),    FLAG_CALLBACK('h', "help", help),    FLAG_CALLBACK('v', 0, verbose)  ));  for (i = 0; i <= argc; ++i) {    if (argv[i])      printf("argv[%d] = /"%s/";/n", i, argv[i]);    else      printf("argv[%d] = 0;/n", i);  }  printf(    "      All: %s/n"    "    Debug: %s/n"    "Verbosity: %d/n"    "    Input: '%s'/n"    "Log Level: '%s'/n",    ON(flag_all),    ON(flag_debug),    verbosity,    input_file,    log_level  );  return 0;}
开发者ID:kext,项目名称:liboptions,代码行数:40,


示例5: bst_help_relocate

bool_t bst_help_relocate(operation_t* op, node_t* pred, operation_t* pred_op, node_t* curr/*, node_t* root*/){	//fprintf(stderr, "bst help relocate/n");	int seen_state = op->relocate_op.state;	if (seen_state == STATE_OP_ONGOING) {		//VCAS in original implementation		operation_t* seen_op = CAS_PTR(&(op->relocate_op.dest->op), op->relocate_op.dest_op, FLAG(op, STATE_OP_RELOCATE));		if ((seen_op == op->relocate_op.dest_op) || (seen_op == (operation_t *)FLAG(op, STATE_OP_RELOCATE))){			CAS_PTR(&(op->relocate_op.state), STATE_OP_ONGOING, STATE_OP_SUCCESSFUL);			seen_state = STATE_OP_SUCCESSFUL;		} else {			// VCAS			seen_state = CAS_PTR(&(op->relocate_op.state), STATE_OP_ONGOING, STATE_OP_FAILED);		}	}	if (seen_state == STATE_OP_SUCCESSFUL) {		// TODO not clear in the paper code		CAS_PTR(&(op->relocate_op.dest->key), op->relocate_op.remove_key, op->relocate_op.replace_key);		CAS_PTR(&(op->relocate_op.dest->op), FLAG(op, STATE_OP_RELOCATE), FLAG(op, STATE_OP_NONE));	}	bool_t result = (seen_state == STATE_OP_SUCCESSFUL);	if (op->relocate_op.dest == curr) {		return result;	}	CAS_PTR(&(curr->op), FLAG(op, STATE_OP_RELOCATE), FLAG(op, result ? STATE_OP_MARK : STATE_OP_NONE));	if (result) {		if (op->relocate_op.dest == pred) {			pred_op = (operation_t *)FLAG(op, STATE_OP_NONE);		}		bst_help_marked(pred, pred_op, curr/*, root*/);	}	return result;}
开发者ID:LPD-EPFL,项目名称:ASCYLIB,代码行数:35,


示例6: strcpy

static char *cr4_str(u32_t e){	static char str[80];	strcpy(str, "");	FLAG(I386_CR4_VME);	FLAG(I386_CR4_PVI);	FLAG(I386_CR4_TSD);	FLAG(I386_CR4_DE);	FLAG(I386_CR4_PSE);	FLAG(I386_CR4_PAE);	FLAG(I386_CR4_MCE);	FLAG(I386_CR4_PGE);	if(e) { strcat(str, " (++)"); }	return str;}
开发者ID:Sciumo,项目名称:minix,代码行数:15,


示例7: aftol

long aftol(char *str){	char	ch;	size_t	c=0;	ulong	l=0UL;	while(str[c]) {		ch=toupper(str[c]);		if(ch>='A' && ch<='Z')			l|=FLAG(ch);		c++; 	}	return(l);}
开发者ID:ftnapps,项目名称:pkg-sbbs,代码行数:14,


示例8: letter

/*!    Returns true if the character is a letter (Letter_* categories);    otherwise returns false.*/bool QChar::isLetter() const{    const int test = FLAG(Letter_Uppercase) |                     FLAG(Letter_Lowercase) |                     FLAG(Letter_Titlecase) |                     FLAG(Letter_Modifier) |                     FLAG(Letter_Other);    return FLAG(qGetProp(ucs)->category) & test;}
开发者ID:phen89,项目名称:rtqt,代码行数:13,


示例9: bst_remove

sval_t bst_remove(skey_t key, node_t* node_r) {    bool_t injecting = TRUE;     node_t* leaf;    sval_t val = 0;    while (1) {      UPDATE_TRY();        bst_seek(key, node_r);        val = seek_record->leaf->value;        node_t* parent = seek_record->parent;        node_t** child_addr;        if (key < parent->key) {            child_addr = (node_t**) &(parent->left);        } else {            child_addr = (node_t**) &(parent->right);        }        if (injecting == TRUE) {            leaf = seek_record->leaf;            if (leaf->key != key) {                return 0;            }            node_t* lf = ADDRESS(leaf);            node_t* result = CAS_PTR(child_addr, lf, FLAG(lf));            if (result == ADDRESS(leaf)) {                injecting = FALSE;                bool_t done = bst_cleanup(key);                if (done == TRUE) {                    return val;                }            } else {                node_t* chld = *child_addr;                if ( (ADDRESS(chld) == leaf) && (GETFLAG(chld) || GETTAG(chld)) ) {                    bst_cleanup(key);                }            }        } else {            if (seek_record->leaf != leaf) {                return val;             } else {                bool_t done = bst_cleanup(key);                if (done == TRUE) {                    return val;                }            }        }    }}
开发者ID:LPD-EPFL,项目名称:ASCYLIB,代码行数:49,


示例10: madwifi_real_init

static int madwifi_real_init(void) {  size_t max = STATIC_ARRAY_SIZE(specs);  for (size_t i = 0; i < STATIC_ARRAY_SIZE(bounds); i++)    bounds[i] = 0;  watchlist_set(watch_items, 0);  watchlist_set(misc_items, 0);  for (size_t i = 0; i < max; i++) {    bounds[specs[i].flags & SRC_MASK] = i;    if (specs[i].flags & LOG)      watch_items[i / 32] |= FLAG(i);    if (specs[i].flags & SU)      misc_items[i / 32] |= FLAG(i);  }  for (size_t i = 0; i < STATIC_ARRAY_SIZE(bounds); i++)    bounds[i]++;  return (0);}
开发者ID:ajdiaz,项目名称:collectd,代码行数:24,


示例11: YeloPrepareDefinitions

		// Process a blam scenario for the current operating mode (editing or cache building).		// Returns the blam scenario's handle or datum_index::null		Yelo::datum_index YeloPrepareDefinitions(cstring scenario_name, const bool for_build_cache)		{			// If we're not building a cache file, just load the scenario into memory without any of its references			datum_index scenario_index = tag_load<TagGroups::scenario>(scenario_name, for_build_cache ? 				FLAG(Flags::_tag_load_verify_exist_first_bit) : 				FLAG(Flags::_tag_load_non_resolving_references_bit));			if(!scenario_index.IsNull())			{				TagGroups::scenario* scenario = tag_get<TagGroups::scenario>(scenario_index);				datum_index yelo = YeloPrepareDefinitionsYeloScenario(					scenario->GetYeloReferenceHack(), for_build_cache);				// if we're not building a cache, then this is sapien and we want it to load 				// the scenario and all of it's dependencies after we return the code flow 				// back to it				if(!for_build_cache) tag_unload(scenario_index);				return yelo;			}			return datum_index::null;		}
开发者ID:CodeAsm,项目名称:open-sauce,代码行数:26,


示例12: HT4C_THROW_ARGUMENT

	void Cells::add( const char* row, const char* columnFamily, const char* columnQualifier, uint64_t timestamp, const void* value, uint32_t valueLength, uint8_t flag ) {		if( valueLength > Cell::MaxSize ) {			HT4C_THROW_ARGUMENT("cell value exceeds the limit", "valueLength");		}		flag = FLAG( columnFamily, columnQualifier, flag );		Cell cell( row						 , CF(columnFamily)						 , columnQualifier						 , TIMESTAMP(timestamp, flag)						 , value						 , valueLength						 , flag);		cellsBuilder->add( cell.get(), true );	}
开发者ID:andysoftdev,项目名称:ht4c,代码行数:16,


示例13: bst_add

bool_t bst_add(bst_key_t k, node_t* root){	node_t* pred;	node_t* curr;	node_t* new_node;	operation_t* pred_op;	operation_t* curr_op;	operation_t* cas_op;	search_res_t result;	while(TRUE) {		result = bst_find(k, &pred, &pred_op, &curr, &curr_op, root, root);		if (result == FOUND) {			return FALSE;		}		new_node = (node_t*) ssalloc(sizeof(node_t));		new_node->key = k;		new_node->op = NULL;		new_node->left = NULL;		new_node->right = NULL;		bool_t is_left = (result == NOT_FOUND_L);		node_t* old;		if (is_left) {			old = curr->left;		} else {			old = curr->right;		}		cas_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t));		cas_op->child_cas_op.is_left = is_left;		cas_op->child_cas_op.expected = old;		cas_op->child_cas_op.update = new_node;#if defined(__tile__)		MEM_BARRIER;#endif		if (CAS_PTR(&curr->op, curr_op, FLAG(cas_op, STATE_OP_CHILDCAS)) == curr_op) {			bst_help_child_cas(cas_op, curr, root);			return TRUE;		}	}}
开发者ID:LPD-EPFL,项目名称:ASCYLIB,代码行数:46,


示例14: borg_build_inn

/* Get food and rest at the inn */static bool borg_build_inn(void){	int i;	list_item *l_ptr;	bool rest = TRUE;	/* Is it light outside */	rest &= (bp_ptr->hour < 6 || bp_ptr->hour > 17);	 	/* This is a respectable place */	rest &= !bp_ptr->status.cut && !bp_ptr->status.poisoned;	/* Check the vampire flag */	rest &= !FLAG(bp_ptr, TR_HURT_LITE);	/* Loop through the equipment */	for (i = 0; i < equip_num; i++)	{		l_ptr = look_up_equip_slot(i);		/* Check the equipment for that flag */		if (l_ptr) rest &= !KN_FLAG(l_ptr, TR_HURT_LITE);	}	/* If the borg wants a rest */	if (rest && borg_gold > 25)	{		/* Wait for daybreak */		borg_keypress('R');	}	/* Can the borg use more food? */	if (!bp_ptr->status.full && borg_gold > 25)	{		/* Have dinner */		borg_keypress('E');	}	/* One pass takes care of all needs */	return (FALSE);}
开发者ID:jcheatham,项目名称:Zangband,代码行数:42,


示例15: param

cell_t *parse_word(seg_t w, cell_t *module, unsigned int n, cell_t *entry) {  cell_t *c;  cell_t *data = NULL;  csize_t in = 0, out = 1;  if(w.s[0] == '?' && w.n == 1) {    c = param(T_ANY, entry);  } else if(in = 1, out = 1, match_param_word("ap", w, &in, &out)) {    c = func(OP_ap, ++in, ++out);  } else if(in = 1, out = 1, match_param_word("comp", w, &in, &out)) {    in += 2;    c = func(OP_compose, in, ++out);  } else if(in = 1, out = 1, match_param_word("external", w, &in, &out)) {    c = func(OP_external, ++in, out);  } else {    cell_t *e = lookup_word(w);    if(!e) e = module_lookup_compiled(w, &module);    if(e) {      in = e->entry.in;      out = e->entry.out;      if(FLAG(*e, entry, PRIMITIVE)) {        if(e->op == OP_placeholder) {          c = func(OP_placeholder, n + 1, 1);          int x = trace_alloc(entry, n + 2);          in = n;          out = 1;          data = var_create(T_LIST, tc_get(entry, x), 0, 0);        } else {          c = func(e->op, e->entry.in, e->entry.out);        }      } else {        c = func(OP_exec, e->entry.in + 1, e->entry.out);        data = e;      }    } else {      return NULL;    }  }  if(in) c->expr.arg[0] = (cell_t *)(intptr_t)(in - 1);  TRAVERSE(c, out) {    *p = dep(c);  }
开发者ID:HackerFoo,项目名称:poprc,代码行数:41,


示例16: ECGroup_consGFp_mont

/* Construct a generic ECGroup for elliptic curves over prime fields with * field arithmetic implemented in Montgomery coordinates. */ECGroup *ECGroup_consGFp_mont(const mp_int *irr, const mp_int *curvea,					 const mp_int *curveb, const mp_int *genx,					 const mp_int *geny, const mp_int *order, int cofactor){	mp_err res = MP_OKAY;	ECGroup *group = NULL;	group = ECGroup_new(FLAG(irr));	if (group == NULL)		return NULL;	group->meth = GFMethod_consGFp_mont(irr);	if (group->meth == NULL) {		res = MP_MEM;		goto CLEANUP;	}	MP_CHECKOK(group->meth->			   field_enc(curvea, &group->curvea, group->meth));	MP_CHECKOK(group->meth->			   field_enc(curveb, &group->curveb, group->meth));	MP_CHECKOK(group->meth->field_enc(genx, &group->genx, group->meth));	MP_CHECKOK(group->meth->field_enc(geny, &group->geny, group->meth));	MP_CHECKOK(mp_copy(order, &group->order));	group->cofactor = cofactor;	group->point_add = &ec_GFp_pt_add_aff;	group->point_sub = &ec_GFp_pt_sub_aff;	group->point_dbl = &ec_GFp_pt_dbl_aff;	group->point_mul = &ec_GFp_pt_mul_jm_wNAF;	group->base_point_mul = NULL;	group->points_mul = &ec_GFp_pts_mul_jac;	group->validate_point = &ec_GFp_validate_point;  CLEANUP:	if (res != MP_OKAY) {		ECGroup_free(group);		return NULL;	}	return group;}
开发者ID:AlfredArouna,项目名称:illumos-gate,代码行数:42,


示例17: bst_help_marked

void bst_help_marked(node_t* pred, operation_t* pred_op, node_t* curr, node_t* root){	node_t* new_ref;	if (ISNULL(curr->left)) {		if (ISNULL(curr->right)) {			new_ref = (node_t*)SETNULL(curr);		} else {			new_ref = curr->right;		}	} else {		new_ref = curr->left;	}	operation_t* cas_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t));	cas_op->child_cas_op.is_left = (curr == pred->left);	cas_op->child_cas_op.expected = curr;	cas_op->child_cas_op.update = new_ref;	if (CAS_PTR(&(pred->op), pred_op, FLAG(cas_op, STATE_OP_CHILDCAS)) == pred_op) {		bst_help_child_cas(cas_op, pred, root);	}}
开发者ID:LPD-EPFL,项目名称:ASCYLIB,代码行数:22,


示例18: __invariant

void CCritter::DrawText(CFOFont* lpfnt){  __invariant();  if(!text_str && FLAG(flags,FCRIT_MOB)) return;  if(visible)  {    int x=drect.left+((drect.right-drect.left)>>1)-100+cmn_scr_ox;    int y=drect.top-73+cmn_scr_oy;    RECT r={x,y,x+200,y+70};    lpfnt->RenderText(r,text_str?text_str:name,FT_CENTERX|FT_BOTTOM,text_color);  }  if(GetTickCount()-SetTime>=text_delay)  {    if (text_str != NULL) {      delete [] text_str;      text_str = NULL;    }    text_color=COLOR_CRITNAME;  }}
开发者ID:BHjr132,项目名称:fonline,代码行数:22,


示例19: place

/*  * place - Place block of asize bytes at start of free block bp  *         and split if remainder would be at least minimum block size */static void place(void *bp, size_t asize){    size_t csize = GET_SIZE(HDRP(bp));       if (IS_VALID(csize - asize)) {          /* we want to make sure the new free block satisfy the minimum requirement */                    int t = (bp == heap_tailp);        delete_node(get_level(GET_SIZE(HDRP(bp))), bp); /* remove the record in the free block list */        SET_SIZE(HDRP(bp), asize);        MARK_ALLOC(HDRP(bp));        bp = NEXT_BLKP(bp);        PUT(HDRP(bp), PACK3(csize-asize, 2, 0));        PUT(FTRP(bp), PACK3(csize-asize, 2, 0));          insert_node(get_level(GET_SIZE(HDRP(bp))), bp);        if (t) {            heap_tailp = bp;        }    }else {         delete_node(get_level(GET_SIZE(HDRP(bp))), bp);        MARK_ALLOC(HDRP(bp));        FLAG(HDRP(NEXT_BLKP(bp)));    }}
开发者ID:cmxcn,项目名称:CSAPP_labs,代码行数:26,


示例20: ECGroup_consGF2m

/* Construct a generic ECGroup for elliptic curves over binary polynomial * fields. */ECGroup *ECGroup_consGF2m(const mp_int *irr, const unsigned int irr_arr[5],				 const mp_int *curvea, const mp_int *curveb,				 const mp_int *genx, const mp_int *geny,				 const mp_int *order, int cofactor){	mp_err res = MP_OKAY;	ECGroup *group = NULL;	group = ECGroup_new(FLAG(irr));	if (group == NULL)		return NULL;	group->meth = GFMethod_consGF2m(irr, irr_arr);	if (group->meth == NULL) {		res = MP_MEM;		goto CLEANUP;	}	MP_CHECKOK(mp_copy(curvea, &group->curvea));	MP_CHECKOK(mp_copy(curveb, &group->curveb));	MP_CHECKOK(mp_copy(genx, &group->genx));	MP_CHECKOK(mp_copy(geny, &group->geny));	MP_CHECKOK(mp_copy(order, &group->order));	group->cofactor = cofactor;	group->point_add = &ec_GF2m_pt_add_aff;	group->point_sub = &ec_GF2m_pt_sub_aff;	group->point_dbl = &ec_GF2m_pt_dbl_aff;	group->point_mul = &ec_GF2m_pt_mul_mont;	group->base_point_mul = NULL;	group->points_mul = &ec_pts_mul_basic;	group->validate_point = &ec_GF2m_validate_point;  CLEANUP:	if (res != MP_OKAY) {		ECGroup_free(group);		return NULL;	}	return group;}
开发者ID:AlfredArouna,项目名称:illumos-gate,代码行数:41,


示例21: FLAG

/*!    Returns true if the character is a printable character; otherwise    returns false. This is any character not of category Cc or Cn.    Note that this gives no indication of whether the character is    available in a particular font.*/bool QChar::isPrint() const{    const int test = FLAG(Other_Control) |                     FLAG(Other_NotAssigned);    return !(FLAG(qGetProp(ucs)->category) & test);}
开发者ID:phen89,项目名称:rtqt,代码行数:13,


示例22: ec_GFp_pt_mul_jm_wNAF

/* Computes R = nP where R is (rx, ry) and P is the base point. Elliptic * curve points P and R can be identical. Uses mixed Modified-Jacobian * co-ordinates for doubling and Chudnovsky Jacobian coordinates for * additions. Assumes input is already field-encoded using field_enc, and * returns output that is still field-encoded. Uses 5-bit window NAF * method (algorithm 11) for scalar-point multiplication from Brown, * Hankerson, Lopez, Menezes. Software Implementation of the NIST Elliptic * Curves Over Prime Fields. */mp_errec_GFp_pt_mul_jm_wNAF(const mp_int *n, const mp_int *px, const mp_int *py,                                          mp_int *rx, mp_int *ry, const ECGroup *group){        mp_err res = MP_OKAY;        mp_int precomp[16][2], rz, tpx, tpy;        mp_int raz4;        mp_int scratch[MAX_SCRATCH];        signed char *naf = NULL;        int i, orderBitSize;        MP_DIGITS(&rz) = 0;        MP_DIGITS(&raz4) = 0;        MP_DIGITS(&tpx) = 0;        MP_DIGITS(&tpy) = 0;        for (i = 0; i < 16; i++) {                MP_DIGITS(&precomp[i][0]) = 0;                MP_DIGITS(&precomp[i][1]) = 0;        }        for (i = 0; i < MAX_SCRATCH; i++) {                MP_DIGITS(&scratch[i]) = 0;        }        ARGCHK(group != NULL, MP_BADARG);        ARGCHK((n != NULL) && (px != NULL) && (py != NULL), MP_BADARG);        /* initialize precomputation table */        MP_CHECKOK(mp_init(&tpx, FLAG(n)));        MP_CHECKOK(mp_init(&tpy, FLAG(n)));;        MP_CHECKOK(mp_init(&rz, FLAG(n)));        MP_CHECKOK(mp_init(&raz4, FLAG(n)));        for (i = 0; i < 16; i++) {                MP_CHECKOK(mp_init(&precomp[i][0], FLAG(n)));                MP_CHECKOK(mp_init(&precomp[i][1], FLAG(n)));        }        for (i = 0; i < MAX_SCRATCH; i++) {                MP_CHECKOK(mp_init(&scratch[i], FLAG(n)));        }        /* Set out[8] = P */        MP_CHECKOK(mp_copy(px, &precomp[8][0]));        MP_CHECKOK(mp_copy(py, &precomp[8][1]));        /* Set (tpx, tpy) = 2P */        MP_CHECKOK(group->                           point_dbl(&precomp[8][0], &precomp[8][1], &tpx, &tpy,                                                 group));        /* Set 3P, 5P, ..., 15P */        for (i = 8; i < 15; i++) {                MP_CHECKOK(group->                                   point_add(&precomp[i][0], &precomp[i][1], &tpx, &tpy,                                                         &precomp[i + 1][0], &precomp[i + 1][1],                                                         group));        }        /* Set -15P, -13P, ..., -P */        for (i = 0; i < 8; i++) {                MP_CHECKOK(mp_copy(&precomp[15 - i][0], &precomp[i][0]));                MP_CHECKOK(group->meth->                                   field_neg(&precomp[15 - i][1], &precomp[i][1],                                                         group->meth));        }        /* R = inf */        MP_CHECKOK(ec_GFp_pt_set_inf_jac(rx, ry, &rz));        orderBitSize = mpl_significant_bits(&group->order);        /* Allocate memory for NAF */#ifdef _KERNEL        naf = (signed char *) kmem_alloc((orderBitSize + 1), FLAG(n));#else        naf = (signed char *) malloc(sizeof(signed char) * (orderBitSize + 1));        if (naf == NULL) {                res = MP_MEM;                goto CLEANUP;        }#endif        /* Compute 5NAF */        ec_compute_wNAF(naf, orderBitSize, n, 5);        /* wNAF method */        for (i = orderBitSize; i >= 0; i--) {                /* R = 2R */                ec_GFp_pt_dbl_jm(rx, ry, &rz, &raz4, rx, ry, &rz,                                             &raz4, scratch, group);                if (naf[i] != 0) {                        ec_GFp_pt_add_jm_aff(rx, ry, &rz, &raz4,                                                                 &precomp[(naf[i] + 15) / 2][0],//.........这里部分代码省略.........
开发者ID:AntinZhu,项目名称:jdk-source,代码行数:101,


示例23: compute_winpos

/****** compute_winpos ********************************************************PROTO	void compute_winpos(picstruct *field, picstruct *wfield,			objstruct *obj)PURPOSE	Compute windowed source barycenter.INPUT	Picture structure pointer,	Weight-map structure pointer,	object structure.OUTPUT  -.NOTES   obj->posx and obj->posy are taken as initial centroid guesses.AUTHOR  E. Bertin (IAP)VERSION 03/05/2011 ***/void	compute_winpos(picstruct *field, picstruct *wfield, objstruct *obj)  {   float		r2,invtwosig2, raper,raper2, rintlim,rintlim2,rextlim2,			dx,dx1,dy,dy2, sig, invngamma, pdbkg,                        offsetx,offsety,scalex,scaley,scale2, locarea;   double               tv, norm, pix, var, backnoise2, invgain, locpix,			dxpos,dypos, err,err2, emx2,emy2,emxy,			esum, temp,temp2, mx2, my2,mxy,pmx2, theta, mx,my,			mx2ph, my2ph;   int                  i,x,y, x2,y2, xmin,xmax,ymin,ymax, sx,sy, w,h,                        fymin,fymax, pflag,corrflag, gainflag, errflag,			momentflag;   long                 pos;   PIXTYPE              *strip,*stript, *wstrip,*wstript,                        wthresh = 0.0;  if (wfield)    wthresh = wfield->weight_thresh;  wstrip = wstript = NULL;  w = field->width;  h = field->stripheight;  fymin = field->ymin;  fymax = field->ymax;  pflag = (prefs.detect_type==PHOTO)? 1:0;  corrflag = (prefs.mask_type==MASK_CORRECT);  gainflag = wfield && prefs.weightgain_flag;  errflag = FLAG(obj2.winposerr_mx2) | FLAG(obj2.fluxerr_win);  momentflag = FLAG(obj2.win_mx2) | FLAG(obj2.winposerr_mx2);  var = backnoise2 = field->backsig*field->backsig;  invgain = field->gain>0.0? 1.0/field->gain : 0.0;  sig = obj2->hl_radius*2.0/2.35; /* From half-FWHM to sigma */  invtwosig2 = 1.0/(2.0*sig*sig);/* Integration radius */  raper = WINPOS_NSIG*sig;/* For photographic data */  if (pflag)    {    invngamma = 1.0/field->ngamma;    pdbkg = expf(obj->dbkg*invngamma);    }  else    {    invngamma = 0.0;    pdbkg = 0.0;    }  raper2 = raper*raper;/* Internal radius of the oversampled annulus (<r-sqrt(2)/2) */  rintlim = raper - 0.75;  rintlim2 = (rintlim>0.0)? rintlim*rintlim: 0.0;/* External radius of the oversampled annulus (>r+sqrt(2)/2) */  rextlim2 = (raper + 0.75)*(raper + 0.75);  scaley = scalex = 1.0/WINPOS_OVERSAMP;  scale2 = scalex*scaley;  offsetx = 0.5*(scalex-1.0);  offsety = 0.5*(scaley-1.0);/* Use isophotal centroid as a first guess */  mx = obj2->posx - 1.0;  my = obj2->posy - 1.0;  for (i=0; i<WINPOS_NITERMAX; i++)    {    xmin = (int)(mx-raper+0.499999);    xmax = (int)(mx+raper+1.499999);    ymin = (int)(my-raper+0.499999);    ymax = (int)(my+raper+1.499999);    mx2ph = mx*2.0 + 0.49999;    my2ph = my*2.0 + 0.49999;    if (xmin < 0)      {      xmin = 0;      obj->flag |= OBJ_APERT_PB;      }    if (xmax > w)      {      xmax = w;      obj->flag |= OBJ_APERT_PB;      }    if (ymin < fymin)      {      ymin = fymin;      obj->flag |= OBJ_APERT_PB;      }    if (ymax > fymax)      {//.........这里部分代码省略.........
开发者ID:Starlink,项目名称:sextractor,代码行数:101,


示例24: lnk_dump

void lnk_dump(void){    const LINK_HEADER*        hdr;    const DATABLOCK_HEADER*   bhdr;    DWORD dwFlags;    offset = 0;    hdr = fetch_block();    if (!hdr)        return;    printf("Header/n");    printf("------/n/n");    printf("Size:    %04x/n", hdr->dwSize);    printf("GUID:    %s/n", get_guid_str(&hdr->MagicGuid));    printf("FileAttr: %08x/n", hdr->dwFileAttr);    printf("FileLength: %08x/n", hdr->dwFileLength);    printf("nIcon: %d/n", hdr->nIcon);    printf("Startup: %d/n", hdr->fStartup);    printf("HotKey: %08x/n", hdr->wHotKey);    printf("Unknown5: %08x/n", hdr->Unknown5);    printf("Unknown6: %08x/n", hdr->Unknown6);    /* dump out all the flags */    printf("Flags:   %04x ( ", hdr->dwFlags);    dwFlags=hdr->dwFlags;#define FLAG(x) do /                { /                    if (dwFlags & SLDF_##x) /                    { /                        printf("%s ", #x); /                        dwFlags&=~SLDF_##x; /                    } /                } while (0)    FLAG(HAS_ID_LIST);    FLAG(HAS_LINK_INFO);    FLAG(HAS_NAME);    FLAG(HAS_RELPATH);    FLAG(HAS_WORKINGDIR);    FLAG(HAS_ARGS);    FLAG(HAS_ICONLOCATION);    FLAG(UNICODE);    FLAG(FORCE_NO_LINKINFO);    FLAG(HAS_EXP_SZ);    FLAG(RUN_IN_SEPARATE);    FLAG(HAS_LOGO3ID);    FLAG(HAS_DARWINID);    FLAG(RUNAS_USER);    FLAG(HAS_EXP_ICON_SZ);    FLAG(NO_PIDL_ALIAS);    FLAG(FORCE_UNCNAME);    FLAG(RUN_WITH_SHIMLAYER);    FLAG(FORCE_NO_LINKTRACK);    FLAG(ENABLE_TARGET_METADATA);    FLAG(DISABLE_KNOWNFOLDER_RELATIVE_TRACKING);    FLAG(RESERVED);#undef FLAG    if (dwFlags)        printf("+%04x", dwFlags);    printf(")/n");    printf("Length:  %04x/n", hdr->dwFileLength);    printf("/n");    if (hdr->dwFlags & SLDF_HAS_ID_LIST)        dump_pidl();    if (hdr->dwFlags & SLDF_HAS_LINK_INFO)        dump_location();    if (hdr->dwFlags & SLDF_HAS_NAME)        dump_string("Description", hdr->dwFlags & SLDF_UNICODE);    if (hdr->dwFlags & SLDF_HAS_RELPATH)        dump_string("Relative path", hdr->dwFlags & SLDF_UNICODE);    if (hdr->dwFlags & SLDF_HAS_WORKINGDIR)        dump_string("Working directory", hdr->dwFlags & SLDF_UNICODE);    if (hdr->dwFlags & SLDF_HAS_ARGS)        dump_string("Arguments", hdr->dwFlags & SLDF_UNICODE);    if (hdr->dwFlags & SLDF_HAS_ICONLOCATION)        dump_string("Icon path", hdr->dwFlags & SLDF_UNICODE);    bhdr=fetch_block();    while (bhdr)    {        if (!bhdr->cbSize)            break;        switch (bhdr->dwSignature)        {        case EXP_SZ_LINK_SIG:            dump_sz_block(bhdr, "exp.link");            break;        case EXP_SPECIAL_FOLDER_SIG:            dump_special_folder_block(bhdr);            break;        case EXP_SZ_ICON_SIG:            dump_sz_block(bhdr, "icon");            break;        case EXP_DARWIN_ID_SIG:            dump_darwin_id(bhdr);            break;        default://.........这里部分代码省略.........
开发者ID:Sunmonds,项目名称:wine,代码行数:101,


示例25: Flag

		static TStorage Flag(TEnumBitsClass bit_member)		{			return FLAG(bit_member);		}
开发者ID:guardian2433,项目名称:open-sauce,代码行数:4,



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


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