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

C++ rounddown函数代码示例

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

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



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

示例1: sparse_dump_mark

/*
 * Include or exclude pages in a sparse dump, by half-open virtual
 * address interval (which may wrap around the end of the space).
 */
static void
sparse_dump_mark(vaddr_t vbegin, vaddr_t vend, int includep)
{
	pmap_t pmap;
	paddr_t p;
	vaddr_t v;

	/*
	 * If a partial page is called for, the whole page must be included.
	 */
	if (includep) {
		vbegin = rounddown(vbegin, PAGE_SIZE);
		vend = roundup(vend, PAGE_SIZE);
	} else {
		vbegin = roundup(vbegin, PAGE_SIZE);
		vend = rounddown(vend, PAGE_SIZE);
	}

	pmap = pmap_kernel();
	for (v = vbegin; v != vend; v += PAGE_SIZE) {
		if (pmap_extract(pmap, v, &p)) {
			if (includep)
				setbit(sparse_dump_physmap, p/PAGE_SIZE);
			else
				clrbit(sparse_dump_physmap, p/PAGE_SIZE);
		}
	}
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:32,代码来源:dumpsys.c


示例2: __xvip_dma_try_format

static void
__xvip_dma_try_format(struct xvip_dma *dma, struct v4l2_pix_format *pix,
		      const struct xvip_video_format **fmtinfo)
{
	const struct xvip_video_format *info;
	unsigned int min_width;
	unsigned int max_width;
	unsigned int min_bpl;
	unsigned int max_bpl;
	unsigned int width;
	unsigned int align;
	unsigned int bpl;

	/* Retrieve format information and select the default format if the
	 * requested format isn't supported.
	 */
	info = xvip_get_format_by_fourcc(pix->pixelformat);
	if (IS_ERR(info))
		info = xvip_get_format_by_fourcc(XVIP_DMA_DEF_FORMAT);

	pix->pixelformat = info->fourcc;
	pix->colorspace = V4L2_COLORSPACE_SRGB;
	pix->field = V4L2_FIELD_NONE;

	/* The transfer alignment requirements are expressed in bytes. Compute
	 * the minimum and maximum values, clamp the requested width and convert
	 * it back to pixels.
	 */
	align = lcm(dma->align, info->bpp);
	min_width = roundup(XVIP_DMA_MIN_WIDTH, align);
	max_width = rounddown(XVIP_DMA_MAX_WIDTH, align);
	width = rounddown(pix->width * info->bpp, align);

	pix->width = clamp(width, min_width, max_width) / info->bpp;
	pix->height = clamp(pix->height, XVIP_DMA_MIN_HEIGHT,
			    XVIP_DMA_MAX_HEIGHT);

	/* Clamp the requested bytes per line value. If the maximum bytes per
	 * line value is zero, the module doesn't support user configurable line
	 * sizes. Override the requested value with the minimum in that case.
	 */
	min_bpl = pix->width * info->bpp;
	max_bpl = rounddown(XVIP_DMA_MAX_WIDTH, dma->align);
	bpl = rounddown(pix->bytesperline, dma->align);

	pix->bytesperline = clamp(bpl, min_bpl, max_bpl);
	pix->sizeimage = pix->bytesperline * pix->height;

	if (fmtinfo)
		*fmtinfo = info;
}
开发者ID:bmouring,项目名称:linux-xlnx,代码行数:51,代码来源:xilinx-dma.c


示例3: pcm512x_pllin_dac_rate

static unsigned long pcm512x_pllin_dac_rate(struct snd_soc_dai *dai,
					    unsigned long osr_rate,
					    unsigned long pllin_rate)
{
	struct snd_soc_codec *codec = dai->codec;
	struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec);
	unsigned long dac_rate;

	if (!pcm512x->pll_out)
		return 0; /* no PLL to bypass, force SCK as DAC input */

	if (pllin_rate % osr_rate)
		return 0; /* futile, quit early */

	/* run DAC no faster than 6144000 Hz */
	for (dac_rate = rounddown(pcm512x_dac_max(pcm512x, 6144000), osr_rate);
	     dac_rate;
	     dac_rate -= osr_rate) {

		if (pllin_rate / dac_rate > 128)
			return 0; /* DAC divider would be too big */

		if (!(pllin_rate % dac_rate))
			return dac_rate;

		dac_rate -= osr_rate;
	}

	return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:30,代码来源:pcm512x.c


示例4: update_range__

static void update_range__(struct sw_flow_match *match,
			   size_t offset, size_t size, bool is_mask)
{
	struct sw_flow_key_range *range = NULL;
	size_t start = rounddown(offset, sizeof(long));
	size_t end = roundup(offset + size, sizeof(long));

	if (!is_mask)
		range = &match->range;
	else if (match->mask)
		range = &match->mask->range;

	if (!range)
		return;

	if (range->start == range->end) {
		range->start = start;
		range->end = end;
		return;
	}

	if (range->start > start)
		range->start = start;

	if (range->end < end)
		range->end = end;
}
开发者ID:fraant,项目名称:openvswitch,代码行数:27,代码来源:flow_netlink.c


示例5: chacha20_simd

static int chacha20_simd(struct blkcipher_desc *desc, struct scatterlist *dst,
			 struct scatterlist *src, unsigned int nbytes)
{
	struct blkcipher_walk walk;
	u32 state[16];
	int err;

	if (nbytes <= CHACHA20_BLOCK_SIZE || !may_use_simd())
		return crypto_chacha20_crypt(desc, dst, src, nbytes);

	blkcipher_walk_init(&walk, dst, src, nbytes);
	err = blkcipher_walk_virt_block(desc, &walk, CHACHA20_BLOCK_SIZE);

	crypto_chacha20_init(state, crypto_blkcipher_ctx(desc->tfm), walk.iv);

	kernel_neon_begin();

	while (walk.nbytes >= CHACHA20_BLOCK_SIZE) {
		chacha20_dosimd(state, walk.dst.virt.addr, walk.src.virt.addr,
				rounddown(walk.nbytes, CHACHA20_BLOCK_SIZE));
		err = blkcipher_walk_done(desc, &walk,
					  walk.nbytes % CHACHA20_BLOCK_SIZE);
	}

	if (walk.nbytes) {
		chacha20_dosimd(state, walk.dst.virt.addr, walk.src.virt.addr,
				walk.nbytes);
		err = blkcipher_walk_done(desc, &walk, 0);
	}

	kernel_neon_end();

	return err;
}
开发者ID:McPrapor,项目名称:kernel_misu,代码行数:34,代码来源:chacha20-neon-glue.c


示例6: elf_ph_sane

static int elf_ph_sane(Elf_Phdr *phdr)
{
  if (rounddown((uintptr_t)phdr, sizeof(Elf_Addr)) != (uintptr_t)phdr) {
     return 0;
  }
  return 1;
}
开发者ID:kl07,项目名称:minix-course,代码行数:7,代码来源:exec_elf.c


示例7: offtab_read_window

static bool
offtab_read_window(struct offtab *offtab, uint32_t blkno, int read_flags)
{
	const uint32_t window_start = rounddown(blkno, offtab->ot_window_size);
	size_t window_bytes;
	off_t window_pos;

	assert(offtab->ot_mode == OFFTAB_MODE_READ);
	assert(ISSET(read_flags, OFFTAB_READ_SEEK) ||
	    (lseek(offtab->ot_fd, 0, SEEK_CUR) == offtab->ot_fdpos) ||
	    ((lseek(offtab->ot_fd, 0, SEEK_CUR) == -1) && (errno == ESPIPE)));

	offtab_compute_window_position(offtab, window_start,
	    &window_bytes, &window_pos);
	const ssize_t n_read = (ISSET(read_flags, OFFTAB_READ_SEEK)
	    ? pread_block(offtab->ot_fd, offtab->ot_window, window_bytes,
		window_pos)
	    : read_block(offtab->ot_fd, offtab->ot_window, window_bytes));
	if (n_read == -1) {
		(*offtab->ot_report)("read offset table at %"PRIuMAX,
		    (uintmax_t)window_pos);
		return false;
	}
	assert(n_read >= 0);
	if ((size_t)n_read != window_bytes) {
		(*offtab->ot_reportx)("partial read of offset table"
		    " at %"PRIuMAX": %zu != %zu",
		    (uintmax_t)window_pos, (size_t)n_read, window_bytes);
		return false;
	}

	offtab->ot_window_start = window_start;

	return true;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:35,代码来源:offtab.c


示例8: swiotlb_set_max_segment

void swiotlb_set_max_segment(unsigned int val)
{
	if (swiotlb_force == SWIOTLB_FORCE)
		max_segment = 1;
	else
		max_segment = rounddown(val, PAGE_SIZE);
}
开发者ID:Anjali05,项目名称:linux,代码行数:7,代码来源:swiotlb.c


示例9: pcm512x_find_sck

static unsigned long pcm512x_find_sck(struct snd_soc_dai *dai,
				      unsigned long bclk_rate)
{
	struct device *dev = dai->dev;
	struct snd_soc_codec *codec = dai->codec;
	struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec);
	unsigned long sck_rate;
	int pow2;

	/* 64 MHz <= pll_rate <= 100 MHz, VREF mode */
	/* 16 MHz <= sck_rate <=  25 MHz, VREF mode */

	/* select sck_rate as a multiple of bclk_rate but still with
	 * as many factors of 2 as possible, as that makes it easier
	 * to find a fast DAC rate
	 */
	pow2 = 1 << fls((pcm512x_pll_max(pcm512x) - 16000000) / bclk_rate);
	for (; pow2; pow2 >>= 1) {
		sck_rate = rounddown(pcm512x_pll_max(pcm512x),
				     bclk_rate * pow2);
		if (sck_rate >= 16000000)
			break;
	}
	if (!pow2) {
		dev_err(dev, "Impossible to generate a suitable SCK\n");
		return 0;
	}

	dev_dbg(dev, "sck_rate %lu\n", sck_rate);
	return sck_rate;
}
开发者ID:020gzh,项目名称:linux,代码行数:31,代码来源:pcm512x.c


示例10: ath10k_bmi_fast_download

int ath10k_bmi_fast_download(struct ath10k *ar,
			     u32 address, const void *buffer, u32 length)
{
	u8 trailer[4] = {};
	u32 head_len = rounddown(length, 4);
	u32 trailer_len = length - head_len;
	int ret;

	ret = ath10k_bmi_lz_stream_start(ar, address);
	if (ret)
		return ret;

	/* copy the last word into a zero padded buffer */
	if (trailer_len > 0)
		memcpy(trailer, buffer + head_len, trailer_len);

	ret = ath10k_bmi_lz_data(ar, buffer, head_len);
	if (ret)
		return ret;

	if (trailer_len > 0)
		ret = ath10k_bmi_lz_data(ar, trailer, 4);

	if (ret != 0)
		return ret;

	/*
	 * Close compressed stream and open a new (fake) one.
	 * This serves mainly to flush Target caches.
	 */
	ret = ath10k_bmi_lz_stream_start(ar, 0x00);

	return ret;
}
开发者ID:Cool-Joe,项目名称:imx23-audio,代码行数:34,代码来源:bmi.c


示例11: mouse_cut_start

/* a mouse button is pressed, start cut operation */
static void
mouse_cut_start(scr_stat *scp)
{
    int i;
    int s;

    if (scp->status & MOUSE_VISIBLE) {
	sc_remove_all_cutmarkings(scp->sc);
	if ((scp->mouse_pos == scp->mouse_cut_start) &&
	    (scp->mouse_pos == scp->mouse_cut_end)) {
	    cut_buffer[0] = '\0';
	    return;
	} else if (skip_spc_right(scp, scp->mouse_pos) >= scp->xsize) {
	    /* if the pointer is on trailing blank chars, mark towards eol */
	    i = skip_spc_left(scp, scp->mouse_pos) + 1;
	    s = spltty();
	    scp->mouse_cut_start =
	        rounddown(scp->mouse_pos, scp->xsize) + i;
	    scp->mouse_cut_end =
	        (scp->mouse_pos / scp->xsize + 1) * scp->xsize - 1;
	    splx(s);
	    cut_buffer[0] = '\r';
	} else {
	    s = spltty();
	    scp->mouse_cut_start = scp->mouse_pos;
	    scp->mouse_cut_end = scp->mouse_cut_start;
	    splx(s);
	    cut_buffer[0] = sc_vtb_getc(&scp->vtb, scp->mouse_cut_start);
	}
	cut_buffer[1] = '\0';
	scp->status |= MOUSE_CUTTING;
    	mark_all(scp);	/* this is probably overkill XXX */
    }
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:35,代码来源:scmouse.c


示例12: mouse_cut_word

/* copy a word under the mouse pointer */
static void
mouse_cut_word(scr_stat *scp)
{
    int start;
    int end;
    int sol;
    int eol;
    int c;
    int j;
    int len;

    /*
     * Because we don't have locale information in the kernel,
     * we only distinguish space char and non-space chars.  Punctuation
     * chars, symbols and other regular chars are all treated alike
     * unless user specified SC_CUT_SEPCHARS in his kernel config file.
     */
    if (scp->status & MOUSE_VISIBLE) {
	sol = rounddown(scp->mouse_pos, scp->xsize);
	eol = sol + scp->xsize;
	c = sc_vtb_getc(&scp->vtb, scp->mouse_pos);
	if (IS_SEP_CHAR(c)) {
	    /* blank space */
	    for (j = scp->mouse_pos; j >= sol; --j) {
		c = sc_vtb_getc(&scp->vtb, j);
	        if (!IS_SEP_CHAR(c))
		    break;
	    }
	    start = ++j;
	    for (j = scp->mouse_pos; j < eol; ++j) {
		c = sc_vtb_getc(&scp->vtb, j);
	        if (!IS_SEP_CHAR(c))
		    break;
	    }
	    end = j - 1;
	} else {
	    /* non-space word */
	    for (j = scp->mouse_pos; j >= sol; --j) {
		c = sc_vtb_getc(&scp->vtb, j);
	        if (IS_SEP_CHAR(c))
		    break;
	    }
	    start = ++j;
	    for (j = scp->mouse_pos; j < eol; ++j) {
		c = sc_vtb_getc(&scp->vtb, j);
	        if (IS_SEP_CHAR(c))
		    break;
	    }
	    end = j - 1;
	}

	/* copy the found word */
	mouse_do_cut(scp, start, end);
	len = strlen(cut_buffer);
	if (cut_buffer[len - 1] == '\r')
	    cut_buffer[len - 1] = '\0';
    }
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:59,代码来源:scmouse.c


示例13: tscm_hwdep_read_queue

static long tscm_hwdep_read_queue(struct snd_tscm *tscm, char __user *buf,
				  long remained, loff_t *offset)
{
	char __user *pos = buf;
	unsigned int type = SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL;
	struct snd_firewire_tascam_change *entries = tscm->queue;
	long count;

	// At least, one control event can be copied.
	if (remained < sizeof(type) + sizeof(*entries)) {
		spin_unlock_irq(&tscm->lock);
		return -EINVAL;
	}

	// Copy the type field later.
	count = sizeof(type);
	remained -= sizeof(type);
	pos += sizeof(type);

	while (true) {
		unsigned int head_pos;
		unsigned int tail_pos;
		unsigned int length;

		if (tscm->pull_pos == tscm->push_pos)
			break;
		else if (tscm->pull_pos < tscm->push_pos)
			tail_pos = tscm->push_pos;
		else
			tail_pos = SND_TSCM_QUEUE_COUNT;
		head_pos = tscm->pull_pos;

		length = (tail_pos - head_pos) * sizeof(*entries);
		if (remained < length)
			length = rounddown(remained, sizeof(*entries));
		if (length == 0)
			break;

		spin_unlock_irq(&tscm->lock);
		if (copy_to_user(pos, &entries[head_pos], length))
			return -EFAULT;

		spin_lock_irq(&tscm->lock);

		tscm->pull_pos = tail_pos % SND_TSCM_QUEUE_COUNT;

		count += length;
		remained -= length;
		pos += length;
	}

	spin_unlock_irq(&tscm->lock);

	if (copy_to_user(buf, &type, sizeof(type)))
		return -EFAULT;

	return count;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:58,代码来源:tascam-hwdep.c


示例14: kfd_doorbell_init

/* Doorbell calculations for device init. */
void kfd_doorbell_init(struct kfd_dev *kfd)
{
	size_t doorbell_start_offset;
	size_t doorbell_aperture_size;
	size_t doorbell_process_limit;

	/*
	 * We start with calculations in bytes because the input data might
	 * only be byte-aligned.
	 * Only after we have done the rounding can we assume any alignment.
	 */

	doorbell_start_offset =
			roundup(kfd->shared_resources.doorbell_start_offset,
					doorbell_process_allocation());

	doorbell_aperture_size =
			rounddown(kfd->shared_resources.doorbell_aperture_size,
					doorbell_process_allocation());

	if (doorbell_aperture_size > doorbell_start_offset)
		doorbell_process_limit =
			(doorbell_aperture_size - doorbell_start_offset) /
						doorbell_process_allocation();
	else
		doorbell_process_limit = 0;

	kfd->doorbell_base = kfd->shared_resources.doorbell_physical_address +
				doorbell_start_offset;

	kfd->doorbell_id_offset = doorbell_start_offset / sizeof(u32);
	kfd->doorbell_process_limit = doorbell_process_limit - 1;

	kfd->doorbell_kernel_ptr = ioremap(kfd->doorbell_base,
						doorbell_process_allocation());

	BUG_ON(!kfd->doorbell_kernel_ptr);

	pr_debug("kfd: doorbell initialization:\n");
	pr_debug("kfd: doorbell base           == 0x%08lX\n",
			(uintptr_t)kfd->doorbell_base);

	pr_debug("kfd: doorbell_id_offset      == 0x%08lX\n",
			kfd->doorbell_id_offset);

	pr_debug("kfd: doorbell_process_limit  == 0x%08lX\n",
			doorbell_process_limit);

	pr_debug("kfd: doorbell_kernel_offset  == 0x%08lX\n",
			(uintptr_t)kfd->doorbell_base);

	pr_debug("kfd: doorbell aperture size  == 0x%08lX\n",
			kfd->shared_resources.doorbell_aperture_size);

	pr_debug("kfd: doorbell kernel address == 0x%08lX\n",
			(uintptr_t)kfd->doorbell_kernel_ptr);
}
开发者ID:0x000000FF,项目名称:edison-linux,代码行数:58,代码来源:kfd_doorbell.c


示例15: smsi2c_ts_feed

int smsi2c_ts_feed(void *args, unsigned char * ts_buffer, int size) 
{
	struct smscore_device_t *coredev = (struct smscore_device_t *)args;
	struct smscore_buffer_t *cb;
	struct SmsMsgHdr_S *phdr;
	int len = 0;
	int quotient, residue;
	int ts_buf_size_188align;
	sms_debug("%s: buffer:0x%p, size:%d\n", __func__, ts_buffer, size);
if (!size || !args)
		return 0;

#define TS_PACKET_SIZE 188
	ts_buf_size_188align = rounddown((MAX_I2C_BUF_SIZE - sizeof(struct SmsMsgHdr_S)), TS_PACKET_SIZE);
	quotient = size / ts_buf_size_188align;
	residue = size % ts_buf_size_188align;

	for (; quotient > 0; quotient--) {
		cb = smscore_getbuffer(coredev);
		if (!cb) {
			sms_err("Unable to allocate data buffer!\n");
			goto exit;
		}
		phdr = (struct SmsMsgHdr_S *)cb->p;
		memset(cb->p, 0, (int)sizeof(struct SmsMsgHdr_S));
		SMS_INIT_MSG_EX(phdr, MSG_SMS_DAB_CHANNEL, HIF_TASK, 1, ts_buf_size_188align + sizeof(struct SmsMsgHdr_S));
		memcpy((u8*)(phdr+1),ts_buffer, ts_buf_size_188align);
		cb->offset = 0;
		cb->size = ts_buf_size_188align + sizeof(struct SmsMsgHdr_S);
		smscore_onresponse(coredev, cb);
		
		ts_buffer += ts_buf_size_188align;
		len += ts_buf_size_188align;
	}
	if (residue) {
		cb = smscore_getbuffer(coredev);
		if (!cb) {
			sms_err("Unable to allocate data buffer!\n");
			goto exit;
		}
		phdr = (struct SmsMsgHdr_S *)cb->p;
		memset(cb->p, 0, (int)sizeof(struct SmsMsgHdr_S));
		SMS_INIT_MSG_EX(phdr, MSG_SMS_DAB_CHANNEL, HIF_TASK, 1, residue + sizeof(struct SmsMsgHdr_S));
		memcpy((u8*)(phdr+1),ts_buffer, residue);
		cb->offset = 0;
		cb->size = residue + sizeof(struct SmsMsgHdr_S);
		smscore_onresponse(coredev, cb);
		
		ts_buffer += residue;
		len += residue;
	}
	
exit:
	return len;

}
开发者ID:iuncuim,项目名称:A476_V1B_5.1_kernel,代码行数:56,代码来源:smsi2c.c


示例16: read_wbuf

void
read_wbuf(int fd, wbuf *buf, xfs_mount_t *mp)
{
	int		res = 0;
	xfs_off_t	lres = 0;
	xfs_off_t	newpos;
	size_t		diff;

	newpos = rounddown(buf->position, (xfs_off_t) buf->min_io_size);

	if (newpos != buf->position)  {
		diff = buf->position - newpos;
		buf->position = newpos;

		buf->length += diff;
	}

	if (source_position != buf->position)  {
		lres = lseek64(fd, buf->position, SEEK_SET);
		if (lres < 0LL)  {
			do_warn(_("%s:  lseek64 failure at offset %lld\n"),
				progname, source_position);
			die_perror();
		}
		source_position = buf->position;
	}

	ASSERT(source_position % source_sectorsize == 0);

	/* round up length for direct I/O if necessary */

	if (buf->length % buf->min_io_size != 0)
		buf->length = roundup(buf->length, buf->min_io_size);

	if (buf->length > buf->size)  {
		do_warn(_("assert error:  buf->length = %d, buf->size = %d\n"),
			buf->length, buf->size);
		killall();
		abort();
	}

	if ((res = read(fd, buf->data, buf->length)) < 0)  {
		do_warn(_("%s:  read failure at offset %lld\n"),
				progname, source_position);
		die_perror();
	}

	if (res < buf->length &&
	    source_position + res == mp->m_sb.sb_dblocks * source_blocksize)
		res = buf->length;
	else
		ASSERT(res == buf->length);
	source_position += res;
	buf->length = res;
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:55,代码来源:xfs_copy.c


示例17: add_aginode_uncertain

/*
 * ok, the uncertain inodes are a set of trees just like the
 * good inodes but all starting inode records are (arbitrarily)
 * aligned on XFS_CHUNK_PER_INODE boundaries to prevent overlaps.
 * this means we may have partials records in the tree (e.g. records
 * without 64 confirmed uncertain inodes).  Tough.
 *
 * free is set to 1 if the inode is thought to be free, 0 if used
 */
void
add_aginode_uncertain(
	struct xfs_mount	*mp,
	xfs_agnumber_t		agno,
	xfs_agino_t		ino,
	int			free)
{
	ino_tree_node_t		*ino_rec;
	xfs_agino_t		s_ino;
	int			offset;

	ASSERT(agno < glob_agcount);
	ASSERT(last_rec != NULL);

	s_ino = rounddown(ino, XFS_INODES_PER_CHUNK);

	/*
	 * check for a cache hit
	 */
	if (last_rec[agno] != NULL && last_rec[agno]->ino_startnum == s_ino)  {
		offset = ino - s_ino;
		if (free)
			set_inode_free(last_rec[agno], offset);
		else
			set_inode_used(last_rec[agno], offset);

		return;
	}

	/*
	 * check to see if record containing inode is already in the tree.
	 * if not, add it
	 */
	ino_rec = (ino_tree_node_t *)
		avl_findrange(inode_uncertain_tree_ptrs[agno], s_ino);
	if (!ino_rec) {
		ino_rec = alloc_ino_node(mp, s_ino);

		if (!avl_insert(inode_uncertain_tree_ptrs[agno],
				&ino_rec->avl_node))
			do_error(
	_("add_aginode_uncertain - duplicate inode range\n"));
	}

	if (free)
		set_inode_free(ino_rec, ino - s_ino);
	else
		set_inode_used(ino_rec, ino - s_ino);

	/*
	 * set cache entry
	 */
	last_rec[agno] = ino_rec;
}
开发者ID:chandanr,项目名称:xfsprogs-dev,代码行数:63,代码来源:incore_ino.c


示例18: board_init_f_alloc_reserve

ulong board_init_f_alloc_reserve(ulong top)
{
	/* Reserve early malloc arena */
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
	top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
#endif
	/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
	top = rounddown(top-sizeof(struct global_data), 16);

	return top;
}
开发者ID:OpenNoah,项目名称:u-boot,代码行数:11,代码来源:board_init.c


示例19: test_hexdump_overflow_set

static void __init test_hexdump_overflow_set(size_t buflen, bool ascii)
{
	unsigned int i = 0;
	int rs = (get_random_int() % 2 + 1) * 16;

	do {
		int gs = 1 << i;
		size_t len = get_random_int() % rs + gs;

		test_hexdump_overflow(buflen, rounddown(len, gs), rs, gs, ascii);
	} while (i++ < 3);
}
开发者ID:Lyude,项目名称:linux,代码行数:12,代码来源:test_hexdump.c


示例20: probe_kernel_read

long probe_kernel_read(void *dst, const void *src, size_t size)
{
	void *psrc = (void *)rounddown((unsigned long)src, PAGE_SIZE);

	if ((unsigned long)src < PAGE_SIZE || size <= 0)
		return -EFAULT;

	if (os_mincore(psrc, size + src - psrc) <= 0)
		return -EFAULT;

	return __probe_kernel_read(dst, src, size);
}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:12,代码来源:maccess.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ roundedIntPoint函数代码示例发布时间:2022-05-30
下一篇:
C++ round_up函数代码示例发布时间: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