本文整理汇总了C++中FLAG函数的典型用法代码示例。如果您正苦于以下问题:C++ FLAG函数的具体用法?C++ FLAG怎么用?C++ FLAG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLAG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:bst_howley.c
示例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,代码来源:ls_dirs.c
示例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,代码来源:refer3.c
示例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,代码来源:test.c
示例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,代码来源:bst_howley.c
示例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,代码来源:memory.c
示例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,代码来源:scfglib2.c
示例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,代码来源:qchar.cpp
示例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,代码来源:bst-aravind.c
示例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,代码来源:madwifi.c
示例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,代码来源:yelo_scenario_definitions.cpp
示例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,代码来源:Cells.cpp
示例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,代码来源:bst_howley.c
示例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,代码来源:zborg8.c
示例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,代码来源:parse.c
示例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,代码来源:ecl.c
示例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,代码来源:bst_howley.c
示例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,代码来源:Critter.cpp
示例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,代码来源:refer3.c
示例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,代码来源:ecl.c
注:本文中的FLAG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论