您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CEIL函数代码示例

51自学网 2021-06-01 19:58:08
  C++
这篇教程C++ CEIL函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ep2_mul_fix_yaowi

void ep2_mul_fix_yaowi(ep2_t r, ep2_t *t, bn_t k) {	int i, j, l;	ep2_t a;	uint8_t win[CEIL(2 * FP_BITS, EP_DEPTH)];	ep2_null(a);	TRY {		ep2_new(a);		ep2_set_infty(r);		ep2_set_infty(a);		l = CEIL(2 * FP_BITS, EP_DEPTH);		bn_rec_win(win, &l, k, EP_DEPTH);		for (j = (1 << EP_DEPTH) - 1; j >= 1; j--) {			for (i = 0; i < l; i++) {				if (win[i] == j) {					ep2_add(a, a, t[i]);				}			}			ep2_add(r, r, a);		}		ep2_norm(r, r);	}	CATCH_ANY {		THROW(ERR_CAUGHT);	}	FINALLY {		ep2_free(a);	}}
开发者ID:cryptobiu,项目名称:libscapi,代码行数:33,


示例2: jgfs_enlarge

bool jgfs_enlarge(struct jgfs_dir_ent *dir_ent, uint32_t new_size) {	uint32_t clust_size = jgfs_clust_size();		if (new_size <= dir_ent->size) {		errx(1, "jgfs_enlarge: new_size is not larger");	}		bool nospc = false;	uint16_t clust_before = CEIL(dir_ent->size, clust_size),		clust_after = CEIL(new_size, clust_size);	fat_ent_t new_addr;		if (clust_before != clust_after) {		/* special case for zero-size files */		if (dir_ent->size == 0) {			if (jgfs_fat_find(FAT_FREE, &new_addr)) {				dir_ent->begin = new_addr;				jgfs_fat_write(new_addr, FAT_EOF);								clust_before = 1;			} else {				return false;			}		}				fat_ent_t this = dir_ent->begin, next;				for (uint16_t i = 1; i < clust_after; ++i) {			next = jgfs_fat_read(this);						/* this means the filesystem is inconsistent */			if (this == FAT_EOF && i < clust_before) {				warnx("jgfs_enlarge: found premature FAT_EOF in clust chain");				clust_before = i;			}						if (i >= clust_before) {				if (jgfs_fat_find(FAT_FREE, &new_addr)) {					jgfs_fat_write(this, new_addr);					jgfs_fat_write(new_addr, FAT_EOF);										this = new_addr;				} else {					clust_after = i - 1;					new_size = clust_after * clust_size;					nospc = true;					break;				}			} else {				this = next;			}		}	}		jgfs_zero_span(dir_ent, dir_ent->size, new_size - dir_ent->size);		dir_ent->size = new_size;		return !nospc;}
开发者ID:jgottula,项目名称:jgfs,代码行数:60,


示例3: _fill_polygon_gray8

static int_fill_polygon_gray8(uint8_t *img,        int npoints, Edge *e, uint8_t intensity,         int w, int h, int rowstride){    int i, j;    float *xx;    int ymin, ymax;    float y;    if (npoints <= 0) return 0;    /* Find upper and lower polygon boundary (within image) */    ymin = e[0].ymin;    ymax = e[0].ymax;    for (i = 1; i < npoints; i++) {        if (e[i].ymin < ymin) ymin = e[i].ymin;        if (e[i].ymax > ymax) ymax = e[i].ymax;    }    if (ymin < 0) ymin = 0;    if (ymax >= h) ymax = h-1;    /* Process polygon edges */    xx = malloc(npoints * sizeof(float));    if (!xx) return -1;    for (;ymin <= ymax; ymin++) {        y = ymin+0.5F;        for (i = j = 0; i < npoints; i++) {            if (y >= e[i].ymin && y <= e[i].ymax) {                if (e[i].d == 0)                    draw_hline_gray8(img, e[i].xmin, ymin, e[i].xmax,                             intensity, w, h, rowstride);                else                    xx[j++] = (y-e[i].y0) * e[i].dx + e[i].x0;            }        }        if (j == 2) {            if (xx[0] < xx[1])                draw_hline_gray8(img, CEIL(xx[0]-0.5), ymin, FLOOR(xx[1]+0.5),                        intensity, w, h, rowstride);            else                draw_hline_gray8(img, CEIL(xx[1]-0.5), ymin, FLOOR(xx[0]+0.5),                        intensity, w, h, rowstride);        } else {            qsort(xx, j, sizeof(float), x_cmp);            for (i = 0; i < j-1 ; i += 2)                draw_hline_gray8(img, CEIL(xx[i]-0.5), ymin, FLOOR(xx[i+1]+0.5),                        intensity, w, h, rowstride);        }    }    free(xx);    return 0;}
开发者ID:Patrick6289,项目名称:navguide,代码行数:57,


示例4: rfbScaledCorrection

/* So, all of the encodings point to the ->screen->frameBuffer, * We need to change this! */void rfbScaledCorrection(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int *x, int *y, int *w, int *h, char *function){    double x1,y1,w1,h1, x2, y2, w2, h2;    double scaleW = ((double) to->width) / ((double) from->width);    double scaleH = ((double) to->height) / ((double) from->height);    /*     * rfbLog("rfbScaledCorrection(%p -> %p, %dx%d->%dx%d (%dXx%dY-%dWx%dH)/n",     * from, to, from->width, from->height, to->width, to->height, *x, *y, *w, *h);     */    /* If it's the original framebuffer... */    if (from==to) return;    x1 = ((double) *x) * scaleW;    y1 = ((double) *y) * scaleH;    w1 = ((double) *w) * scaleW;    h1 = ((double) *h) * scaleH;    /*cast from double to int is same as "*x = floor(x1);" */    x2 = FLOOR(x1);    y2 = FLOOR(y1);    /* include into W and H the jitter of scaling X and Y */    w2 = CEIL(w1 + ( x1 - x2 ));    h2 = CEIL(h1 + ( y1 - y2 ));    /*     * rfbLog("%s (%dXx%dY-%dWx%dH  ->  %fXx%fY-%fWx%fH) {%dWx%dH -> %dWx%dH}/n",     *    function, *x, *y, *w, *h, x2, y2, w2, h2,     *    from->width, from->height, to->width, to->height);     */    /* simulate ceil() without math library */    *x = (int)x2;    *y = (int)y2;    *w = (int)w2;    *h = (int)h2;    /* Small changes for a thumbnail may be scaled to zero */    if (*w==0) (*w)++;    if (*h==0) (*h)++;    /* scaling from small to big may overstep the size a bit */    if (*x+*w > to->width)  *w=to->width - *x;    if (*y+*h > to->height) *h=to->height - *y;}
开发者ID:joecks,项目名称:droid-VNC-server,代码行数:51,


示例5: str9xpec_set_instr

int str9xpec_set_instr(jtag_tap_t *tap, u32 new_instr, tap_state_t end_state){	if( tap == NULL ){		return ERROR_TARGET_INVALID;	}	if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)	{		scan_field_t field;		field.tap = tap;		field.num_bits = tap->ir_length;		field.out_value = calloc(CEIL(field.num_bits, 8), 1);		buf_set_u32(field.out_value, 0, field.num_bits, new_instr);		field.out_mask = NULL;		field.in_value = NULL;		field.in_check_value = NULL;		field.in_check_mask = NULL;		field.in_handler = NULL;		field.in_handler_priv = NULL;		jtag_add_ir_scan(1, &field, end_state);		free(field.out_value);	}	return ERROR_OK;}
开发者ID:unnamet,项目名称:estick-jtag,代码行数:28,


示例6: footprint_blob

/* Footprint of a blob ----------------------------------------------------- */void footprint_blob(    ImageOver &blobprint,         // blob foot_print table    const struct blobtype &blob,  // blob description    int   istep,            // number of foot-print samples per one sample    // on projection plane in u,v directions    int   normalise)        // set to 1 if you want normalise. Usually// you may omit it and no normalisation is performed{    // Resize output image and redefine the origin of it    int footmax = CEIL(blob.radius);    blobprint.init(-footmax, footmax, istep, -footmax, footmax, istep);    // Run for Imge class indexes    for (int i = STARTINGY(blobprint()); i <= FINISHINGY(blobprint()); i++)        for (int j = STARTINGX(blobprint()); j <= FINISHINGX(blobprint()); j++)        {            // Compute oversampled index and blob value            double vi, ui;            IMG2OVER(blobprint, i, j, vi, ui);            double r = sqrt(vi * vi + ui * ui);            IMGPIXEL(blobprint, i, j) = blob_proj(r, blob);        }    // Adjust the footprint structure    if (normalise)        blobprint() /= blobprint().sum();}
开发者ID:josegutab,项目名称:scipion,代码行数:28,


示例7: get_chunks_to_complete_relative_chunk

//Given a chunk, calculates the number of the chunks needed to complete a relative chunk, forwards.static inline size_t get_chunks_to_complete_relative_chunk(size_t chunk, size_t chunk_size, size_t other_chunk_size){	uint64_t delta = get_next_relative_chunk_position(chunk, chunk_size, other_chunk_size) - get_chunk_position(chunk, chunk_size);	if (delta)		return CEIL(delta, chunk_size);	return 0;}
开发者ID:gemarcano,项目名称:libctr9,代码行数:8,


示例8: i_sceiling

integer i_sceiling(real *x)#endif{#define CEIL(x) ((int)(x) + ((x) > 0 && (x) != (int)(x)))    return (integer) CEIL(*x);}
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:7,


示例9: cp_ecss_sig

int cp_ecss_sig(bn_t e, bn_t s, uint8_t *msg, int len, bn_t d) {	bn_t n, k, x, r;	ec_t p;	uint8_t hash[MD_LEN];	uint8_t m[len + FC_BYTES];	int result = STS_OK;	bn_null(n);	bn_null(k);	bn_null(x);	bn_null(r);	ec_null(p);	TRY {		bn_new(n);		bn_new(k);		bn_new(x);		bn_new(r);		ec_new(p);		ec_curve_get_ord(n);		do {			bn_rand_mod(k, n);			ec_mul_gen(p, k);			ec_get_x(x, p);			bn_mod(r, x, n);		} while (bn_is_zero(r));		memcpy(m, msg, len);		bn_write_bin(m + len, FC_BYTES, r);		md_map(hash, m, len + FC_BYTES);		if (8 * MD_LEN > bn_bits(n)) {			len = CEIL(bn_bits(n), 8);			bn_read_bin(e, hash, len);			bn_rsh(e, e, 8 * MD_LEN - bn_bits(n));		} else {			bn_read_bin(e, hash, MD_LEN);		}		bn_mod(e, e, n);		bn_mul(s, d, e);		bn_mod(s, s, n);		bn_sub(s, n, s);		bn_add(s, s, k);		bn_mod(s, s, n);	}	CATCH_ANY {		result = STS_ERR;	}	FINALLY {		bn_free(n);		bn_free(k);		bn_free(x);		bn_free(r);		ec_free(p);	}	return result;}
开发者ID:Arash-Afshar,项目名称:relic,代码行数:60,


示例10: create_hashtable

struct hashtable * create_hashtable(unsigned int minsize,						uint32_t (*hashfn) (String key),						boolean (*eqfn) (const String str1, const String str2)){    struct hashtable *h;    unsigned int pindex, size = primes[0];    /* Check requested hashtable isn't too large */    if (minsize > MAX_HASH_TABLE_SIZE) return NULL;    /* Enforce size as prime */    for (pindex=0; pindex < prime_table_length; pindex++) {        if (primes[pindex] >= minsize) { size = primes[pindex]; break; }    }    h = (struct hashtable *)EXIP_MALLOC(sizeof(struct hashtable));    if (NULL == h) return NULL; /*oom*/    h->table = (struct entry **)EXIP_MALLOC(sizeof(struct entry*) * size);    if (NULL == h->table) { EXIP_MFREE(h); return NULL; } /*oom*/    memset(h->table, 0, size * sizeof(struct entry *));    h->tablelength  = size;    h->primeindex   = pindex;    h->entrycount   = 0;    h->hashfn       = hashfn;    h->eqfn         = eqfn;    h->loadlimit    = CEIL(size * max_load_factor);    return h;}
开发者ID:kjussakov,项目名称:exip-eval,代码行数:25,


示例11: exec_viewtiles

static void exec_viewtiles(const char* args, context_t* ctx, debug_t* dbg){    (void)args;    (void)ctx;    if (!dbg->show_tiles) {        dbg->window = window_create(            "Tiles",            (DBG_TILES_PER_ROW) * (TILE_WIDTH + 1),            CEIL(MAX_TILES, DBG_TILES_PER_ROW) * (TILE_HEIGHT + 1)        );        if (dbg->window == NULL) {            printf("Failed to create window/n");            return;        }    } else {        window_free(dbg->window);        dbg->window = NULL;    }    dbg->show_tiles = !dbg->show_tiles;        printf("Toggling tile view./n");}
开发者ID:lmb,项目名称:Spielbub,代码行数:25,


示例12: CEIL

void Column::Resize(size_t num) {	num_tuples_ = num;	const size_t new_num_blocks = CEIL(num, kNumTuplesPerBlock);	const size_t old_num_blocks = blocks_.size();	if (new_num_blocks > old_num_blocks) {    // need to add blocks		// fill up the last block		blocks_[old_num_blocks - 1]->Resize(kNumTuplesPerBlock);		// append new blocks		for (size_t bid = old_num_blocks; bid < new_num_blocks; bid++) {			ColumnBlock* new_block = CreateNewBlock();			new_block->Resize(kNumTuplesPerBlock);			blocks_.push_back(new_block);		}	} else if (new_num_blocks < old_num_blocks) {   // need to remove blocks		for (size_t bid = old_num_blocks - 1; bid > new_num_blocks; bid--) {			delete blocks_.back();			blocks_.pop_back();		}	}	// now the number of block is desired	// correct the size of the last block	size_t num_tuples_last_block = num % kNumTuplesPerBlock;	if (0 < num_tuples_last_block) {		blocks_.back()->Resize(num_tuples_last_block);	}	assert(blocks_.size() == new_num_blocks);}
开发者ID:fzqneo,项目名称:ByteSlice,代码行数:28,


示例13: jg_getattr

int jg_getattr(const char *path, struct stat *buf) {	struct jgfs_dir_clust *parent;	struct jgfs_dir_ent   *child;	int rtn;	if ((rtn = jgfs_lookup(path, &parent, &child)) != 0) {		return rtn;	}		buf->st_nlink = 1;	buf->st_uid = 0;	buf->st_gid = 0;	buf->st_size = child->size;	buf->st_blocks = CEIL(child->size, jgfs_clust_size());	buf->st_atime = buf->st_ctime = buf->st_mtime = child->mtime;		if (child->type == TYPE_FILE) {		buf->st_mode = 0644 | S_IFREG;	} else if (child->type == TYPE_DIR) {		buf->st_mode = 0755 | S_IFDIR;	} else if (child->type == TYPE_SYMLINK) {		buf->st_mode = 0777 | S_IFLNK;	} else {		errx(1, "jg_getattr: unknown type 0x%x", child->type);	}		return 0;}
开发者ID:jgottula,项目名称:jgfs,代码行数:27,


示例14: switch

void FORTE_F_CEIL::executeEvent(int pa_nEIID){  switch(pa_nEIID){    case scm_nEventREQID:      OUT() = CEIL(X());      sendOutputEvent(scm_nEventCNFID);      break;  }}
开发者ID:EstebanQuerol,项目名称:Black_FORTE,代码行数:8,


示例15: access_bank

void access_bank(uint64_t gpu_mask, int shift, uint64_t iter){	int oft = 0;	if(gpu_mask > 0){ 		g_mem_size += gpu_mask;		oft +=  gpu_mask / 4;	}	if(shift >= 0){		g_mem_size += (uint64_t)1 << shift;		oft += ((uint64_t)1 << shift) / 4;	}	g_mem_size +=  farest_dist;	g_mem_size = CEIL(g_mem_size, min_interval);	/* alloc memory. align to a page boundary */	int fd = open("/dev/mem", O_RDWR | O_SYNC);	void *addr = (void *) 0x1000000080000000;	int *memchunk = NULL;		if (fd < 0) {		perror("Open failed");		exit(1);	}	memchunk = mmap(0, g_mem_size,			PROT_READ | PROT_WRITE, 			MAP_SHARED, 			fd, (off_t)addr);	if (memchunk == MAP_FAILED) {		perror("failed to alloc");		exit(1);	}	list = &memchunk[oft];	next = 0; 	struct timespec start, end;	clock_gettime(CLOCK_REALTIME, &start);	/* access banks */	uint64_t naccess = run(iter);	clock_gettime(CLOCK_REALTIME, &end);	uint64_t nsdiff = get_elapsed(&start, &end);	//printf("bandwidth %.2f MB/s/n", 64.0*1000.0*(double)naccess/(double)nsdiff);	if(shift >= 0)		bandwidth[shift] = 64.0 * 1000.0 * (double)naccess/(double)nsdiff;	else		bandwidth[MAX_SHIFT_NUM - 1] = 64.0 * 1000.0 * (double)naccess/(double)nsdiff;		munmap(memchunk, g_mem_size);		close(fd);}
开发者ID:humasama,项目名称:HSA_Conflict_TST,代码行数:56,


示例16: alignTimeUp

static int64_t alignTimeUp(int64_t ts, int unit, int count){	switch (unit) {	case FT_SECOND:		ts = CEIL(ts, count * 1000);		break;	case FT_MINUTE:		ts = CEIL(ts, count * 60 * 1000);		break;	case FT_HOUR:		ts = CEIL(ts, count * 3600 * 1000);		break;	default:		// TODO: more FT_XXX		break;	}	return ts;}
开发者ID:roberty65,项目名称:mdOps,代码行数:19,


示例17: QRenderedFontFT

    QRenderedFontFT(QDiskFont* f, const QFontDef &d) :	QRenderedFont(f,d)    {	QDiskFontFT *df = (QDiskFontFT*)(f->p);	myface=df->face;	selectThisSize();	// A 1-pixel baseline is excluded in Qt/Windows/X11 fontmetrics	// (see QFontMetrics::height())	//	fascent=CEIL(myface->size->metrics.ascender)/64;	fdescent=-FLOOR(myface->size->metrics.descender)/64-1;	fmaxwidth=CEIL(myface->size->metrics.max_advance)/64;	fleading=CEIL(myface->size->metrics.height)/64	    - fascent - fdescent - 1;	// FT has these in font units	funderlinepos = ptsize/200+1;	funderlinewidth = ptsize/200+1;    }
开发者ID:alephzain,项目名称:archos-gpl-gen8,代码行数:19,


示例18: hashtable_expand

static int hashtable_expand(struct hashtable *h){    /* Double the size of the table to accommodate more entries */    struct entry **newtable;    struct entry *e;    struct entry **pE;    unsigned int newsize, i, index;    /* Check we're not hitting max capacity */    if (h->primeindex == (prime_table_length - 1) || primes[h->primeindex + 1] > MAX_HASH_TABLE_SIZE) return 0;    newsize = primes[++(h->primeindex)];    newtable = (struct entry **)EXIP_MALLOC(sizeof(struct entry*) * newsize);    if (NULL != newtable)    {        memset(newtable, 0, newsize * sizeof(struct entry *));        /* This algorithm is not 'stable'. ie. it reverses the list         * when it transfers entries between the tables */        for (i = 0; i < h->tablelength; i++) {            while (NULL != (e = h->table[i])) {                h->table[i] = e->next;                index = indexFor(newsize,e->hash);                e->next = newtable[index];                newtable[index] = e;            }        }        EXIP_MFREE(h->table);        h->table = newtable;    }    /* Plan B: realloc instead */    else     {        newtable = (struct entry **) EXIP_REALLOC(h->table, newsize * sizeof(struct entry *));        if (NULL == newtable) { (h->primeindex)--; return 0; }        h->table = newtable;        memset(newtable[h->tablelength], 0, newsize - h->tablelength);        for (i = 0; i < h->tablelength; i++) {            for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {                index = indexFor(newsize,e->hash);                if (index == i)                {                    pE = &(e->next);                }                else                {                    *pE = e->next;                    e->next = newtable[index];                    newtable[index] = e;                }            }        }    }    h->tablelength = newsize;    h->loadlimit   = CEIL(newsize * max_load_factor);    return -1;}
开发者ID:kjussakov,项目名称:exip-eval,代码行数:55,


示例19: BElementXferBndS

void NS_DIM_PREFIX BElementXferBndS (BNDS **bnds, int n, int proc, int prio){  INT size,i,size0;  size = CEIL(sizeof(INT));  for (i=0; i<n; i++)    if (bnds[i] != NULL)    {      size0 = BND_SIZE(bnds[i]);      size += CEIL(size0) + CEIL(sizeof(INT));      PRINTDEBUG(dom,1,("BElementXferBndS(): Xfer  me %x "                        "%d pid %d n %d size %d/n",                        me,bnds[i],BND_PATCH_ID(bnds[i]),                        BND_N(bnds[i]),BND_SIZE(bnds[i])));    }  DDD_XferAddData(size,DDD_DOMAIN_DATA);}
开发者ID:rolk,项目名称:ug,代码行数:20,


示例20: process_window

//process the current window, and advance to the next one.//Returns a negative number on a failure, a zero when there are still more windows to go, and a 1 when done.static inline int process_window(ctr_crypto_interface *io, write_window *window, size_t sector_size, size_t block_size, void (*input_function)(void *io, void *buffer, uint64_t block, size_t block_count), void (*output_function)(void *io, void *buffer, uint64_t block, size_t block_count)){	//FIXME what if we try to read more than there is disk? Return zeros?	size_t sectors_to_read = (window->window_size - window->window_offset) / sector_size;	int res = ctr_io_read_sector(io->lower_io, window->window + window->window_offset, window->window_size - window->window_offset, window->current_sector, sectors_to_read);	if (res)		return -1;	size_t block_start_offset = window->block_offset;	uint8_t *pos = window->window + block_start_offset;	size_t amount_to_copy = window->window_size - window->window_offset;	if (amount_to_copy > window->buffer_size - window->buffer_offset)		amount_to_copy = window->buffer_size - window->buffer_offset;	//In the case that blocks are aligned to sectors, this is not necessary... FIXME	//only process parts that won't be overwritten completely	//	from block_start_offset to window->window_offset	size_t blocks_to_process = CEIL(window->window_offset - block_start_offset, block_size);	if (!blocks_to_process) blocks_to_process = 1;	output_function(io, pos, window->block, blocks_to_process);	//now copy data from buffer	memcpy(window->window + window->window_offset, window->buffer + window->buffer_offset, amount_to_copy);	window->buffer_offset += amount_to_copy;	blocks_to_process = CEIL(amount_to_copy + window->window_offset - block_start_offset, block_size);	input_function(io, pos, window->block, blocks_to_process);	//We need to write out the full blocks processed actually, not just the sectors	size_t sectors_processed = (amount_to_copy + window->window_offset) / sector_size;	size_t sectors_to_copy = CEIL(blocks_to_process * block_size, sector_size);	res = ctr_io_write_sector(io->lower_io, window->window, sectors_to_copy * sector_size, window->sector);	if (res)		return -2;	//Copy sector that contain part of next block	update_window(window, sectors_processed);	return window->buffer_offset >= window->buffer_size;}
开发者ID:gemarcano,项目名称:libctr9,代码行数:43,


示例21: computeMForULSH

// Computes the parameter <m> of the algorithm, given the parameter// <k> and the desired success probability <successProbability>. Only// meaningful when functions <g> are interdependent (pairs of// functions <u>, where the <m> functions <u> are each k/2-tuples of// independent LSH functions).    //g函数是相关时,有用! 为了减少计算时间IntT computeMForULSH(IntT k, RealT successProbability){  ASSERT((k & 1) == 0); // k should be even in order to use ULSH.  RealT mu = 1 - POW(computeFunctionP(PARAMETER_W_DEFAULT, 1), k / 2);    //1-p1^(k/2)   ,为1 说明c=1  RealT P = successProbability;  RealT d = (1-mu)/(1-P)*1/LOG(1/mu) * POW(mu, -1/(1-mu));     //(p1^k/2)/delta*log(1/(p1^k/2))*((1-p1^k/2)^(-1/(p1^(k/2))))   RealT y = LOG(d);  IntT m = CEIL(1 - y/LOG(mu) - 1/(1-mu));  while (POW(mu, m-1) * (1 + m * (1-mu)) > 1 - P){      //13    m++;  }  return m;}
开发者ID:dodo1211,项目名称:1015_2,代码行数:17,


示例22: ellipsePoint

static voidellipsePoint(int cx, int cy, int w, int h,             float i, int *x, int *y){    float i_cos, i_sin;    float x_f, y_f;    double modf_int;    i_cos = cos(i*M_PI/180);    i_sin = sin(i*M_PI/180);    x_f = (i_cos * w/2) + cx;    y_f = (i_sin * h/2) + cy;    if (modf(x_f, &modf_int) == 0.5) {        *x = i_cos > 0 ? FLOOR(x_f) : CEIL(x_f);    } else {        *x = FLOOR(x_f + 0.5);    }    if (modf(y_f, &modf_int) == 0.5) {        *y = i_sin > 0 ? FLOOR(y_f) : CEIL(y_f);    } else {        *y = FLOOR(y_f + 0.5);    }}
开发者ID:anntzer,项目名称:Pillow,代码行数:22,


示例23: make_even_distribution

// Fill DF with evenly distributed rot & tilt =================================void make_even_distribution(std::vector<double> &rotList, std::vector<double> &tiltList,							double sampling, SymList &SL, bool include_mirror){    int rot_nstep, tilt_nstep = ROUND(180. / sampling) + 1;    double rot_sam, tilt, tilt_sam;    bool append;    tilt_sam = (180. / tilt_nstep);    // Create evenly distributed angles    rotList.clear();    tiltList.clear();    rotList.reserve(20000);  // Normally there are many less directions than 20000    tiltList.reserve(20000); // Set to 20000 to avoid resizing    Matrix2D<double> L(3,3),R(3,3);    for (int tilt_step = 0; tilt_step < tilt_nstep; tilt_step++)    {        tilt = ((double)tilt_step / (tilt_nstep - 1)) * 180.;        if (tilt > 0)            rot_nstep = CEIL(360. * sin(DEG2RAD(tilt)) / sampling);        else            rot_nstep = 1;        rot_sam = 360. / (double)rot_nstep;        for (double rot = 0.; rot < 360.; rot += rot_sam)        {            // Check whether by symmetry or mirror the angle has been included already            append = true;            size_t imax=rotList.size();            double *ptrRot=NULL;            double *ptrTilt=NULL;            if (imax>0)            {            	ptrRot=&rotList[0];            	ptrTilt=&tiltList[0];            }            for (size_t i=0; i<imax; ++i, ++ptrRot, ++ptrTilt)            {                if (!directions_are_unique(rot, tilt, *ptrRot, *ptrTilt, rot_sam, tilt_sam, SL,                                           include_mirror, L, R))                {                    append = false;                    break;                }            }            if (append)            {            	rotList.push_back(rot);            	tiltList.push_back(tilt);            }        }    }}
开发者ID:I2PC,项目名称:scipion,代码行数:52,


示例24: jgfs_reduce

void jgfs_reduce(struct jgfs_dir_ent *dir_ent, uint32_t new_size) {	if (new_size >= dir_ent->size) {		errx(1, "jgfs_reduce: new_size is not smaller");	}		uint16_t clust_before = CEIL(dir_ent->size, jgfs_clust_size()),		clust_after = CEIL(new_size, jgfs_clust_size());		if (clust_before != clust_after) {		fat_ent_t this = dir_ent->begin, next;				for (uint16_t i = 1; i <= clust_before; ++i) {			next = jgfs_fat_read(this);						/* this means the filesystem is inconsistent */			if (this == FAT_EOF && i < clust_before) {				warnx("jgfs_reduce: found premature FAT_EOF in clust chain");				break;			}						if (i == clust_after) {				jgfs_fat_write(this, FAT_EOF);			} else if (i > clust_after) {				jgfs_fat_write(this, FAT_FREE);			}						this = next;		}				/* special case for zero-size files */		if (clust_after == 0) {			jgfs_fat_write(dir_ent->begin, FAT_FREE);			dir_ent->begin = FAT_NALLOC;		}	}		dir_ent->size = new_size;}
开发者ID:jgottula,项目名称:jgfs,代码行数:38,


示例25: BElementGatherBndS

void NS_DIM_PREFIX BElementGatherBndS (BNDS **bnds, int n, int cnt, char *data){  INT size,i;  for (i=0; i<n; i++)    if (bnds[i] != NULL)    {      PRINTDEBUG(dom,1,("BElementGatherBndS(): %d  "                        "me %d %x pid %d n %d size %d/n",i,                        me,bnds[i],BND_PATCH_ID(bnds[i]),                        BND_N(bnds[i]),BND_SIZE(bnds[i])));      size = BND_SIZE(bnds[i]);      memcpy(data,&i,sizeof(INT));      data += CEIL(sizeof(INT));      memcpy(data,bnds[i],size);      data += CEIL(size);    }  i = -1;  memcpy(data,&i,sizeof(INT));}
开发者ID:rolk,项目名称:ug,代码行数:23,


示例26: packRevComp

// pack reverse complement readvoid packRevComp(char *sym, uint8_t *pck, uint8_t len){  memset(pck, 0, CEIL(len, 4)*sizeof(uint8_t));          for (uint32_t i = 0; i < len; i++) {    switch (sym[i]) {    case 'A': setVal(pck, i, 3); break;    case 'C': setVal(pck, i, 2); break;    case 'G': setVal(pck, i, 1); break;    case 'T': setVal(pck, i, 0); break;    default : setVal(pck, i, 0);    }  }}
开发者ID:samuelwong5,项目名称:genomics,代码行数:15,


示例27: str9xpec_handle_part_id_command

int str9xpec_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc){	flash_bank_t *bank;	scan_field_t field;	u8 *buffer = NULL;	jtag_tap_t *tap;	u32 idcode;	str9xpec_flash_controller_t *str9xpec_info = NULL;	if (argc < 1)	{		return ERROR_COMMAND_SYNTAX_ERROR;	}	bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0));	if (!bank)	{		command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]);		return ERROR_OK;	}	str9xpec_info = bank->driver_priv;	tap = str9xpec_info->tap;	buffer = calloc(CEIL(32, 8), 1);	str9xpec_set_instr(tap, ISC_IDCODE, TAP_IRPAUSE);	field.tap = tap;	field.num_bits = 32;	field.out_value = NULL;	field.out_mask = NULL;	field.in_value = buffer;	field.in_check_value = NULL;	field.in_check_mask = NULL;	field.in_handler = NULL;	field.in_handler_priv = NULL;	jtag_add_dr_scan(1, &field, TAP_IDLE);	jtag_execute_queue();	idcode = buf_get_u32(buffer, 0, 32);	command_print(cmd_ctx, "str9xpec part id: 0x%8.8x", idcode);	free(buffer);	return ERROR_OK;}
开发者ID:unnamet,项目名称:estick-jtag,代码行数:49,


示例28: BElementScatterBndS

void NS_DIM_PREFIX BElementScatterBndS (BNDS **bnds, int n, int cnt, char *data){  INT size,i;  BNDS *bs;  memcpy(&i,data,sizeof(INT));  while (i != -1)  {    data += CEIL(sizeof(INT));    bs = (BNDS *) data;    size = BND_SIZE(bs);    PRINTDEBUG(dom,1,("BElementScatterBndS(): %d me %d/n",i,size));    if (bnds[i] == NULL)    {      bs = (BNDS *) memmgr_AllocOMEM((size_t)size,TypeBndS,0,0);      memcpy(bs,data,size);      bnds[i] = bs;    }    data += CEIL(size);    memcpy(&i,data,sizeof(INT));  }}
开发者ID:rolk,项目名称:ug,代码行数:24,


示例29: convert

char* convert(char* s, int numRows) {    int len = strlen(s), unitSize = numRows == 1 ? 1 : numRows-1 << 1, unitCount = CEIL(len, unitSize), i, j;    char* res = (char*)malloc(sizeof(char)*(len + 1)), *p =  res;    for(i = 0; i < numRows; i++) {        for(j = 0; j < unitCount; j++) {            if(i == 0 || i == numRows - 1) {                PUT_IF_EXISTS(p, s, len, j*unitSize + i);            } else {                PUT_IF_EXISTS(p, s, len, j*unitSize + i);                PUT_IF_EXISTS(p, s, len, (j + 1)*unitSize - i);            }        }    }    *p = '/0';    return res;}
开发者ID:Moonshile,项目名称:AlgorithmCandy,代码行数:16,



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


C++ CEILING函数代码示例
C++ CEGUI_THROW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。