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


C++ round_up函数代码示例

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


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

示例1: printk

/* Called from syscall */
static struct bpf_map *bloom_map_alloc(union bpf_attr *attr)
{
        printk("* In function %s *\n", __FUNCTION__);
	return ERR_PTR(-ENOMEM);
#if 0
	struct bpf_bloom *bloom;
	int err, i;

	bloom = kzalloc(sizeof(*bloom), GFP_USER);
	if (!bloom)
		return ERR_PTR(-ENOMEM);

	/* mandatory map attributes */
	bloom->map.key_size = attr->key_size;
	bloom->map.value_size = attr->value_size;
	bloom->map.max_entries = attr->max_entries;

	/* check sanity of attributes.
	 * value_size == 0 may be allowed in the future to use map as a set
	 */
	err = -EINVAL;
	if (bloom->map.max_entries == 0 || bloom->map.key_size == 0 ||
	    bloom->map.value_size == 0)
		goto free_bloom;

	/* hash table size must be power of 2 */
	bloom->n_buckets = roundup_pow_of_two(bloom->map.max_entries);

	err = -E2BIG;
	if (bloom->map.key_size > MAX_BPF_STACK)
		/* eBPF programs initialize keys on stack, so they cannot be
		 * larger than max stack size
		 */
		goto free_bloom;

	err = -ENOMEM;
	/* prevent zero size kmalloc and check for u32 overflow */
	if (bloom->n_buckets == 0 ||
	    bloom->n_buckets > U32_MAX / sizeof(struct hlist_head))
		goto free_bloom;

	bloom->buckets = kmalloc_array(bloom->n_buckets, sizeof(struct hlist_head),
				      GFP_USER | __GFP_NOWARN);

	if (!bloom->buckets) {
		bloom->buckets = vmalloc(bloom->n_buckets * sizeof(struct hlist_head));
		if (!bloom->buckets)
			goto free_bloom;
	}

	for (i = 0; i < bloom->n_buckets; i++)
		INIT_HLIST_HEAD(&bloom->buckets[i]);

	spin_lock_init(&bloom->lock);
	bloom->count = 0;

	bloom->elem_size = sizeof(struct bloom_elem) +
			  round_up(bloom->map.key_size, 8) +
			  bloom->map.value_size;
	return &bloom->map;

free_bloom:
	kfree(bloom);
	return ERR_PTR(err);
#endif
}
开发者ID:tcolgate,项目名称:test,代码行数:67,代码来源:bloomtab.c

示例2: emac_outblk_32bit

static void emac_outblk_32bit(void __iomem *reg, void *data, int count)
{
	writesl(reg, data, round_up(count, 4) / 4);
}
开发者ID:020gzh,项目名称:linux,代码行数:4,代码来源:sun4i-emac.c

示例3: smp_processor_id

{
	struct mm_struct *mm = vma->vm_mm;
	int cpu = smp_processor_id();

	if (cpu_context(cpu, mm) != 0) {
		unsigned long size, flags;
		int huge = is_vm_hugetlb_page(vma);

		ENTER_CRITICAL(flags);
		if (huge) {
			start = round_down(start, HPAGE_SIZE);
			end = round_up(end, HPAGE_SIZE);
			size = (end - start) >> HPAGE_SHIFT;
		} else {
			start = round_down(start, PAGE_SIZE << 1);
			end = round_up(end, PAGE_SIZE << 1);
			size = (end - start) >> (PAGE_SHIFT + 1);
		}
		if (size <= current_cpu_data.tlbsize/2) {
			int oldpid = read_c0_entryhi();
			int newpid = cpu_asid(cpu, mm);

			while (start < end) {
				int idx;

				write_c0_entryhi(start | newpid);
				if (huge)
					start += HPAGE_SIZE;
				else
					start += (PAGE_SIZE << 1);
				mtc0_tlbw_hazard();
开发者ID:RyanMallon,项目名称:linux-ep93xx,代码行数:31,代码来源:tlb-r4k.c

示例4: fname_encrypt

/**
 * fname_encrypt() - encrypt a filename
 *
 * The caller must have allocated sufficient memory for the @oname string.
 *
 * Return: 0 on success, -errno on failure
 */
static int fname_encrypt(struct inode *inode,
			const struct qstr *iname, struct fscrypt_str *oname)
{
	struct ablkcipher_request *req = NULL;
	DECLARE_FS_COMPLETION_RESULT(ecr);
	struct fscrypt_info *ci = inode->i_crypt_info;
	struct crypto_ablkcipher *tfm = ci->ci_ctfm;
	int res = 0;
	char iv[FS_CRYPTO_BLOCK_SIZE];
	struct scatterlist sg;
	int padding = 4 << (ci->ci_flags & FS_POLICY_FLAGS_PAD_MASK);
	unsigned int lim;
	unsigned int cryptlen;

	lim = inode->i_sb->s_cop->max_namelen(inode);
	if (iname->len <= 0 || iname->len > lim)
		return -EIO;

	/*
	 * Copy the filename to the output buffer for encrypting in-place and
	 * pad it with the needed number of NUL bytes.
	 */
	cryptlen = max_t(unsigned int, iname->len, FS_CRYPTO_BLOCK_SIZE);
	cryptlen = round_up(cryptlen, padding);
	cryptlen = min(cryptlen, lim);
	memcpy(oname->name, iname->name, iname->len);
	memset(oname->name + iname->len, 0, cryptlen - iname->len);

	/* Initialize the IV */
	memset(iv, 0, FS_CRYPTO_BLOCK_SIZE);

	/* Set up the encryption request */
	req = ablkcipher_request_alloc(tfm, GFP_NOFS);
	if (!req) {
		printk_ratelimited(KERN_ERR
			"%s: ablkcipher_request_alloc() failed\n", __func__);
		return -ENOMEM;
	}
	ablkcipher_request_set_callback(req,
			CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
			fname_crypt_complete, &ecr);
	sg_init_one(&sg, oname->name, cryptlen);
	ablkcipher_request_set_crypt(req, &sg, &sg, cryptlen, iv);

	/* Do the encryption */
	res = crypto_ablkcipher_encrypt(req);
	if (res == -EINPROGRESS || res == -EBUSY) {
		/* Request is being completed asynchronously; wait for it */
		wait_for_completion(&ecr.completion);
		res = ecr.res;
	}
	ablkcipher_request_free(req);
	if (res < 0) {
		printk_ratelimited(KERN_ERR
				"%s: Error (error code %d)\n", __func__, res);
		return res;
	}

	oname->len = cryptlen;
	return 0;
}
开发者ID:AICP,项目名称:kernel_moto_shamu,代码行数:68,代码来源:fname.c

示例5: _rtld_digest_phdr

/*
 * Process a shared object's program header.  This is used only for the
 * main program, when the kernel has already loaded the main program
 * into memory before calling the dynamic linker.  It creates and
 * returns an Obj_Entry structure.
 */
Obj_Entry *
_rtld_digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry)
{
	Obj_Entry      *obj;
	const Elf_Phdr *phlimit = phdr + phnum;
	const Elf_Phdr *ph;
	int             nsegs = 0;
	Elf_Addr	vaddr;

	obj = _rtld_obj_new();

	for (ph = phdr; ph < phlimit; ++ph) {
		if (ph->p_type != PT_PHDR)
			continue;

		obj->phdr = (void *)(uintptr_t)ph->p_vaddr;
		obj->phsize = ph->p_memsz;
		obj->relocbase = (caddr_t)((uintptr_t)phdr - (uintptr_t)ph->p_vaddr);
		dbg(("headers: phdr %p (%p) phsize %zu relocbase %p",
		    obj->phdr, phdr, obj->phsize, obj->relocbase));
		break;
	}

	for (ph = phdr; ph < phlimit; ++ph) {
		vaddr = (Elf_Addr)(uintptr_t)(obj->relocbase + ph->p_vaddr);
		switch (ph->p_type) {

		case PT_INTERP:
			obj->interp = (const char *)(uintptr_t)vaddr;
			dbg(("headers: %s %p phsize %" PRImemsz,
			    "PT_INTERP", (void *)(uintptr_t)vaddr,
			     ph->p_memsz));
			break;

		case PT_LOAD:
			assert(nsegs < 2);
			if (nsegs == 0) {	/* First load segment */
				obj->vaddrbase = round_down(vaddr);
				obj->mapbase = (caddr_t)(uintptr_t)obj->vaddrbase;
				obj->textsize = round_up(vaddr + ph->p_memsz) -
				    obj->vaddrbase;
			} else {		/* Last load segment */
				obj->mapsize = round_up(vaddr + ph->p_memsz) -
				    obj->vaddrbase;
			}
			++nsegs;
			dbg(("headers: %s %p phsize %" PRImemsz,
			    "PT_LOAD", (void *)(uintptr_t)vaddr,
			     ph->p_memsz));
			break;

		case PT_DYNAMIC:
			obj->dynamic = (Elf_Dyn *)(uintptr_t)vaddr;
			dbg(("headers: %s %p phsize %" PRImemsz,
			    "PT_DYNAMIC", (void *)(uintptr_t)vaddr,
			     ph->p_memsz));
			break;

#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
		case PT_TLS:
			obj->tlsindex = 1;
			obj->tlssize = ph->p_memsz;
			obj->tlsalign = ph->p_align;
			obj->tlsinitsize = ph->p_filesz;
			obj->tlsinit = (void *)(uintptr_t)ph->p_vaddr;
			dbg(("headers: %s %p phsize %" PRImemsz,
			    "PT_TLS", (void *)(uintptr_t)vaddr,
			     ph->p_memsz));
			break;
#endif
#ifdef __ARM_EABI__
		case PT_ARM_EXIDX:
			obj->exidx_start = (void *)(uintptr_t)vaddr;
			obj->exidx_sz = ph->p_memsz;
			dbg(("headers: %s %p phsize %" PRImemsz,
			    "PT_ARM_EXIDX", (void *)(uintptr_t)vaddr,
			     ph->p_memsz));
			break;
#endif
		}
	}
	assert(nsegs == 2);

	obj->entry = entry;
	return obj;
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:92,代码来源:headers.c

示例6: rtl8188eu_xmitframe_complete

s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
{
	struct hal_data_8188e	*haldata = GET_HAL_DATA(adapt);
	struct xmit_frame *pxmitframe = NULL;
	struct xmit_frame *pfirstframe = NULL;

	/*  aggregate variable */
	struct hw_xmit *phwxmit;
	struct sta_info *psta = NULL;
	struct tx_servq *ptxservq = NULL;

	struct list_head *xmitframe_plist = NULL, *xmitframe_phead = NULL;

	u32 pbuf;	/*  next pkt address */
	u32 pbuf_tail;	/*  last pkt tail */
	u32 len;	/*  packet length, except TXDESC_SIZE and PKT_OFFSET */

	u32 bulksize = haldata->UsbBulkOutSize;
	u8 desc_cnt;
	u32 bulkptr;

	/*  dump frame variable */
	u32 ff_hwaddr;

	RT_TRACE(_module_rtl8192c_xmit_c_, _drv_info_, ("+xmitframe_complete\n"));

	/*  check xmitbuffer is ok */
	if (pxmitbuf == NULL) {
		pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
		if (pxmitbuf == NULL)
			return false;
	}

	/* 3 1. pick up first frame */
	rtw_free_xmitframe(pxmitpriv, pxmitframe);

	pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
	if (pxmitframe == NULL) {
		/*  no more xmit frame, release xmit buffer */
		rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
		return false;
	}

	pxmitframe->pxmitbuf = pxmitbuf;
	pxmitframe->buf_addr = pxmitbuf->pbuf;
	pxmitbuf->priv_data = pxmitframe;

	pxmitframe->agg_num = 1; /*  alloc xmitframe should assign to 1. */
	pxmitframe->pkt_offset = 1; /*  first frame of aggregation, reserve offset */

	rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe);

	/*  always return ndis_packet after rtw_xmitframe_coalesce */
	rtw_os_xmit_complete(adapt, pxmitframe);

	/* 3 2. aggregate same priority and same DA(AP or STA) frames */
	pfirstframe = pxmitframe;
	len = xmitframe_need_length(pfirstframe) + TXDESC_SIZE + (pfirstframe->pkt_offset*PACKET_OFFSET_SZ);
	pbuf_tail = len;
	pbuf = round_up(pbuf_tail, 8);

	/*  check pkt amount in one bulk */
	desc_cnt = 0;
	bulkptr = bulksize;
	if (pbuf < bulkptr) {
		desc_cnt++;
	} else {
		desc_cnt = 0;
		bulkptr = ((pbuf / bulksize) + 1) * bulksize; /*  round to next bulksize */
	}

	/*  dequeue same priority packet from station tx queue */
	psta = pfirstframe->attrib.psta;
	switch (pfirstframe->attrib.priority) {
	case 1:
	case 2:
		ptxservq = &(psta->sta_xmitpriv.bk_q);
		phwxmit = pxmitpriv->hwxmits + 3;
		break;
	case 4:
	case 5:
		ptxservq = &(psta->sta_xmitpriv.vi_q);
		phwxmit = pxmitpriv->hwxmits + 1;
		break;
	case 6:
	case 7:
		ptxservq = &(psta->sta_xmitpriv.vo_q);
		phwxmit = pxmitpriv->hwxmits;
		break;
	case 0:
	case 3:
	default:
		ptxservq = &(psta->sta_xmitpriv.be_q);
		phwxmit = pxmitpriv->hwxmits + 2;
		break;
	}
	spin_lock_bh(&pxmitpriv->lock);

	xmitframe_phead = get_list_head(&ptxservq->sta_pending);
	xmitframe_plist = xmitframe_phead->next;
//.........这里部分代码省略.........
开发者ID:020gzh,项目名称:linux,代码行数:101,代码来源:rtl8188eu_xmit.c

示例7: ccci_alloc_smem

int ccci_alloc_smem(int md_id)
{
    ccci_mem_layout_t    *mem_layout_ptr = NULL;
    int                    ret = 0;
    int                    smem_size = 0;
    int                    *smem_vir;
    dma_addr_t            smem_phy;
    int                    i,j, base_virt, base_phy;
    int                    size;

    smem_size = cal_md_smem_size(md_id);
    ret = cfg_md_mem_layout(md_id);
    if(ret < 0) {
        CCCI_MSG_INF(md_id, "ctl", "md mem layout config fail\n");
        return ret;
    }
    mem_layout_ptr = &md_mem_layout_tab[md_id];

#ifdef CCCI_STATIC_SHARED_MEM
    if (md_mem_layout_tab[md_id].smem_region_size < smem_size) {
        CCCI_MSG_INF(md_id, "ctl", "[error]CCCI shared mem isn't enough: 0x%08X\n", smem_size);
        return -ENOMEM;
    }
    smem_phy = mem_layout_ptr->smem_region_phy;
    smem_vir = (int*)ioremap_nocache((unsigned long)smem_phy, smem_size);
    if (!smem_vir) {
        CCCI_MSG_INF(md_id, "ctl", "ccci smem ioremap fail\n");
        return -ENOMEM;
    }

#else // dynamic allocation shared memory

    smem_vir = dma_alloc_coherent(NULL, smem_size, &smem_phy, GFP_KERNEL);
    if (smem_vir == NULL) {
        CCCI_MSG_INF(md_id, "ctl", "ccci smem dma_alloc_coherent fail\n");
        return -CCCI_ERR_GET_MEM_FAIL;
    }
    mem_layout_ptr->smem_region_phy = (unsigned int)smem_phy;
    mem_layout_ptr->smem_region_size = smem_size;

#endif

    mem_layout_ptr->smem_region_vir = (unsigned int)smem_vir;
    CCCI_CTL_MSG(md_id, "ccci_smem_phy=%x, ccci_smem_size=%d, ccci_smem_virt=%x\n",
                 (unsigned int)smem_phy, smem_size, (unsigned int)smem_vir);

    WARN_ON(smem_phy&(0x4000-1)||smem_size&(0x4000-1));

    // Memory allocate done, config for each sub module
    base_virt = (int)smem_vir;
    base_phy = (int)smem_phy;

    // Total
    md_smem_tab[md_id].ccci_smem_vir = base_virt;
    md_smem_tab[md_id].ccci_smem_phy = base_phy;
    md_smem_tab[md_id].ccci_smem_size = smem_size;

    //MD runtime data!! Note: This item must be the first!!!
    md_smem_tab[md_id].ccci_md_runtime_data_smem_base_virt = base_virt;
    md_smem_tab[md_id].ccci_md_runtime_data_smem_base_phy = base_phy;
    md_smem_tab[md_id].ccci_md_runtime_data_smem_size = CCCI_MD_RUNTIME_DATA_SMEM_SIZE;
    base_virt += CCCI_MD_RUNTIME_DATA_SMEM_SIZE;
    base_phy += CCCI_MD_RUNTIME_DATA_SMEM_SIZE;

    // EXP
    md_smem_tab[md_id].ccci_exp_smem_base_virt = base_virt;
    md_smem_tab[md_id].ccci_exp_smem_base_phy = base_phy;
    md_smem_tab[md_id].ccci_exp_smem_size = MD_EX_LOG_SIZE;
    base_virt += MD_EX_LOG_SIZE;
    base_phy += MD_EX_LOG_SIZE;

    //MD Exception expand Info
    md_smem_tab[md_id].ccci_md_ex_exp_info_smem_base_virt = base_virt;
    md_smem_tab[md_id].ccci_md_ex_exp_info_smem_base_phy = base_phy;
    md_smem_tab[md_id].ccci_md_ex_exp_info_smem_size = CCCI_MD_EX_EXP_INFO_SMEM_SIZE;
    base_virt += CCCI_MD_EX_EXP_INFO_SMEM_SIZE;
    base_phy += CCCI_MD_EX_EXP_INFO_SMEM_SIZE;

    //Misc info
    md_smem_tab[md_id].ccci_misc_info_base_virt = base_virt;
    md_smem_tab[md_id].ccci_misc_info_base_phy = base_phy;
    md_smem_tab[md_id].ccci_misc_info_size = CCCI_MISC_INFO_SMEM_SIZE;
    base_virt += CCCI_MISC_INFO_SMEM_SIZE;
    base_phy += CCCI_MISC_INFO_SMEM_SIZE;

    base_virt = round_up(base_virt, 0x1000);
    base_phy = round_up(base_phy, 0x1000);

    // PCM
    md_smem_tab[md_id].ccci_pcm_smem_base_virt = base_virt;
    md_smem_tab[md_id].ccci_pcm_smem_base_phy = base_phy;
    md_smem_tab[md_id].ccci_pcm_smem_size = pcm_smem_size[md_id];
    size = round_up(pcm_smem_size[md_id], 0x1000);
    base_virt += size;
    base_phy += size;

    // LOG
    md_smem_tab[md_id].ccci_mdlog_smem_base_virt = base_virt;
    md_smem_tab[md_id].ccci_mdlog_smem_base_phy = base_phy;
    md_smem_tab[md_id].ccci_mdlog_smem_size = md_log_smem_size[md_id];
//.........这里部分代码省略.........
开发者ID:4Fwolf,项目名称:signal75-kernel-3.10.61,代码行数:101,代码来源:ccci_settings.c

示例8: create_modules_from_initrd

static void
create_modules_from_initrd(struct bootinfo* bi,
                           const uint8_t*   initrd_base,
                           size_t           initrd_bytes)
{
    errval_t err;
    lvaddr_t mmstrings_base = 0;
    lvaddr_t mmstrings      = 0;

    // CPIO archive is crafted such that first file is
    // command-line strings for "modules" - ie menu.lst. The
    // subsequent file follow in the order they appear in
    // menu.lst.arm.
    const uint8_t* data;
    size_t bytes;

    if (cpio_get_file_by_name(initrd_base, initrd_bytes,
                              "menu.lst.modules",
                              &data, &bytes))
    {
        assert(bytes < BASE_PAGE_SIZE);

        mmstrings_base = alloc_mem(BASE_PAGE_SIZE);
        mmstrings      = mmstrings_base;

        STARTUP_PROGRESS();

        // Create cap for strings area in first slot of modulecn
        err = caps_create_new(
                  ObjType_Frame,
                  mem_to_local_phys(mmstrings_base),
                  BASE_PAGE_BITS, BASE_PAGE_BITS,
                  my_core_id,
                  caps_locate_slot(
                      CNODE(spawn_state.modulecn),
                      spawn_state.modulecn_slot++)
                  );
        assert(err_is_ok(err));

        STARTUP_PROGRESS();

        // Copy strings from file into allocated page
        memcpy((void*)mmstrings_base, data, bytes);
        ((char*)mmstrings_base)[bytes] = '\0';

        STARTUP_PROGRESS();

        // Skip first line (corresponds to bootscript in archive)
        strtok((char*)mmstrings_base, "\r\n");

        STARTUP_PROGRESS();

        assert(bi->regions_length == 0);
        int ord = 1;
        const char* name;
        while ((mmstrings = (lvaddr_t)strtok(NULL, "\r\n")) != 0)
        {
            if (!cpio_get_file_by_ordinal(initrd_base, initrd_bytes, ord,
                                          &name, &data, &bytes))
            {
                panic("Failed to find file\n");
            }
            ord++;

            debug(SUBSYS_STARTUP,
                  "Creating caps for \"%s\" (Command-line \"%s\")\n",
                   name, (char*)mmstrings);

            // Copy file from archive into RAM.
            // TODO: Give up archive space.
            size_t   pa_bytes = round_up(bytes, BASE_PAGE_SIZE);
            lpaddr_t pa       = alloc_phys(pa_bytes);
            memcpy((void*)local_phys_to_mem(pa), data, bytes);

            struct mem_region* region = &bi->regions[bi->regions_length++];
            region->mr_type    = RegionType_Module;
            region->mrmod_slot = spawn_state.modulecn_slot;
            region->mrmod_size = pa_bytes;
            region->mrmod_data = mmstrings - mmstrings_base;

            assert((pa & BASE_PAGE_MASK) == 0);
            assert((pa_bytes & BASE_PAGE_MASK) == 0);

            while (pa_bytes != 0)
            {
                assert(spawn_state.modulecn_slot
                       < (1UL << spawn_state.modulecn->cap.u.cnode.bits));
                // create as DevFrame cap to avoid zeroing memory contents
                err = caps_create_new(
                          ObjType_DevFrame, pa, BASE_PAGE_BITS,
                          BASE_PAGE_BITS,
                          my_core_id,
                          caps_locate_slot(
                              CNODE(spawn_state.modulecn),
                              spawn_state.modulecn_slot++)
                          );
                assert(err_is_ok(err));
                pa       += BASE_PAGE_SIZE;
                pa_bytes -= BASE_PAGE_SIZE;
            }
//.........这里部分代码省略.........
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:101,代码来源:startup_arch.c

示例9: main

int main ( int argc, char ** argv )
{
    int init_address=-1;
    int max_align = 0;
    unsigned long curr_size = 0;
    bfd *obj_bfd = NULL;
    bfd_error_type myerr;
    unsigned u = 0, v = 0;
    asymbol **q = NULL;
    asection *s = NULL;
    static struct bfd_link_callbacks link_callbacks;
    static struct bfd_link_order link_order;

    void *current = NULL;
    void *cfd_self      = NULL;
    void *cfd_start     = NULL;
    int   cfd_size      = 0;
    void *the_start     = NULL;
    void *start_address = NULL;
    void *m             = NULL;
    
    fprintf ( stderr, "In BFD fast load test. Reloc_howto_type size %d\n",
              sizeof ( rhtt ) );
    
    if ( argc < 3 ) {
        fprintf ( stderr, "Need an executable (eg raw_gcl.exe) and an object file as arguments.\n" );
    } else {

        memset ( &link_info, 0, sizeof (link_info) );
        memset ( &link_order, 0, sizeof (link_order) );
        memset ( &link_callbacks, 0, sizeof (link_callbacks) );
        

        fprintf ( stderr, "BUILDING EXECUTABLE SYMBOL TABLE FOR %s \n", argv[1] );
        build_symbol_table_bfd ( argv[1] );        

        link_callbacks.add_archive_element=madd_archive_element;
        link_callbacks.multiple_definition=mmultiple_definition;
        link_callbacks.multiple_common=mmultiple_common;
        link_callbacks.add_to_set=madd_to_set;
        link_callbacks.constructor=mconstructor;
        link_callbacks.warning=mwarning;
        link_callbacks.undefined_symbol=mundefined_symbol;
        link_callbacks.reloc_overflow=mreloc_overflow;
        link_callbacks.reloc_dangerous=mreloc_dangerous;
        link_callbacks.unattached_reloc=munattached_reloc;
        link_callbacks.notice = mnotice;
        link_info.callbacks = &link_callbacks;
        link_order.type = bfd_indirect_link_order;

        fprintf ( stderr, "OPENING OBJECT FILE %s\n", argv[2] );
        if ( ! ( obj_bfd = bfd_openr ( argv[2], 0 ) ) ) {
            fprintf ( stderr, "Cannot open bfd.\n" );
        }
        
        if ( ( myerr = bfd_get_error () ) && myerr != 3 ) {
            fprintf ( stderr, "Unknown bfd error code on openr %s %d\n.", argv[2], myerr );
        }
        fflush ( stderr );
        if ( ! bfd_check_format ( obj_bfd, bfd_object ) ) {
            fprintf ( stderr, "Unknown bfd format %s.\n", argv[2] );
        }

        if ( ( myerr = bfd_get_error () ) && myerr != 3 ) {
            fprintf ( stderr, "Unknown bfd error code on check_format %s\n", argv[2] );
        }

        bfd_set_error(0);

        current = NULL;

        fprintf ( stderr, "CALCULATING CURRENT, MAX_ALIGN and ALLOCATING \n\n" );

        for ( s= obj_bfd->sections;s;s=s->next) {

            s->owner = obj_bfd;
            s->output_section = ( s->flags & SEC_ALLOC) ? s : obj_bfd->sections;
            s->output_offset=0;

            if (!(s->flags & SEC_ALLOC))
                continue;

            if (max_align<s->alignment_power)
                max_align=s->alignment_power;

            current=round_up(current,1<<s->alignment_power);

            current+=s->_raw_size;

            fprintf ( stderr,
                      "Section %s: owner = %x, output_offset = %x, "
                      "output_section = %x (%s)\n",
                      s->name, s->owner, s->output_offset, s->output_section,
                      s->output_section->name );
        }

        fprintf ( stderr, "1\n");
        curr_size=(unsigned long)current;
        max_align=1<<max_align;

//.........这里部分代码省略.........
开发者ID:great90,项目名称:gcl,代码行数:101,代码来源:bfdtest.c

示例10: collect_md_settings

static void collect_md_settings(void)
{
	unsigned int tmp;
	unsigned int md1_en = 0;
	unsigned int md2_en = 0;
	unsigned int md3_en = 0;
	unsigned int md5_en = 0;
	md_usage_case = 0;

	printk("[ccci] collect_md_settings\n");

	// MTK_ENABLE_MD*
	if(ccci_get_fo_setting("MTK_ENABLE_MD1", &tmp) == 0) {
		if(tmp > 0)
			md1_en = 1;
	}
	if(ccci_get_fo_setting("MTK_ENABLE_MD2", &tmp) == 0) {
		if(tmp > 0) 
			md2_en = 1;
	}
	if(ccci_get_fo_setting("MTK_ENABLE_MD3", &tmp) == 0) {
		if(tmp > 0) 
			md3_en = 1;
	}
	if(ccci_get_fo_setting("MTK_ENABLE_MD5", &tmp) == 0) {
		if(tmp > 0) 
			md5_en = 1;
	}
	// MTK_MD*_SUPPORT
	if(ccci_get_fo_setting("MTK_MD1_SUPPORT", &tmp) == 0) {
		md_support[MD_SYS1] = tmp;
	}
	if(ccci_get_fo_setting("MTK_MD2_SUPPORT", &tmp) == 0) {
		md_support[MD_SYS2] = tmp;
	}
	if(ccci_get_fo_setting("MTK_MD3_SUPPORT", &tmp) == 0) {
		md_support[MD_SYS3] = tmp;
	}
	if(ccci_get_fo_setting("MTK_MD5_SUPPORT", &tmp) == 0) {
		md_support[MD_SYS5] = tmp;
	}
	// MD*_SIZE
	/*
	 * for legacy CCCI: make share memory start address to be 2MB align, as share 
	 * memory size is 2MB - requested by MD MPU.
	 * for ECCCI: ROM+RAM size will be align to 1M, and share memory is 2K,
	 * 1M alignment is also 2K alignment.
	 */
	if(ccci_get_fo_setting("MD1_SIZE", &tmp) == 0) {
		tmp = round_up(tmp, get_md_smem_align(MD_SYS1));
		md_resv_mem_size[MD_SYS1] = tmp;
	}
	if(ccci_get_fo_setting("MD2_SIZE", &tmp) == 0) {
		tmp = round_up(tmp, get_md_smem_align(MD_SYS2));
		md_resv_mem_size[MD_SYS2] = tmp;
	}
	if(ccci_get_fo_setting("MD3_SIZE", &tmp) == 0) {
		tmp = round_up(tmp, get_md_smem_align(MD_SYS3));
		md_resv_mem_size[MD_SYS3] = tmp;
	}
	// MD*_SMEM_SIZE
	#if 0
	if(ccci_get_fo_setting("MD1_SMEM_SIZE", &tmp) == 0) {
		md_resv_smem_size[MD_SYS1] = tmp;
	}
	#else
	md_resv_smem_size[MD_SYS1] = 2*1024*1024;
	#endif
	#if 0
	if(ccci_get_fo_setting("MD2_SMEM_SIZE", &tmp) == 0) {
		md_resv_smem_size[MD_SYS2] = tmp;
	}
	#else
	md_resv_smem_size[MD_SYS2] = 4*1024*1024;
	#endif
	if(ccci_get_fo_setting("MD3_SMEM_SIZE", &tmp) == 0) {
		md_resv_smem_size[MD_SYS3] = tmp;
	}
	
	// Setting conflict checking
	if(md1_en && (md_resv_smem_size[MD_SYS1]>0) && (md_resv_mem_size[MD_SYS1]>0)) {
		// Setting is OK
	} else if (md1_en && ((md_resv_smem_size[MD_SYS1]<=0) || (md_resv_mem_size[MD_SYS1]<=0))) {
		CCCI_UTIL_ERR_MSG_WITH_ID(MD_SYS1,"FO Setting for md1 wrong: <%d:0x%08X:0x%08X>\n", 
				md1_en, md_resv_mem_size[MD_SYS1], md_resv_smem_size[MD_SYS1]);
		md1_en = 0;
		md_resv_smem_size[MD_SYS1] = 0;
		md_resv_mem_size[MD_SYS1] = 0;
	}

	if(md2_en && (md_resv_smem_size[MD_SYS2]>0) && (md_resv_mem_size[MD_SYS2]>0)) {
		// Setting is OK
	} else if (md2_en && ((md_resv_smem_size[MD_SYS2]<=0) || (md_resv_mem_size[MD_SYS2]<=0))) {
		CCCI_UTIL_ERR_MSG_WITH_ID(MD_SYS2,"FO Setting for md2 wrong: <%d:0x%08X:0x%08X>\n", 
				md2_en, md_resv_mem_size[MD_SYS2], md_resv_smem_size[MD_SYS2]);
		md2_en = 0;
		md_resv_smem_size[MD_SYS2] = 0;
		md_resv_mem_size[MD_SYS2] = 0;
	}

//.........这里部分代码省略.........
开发者ID:CobraJet93,项目名称:kernel-3.10.54,代码行数:101,代码来源:ccci_util_lib_fo.c

示例11: veh_pointer_or_null


//.........这里部分代码省略.........
            mvwprintw( w_pickup, maxitems + 2, 0, _( "[%s] Prev" ),
                       ctxt.get_desc( "PREV_TAB", 1 ) );

            center_print( w_pickup, maxitems + 2, c_light_gray, string_format( _( "[%s] All" ),
                          ctxt.get_desc( "SELECT_ALL", 1 ) ) );

            right_print( w_pickup, maxitems + 2, 0, c_light_gray, string_format( _( "[%s] Next" ),
                         ctxt.get_desc( "NEXT_TAB", 1 ) ) );

            if( update ) { // Update weight & volume information
                update = false;
                for( int i = 9; i < pickupW; ++i ) {
                    mvwaddch( w_pickup, 0, i, ' ' );
                }
                units::mass weight_picked_up = 0_gram;
                units::volume volume_picked_up = 0_ml;
                for( size_t i = 0; i < getitem.size(); i++ ) {
                    if( getitem[i].pick ) {
                        item temp = stacked_here[i].begin()->_item;
                        if( temp.count_by_charges() && getitem[i].count < temp.charges && getitem[i].count != 0 ) {
                            temp.charges = getitem[i].count;
                        }
                        int num_picked = std::min( stacked_here[i].size(),
                                                   getitem[i].count == 0 ? stacked_here[i].size() : getitem[i].count );
                        weight_picked_up += temp.weight() * num_picked;
                        volume_picked_up += temp.volume() * num_picked;
                    }
                }

                auto weight_predict = g->u.weight_carried() + weight_picked_up;
                auto volume_predict = g->u.volume_carried() + volume_picked_up;

                mvwprintz( w_pickup, 0, 5, weight_predict > g->u.weight_capacity() ? c_red : c_white,
                           _( "Wgt %.1f" ), round_up( convert_weight( weight_predict ), 1 ) );

                wprintz( w_pickup, c_white, "/%.1f", round_up( convert_weight( g->u.weight_capacity() ), 1 ) );

                std::string fmted_volume_predict = format_volume( volume_predict );
                mvwprintz( w_pickup, 0, 18, volume_predict > g->u.volume_capacity() ? c_red : c_white,
                           _( "Vol %s" ), fmted_volume_predict );

                std::string fmted_volume_capacity = format_volume( g->u.volume_capacity() );
                wprintz( w_pickup, c_white, "/%s", fmted_volume_capacity );
            }

            wrefresh( w_pickup );

            action = ctxt.handle_input();
            raw_input_char = ctxt.get_raw_input().get_first_input();

        } while( action != "QUIT" && action != "CONFIRM" );

        bool item_selected = false;
        // Check if we have selected an item.
        for( auto selection : getitem ) {
            if( selection.pick ) {
                item_selected = true;
            }
        }
        if( action != "CONFIRM" || !item_selected ) {
            w_pickup = catacurses::window();
            w_item_info = catacurses::window();
            add_msg( _( "Never mind." ) );
            g->reenter_fullscreen();
            g->refresh_all();
            return;
开发者ID:KrazyTheFox,项目名称:Cataclysm-DDA,代码行数:67,代码来源:pickup.cpp

示例12: pefile_strip_sig_wrapper

/*
 * Check and strip the PE wrapper from around the signature and check that the
 * remnant looks something like PKCS#7.
 */
static int pefile_strip_sig_wrapper(const void *pebuf,
				    struct pefile_context *ctx)
{
	struct win_certificate wrapper;
	const u8 *pkcs7;
	unsigned len;

	if (ctx->sig_len < sizeof(wrapper)) {
		pr_debug("Signature wrapper too short\n");
		return -ELIBBAD;
	}

	memcpy(&wrapper, pebuf + ctx->sig_offset, sizeof(wrapper));
	pr_debug("sig wrapper = { %x, %x, %x }\n",
		 wrapper.length, wrapper.revision, wrapper.cert_type);

	/* Both pesign and sbsign round up the length of certificate table
	 * (in optional header data directories) to 8 byte alignment.
	 */
	if (round_up(wrapper.length, 8) != ctx->sig_len) {
		pr_debug("Signature wrapper len wrong\n");
		return -ELIBBAD;
	}
	if (wrapper.revision != WIN_CERT_REVISION_2_0) {
		pr_debug("Signature is not revision 2.0\n");
		return -ENOTSUPP;
	}
	if (wrapper.cert_type != WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
		pr_debug("Signature certificate type is not PKCS\n");
		return -ENOTSUPP;
	}

	/* It looks like the pkcs signature length in wrapper->length and the
	 * size obtained from the data dir entries, which lists the total size
	 * of certificate table, are both aligned to an octaword boundary, so
	 * we may have to deal with some padding.
	 */
	ctx->sig_len = wrapper.length;
	ctx->sig_offset += sizeof(wrapper);
	ctx->sig_len -= sizeof(wrapper);
	if (ctx->sig_len < 4) {
		pr_debug("Signature data missing\n");
		return -EKEYREJECTED;
	}

	/* What's left should be a PKCS#7 cert */
	pkcs7 = pebuf + ctx->sig_offset;
	if (pkcs7[0] != (ASN1_CONS_BIT | ASN1_SEQ))
		goto not_pkcs7;

	switch (pkcs7[1]) {
	case 0 ... 0x7f:
		len = pkcs7[1] + 2;
		goto check_len;
	case ASN1_INDEFINITE_LENGTH:
		return 0;
	case 0x81:
		len = pkcs7[2] + 3;
		goto check_len;
	case 0x82:
		len = ((pkcs7[2] << 8) | pkcs7[3]) + 4;
		goto check_len;
	case 0x83 ... 0xff:
		return -EMSGSIZE;
	default:
		goto not_pkcs7;
	}

check_len:
	if (len <= ctx->sig_len) {
		/* There may be padding */
		ctx->sig_len = len;
		return 0;
	}
not_pkcs7:
	pr_debug("Signature data not PKCS#7\n");
	return -ELIBBAD;
}
开发者ID:congwang,项目名称:linux,代码行数:82,代码来源:verify_pefile.c

示例13: elf_object_map

int elf_object_map(struct process *proc, struct elf_module *m)
{
	int i;
	int r;

	dprintf("to load (%d)\n", m->num_to_load);
	dprintf("%-8s %-8s %-8s %-8s\n", "vaddr", "memsz", "offset", "filesz");
	for (i = 0; i < m->num_to_load; i++)
	{
		m->min_vaddr = MIN(round_down_to_page(m->to_load[i].p_vaddr), m->min_vaddr);
		m->max_vaddr = MAX(round_up_to_page(m->to_load[i].p_vaddr + m->to_load[i].p_memsz), m->max_vaddr);

		dprintf("%08x %08x %08x %08x\n",
			m->to_load[i].p_vaddr, m->to_load[i].p_memsz,
			m->to_load[i].p_offset, m->to_load[i].p_filesz);
	}

	dprintf("vaddr -> %08x-%08x\n", m->min_vaddr, m->max_vaddr);

	/* reserve memory for image */
	m->base = vm_process_map(proc, m->min_vaddr, m->max_vaddr - m->min_vaddr,
			_l_PROT_NONE, _l_MAP_ANONYMOUS|_l_MAP_PRIVATE, NULL, 0);
	if (m->base == _l_MAP_FAILED)
	{
		dprintf("mmap failed\n");
		goto error;
	}
	dprintf("base = %08x\n", m->base);

	for (i = 0; i < m->num_to_load; i++)
	{
		int mapflags = elf_mmap_flags_get(m->to_load[i].p_flags);
		user_ptr_t p;
		unsigned int vaddr = round_down_to_page(m->to_load[i].p_vaddr);
		unsigned int vaddr_offset = (m->to_load[i].p_vaddr & pagemask);
		unsigned int memsz = round_up_to_page(vaddr_offset + m->to_load[i].p_memsz);
		unsigned int max_addr;
		void *ptr;
		size_t max_sz = 0;

		elf_map_flags_print(mapflags);

		p = m->base - m->min_vaddr + vaddr;

		dprintf("map at %08x, offset %08x sz %08x\n", p, vaddr, memsz);
		/*
		 * Map anonymous memory then read the data in
		 * rather than mapping the file directly.
		 *
		 * The windows page granularity is different to that on Linux.
		 * The pages may need to be modified to apply relocations.
		 *
		 * nb. need MAP_FIXED to blow away our old mapping
		 */
		p = vm_process_map(proc, p, memsz,
			_l_PROT_READ | _l_PROT_WRITE | _l_PROT_EXEC,
			_l_MAP_FIXED|_l_MAP_PRIVATE|_l_MAP_ANONYMOUS, NULL, 0);
		if (p == _l_MAP_FAILED)
		{
			fprintf(stderr, "mmap failed (%d)\n", -(int)p);
			goto error;
		}

		p = m->base - m->min_vaddr + m->to_load[i].p_vaddr;
		dprintf("pread %08x bytes from %08x to %08x\n",
			m->to_load[i].p_filesz, m->to_load[i].p_offset, p);

		r = vm_get_pointer(proc, p, &ptr, &max_sz);
		if (r < 0)
			goto error;
		if (max_sz < m->to_load[i].p_filesz)
		{
			r = -_L(EPERM);
			goto error;
		}

		r = elf_read(m->fp, ptr, m->to_load[i].p_filesz, m->to_load[i].p_offset);
		if (r != m->to_load[i].p_filesz)
		{
			fprintf(stderr, "read failed (%08x != %08x)\n",
				m->to_load[i].p_filesz, r);
			goto error;
		}

		/* remember highest address we mapped, use it for brk */
		max_addr = m->to_load[i].p_vaddr + m->to_load[i].p_memsz;
		max_addr = round_up(max_addr, pagesize);
		if (proc->brk < max_addr)
			proc->brk = max_addr;
		dprintf("brk at %08x\n", proc->brk);
	}

	m->entry_point = m->base - m->min_vaddr + m->ehdr.e_entry;

	return 0;
error:
	return -1;
}
开发者ID:cheako,项目名称:atratus,代码行数:98,代码来源:elf.c

示例14: LOG_TRACE

template <  typename IN_PORT_TYPE > int probe_signal_i_base::_forecastAndProcess( bool &eos, typename  std::vector< gr_istream< IN_PORT_TYPE > > &istreams )
{
    typedef typename std::vector< gr_istream< IN_PORT_TYPE > >   _IStreamList;

    typename _IStreamList::iterator istream = istreams.begin();
    int nout = 0;
    bool dataReady = false;
    if ( !eos ) {
        uint64_t max_items_avail = 0;
        for ( int idx=0 ; istream != istreams.end() && serviceThread->threadRunning() ; idx++, istream++ ) {
            LOG_TRACE( probe_signal_i_base, "GET MAX ITEMS: STREAM:" << idx << " NITEMS/SCALARS:"
                      << istream->nitems() << "/" << istream->_data.size() );
            max_items_avail = std::max( istream->nitems(), max_items_avail );
        }

        //
        // calc number of output items to produce
        //
        noutput_items = (int) (max_items_avail * gr_sptr->relative_rate ());
        noutput_items = round_down (noutput_items, gr_sptr->output_multiple ());

        if ( noutput_items <= 0  ) {
           LOG_TRACE( probe_signal_i_base, "DATA CHECK - MAX ITEMS  NOUTPUT/MAX_ITEMS:" <<   noutput_items << "/" << max_items_avail);
           return -1;
        }

        if ( gr_sptr->fixed_rate() ) {
            istream = istreams.begin();
            for ( int i=0; istream != istreams.end(); i++, istream++ ) {
                int t_noutput_items = gr_sptr->fixed_rate_ninput_to_noutput( istream->nitems() );
                if ( gr_sptr->output_multiple_set() ) {
                    t_noutput_items = round_up(t_noutput_items, gr_sptr->output_multiple());
                }
                if ( t_noutput_items > 0 ) {
                    if ( noutput_items == 0 ) {
                        noutput_items = t_noutput_items;
                    }
                    if ( t_noutput_items <= noutput_items ) {
                        noutput_items = t_noutput_items;
                    }
                }
            }
            LOG_TRACE( probe_signal_i_base, " FIXED FORECAST NOUTPUT/output_multiple == " 
                      << noutput_items  << "/" << gr_sptr->output_multiple());
        }

        //
        // ask the block how much input they need to produce noutput_items...
        // if enough data is available to process then set the dataReady flag
        //
        int32_t  outMultiple = gr_sptr->output_multiple();
        while ( !dataReady && noutput_items >= outMultiple  ) {
            //
            // ask the block how much input they need to produce noutput_items...
            //
            gr_sptr->forecast(noutput_items, _ninput_items_required);

            LOG_TRACE( probe_signal_i_base, "--> FORECAST IN/OUT " << _ninput_items_required[0]  << "/" << noutput_items  );

            istream = istreams.begin();
            uint32_t dr_cnt=0;
            for ( int idx=0 ; noutput_items > 0 && istream != istreams.end(); idx++, istream++ ) {
                // check if buffer has enough elements
                _input_ready[idx] = false;
                if ( istream->nitems() >= (uint64_t)_ninput_items_required[idx] ) {
                    _input_ready[idx] = true;
                    dr_cnt++;
                }
                LOG_TRACE( probe_signal_i_base, "ISTREAM DATACHECK NELMS/NITEMS/REQ/READY:" << 
                          istream->nelems() << "/" << istream->nitems() << "/" << 
                          _ninput_items_required[idx] << "/" << _input_ready[idx]);
            }
    
            if ( dr_cnt < istreams.size() ) {
                if ( outMultiple > 1 ) {
                    noutput_items -= outMultiple;
                } else {
                    noutput_items /= 2;
                }
            } else {
                dataReady = true;
            }
            LOG_TRACE( probe_signal_i_base, " TRIM FORECAST NOUTPUT/READY " << noutput_items << "/" << dataReady );
        }

        // check if data is ready...
        if ( !dataReady ) {
            LOG_TRACE( probe_signal_i_base, "DATA CHECK - NOT ENOUGH DATA  AVAIL/REQ:" 
                      <<   _istreams[0].nitems() << "/" << _ninput_items_required[0] );
            return -1;
        }

        // reset looping variables
        int  ritems = 0;
        int  nitems = 0;

        // reset caching vectors
        _output_items.clear();
        _input_items.clear();
        _ninput_items.clear();
//.........这里部分代码省略.........
开发者ID:RedhawkSDR,项目名称:integration-gnuhawk,代码行数:101,代码来源:probe_signal_i_base.cpp

示例15: mxr_graph_fix_geometry

static void mxr_graph_fix_geometry(struct mxr_layer *layer,
	enum mxr_geometry_stage stage, unsigned long flags)
{
	struct mxr_geometry *geo = &layer->geo;
	struct mxr_crop *src = &geo->src;
	struct mxr_crop *dst = &geo->dst;
	unsigned int x_center, y_center;

	switch (stage) {

	case MXR_GEOMETRY_SINK: /* nothing to be fixed here */
		flags = 0;
		/* fall through */

	case MXR_GEOMETRY_COMPOSE:
		/* remember center of the area */
		x_center = dst->x_offset + dst->width / 2;
		y_center = dst->y_offset + dst->height / 2;
		/* round up/down to 2 multiple depending on flags */
		if (flags & V4L2_SEL_FLAG_LE) {
			dst->width = round_down(dst->width, 2);
			dst->height = round_down(dst->height, 2);
		} else {
			dst->width = round_up(dst->width, 2);
			dst->height = round_up(dst->height, 2);
		}
		/* assure that compose rect is inside display area */
		dst->width = min(dst->width, dst->full_width);
		dst->height = min(dst->height, dst->full_height);

		/* ensure that compose is reachable using 2x scaling */
		dst->width = min(dst->width, 2 * src->full_width);
		dst->height = min(dst->height, 2 * src->full_height);

		/* setup offsets */
		dst->x_offset = do_center(x_center, dst->width,
			dst->full_width, flags);
		dst->y_offset = do_center(y_center, dst->height,
			dst->full_height, flags);
		flags = 0;
		/* fall through */

	case MXR_GEOMETRY_CROP:
		/* remember center of the area */
		x_center = src->x_offset + src->width / 2;
		y_center = src->y_offset + src->height / 2;
		/* ensure that cropping area lies inside the buffer */
		if (src->full_width < dst->width)
			src->width = dst->width / 2;
		else
			src->width = closest(src->width, dst->width / 2,
				dst->width, flags);

		if (src->width == dst->width)
			geo->x_ratio = 0;
		else
			geo->x_ratio = 1;

		if (src->full_height < dst->height)
			src->height = dst->height / 2;
		else
			src->height = closest(src->height, dst->height / 2,
				dst->height, flags);

		if (src->height == dst->height)
			geo->y_ratio = 0;
		else
			geo->y_ratio = 1;

		/* setup offsets */
		src->x_offset = do_center(x_center, src->width,
			src->full_width, flags);
		src->y_offset = do_center(y_center, src->height,
			src->full_height, flags);
		flags = 0;
		/* fall through */
	case MXR_GEOMETRY_SOURCE:
		src->full_width = clamp_val(src->full_width,
			src->width + src->x_offset, 32767);
		src->full_height = clamp_val(src->full_height,
			src->height + src->y_offset, 2047);
	};
}
开发者ID:dedzt16,项目名称:dedzt16,代码行数:83,代码来源:mixer_grp_layer.c


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