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


C++ UC函数代码示例

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


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

示例1: strpbrk

char *
strpbrk(const char *s, const char *charset)
{
#ifdef FAST_STRPBRK
	uint8_t set[256], inv[256], idx = 0;
#else
	static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
	uint8_t set[32];

	(void)memset(set, 0, sizeof(set));
#endif

	_DIAGASSERT(s != NULL);
	_DIAGASSERT(charset != NULL);

	if (charset[0] == '\0')
		return NULL;
	if (charset[1] == '\0')
		return strchr(s, charset[0]);

	for (; *charset != '\0'; ++charset)
		ADD_TO_SET(UC(*charset));

	for (; *s != '\0'; ++s)
		if (IS_IN_SET(UC(*s)))
			return __UNCONST(s);
	return NULL;
}
开发者ID:Henauxg,项目名称:minix,代码行数:28,代码来源:strpbrk.c

示例2: main1

static void main1(TInput *v) {
    Tform *t;
    UC(tform_ini(&t));
    UC(input2form(v, /**/ &t));
    UC(process(t));
    tform_fin(t);
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:7,代码来源:main.cpp

示例3: Sg_MakePseudoRandom

SgObject Sg_MakePseudoRandom(SgString *name, SgObject seed)
{
  const char *cname = Sg_Utf32sToUtf8s(name);
  int wprng = find_prng(cname), err;
  SgBuiltinPrng *prng;
  
  if (wprng == -1) {
    Sg_Error(UC("%A is not supported"), name);
    return SG_UNDEF;
  }

  prng = make_prng(name);
  SG_BUILTIN_PRNG(prng)->wprng = wprng;
  err = prng_descriptor[wprng].start(&prng->prng);
  if (err != CRYPT_OK) goto err;

  if (!SG_FALSEP(seed)) {
    if (SG_BVECTORP(seed)) {
      err = prng_descriptor[wprng]
	.add_entropy(SG_BVECTOR_ELEMENTS(seed), 
		     SG_BVECTOR_SIZE(seed), &prng->prng);
      if (err != CRYPT_OK) goto err;
    } else { goto err; }
  }

  err = prng_descriptor[wprng].ready(&prng->prng);
  if (err != CRYPT_OK) goto err;

  Sg_RegisterFinalizer(prng, finalize_prng, NULL);
  return SG_OBJ(prng);
 err:
  Sg_Error(UC("Failed to initialize pseudo random: %A"),
	   Sg_MakeStringC(error_to_string(err)));
  return SG_UNDEF;
}
开发者ID:spurious,项目名称:sagittarius-scheme-mirror,代码行数:35,代码来源:random.c

示例4: main0

void main0(int n) {
    int i;
    RNDunif *r;
    UC(rnd_ini(42, 42, 42, 42, /**/ &r));
    for (i = 0; i < n; i++)
        printf("%10.6e\n", rnd_get(r));
    UC(rnd_fin(r));
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:8,代码来源:main.cpp

示例5: comparator_print

static void comparator_print(SgObject o, SgPort *port, SgWriteContext *ctx)
{
  SgComparator *c = SG_COMPARATOR(o);
  if (SG_FALSEP(c->name)) {
    Sg_Printf(port, UC("#<comparator %p>"), c);
  } else {
    Sg_Printf(port, UC("#<comparator %S>"), c->name);
  }
}
开发者ID:ktakashi,项目名称:sagittarius-scheme,代码行数:9,代码来源:compare.c

示例6: inet_ntoa_b

void inet_ntoa_b(struct in_addr addr, char *str)
{
    char *p;

    /* Setup locals */
    p = (char *) &addr;

    sprintf(str, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
}
开发者ID:phoboz,项目名称:vmx,代码行数:9,代码来源:inetLib.c

示例7: UC

char *inet_ntoa_r(struct in_addr in, char *buf, int bufsize)
{
	register char *p;

	p = (char *)&in;
#define	UC(b)	(((int)b)&0xff)
	(void)snprintf(buf, bufsize,
				   "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
	return (buf);
}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:10,代码来源:inet_ntoa.c

示例8: _inet_ntoa

char * _inet_ntoa(struct in_addr in)
{
	static char b[18];
	register char *p;

	p = (char *)&in;
#define	UC(b)	(((int)b)&0xff)
	(void)snprintf(b, sizeof(b),
	    "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
	return (b);
}
开发者ID:hanzhang0116,项目名称:TrafficReductionSnort,代码行数:11,代码来源:spp_entropy.c

示例9: PJ_DEF

/*
 * Convert an Internet host address given in network byte order
 * to string in standard numbers and dots notation.
 */
PJ_DEF(char*) pj_inet_ntoa(pj_in_addr in)
{
#define	UC(b)	(((int)b)&0xff)
    static char b[18];
    char *p;

    p = (char *)&in;
    pj_snprintf(b, sizeof(b), "%d.%d.%d.%d", 
	       UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));

    return b;
}
开发者ID:Jopie64,项目名称:pjsip,代码行数:16,代码来源:sock_linux_kernel.c

示例10: main

int main(int argc, char **argv) {
    Sim *sim;
    Config *cfg;
    int rank, size, dims[3];
    MPI_Comm cart;
    int restart;

    m::ini(&argc, &argv);

    m::get_dims(&argc, &argv, dims);
    m::get_cart(MPI_COMM_WORLD, dims, &cart);

    MC(m::Comm_rank(cart, &rank));
    MC(m::Comm_size(cart, &size));
    msg_ini(rank);
    msg_print("mpi rank/size: %d/%d", rank, size);
    UC(conf_ini(&cfg));
    UC(conf_read(argc, argv, cfg));

    UC(sim_ini(cfg, cart, &sim));
    UC(conf_lookup_bool(cfg, "glb.restart", &restart));
    msg_print("read restart: %s", restart ? "YES" : "NO" );
    if (restart) UC(sim_strt(sim));
    else         UC(sim_gen(sim));
    UC(sim_fin(sim));

    UC(conf_fin(cfg));

    MC(m::Barrier(cart));
    m::fin();
    msg_print("end");
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:32,代码来源:main.cpp

示例11: chain

static void chain(TInput *v, Tform **pt) {
    Tform *t, *t1, *t2;
    t = *pt;

    UC(tform_ini(&t1));
    UC(tform_ini(&t2));
    UC(tform_vector(v->u.a0, v->u.a1,
                    v->u.b0, v->u.b1, /**/ t1));
    UC(tform_chain(t, t1, /**/ t2));
    tform_fin(t1);
    tform_fin(t);
    tform_log(t2);

    *pt = t2;
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:15,代码来源:main.cpp

示例12: io_com_dump

void io_com_dump(MPI_Comm comm, const Coords *coords, const char *name, long id, int n, const int *ii, const float3 *rr) {
    char fname[FILENAME_MAX] = {0}, *data;
    long nchar = 0;
    
    EMALLOC(MAX_CHAR_PER_LINE * n, &data);

    if (m::is_master(comm))
        UC(os_mkdir(BASE));

    gen_fname(name, id, fname);
    
    UC(nchar = swrite(coords, n, ii, rr, /**/ data));
    write_mpi(comm, fname, nchar, data);
    
    EFREE(data);
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:16,代码来源:imp.cpp

示例13: Sg__InitIdentifier

void Sg__InitIdentifier()
{
  /* For future we might want to make identifier <object> to use slot-ref
     but for now.*/
  SgLibrary *clib = Sg_FindLibrary(SG_INTERN("(sagittarius clos)"), TRUE);
  Sg_InitStaticClass(SG_CLASS_IDENTIFIER, UC("<identifier>"), clib, NULL, 0);
}
开发者ID:ktakashi,项目名称:sagittarius-scheme,代码行数:7,代码来源:identifier.c

示例14: strcspn

size_t
strcspn(const char *s, const char *charset)
{
	static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
	const char *t;
	uint8_t set[32];
#define UC(a) ((unsigned int)(unsigned char)(a))

	if (charset[0] == '\0')
		return strlen(s);
	if (charset[1] == '\0') {
		for (t = s; *t != '\0'; ++t)
			if (*t == *charset)
				break;
		return t - s;
	}

	(void)memset(set, 0, sizeof(set));

	for (; *charset != '\0'; ++charset)
		set[UC(*charset) >> 3] |= idx[UC(*charset) & 7];

	for (t = s; *t != '\0'; ++t)
		if (set[UC(*t) >> 3] & idx[UC(*t) & 7])
			break;
	return t - s;
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:27,代码来源:strcspn.c

示例15: main

int main(int argc, char **argv) {
    int dims[3];
    m::ini(&argc, &argv);
    m::get_dims(&argc, &argv, dims); /* eat arguments */
    UC(main1(argc, argv));
    m::fin();
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:7,代码来源:main.cpp


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