当前位置: 首页>>代码示例>>C++>>正文


C++ ccopy函数代码示例

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


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

示例1: builtin_bswap32

static NODE *
builtin_bswap32(const struct bitable *bt, NODE *a)
{
    NODE *f, *t1, *t2, *t3, *t4;

    t1 = buildtree(LS, buildtree(AND, ccopy(a), bcon(255)), bcon(24));
    t2 = buildtree(LS, buildtree(AND, ccopy(a), bcon(255 << 8)), bcon(8));
    t3 = buildtree(AND, buildtree(RS, ccopy(a), bcon(8)), bcon(255 << 8));
    t4 = buildtree(AND, buildtree(RS, a, bcon(24)), bcon(255));
    f = buildtree(OR, buildtree(OR, t1, t2), buildtree(OR, t3, t4));
    return f;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:12,代码来源:builtins.c

示例2: get_home

static inline char*
get_home(void)
{
   const char *env;
   if ((env = getenv("HOME")) && env[0] == '/')
      return ccopy(env);

   struct passwd *pwd;
   if (!(pwd = getpwuid(getuid())) || !pwd->pw_dir || pwd->pw_dir[0] != '/')
      return NULL;

   return ccopy(pwd->pw_dir);
}
开发者ID:Cloudef,项目名称:chck,代码行数:13,代码来源:xdg.c

示例3: argsort

/*
 * Sort arglist so that register assignments ends up last.
 */
static int
argsort(NODE *p)
{
	NODE *q, *r;
	int rv = 0;

	if (p->n_op != CM) {
		if (p->n_op == ASSIGN && p->n_left->n_op == REG &&
		    coptype(p->n_right->n_op) != LTYPE) {
			q = tempnode(0, p->n_type, p->n_df, p->n_ap);
			r = ccopy(q);
			p->n_right = buildtree(COMOP,
			    buildtree(ASSIGN, q, p->n_right), r);
		}
		return rv;
	}
	if (p->n_right->n_op == CM) {
		/* fixup for small structs in regs */
		q = p->n_right->n_left;
		p->n_right->n_left = p->n_left;
		p->n_left = p->n_right;
		p->n_right = p->n_left->n_right;
		p->n_left->n_right = q;
	}
	if (p->n_right->n_op == ASSIGN && p->n_right->n_left->n_op == REG &&
	    coptype(p->n_right->n_right->n_op) != LTYPE) {
		/* move before everything to avoid reg trashing */
		q = tempnode(0, p->n_right->n_type,
		    p->n_right->n_df, p->n_right->n_ap);
		r = ccopy(q);
		p->n_right->n_right = buildtree(COMOP,
		    buildtree(ASSIGN, q, p->n_right->n_right), r);
	}
	if (p->n_right->n_op == ASSIGN && p->n_right->n_left->n_op == REG) {
		if (p->n_left->n_op == CM &&
		    p->n_left->n_right->n_op == STASG) {
			q = p->n_left->n_right;
			p->n_left->n_right = p->n_right;
			p->n_right = q;
			rv = 1;
		} else if (p->n_left->n_op == STASG) {
			q = p->n_left;
			p->n_left = p->n_right;
			p->n_right = q;
			rv = 1;
		}
	}
	return rv | argsort(p->n_left);
}
开发者ID:rheoli,项目名称:pcc,代码行数:52,代码来源:code.c

示例4: tlsinitialexec

/*
 * The "initial exec" tls model.
 */
static NODE *
tlsinitialexec(NODE *p)
{
	NODE *q, *r, *s;
	char *s1, *s2;

	/*
	 * movq %fs:0,%rax
	 * addq [email protected](%rip),%rax
	 */

	q = bcon(0);
	q->n_type = STRTY;

	s = ccopy(r = tempnode(0, INCREF(p->n_type), p->n_df, p->n_ap));
	r = mkx("=r", r);
	r = block(XASM, r, q, INT, 0, 0);

	s1 = "movq %%fs:0,%0\n\taddq ";
	s2 = "@GOTTPOFF(%%rip),%0";
	if (attr_find(p->n_sp->sap, ATTR_SONAME) == NULL) {
		p->n_sp->sap = attr_add(p->n_sp->sap, attr_new(ATTR_SONAME, 1));
		p->n_sp->sap->sarg(0) = p->n_sp->sname;
	}
	r->n_name = mk3str(s1,
	    attr_find(p->n_sp->sap, ATTR_SONAME)->sarg(0), s2);

	r = block(COMOP, r, s, INCREF(p->n_type), p->n_df, p->n_ap);
	r = buildtree(UMUL, r, NIL);
	tfree(p);
	return r;
}
开发者ID:newgenius,项目名称:LiteBSD,代码行数:35,代码来源:local.c

示例5: builtin_va_arg

static NODE *
builtin_va_arg(const struct bitable *bt, NODE *a)
{
    NODE *p, *q, *r, *rv;
    int sz, nodnum;

    /* create a copy to a temp node of current ap */
    p = ccopy(a->n_left);
    q = tempnode(0, p->n_type, p->n_df, p->n_ap);
    nodnum = regno(q);
    rv = buildtree(ASSIGN, q, p);

    r = a->n_right;
    sz = (int)tsize(r->n_type, r->n_df, r->n_ap)/SZCHAR;
    /* add one to ap */
#ifdef BACKAUTO
    rv = buildtree(COMOP, rv , buildtree(PLUSEQ, a->n_left, bcon(sz)));
#else
#error fix wrong eval order in builtin_va_arg
    ecomp(buildtree(MINUSEQ, a->n_left, bcon(sz)));
#endif

    nfree(a->n_right);
    nfree(a);
    r = tempnode(nodnum, INCREF(r->n_type), r->n_df, r->n_ap);
    return buildtree(COMOP, rv, buildtree(UMUL, r, NIL));

}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:28,代码来源:builtins.c

示例6: tlsinitialexec

/*
 * The "initial exec" tls model.
 */
static NODE *
tlsinitialexec(NODE *p)
{
	NODE *q, *r, *s;
	char *s1, *s2;

	/*
	 * movq %fs:0,%rax
	 * addq [email protected](%rip),%rax
	 */

	q = bcon(0);
	q->n_type = STRTY;

	s = ccopy(r = tempnode(0, INCREF(p->n_type), p->n_df, p->n_ap));
	r = mkx("=r", r);
	r = block(XASM, r, q, INT, 0, 0);

	s1 = "movq %%fs:0,%0\n\taddq ";
	s2 = "@GOTTPOFF(%%rip),%0";
	if (p->n_sp->soname == NULL)
		p->n_sp->soname = p->n_sp->sname;
	r->n_name = mk3str(s1, p->n_sp->soname, s2);

	r = block(COMOP, r, s, INCREF(p->n_type), p->n_df, p->n_ap);
	r = buildtree(UMUL, r, NIL);
	tfree(p);
	return r;
}
开发者ID:MoochMcGee,项目名称:pcc-optimized,代码行数:32,代码来源:local.c

示例7: testCommuns

static void testCommuns(FragTrap &ft, ScavTrap &st)
{
    FragTrap copy(ft);
    FragTrap test = copy;

    ft.takeDmg(35);
    ft.takeDmg(35);
    ft.takeDmg(100);

    ft.beRepaired(80);
    ft.beRepaired(80);

    ft.rangeAttack("farfaraway");
    ft.meleeAttack("closeTaget");

    ScavTrap ccopy(st);
    ScavTrap ttest = ccopy;

    st.takeDmg(35);
    st.takeDmg(35);
    st.takeDmg(100);

    st.beRepaired(80);
    st.beRepaired(80);
    st.rangeAttack("farfaraway");
    st.meleeAttack("closeTaget");

}
开发者ID:nyhu,项目名称:PCPP,代码行数:28,代码来源:main.cpp

示例8: xdg_get_path

char*
xdg_get_path(const char *xdg_env, const char *default_path)
{
   assert(xdg_env && default_path && default_path[0] != '/');

   if (!xdg_env || !default_path || default_path[0] == '/')
      return NULL;

   const char *xdg_dir;
   if ((xdg_dir = getenv(xdg_env)) && xdg_dir[0] == '/')
      return strip_slash(ccopy(xdg_dir));

   char *home;
   if (!(home = get_home()))
      return NULL; /** fatal! */

   const size_t len = snprintf(NULL, 0, "%s/%s", home, default_path) + 1;

   char *path;
   if (!(path = calloc(1, len))) {
      free(home);
      return NULL; /** fatal! */
   }

   snprintf(path, len, "%s/%s", home, default_path);
   free(home);
   return path;
}
开发者ID:Cloudef,项目名称:chck,代码行数:28,代码来源:xdg.c

示例9: builtin_isany

static NODE *
builtin_isany(NODE *a, TWORD rt, int cmpt)
{
    NODE *p, *q;
    TWORD t;

    if ((t = mtcheck(a)) == 0)
        return bcon(0);
    p = buildtree(OROR, mtisnan(a->n_left), mtisnan(a->n_right));
    p = buildtree(NOT, p, NIL);
    q = buildtree(cmpt, cast(ccopy(a->n_left), t, 0),
                  cast(ccopy(a->n_right), t, 0));
    p = buildtree(ANDAND, p, q);
    tfree(a);
    return p;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:16,代码来源:builtins.c

示例10: mtisnan

/*
 * Handle the builtin macros for the math functions is*
 * To get something that is be somewhat generic assume that 
 * isnan() is a real function and that cast of a NaN type 
 * to double will still be a NaN.
 */
static NODE *
mtisnan(NODE *p)
{
	NODE *q = block(NAME, NIL, NIL, INT, 0, 0);

	return binhelp(q, cast(ccopy(p), DOUBLE, 0), INT, "isnan");
}
开发者ID:MoochMcGee,项目名称:pcc-optimized,代码行数:13,代码来源:builtins.c

示例11: MWcopy_one_wavelet_matrix

/* special function to 2D slice of 3D matrix z for "wavelet" element of
the work space.  Result is copied to a fortran like output vector, zwork,
with the individual channel results in the rows of the output matrix.
An offset of ts samples from the beginning is given and nt_used samples
are blindly copied to the output matrix.  No error checking is made in
this function as it just assumes this was done earlier.  Uses sunperf
C interface to BLAS functions.  Note z[][][] is assumed to be indexed
left to right as:  wavelet number, channel, timelag.

This function is a little silly because it is so short, but it is repeatedly
and has some pretty obscure indexing.  I hope this clarifies rather than
confuses the algorithm.

Author:  Gary Pavlis
Written: December 2001
*/
void MWcopy_one_wavelet_matrix(complex ***z,int wavelet,complex *zwork,
			int nchan, int ts, int nt_used)
{
	int i;

	for(i=0;i<nchan;++i)
		ccopy(nt_used,(z[wavelet][i])+ts,1,zwork+i,nchan);
}
开发者ID:Nikolaus,项目名称:antelope_contrib,代码行数:24,代码来源:MWstack.c

示例12: AST_OPTIONAL_API_NAME

int AST_OPTIONAL_API_NAME(ast_adsi_display)(unsigned char *buf, int page, int line, int just, int wrap,
		 char *col1, char *col2)
{
	int bytes = 0;

	/* Sanity check line number */

	if (page) {
		if (line > 4) return -1;
	} else {
		if (line > 33) return -1;
	}

	if (line < 1) {
		return -1;
	}
	/* Parameter type */
	buf[bytes++] = ADSI_LOAD_VIRTUAL_DISP;

	/* Reserve space for size */
	bytes++;

	/* Page and wrap indicator */
	buf[bytes++] = ((page & 0x1) << 7) | ((wrap & 0x1) << 6) | (line & 0x3f);

	/* Justification */
	buf[bytes++] = (just & 0x3) << 5;

	/* Omit highlight mode definition */
	buf[bytes++] = 0xff;

	/* Primary column */
	bytes+= ccopy(buf + bytes, (unsigned char *)col1, 20);

	/* Delimiter */
	buf[bytes++] = 0xff;

	/* Secondary column */
	bytes += ccopy(buf + bytes, (unsigned char *)col2, 20);

	/* Update length */
	buf[1] = bytes - 2;

	return bytes;

}
开发者ID:mehulsbhatt,项目名称:asterisk,代码行数:46,代码来源:res_adsi.c

示例13: ccopy

void Frame::circle (const Circle& circle)
{
    Circle ccopy(circle);
    ccopy.xc += originX;
    ccopy.yc += originY;
    fixFillColor(&ccopy);
    fixStrokeStyle(&ccopy);
    display->circle(ccopy);
}
开发者ID:rumkex,项目名称:GPSTk,代码行数:9,代码来源:Frame.cpp

示例14: func_cvec_set

void func_cvec_set(func_t *f, int i, func_t *g)
{
  func_t *a=NULL;
  if(f==NULL || func_ptype(f)!=FUNC_P_CVEC || f->p.rvec==NULL || i<0 || i>=f->p.rvec->n){ FUNC_ERROR_ARG2("func_cvec_set",f,g); }
  a=func_evalf(FR(g));
  if(func_is_real(a))        { ccopy_r(func_cvec_at(f,i),func_real_p(a)); }
  else if(func_is_complex(a)){ ccopy  (func_cvec_at(f,i),func_complex_p(a)); }
  else                       { FUNC_ERROR_ARG2("func_cvec_set",f,g); }
  a=func_del(a);
}
开发者ID:wenxuegege,项目名称:libis,代码行数:10,代码来源:func_cvec.c

示例15: builtin_islessgreater

static NODE *
builtin_islessgreater(const struct bitable *bt, NODE *a)
{
    NODE *p, *q, *r;
    TWORD t;

    if ((t = mtcheck(a)) == 0)
        return bcon(0);
    p = buildtree(OROR, mtisnan(a->n_left), mtisnan(a->n_right));
    p = buildtree(NOT, p, NIL);
    q = buildtree(GT, cast(ccopy(a->n_left), t, 0),
                  cast(ccopy(a->n_right), t, 0));
    r = buildtree(LT, cast(ccopy(a->n_left), t, 0),
                  cast(ccopy(a->n_right), t, 0));
    q = buildtree(OROR, q, r);
    p = buildtree(ANDAND, p, q);
    tfree(a);
    return p;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:19,代码来源:builtins.c


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