本文整理汇总了C++中REF函数的典型用法代码示例。如果您正苦于以下问题:C++ REF函数的具体用法?C++ REF怎么用?C++ REF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了REF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cpu_compute
void cpu_compute (char *name) {
int i, j, mx;
char str[1024];
int64_t *img, v0;
int64_t *B_correct;
uint8_t V[9], rr;
B_correct = (int64_t*) Cache_Aligned_Allocate (SZ);
for (i=0; i<SN-(WN-1); i++)
for (j=0; j<SM-(WM-1); j++) {
V[0] = REF(A,i,j);
V[1] = REF(A,i,j+1);
V[2] = REF(A,i,j+2);
V[3] = REF(A,i+1,j);
V[4] = REF(A,i+1,j+1);
V[5] = REF(A,i+1,j+2);
V[6] = REF(A,i+2,j);
V[7] = REF(A,i+2,j+1);
V[8] = REF(A,i+2,j+2);
rr = cpu_median (V);
REF(B_correct,i,j) = rr;
}
dump_image (B_correct, name);
}
开发者ID:dcaliga,项目名称:delay_queues,代码行数:26,代码来源:main.c
示例2: pq_swap
/* swap elements at indexes i1 and i2 */
static void
pq_swap(PQ pq, int i1, int i2)
{
memcpy(pq->swap_space, REF(pq, i1), pq->element_length);
memcpy(REF(pq, i1), REF(pq, i2), pq->element_length);
memcpy(REF(pq, i2), pq->swap_space, pq->element_length);
}
开发者ID:Arkham,项目名称:c_examples,代码行数:8,代码来源:dijkstra.c
示例3: tmp
BN& BN::operator%=(const BN& mod)
{
BN tmp(*this);
BN_mod(BNP, REF(tmp.dp), REF(mod.dp), CTX);
coimath_local::context.clear();
return *this;
}
开发者ID:dyfet,项目名称:libcoimath,代码行数:7,代码来源:mod.cpp
示例4: query1
int query1()
{
int partId;
REF(AtomicPart) atomH;
REF(any) r;
// set random seed so "hot" runs are truly hot
srandom(1);
// now randomly select parts via partId index and process them
for (int i = 0; i < Query1RepeatCnt; i++) {
// generate part id and lookup part
bool found;
partId = (int) (random() % TotalAtomicParts) + 1;
if (tbl->AtomicPartIdx.find(partId,atomH,found) || !found ||atomH == 0){
fprintf(stderr, "ERROR: Unable to find atomic part %d\n", partId);
cerr << __FILE__ << ", line " << __LINE__
<< ", not an AtomicPart" << endl;
exit(1);
}
if (debugMode) {
printf(" In Query1, partId = %d:\n", partId);
}
// process part by calling the null procedure
atomH->DoNothing();
}
return Query1RepeatCnt;
}
开发者ID:glycerine,项目名称:shore-mt,代码行数:30,代码来源:Query1.C
示例5: main
int main(int argc, char* argv[])
{
REF(Player) player = {0};
REF(Weapon) weapon = {0};
REF(Player) enemy = {0};
player = PlayerCreate();
weapon = PlayerWeapon(player);
enemy = PlayerCreate();
PlayerSetTarget(player, enemy);
printf("Player: %p\n", (void*)GET(player));
printf("Weapon: %p\n", (void*)GET(weapon));
FREE(enemy);
printf("Player Target: %p\n", (void*)TRYGET(PlayerTarget(player)));
FREE(player);
printf("Player: %p\n", (void*)TRYGET(player));
printf("Weapon: %p\n", (void*)TRYGET(weapon));
StentStats();
StentCleanup();
return 0;
}
开发者ID:osen,项目名称:stent,代码行数:26,代码来源:main.c
示例6: tmp
BN& BN::operator*=(const BN& mul)
{
BN tmp(*this);
BN_mul(BNP, REF(tmp.dp), REF(mul.dp), CTX);
coimath_local::context.clear();
return *this;
}
开发者ID:dyfet,项目名称:libcoimath,代码行数:7,代码来源:mul.cpp
示例7: compute_means
/***************************************************************************************
compute_means
***************************************************************************************/
static void
compute_means(
float *image_l,
float *image_r,
int wx,
int wy,
int width,
int height,
float *mean_l,
float *mean_r)
{
int wx2, wy2,
x, y, i, j;
double size_sq;
size_sq = wx * wy;
wx2 = (wx - 1) / 2;
wy2 = (wy - 1) / 2;
for (y = wy2; y < (height-wy2); y++)
for (x = wx2; x < (width-wx2); x++) {
float sum_r = 0.0, sum_l = 0.0;
for (i = -wx2; i <= wx2; i++)
for (j = -wy2; j <= wy2; j++) {
sum_l += REF(image_l, x+i, y+j);
sum_r += REF(image_r, x+i, y+j);
}
REF(mean_r, x,y) = sum_r / size_sq;
REF(mean_l, x, y) = sum_l / size_sq;
}
}
开发者ID:dtbinh,项目名称:Git,代码行数:36,代码来源:stereo_match.c
示例8: SYNTAX
IntegerSyntax::IntegerSyntax()
{
SYNTAX("int");
sign_ = DEFINE("Sign", RANGE("+-"));
binNumber_ =
DEFINE("BinNumber",
GLUE(
STRING("0b"),
REPEAT(1, 256, RANGE('0', '1'))
)
);
octNumber_ =
DEFINE("OctNumber",
GLUE(
CHAR('0'),
REPEAT(1, 24, RANGE('0', '9'))
)
);
hexNumber_ =
DEFINE("HexNumber",
GLUE(
STRING("0x"),
REPEAT(1, 20,
CHOICE(
RANGE('0', '9'),
RANGE('a', 'f'),
RANGE('A', 'F')
)
)
)
);
decNumber_ =
DEFINE("DecNumber",
REPEAT(1, 20,
RANGE('0', '9')
)
);
literal_ =
DEFINE("Literal",
GLUE(
REPEAT(0, 1, REF("Sign")),
CHOICE(
REF("BinNumber"),
REF("OctNumber"),
REF("HexNumber"),
REF("DecNumber")
),
NOT(RANGE(".eE"))
)
);
ENTRY("Literal");
LINK();
}
开发者ID:frankencode,项目名称:fluxkit,代码行数:60,代码来源:IntegerSyntax.cpp
示例9: str_gt
bool str_gt(String * s1,String * t)
{
ENTER();
REF((void *)t);
REF((void *)s1);
{EXIT(); return String_gt(s1,t);}
EXIT();
}
开发者ID:hanjoes,项目名称:wich-c,代码行数:9,代码来源:ret_str_cmp_result.c
示例10: le_msg
void le_msg(String * s,String * t)
{
ENTER();
REF((void *)t);
REF((void *)s);
print_string(String_add(String_add(s,String_new(" is less than or equal to ")),t));
EXIT();
}
开发者ID:hanjoes,项目名称:wich-c,代码行数:9,代码来源:ret_str_cmp_result.c
示例11: gt_msg
void gt_msg(String * s,String * t)
{
ENTER();
REF((void *)t);
REF((void *)s);
print_string(String_add(String_add(s,String_new(" is greater than ")),t));
EXIT();
}
开发者ID:hanjoes,项目名称:wich-c,代码行数:9,代码来源:ret_str_cmp_result.c
示例12: main
int
main(int argc, char *argv[])
{
char *progname = argv[0];
char *fname;
shrc rc;
if(argc != 1){
usage(cerr, progname);
}
// Establish a connection with the vas and initialize
// the object cache.
SH_DO(Shore::init(argc, argv));
SH_BEGIN_TRANSACTION(rc);
// If that failed, or if a transaction aborted...
if(rc){
// after longjmp
cerr << rc << endl;
return 1;
} else {
// The main body of the transaction goes here.
SH_DO(Shore::chdir("/"));
//////////////////////////////////
// GUTS HERE
//////////////////////////////////
fname = "XXX";
{
bool ok = true;
SH_DO( REF(my_obj)::new_persistent (fname, 0644, o_ref) ) ;
if(!o_ref ) {
cerr << "Cannot create new objects " << fname << endl;
ok = false;
} else {
SH_DO( REF(a)::new_persistent ("a_ref_junk", 0644, a_ref) ) ;
if(!a_ref ) {
cerr << "Cannot create new objects " << "a_ref_junk" << endl;
ok = false;
}
}
dotest();
}
SH_DO(SH_COMMIT_TRANSACTION);
}
destroy_obj(fname);
destroy_obj("a_ref_junk");
return 0;
}
开发者ID:glycerine,项目名称:shore-mt,代码行数:55,代码来源:sequences.C
示例13: SuffixArray
SuffixArray(string _a, int m) : a(" " + _a), N(a.length()), m(m),
SA(N), LCP(N), x(N), y(N), w(max(m, N)), c(N) {
a[0] = 0;
DA();
kasaiLCP();
#define REF(X) { rotate(X.begin(), X.begin()+1, X.end()); X.pop_back(); }
REF(SA); REF(LCP);
a = a.substr(1, a.size());
for(int i = 0; i < (int) SA.size(); ++i) --SA[i];
#undef REF
}
开发者ID:lkmtue,项目名称:cp,代码行数:11,代码来源:suffix-array.cpp
示例14: Vector_mul
PVector_ptr Vector_mul(PVector_ptr a, PVector_ptr b)
{
REF((heap_object *)a.vector);
REF((heap_object *)b.vector);
int i;
if ( a.vector==NULL || b.vector==NULL || a.vector->length!=b.vector->length ) vector_operation_error();
size_t n = a.vector->length;
PVector_ptr c = PVector_init(0, n);
for (i=0; i<n; i++) c.vector->nodes[i].data = ith(a, i) * ith(b, i);
DEREF((heap_object *)a.vector);
DEREF((heap_object *)b.vector);
return c;
}
开发者ID:syuanivy,项目名称:runtime,代码行数:13,代码来源:wich.c
示例15: Vector_eq
bool Vector_eq(PVector_ptr a, PVector_ptr b) {
REF((heap_object *)a.vector);
REF((heap_object *)b.vector);
if (a.vector == NULL || b.vector == NULL) return false;
if (a.vector->length != b.vector->length) return false;
int i = (int)a.vector->length;
for (int j = 0; j < i; j++) {
if(a.vector->nodes[j].data != b.vector->nodes[j].data) return false;
}
DEREF((heap_object *)a.vector);
DEREF((heap_object *)b.vector);
return true;
}
开发者ID:syuanivy,项目名称:runtime,代码行数:13,代码来源:wich.c
示例16: REF
String *String_add(String *s, String *t)
{
if ( s==NULL ) return t; // don't REF/DEREF as we might free our return value
if ( t==NULL ) return s;
REF((heap_object *)s);
REF((heap_object *)t);
size_t n = strlen(s->str) + strlen(t->str);
String *u = String_alloc(n);
strcpy(u->str, s->str);
strcat(u->str, t->str);
DEREF((heap_object *)s);
DEREF((heap_object *)t);
return u;
}
开发者ID:syuanivy,项目名称:runtime,代码行数:14,代码来源:wich.c
示例17: cryptframe_set_dest_public_key
///
/// Set the encryption key to use when sending to destaddr
/// Set destkey to NULL to stop encrypting to that destination
WINEXPORT void
cryptframe_set_dest_public_key(NetAddr*destaddr, ///< Destination addr,port
CryptFramePublicKey*destkey) ///< Public key to use when encrypting
{
INITMAPS;
g_return_if_fail(NULL != destaddr);
if (NULL == destkey) {
g_hash_table_remove(addr_to_public_key_map, destaddr);
}else{
REF(destaddr);
REF(destkey);
g_hash_table_insert(addr_to_public_key_map, destaddr, destkey);
}
}
开发者ID:JJediny,项目名称:assimilation-official,代码行数:17,代码来源:cryptframe.c
示例18: Vector_add
PVector_ptr Vector_add(PVector_ptr a, PVector_ptr b)
{
REF((heap_object *)a.vector);
REF((heap_object *)b.vector);
int i;
if ( a.vector==NULL || b.vector==NULL || a.vector->length!=b.vector->length ) vector_operation_error();
size_t n = a.vector->length;
PVector_ptr c = PVector_init(0, n);
for (i=0; i<n; i++) c.vector->nodes[i].data = ith(a, i) + ith(b, i); // safe because we have sole ptr to c for now
DEREF((heap_object *)a.vector);
DEREF((heap_object *)b.vector);
return c;
}
开发者ID:syuanivy,项目名称:runtime,代码行数:14,代码来源:wich.c
示例19: ALLOC_AND_ZERO
Index *index_new(Store *store, Analyzer *analyzer, HashSet *def_fields,
bool create)
{
Index *self = ALLOC_AND_ZERO(Index);
HashSetEntry *hse;
/* FIXME: need to add these to the query parser */
self->config = default_config;
mutex_init(&self->mutex, NULL);
self->has_writes = false;
if (store) {
REF(store);
self->store = store;
} else {
self->store = open_ram_store();
create = true;
}
if (analyzer) {
self->analyzer = analyzer;
REF(analyzer);
} else {
self->analyzer = mb_standard_analyzer_new(true);
}
if (create) {
FieldInfos *fis = fis_new(STORE_YES, INDEX_YES,
TERM_VECTOR_WITH_POSITIONS_OFFSETS);
index_create(self->store, fis);
fis_deref(fis);
}
/* options */
self->key = NULL;
self->id_field = intern("id");
self->def_field = intern("id");
self->auto_flush = false;
self->check_latest = true;
REF(self->analyzer);
self->qp = qp_new(self->analyzer);
for (hse = def_fields->first; hse; hse = hse->next) {
qp_add_field(self->qp, (Symbol)hse->elem, true, true);
}
/* Index is a convenience class so set qp convenience options */
self->qp->allow_any_fields = true;
self->qp->clean_str = true;
self->qp->handle_parse_errors = true;
return self;
}
开发者ID:dustin,项目名称:ferret,代码行数:49,代码来源:ind.c
示例20: BN_mod
BN BN::operator%(const BN& mod) const
{
BN result;
BN_mod(PTR(result.dp), BNP, REF(mod.dp), CTX);
printf("HERE!\n");
return result;
}
开发者ID:dyfet,项目名称:libcoimath,代码行数:7,代码来源:mod.cpp
注:本文中的REF函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论