本文整理汇总了C++中REF函数的典型用法代码示例。如果您正苦于以下问题:C++ REF函数的具体用法?C++ REF怎么用?C++ REF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了REF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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();
}
示例9: str_gt
bool str_gt(String * s1,String * t)
{
ENTER();
REF((void *)t);
REF((void *)s1);
{EXIT(); return String_gt(s1,t);}
EXIT();
}
示例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();
}
示例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();
}
示例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;
}
示例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
}
示例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;
}
示例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;
}