• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ process_block函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _gvn

LoopInvariantCodeMotion::LoopInvariantCodeMotion(ShortLoopOptimizer *slo, GlobalValueNumbering* gvn, BlockBegin* loop_header, BlockList* loop_blocks)
  : _gvn(gvn), _short_loop_optimizer(slo) {

  TRACE_VALUE_NUMBERING(tty->print_cr("using loop invariant code motion loop_header = %d", loop_header->block_id()));
  TRACE_VALUE_NUMBERING(tty->print_cr("** loop invariant code motion for short loop B%d", loop_header->block_id()));

  BlockBegin* insertion_block = loop_header->dominator();
  if (insertion_block->number_of_preds() == 0) {
    return;  // only the entry block does not have a predecessor
  }

  assert(insertion_block->end()->as_Base() == NULL, "cannot insert into entry block");
  _insertion_point = insertion_block->end()->prev();
  _insert_is_pred = loop_header->is_predecessor(insertion_block);

  BlockEnd *block_end = insertion_block->end();
  _state = block_end->state_before();

  if (!_state) {
    // If, TableSwitch and LookupSwitch always have state_before when
    // loop invariant code motion happens..
    assert(block_end->as_Goto(), "Block has to be goto");
    _state = block_end->state();
  }

  // the loop_blocks are filled by going backward from the loop header, so this processing order is best
  assert(loop_blocks->at(0) == loop_header, "loop header must be first loop block");
  process_block(loop_header);
  for (int i = loop_blocks->length() - 1; i >= 1; i--) {
    process_block(loop_blocks->at(i));
  }
}
开发者ID:dain,项目名称:graal,代码行数:32,代码来源:c1_ValueMap.cpp


示例2: accept_client

void accept_client(void) {
	char buffer[1024];
	struct sockaddr_in cli_addr;
	int n;
	int client;
	socklen_t clilen = sizeof(struct sockaddr_in);

	/* Accept a client: */
	client = accept(s, (struct sockaddr *)&cli_addr, &clilen);

	if(client < 0) {
		warn("Error on accept.");
		return;
	}

	ip4_t r_addr = {cli_addr.sin_addr.s_addr};
	printf("Got client from %d.%d.%d.%d.\n", r_addr.components.p1, r_addr.components.p2, r_addr.components.p3, r_addr.components.p4);

	/* Read data from the client: */
	do {
		bzero(buffer, 1024);
		n = read(client, buffer, 1023);

		if(n < 0) {
			warn("Error reading from socket; breaking connection.");
			close(client);
			return;
		}

		process_block(buffer, n);
	} while(n == 1023);

	process_block(NULL, 0);

	printf("\n");

	/* Write data to the client: */
	const char * output = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";
	n = write(client, output, strlen(output));

	if(n < 0) {
		warn("Error writing to socket; breaking connection.");
		close(client);
		return;
	}

	if(output_file(client, "public/index.html")) {
		close(client);
		return;
	}

	/* Close the connection: */
	close(client);
}
开发者ID:minitech,项目名称:Xeric,代码行数:54,代码来源:server.c


示例3: pdfout_text_get_page

void
pdfout_text_get_page (FILE *stream, fz_context *ctx,
		      pdf_document *doc, int page_number)
{
  fz_stext_sheet *sheet;
  fz_stext_page *text;

  sheet = fz_new_stext_sheet (ctx);

  text = fz_new_stext_page_from_page_number (ctx, &doc->super, page_number,
					     sheet, 0);
  
  /* printf ("in pdfout_text_get_page, page_number: %d, page->len: %d\n", */
  /* 	  page_number, text->len); */

  for (int i = 0; i < text->len; ++i)
    {
      fz_page_block *block = &text->blocks[i];
      if (block->type == FZ_PAGE_BLOCK_TEXT)
	process_block (ctx, stream, block->u.text);
    }
  
  fprintf (stream, "\f\n");

  /* cleanup */
  fz_drop_stext_page (ctx, text);
  fz_drop_stext_sheet (ctx, sheet);
}
开发者ID:amba,项目名称:pdfout,代码行数:28,代码来源:text-extraction.c


示例4: CRYPTO_MALLOC

unsigned char *sha1(const unsigned char *data, unsigned int len) {
	sha1_ctx *ctx = CRYPTO_MALLOC(sizeof(*ctx));
	char *hash = CRYPTO_MALLOC(20);
	int i;

	ctx->overflow = 0;
	ctx->data = data;
	ctx->len = len;
	ctx->datalen = len * 8;
	ctx->next = data;
	ctx->H[0] = 0x67452301;
	ctx->H[1] = 0xEFCDAB89; 
	ctx->H[2] = 0x98BADCFE;
	ctx->H[3] = 0x10325476;
	ctx->H[4] = 0xC3D2E1F0;
	do {
          process_block(ctx);
	} while (ctx->len > 0);
	for (i = 0; i < 5; i++) {
          unsigned int l = long_swap(ctx->H[i]);
          memcpy(hash + i*sizeof(unsigned int), (void *)&l, sizeof(unsigned int));
	}
	CRYPTO_FREE(ctx);
	return hash;
}
开发者ID:0xe,项目名称:win-sshd,代码行数:25,代码来源:sha1.c


示例5: read_block_msg

static bool read_block_msg(struct p2p_message *msg, int64_t fpos)
{
	/* unknown records are invalid */
	if (strncmp(msg->hdr.command, "block",
		    sizeof(msg->hdr.command)))
		return false;

	bool rc = false;

	struct bp_block block;
	bp_block_init(&block);

	struct const_buffer buf = { msg->data, msg->hdr.data_len };
	if (!deser_bp_block(&block, &buf)) {
		fprintf(plog, "brd: block deser fail\n");
		goto out;
	}
	bp_block_calc_sha256(&block);

	if (!bp_block_valid(&block)) {
		fprintf(plog, "brd: block not valid\n");
		goto out;
	}

	rc = process_block(&block, fpos);

out:
	bp_block_free(&block);
	return rc;
}
开发者ID:gitter-badger,项目名称:picocoin,代码行数:30,代码来源:brd.c


示例6: isl_ast_node_get_type

void cpp_from_isl::process_node(isl_ast_node *node)
{
    auto type = isl_ast_node_get_type(node);
    switch(type)
    {
    case isl_ast_node_for:
        process_for(node); break;
    case isl_ast_node_if:
        process_if(node); break;
    case isl_ast_node_block:
        process_block(node); break;
    case isl_ast_node_user:
        process_user(node); break;
    case isl_ast_node_mark:
    {
        // TODO: label the stmt?
        auto marked_node = isl_ast_node_mark_get_node(node);
        process_node(marked_node);
        isl_ast_node_free(marked_node);
        break;
    }
    default:
        throw error("Unexpected AST node type.");
    }
}
开发者ID:l0gicpath,项目名称:stream-lang,代码行数:25,代码来源:cpp_from_isl.cpp


示例7: process_AD

/* ============================== Process Associated Data =================================*/
static void process_AD(
	block W, block Delta_1, const block npub, block param, 
	const u8 *ad, u64 adlen) {	

	block Delta_2, blk, result;
	u8 Is_complete = 1, ozs[16];
	int i; for(i=1; i<16; i++){ozs[i]=0x00;} ozs[0] = 0x80; 

	

	/* ===== make the first block blk based on npub and param ===== */
	load_block(blk, npub, param, 8, 8);
	
	while(1){ 
		
		/* ============= Process the current Block ==================== */
		process_block(Delta_1, Delta_2, result, blk, W, Is_complete, ENCRYPT, 0, AD);
				
		/* === Compute the next Block and updating the pointers and counters ===*/
		if(adlen==0) break; 
		
		else if(adlen <= 16) {
			load_block(blk, ad, ozs, adlen, 16-adlen); 
			if(adlen != 16) Is_complete = 0;
			adlen = 0; 
		}

		else {load_block(blk, ad, ozs, 16, 0); ad +=16; adlen -=16;}
	}

}
开发者ID:0x64616E69656C,项目名称:supercop,代码行数:32,代码来源:encrypt.c


示例8: sys_sem_wait_x

//----------------------------------------------------------------------------------------------------//
//  @func - sys_sem_wait_x
//! @desc
//!   Semaphore wait operation
//!   - Decrement semaphore value
//!   - If value < 0, block
//! @param
//!   - sem is the semaphore reference
//! @return
//!   - 0 on success, -1 on failure
//!     errno set to,
//!     EINVAL - If the semaphore identifier does not refer to a valid semaphore
//!     EIDRM  - If the semaphore was removed forcibly
//! @note
//!   - Renamed away from sys_sem_wait because it conflicts with functions in LWIP.
//----------------------------------------------------------------------------------------------------//
int sys_sem_wait_x (sem_t* sem)
{
    sem_info_t* seminfo = get_sem_by_semt (sem);
    if (seminfo == NULL) {
        kerrno = EINVAL;
	return -1;
    }

    seminfo->sem_value-- ;                                              // Decrement the resource count
    if (seminfo->sem_value < 0)                                         // If resource unavailable
	process_block (&(seminfo->sem_wait_q), PROC_WAIT);

    // Return here on unblock

    // Special. Not part of posix specification. If the semaphore was force_destroy'ed
    // then the process has not really acquired the semaphore when it was unblocked,
    // but rather it is in an interrupted situation. Signal error in this case

    if (seminfo->sem_id == -1) {                                         // If sem invalidated by now
        kerrno = EIDRM;
	return -1;
    }

    return 0 ;
}
开发者ID:BBBSnowball,项目名称:reconos,代码行数:41,代码来源:semaphore.c


示例9: sys_pthread_join

//----------------------------------------------------------------------------------------------------//
//  @func - sys_pthread_join
//! @desc
//!   Suspend current thread till target thread terminates. Then completely detach target thread.
//!   - Verify target is present and is joinable
//!   - Block onto target's join queue
//!   - When unblocked, if thread not already detached, detach it
//!   - if retval is not NULL, then store target's return value in *retval.
//! @param
//!   - target is the thread to join with
//!   - retval is the location to store return value of target thread.
//! @return
//!   - Return 0 on success and return value of target thread in location referenced by retval.
//!   - Return ESRCH, EINVAL as appropriate
//! @note
//!   - none
//----------------------------------------------------------------------------------------------------//
int sys_pthread_join (pthread_t target, void **retval)
{
    pthread_info_t *target_info = pthread_get_info (target);
    pthread_t cur  = sys_pthread_self ();
    pthread_info_t *self = pthread_get_info (cur);

    if (target_info == NULL)
        return ESRCH;

    // @note - Can possibly detect deadlocks here
    if (target_info->state == PTHREAD_STATE_ALIVE) {
        if (target_info->join_thread != NULL)                   // Some other thread already waiting to join
            return EINVAL;                                      // Therefore invalid to join with this target

        target_info->join_thread = self;                        // Block and yield execution to some other context
        process_block (&(target_info->joinq), PROC_WAIT);       // Indicate that self wants to join with target.

        if (retval != NULL)
            *retval = target_info->retval;
    } else if (target_info->state == PTHREAD_STATE_DETACHED)    // Can potentially return success here.
        return ESRCH;                                           // POSIX is not specific about behavior on multiple joins to an already terminated thread.

    if (target_info->state != PTHREAD_STATE_DETACHED)  {        // Target thread already in state PTHREAD_STATE_EXIT. Detach target thread.
        if (retval != NULL)                                     // Thread already detached if detachstate was PTHREAD_STATE_DETACHED,
            *retval = target_info->retval;
        process_invalidate (target_info->parent);               // Clear up corresponding parent structure
        invalidate_thread_info (target_info);
    }

    return 0; // Success
}
开发者ID:BBBSnowball,项目名称:reconos,代码行数:48,代码来源:pthread.c


示例10: process_block

inline void sha1::process_byte(cvc4_uchar8 byte)
{
    block_[block_byte_index_++] = byte;
    ++byte_count_;
    if (block_byte_index_ == 64) {
        block_byte_index_ = 0;
        process_block();
    }
}
开发者ID:kyledewey,项目名称:CVC4,代码行数:9,代码来源:sha1.hpp


示例11: parse_stream

int parse_stream (FILE *stream, void *resblock)
{
  char buffer[BLOCKSIZE + 72];
  size_t sum;


  /* Iterate over full file contents.  */
  while (1)
    {
      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
         computation function processes the whole buffer so that with the
         next round of the loop another block can be read.  */
      size_t n;
      sum = 0;

      /* Read block.  Take care for partial reads.  */
      while (1)
	{
	  n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);

	  sum += n;

	  if (sum == BLOCKSIZE)
	    break;

	  if (n == 0)
	    {
	      /* Check for the error flag IFF N == 0, so that we don't
	         exit the loop after a partial read due to e.g., EAGAIN
	         or EWOULDBLOCK.  */
	      if (ferror (stream))
		return 1;
	      goto process_partial_block;
	    }

	  /* We've read at least one byte, so ignore errors.  But always
	     check for EOF, since feof may be true even though N > 0.
	     Otherwise, we could end up calling fread after EOF.  */
	  if (feof (stream))
	    goto process_partial_block;
	}

      /* Process buffer with BLOCKSIZE bytes.  Note that
         BLOCKSIZE % 64 == 0
       */
      process_block (buffer, BLOCKSIZE);
    }

process_partial_block:

  /* Process any remaining bytes.  */
  if (sum > 0)
    process_bytes (buffer, sum);

  return 0;
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:56,代码来源:a32.c


示例12: process_conf

static int
process_conf(struct sc_profile *profile, scconf_context *conf)
{
	struct state	state;

	memset(&state, 0, sizeof(state));
	state.filename = conf->filename;
	state.profile = profile;
	return process_block(&state, &root_ops, "root", conf->root);
}
开发者ID:Emergya,项目名称:opendnie-debian-packaging,代码行数:10,代码来源:profile.c


示例13: cmac_update

static int cmac_update(drew_mac_t *ctx, const uint8_t *data, size_t len)
{
	struct cmac *c = ctx->ctx;
	const uint8_t *in = data;

	if (len == 0)
		return 0;

	c->nonzero_len = true;

	if (c->boff) {
		const size_t b = MIN(c->blksize - c->boff, len);
		memcpy(c->buf+c->boff, in, b);
		if ((c->boff += b) == c->blksize) {
			if (len != b) {
				process_block(c, c->buf);
				c->boff = 0;
			}
			else
				c->boff = 16;
		}
		len -= b;
		in += b;
	}

	/* The last block must be treated specially, so make sure that this isn't it
	 * by ensuring that there's at least one more byte than the block size.
	 */
	while (len >= c->blksize+1) {
		process_block(c, in);
		len -= c->blksize;
		in += c->blksize;
	}

	if (len) {
		memcpy(c->buf, in, len);
		c->boff = len;
	}

	return 0;
}
开发者ID:bk2204,项目名称:drew,代码行数:41,代码来源:cmac.c


示例14: process_option

/*
 * Process an option block
 */
static int
process_option(struct state *cur, struct block *info,
		const char *name, scconf_block *blk)
{
	sc_profile_t	*profile = cur->profile;
	int		match = 0, i;

	for (i = 0; profile->options[i]; i++)
		match |= !strcmp(profile->options[i], name);
	if (!match && strcmp("default", name))
		return 0;
	return process_block(cur, info, name, blk);
}
开发者ID:Emergya,项目名称:opendnie-debian-packaging,代码行数:16,代码来源:profile.c


示例15: process_key

/*
 * Process a key block
 */
static int
process_key(struct state *cur, struct block *info,
		const char *name, scconf_block *blk)
{
	unsigned int	type, id;
	struct state	state;

	if (get_authid(cur, name, &type, &id))
		return 1;

	init_state(cur, &state);
	state.key = new_key(cur->profile, type, id);
	return process_block(&state, info, name, blk);
}
开发者ID:Emergya,项目名称:opendnie-debian-packaging,代码行数:17,代码来源:profile.c


示例16: process_pin

static int
process_pin(struct state *cur, struct block *info,
		const char *name, scconf_block *blk)
{
	struct state	state;
	unsigned int	id;

	if (map_str2int(cur, name, &id, pinIdNames))
		return 1;

	init_state(cur, &state);
	state.pin = new_pin(cur->profile, id);

	return process_block(&state, info, name, blk);
}
开发者ID:Emergya,项目名称:opendnie-debian-packaging,代码行数:15,代码来源:profile.c


示例17: process_ef

static int
process_ef(struct state *cur, struct block *info,
		const char *name, scconf_block *blk)
{
	struct state	state;

	init_state(cur, &state);
	if (name == NULL) {
		parse_error(cur, "No name given for EF object.");
		return 1;
	}
	if (!(state.file = new_file(cur, name, SC_FILE_TYPE_WORKING_EF)))
		return 1;
	return process_block(&state, info, name, blk);
}
开发者ID:Emergya,项目名称:opendnie-debian-packaging,代码行数:15,代码来源:profile.c


示例18: process_block

string RVRecursiveFunctionLocator::nextRecursiveFunction()
{
	for(; currStmnt; currStmnt = currStmnt->next) {
		if (currStmnt->isFuncDef()){
			currName = ((FunctionDef*) currStmnt)->FunctionName()->name;
			wasFound = false;
			process_block((FunctionDef*) currStmnt);
			//if (wasFound){
			if (true){
				currStmnt = currStmnt->next;
				return currName;
			}
		}
	}
	return "";
}
开发者ID:smaorus,项目名称:rvt,代码行数:16,代码来源:rv_framasum.cpp


示例19: while

void Encode::run()
{
    Stopwatch stopwatch;

    while (next_block())
        process_block();

    stopwatch.stop("[runtime]");

    printf("\n");
    vmpeak(stdout);

    printf("\n");
    printf("output.nomatch      : %zu (%.2f%%)\n", output.nomatch, (output.nomatch/(double)input.nreads)*100.0);
    printf("output.fullmatch    : %zu (%.2f%%)\n", output.nfullmatch, (output.nfullmatch/(double)input.nreads)*100.0);
    printf("output.nrcomplement : %zu (%.2f%%)\n", output.nrcomplement, (output.nrcomplement/(double)input.nreads)*100.0);
    printf("output.nbits        : %zu\n", output.nbits);
    printf("output.nbytes       : %zu (%.2f MB)\n", output.nbits / 8, output.nbits / 8.0 / 1e6);
    printf("output.compression  : %.2f%%\n", ((output.nbits/8.0)/input.nbytes)*100.0);
    printf("\n");
}
开发者ID:tkind94,项目名称:afin---faust,代码行数:21,代码来源:faust-encode.cpp


示例20: cmac_final

static int cmac_final(drew_mac_t *ctx, uint8_t *digest, int flags)
{
	struct cmac *c = ctx->ctx;

	if (!c->nonzero_len) {
		memset(c->buf+1, 0, c->blksize-1);
		c->buf[c->boff] = 0x80;
		xor_aligned2(c->buf, c->k2, BUFFER_SIZE);
	}
	else if (c->boff == c->blksize) {
		xor_aligned2(c->buf, c->k1, BUFFER_SIZE);
	}
	else {
		memset(c->buf+c->boff, 0, c->blksize-c->boff);
		c->buf[c->boff] = 0x80;
		xor_aligned2(c->buf, c->k2, BUFFER_SIZE);
	}
	process_block(c, c->buf);
	memcpy(digest, c->hash, c->taglen);

	return 0;
}
开发者ID:bk2204,项目名称:drew,代码行数:22,代码来源:cmac.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ process_commands函数代码示例发布时间:2022-05-30
下一篇:
C++ process_arguments函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap