亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? align.c

?? C語言庫函數(shù)的原型,有用的拿去
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
    int bFree = 0;

    /* special cases */
    if (memblock == NULL)
    {
        return _aligned_offset_malloc_base(size, align, offset);
    }
    if (size == 0)
    {
        _aligned_free_base(memblock);
        return NULL;
    }

    /* validation section */
    _VALIDATE_RETURN(IS_2_POW_N(align), EINVAL, NULL);
    _VALIDATE_RETURN(offset == 0 || offset < size, EINVAL, NULL);

    stptr = (uintptr_t)memblock;

    /* ptr points to the pointer to starting of the memory block */
    stptr = (stptr & ~(PTR_SZ -1)) - PTR_SZ;

    /* ptr is the pointer to the start of memory block*/
    stptr = *((uintptr_t *)stptr);

    align = (align > PTR_SZ ? align : PTR_SZ) -1;
    /* gap = number of bytes needed to round up offset to align with PTR_SZ*/
    gap = (0 -offset)&(PTR_SZ -1);

    diff = (uintptr_t)memblock - stptr;
    /* Mov size is min of the size of data available and sizw requested.
     */
    CRT_WARNING_DISABLE_PUSH(22018, "Silence prefast about overflow/underflow");
    movsz = _msize((void *)stptr) - ((uintptr_t)memblock - stptr);
    CRT_WARNING_POP
    movsz = movsz > size? size: movsz;
    reqsz = PTR_SZ +gap +align +size;

    _VALIDATE_RETURN_NOEXC(size <= reqsz, ENOMEM, NULL);

    /* First check if we can expand(reducing or expanding using expand) data
     * safely, ie no data is lost. eg, reducing alignment and keeping size
     * same might result in loss of data at the tail of data block while
     * expanding.
     *
     * If no, use malloc to allocate the new data and move data.
     *
     * If yes, expand and then check if we need to move the data.
     */
    if ((stptr +align +PTR_SZ +gap)<(uintptr_t)memblock)
    {
        if ((ptr = (uintptr_t)malloc(reqsz)) == (uintptr_t) NULL)
            return NULL;
        bFree = 1;
    }
    else
    {
        /* we need to save errno, which can be modified by _expand */
        errno_t save_errno = errno;
        if ((ptr = (uintptr_t)_expand((void *)stptr, reqsz)) == (uintptr_t)NULL)
        {
            errno = save_errno;
            if ((ptr = (uintptr_t)malloc(reqsz)) == (uintptr_t) NULL)
                return NULL;
            bFree = 1;
        }
        else
            stptr = ptr;
    }


    if ( ptr == ((uintptr_t)memblock - diff)
         && !( ((size_t)memblock + gap +offset) & ~(align) ))
    {
        return memblock;
    }

    retptr =((ptr +PTR_SZ +gap +align +offset)&~align)- offset;
    memmove((void *)retptr, (void *)(stptr + diff), movsz);
    if ( bFree)
        free ((void *)stptr);

    ((uintptr_t *)(retptr - gap))[-1] = ptr;
    return (void *)retptr;
}


/***
*
* size_t _aligned_msize_base(void *memblock, size_t align, size_t offset)
*
* Purpose:
*       Computes the size of an aligned block.
*
* Entry:
*       void * memblock - pointer to the aligned block of memory
*
* Exceptions:
*       None. If memblock == NULL 0 is returned.
*
*******************************************************************************/

size_t __cdecl _aligned_msize_base(void *memblock, size_t align, size_t offset)
{
    size_t header_size = 0; /* Size of the header block */
    size_t footer_size = 0; /* Size of the footer block */
    size_t total_size  = 0; /* total size of the allocated block */
    size_t user_size   = 0; /* size of the user block*/
    uintptr_t gap      = 0; /* keep the alignment of the data block */
                             /* after the sizeof(void*) aligned pointer */
                             /* to the beginning of the allocated block */
    uintptr_t ptr      = 0; /* computes the beginning of the allocated block */

    _VALIDATE_RETURN (memblock != NULL, EINVAL, -1);

    /* HEADER SIZE + FOOTER SIZE = GAP + ALIGN + SIZE OF A POINTER*/
    /* HEADER SIZE + USER SIZE + FOOTER SIZE = TOTAL SIZE */

    ptr = (uintptr_t)memblock;            /* ptr points to the start of the aligned memory block */
    ptr = (ptr & ~(PTR_SZ - 1)) - PTR_SZ; /* ptr is one position behind memblock */
                                          /* the value in ptr is the start of the real allocated block */
    ptr = *((uintptr_t *)ptr);            /* after dereference ptr points to the beginning of the allocated block */

    total_size = _msize((void*)ptr);
    header_size = (uintptr_t) memblock - ptr;
    gap = (0 - offset) & (PTR_SZ - 1);
    /* Alignment cannot be less than sizeof(void*) */
    align = (align > PTR_SZ ? align : PTR_SZ) -1;
    footer_size = gap + align + PTR_SZ - header_size;
    user_size = total_size - header_size - footer_size;

    return user_size;
}

/***
*
* void *_aligned_offset_recalloc_base (void * memblock, size_t size, size_t count, size_t alignment, int offset)
*       - Reallocate a block of memory from the heap.
*
* Purpose:
*       Reallocates a block of memory which is shifted by offset from
*       alignment of at least size bytes from the heap and return a pointer
*       to it. Size can be either greater or less than the original size of the
*       block.
*
* Entry:
*       void *memblock - pointer to block in the heap previously allocated by
*               call to _aligned_malloc(), _aligned_offset_malloc(),
*               _aligned_realloc() or _aligned_offset_realloc().
*       size_t count - count of items
*       size_t size - size of items
*       size_t alignment - alignment of memory
*       size_t offset - offset of memory from the alignment
*
* Exit:
*       Success: Pointer to re-allocated memory block
*       Failure: Null, errno is set
*
* Exceptions:
*       Input parameters are validated. Refer to the validation section of the function.
*
*******************************************************************************/

void * __cdecl _aligned_offset_recalloc_base(
    void * memblock,
    size_t count,
    size_t size,
    size_t align,
    size_t offset
    )
{
    size_t user_size  = 0;    /* wanted size, passed to aligned realoc */
    size_t start_fill = 0;    /* location where aligned recalloc starts to fill with 0 */
                              /* filling must start from the end of the previous user block */
    void * retptr     = NULL; /* result of aligned recalloc*/
    uintptr_t ptr     = 0;    /* points to the beginning of the allocated block*/

    /* ensure that (size * num) does not overflow */
    if (count > 0)
    {
        _VALIDATE_RETURN_NOEXC((_HEAP_MAXREQ / count) >= size, ENOMEM, NULL);
    }

    user_size = size * count;

    if (memblock != NULL)
    {
        start_fill = _aligned_msize(memblock, align, offset);
    }

    retptr = _aligned_offset_realloc_base(memblock, user_size, align, offset);

    if (retptr != NULL)
    {
        if (start_fill < user_size)
        {
            memset ((char*)retptr + start_fill, 0, user_size - start_fill);
        }
    }
    return retptr;
}

/***
*
* void *_aligned_free_base(void *memblock)
*       - Free the memory which was allocated using _aligned_malloc or
*       _aligned_offset_memory
*
* Purpose:
*       Frees the aligned memory block which was allocated using _aligned_malloc.
*
* Entry:
*       void * memblock - pointer to the block of memory
*
* Exceptions:
*       None. If memblock == NULL we simply return without doing anything.
*
*******************************************************************************/

void  __cdecl _aligned_free_base(void *memblock)
{
    uintptr_t ptr;

    if (memblock == NULL)
        return;

    ptr = (uintptr_t)memblock;

    /* ptr points to the pointer to starting of the memory block */
    ptr = (ptr & ~(PTR_SZ -1)) - PTR_SZ;

    /* ptr is the pointer to the start of memory block*/
    ptr = *((uintptr_t *)ptr);
    free((void *)ptr);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区.www| 91女神在线视频| 99精品国产99久久久久久白柏| 色婷婷激情久久| 欧美xingq一区二区| 亚洲人成网站色在线观看| 蜜桃一区二区三区在线观看| 风间由美一区二区av101| 欧美日韩成人综合在线一区二区| 久久免费视频色| 亚洲成人一区在线| 成人午夜又粗又硬又大| 欧美tickling网站挠脚心| 亚洲精品免费播放| 成人免费观看av| 久久久国产午夜精品| 美女一区二区在线观看| 欧美色涩在线第一页| 亚洲美女视频一区| 99精品视频在线观看免费| 久久精品一区四区| 黄色小说综合网站| 日韩午夜激情av| 日韩av一区二区在线影视| 91国产成人在线| 亚洲黄色在线视频| 91论坛在线播放| 国产精品久久久久永久免费观看 | 日本一区二区三区在线不卡| 喷水一区二区三区| 欧美丰满美乳xxx高潮www| 亚洲一区二区免费视频| 91成人国产精品| 亚洲综合男人的天堂| 99riav一区二区三区| 亚洲欧洲精品一区二区三区不卡| 成人午夜电影久久影院| 中文字幕欧美日韩一区| www.欧美.com| 一区二区国产盗摄色噜噜| 日本韩国欧美三级| 亚洲第一福利视频在线| 91精品国产综合久久精品麻豆| 亚洲成av人片观看| 日韩一区二区三区在线视频| 久久精品久久99精品久久| 欧美成人bangbros| 国产91在线看| 亚洲欧美视频一区| 欧美日韩午夜在线| 蜜桃视频免费观看一区| 精品欧美乱码久久久久久1区2区| 韩国欧美国产一区| 中文字幕中文在线不卡住| 91亚洲永久精品| 亚洲成人免费av| 26uuu欧美日本| 91视频免费观看| 日本欧美一区二区三区乱码| 久久久精品免费网站| 色综合久久久久综合体桃花网| 亚洲影院久久精品| 亚洲精品一区二区三区蜜桃下载| 成人丝袜高跟foot| 亚洲va韩国va欧美va| 久久夜色精品一区| 色婷婷一区二区三区四区| 免费日韩伦理电影| 中文字幕日韩av资源站| 欧美狂野另类xxxxoooo| 国产成人免费视| 亚洲一区二区五区| 国产三区在线成人av| 欧美影视一区二区三区| 国产综合久久久久久久久久久久| 日韩理论片在线| 精品久久人人做人人爽| 色综合一个色综合亚洲| 美女视频免费一区| 久久久久久久久久美女| 欧美群妇大交群的观看方式| 亚洲色图20p| 乱中年女人伦av一区二区| 不卡av在线免费观看| 欧美高清视频在线高清观看mv色露露十八 | 日韩免费一区二区三区在线播放| 国产福利一区二区三区在线视频| 亚洲成人精品一区| 国产精品女同一区二区三区| 欧美大黄免费观看| 欧洲另类一二三四区| 国产69精品久久久久毛片| 日本色综合中文字幕| 一区二区久久久久| 亚洲私人影院在线观看| 久久综合成人精品亚洲另类欧美| 欧美福利视频一区| 欧美日产国产精品| 欧洲一区二区三区在线| 成人黄色小视频| 国产麻豆日韩欧美久久| 美女一区二区视频| 日韩精品乱码免费| 亚洲 欧美综合在线网络| 亚洲三级电影网站| 国产精品午夜在线| 国产午夜亚洲精品不卡| 久久人人97超碰com| 欧美成人a∨高清免费观看| 在线播放91灌醉迷j高跟美女 | 国产精品亚洲午夜一区二区三区 | 欧美r级电影在线观看| 欧美精品久久99久久在免费线| 在线影院国内精品| 色综合久久久久久久久久久| 99国产欧美另类久久久精品| 成人免费视频caoporn| 成av人片一区二区| www..com久久爱| 色综合久久久久网| 欧美无乱码久久久免费午夜一区 | 亚洲 欧美综合在线网络| 五月天中文字幕一区二区| 丝袜诱惑亚洲看片| 日韩一区精品字幕| 久久99热这里只有精品| 精品午夜一区二区三区在线观看| 国产在线精品一区二区夜色 | 欧美国产禁国产网站cc| 中文字幕av一区二区三区免费看| 中文字幕成人av| 亚洲自拍偷拍九九九| 首页国产欧美久久| 国精产品一区一区三区mba桃花| 国产成人综合精品三级| 国产91丝袜在线18| 色婷婷综合久久久久中文| 欧美日韩国产天堂| 精品国产一区二区精华| 欧美高清在线一区| 亚洲三级小视频| 日本不卡123| 国产白丝精品91爽爽久久 | ●精品国产综合乱码久久久久| 亚洲色图视频网站| 日本不卡123| 国产激情视频一区二区在线观看| 99久久精品国产网站| 7777精品伊人久久久大香线蕉的| 精品第一国产综合精品aⅴ| 中文字幕亚洲区| 蜜臀av性久久久久蜜臀aⅴ| 成人av小说网| 日韩亚洲国产中文字幕欧美| 国产精品对白交换视频| 丝袜美腿亚洲一区| av激情成人网| 日韩美女视频一区二区在线观看| 久久色中文字幕| 亚洲第一综合色| 国产99久久久国产精品免费看| 在线观看不卡一区| 欧美国产一区二区在线观看| 日韩精品亚洲一区| 91视频一区二区三区| 26uuu国产一区二区三区| 亚洲福利一区二区| 北岛玲一区二区三区四区| 欧美电影一区二区| 亚洲欧美日韩国产另类专区| 国产在线国偷精品免费看| 欧美视频在线一区| 国产精品久久午夜夜伦鲁鲁| 美女视频网站久久| 91精品久久久久久久久99蜜臂| 亚洲欧洲一区二区三区| 国产伦精品一区二区三区免费 | 日韩美女视频一区二区| 狠狠色丁香婷婷综合| 欧美日韩一区高清| 亚洲人成网站在线| a美女胸又www黄视频久久| 久久亚洲免费视频| 男女性色大片免费观看一区二区 | 91视频一区二区三区| 亚洲欧洲精品一区二区三区| 国产一区二区三区四区五区美女 | 国产精品 日产精品 欧美精品| 欧美一区二区免费视频| 国产综合久久久久久久久久久久| 欧美精品 日韩| 日韩精品欧美成人高清一区二区| 欧美三级午夜理伦三级中视频| 中文字幕一区二区在线观看| 国产成人av福利| 欧美精品一区二区三区一线天视频 | 成人爱爱电影网址| 国产精品私人影院| 成人动漫av在线| 亚洲精品中文在线观看|