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

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

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

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

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

示例1: HEADER

bool videoInputCamera::setSizeAndSubtype() {	//store current mediatype	AM_MEDIA_TYPE * tmpType = NULL;	HRESULT	hr = pStreamConfig->GetFormat(&tmpType);	if(hr != S_OK)return false;	VIDEOINFOHEADER *lpVih =  reinterpret_cast<VIDEOINFOHEADER*>(pAmMediaType->pbFormat);	HEADER(lpVih)->biWidth  = cfg->cam_width;	HEADER(lpVih)->biHeight = cfg->cam_height;	pAmMediaType->formattype = FORMAT_VideoInfo;	pAmMediaType->majortype  = MEDIATYPE_Video;	pAmMediaType->subtype	 = getMediaSubtype(cfg->cam_format);	//buffer size	pAmMediaType->lSampleSize = cfg->cam_width* cfg->cam_height*3;	//set fps if requested	lpVih->AvgTimePerFrame = (unsigned long)(10000000 /  cfg->cam_fps);	//okay lets try new size	hr = pStreamConfig->SetFormat(pAmMediaType);	if(hr == S_OK){		if( tmpType != NULL )deleteMediaType(tmpType);		return true;	}else{		pStreamConfig->SetFormat(tmpType);		if( tmpType != NULL )deleteMediaType(tmpType);	}	return false;}
开发者ID:cmayer0087,项目名称:reacTIVision,代码行数:33,


示例2: sort_ide_block

/* sort the IDE block as per the typelib spec: IID order, unresolved first */static voidsort_ide_block(TreeState *state){    XPTInterfaceDirectoryEntry *ide;    int i;    /* boy, I sure hope qsort works correctly everywhere */#ifdef DEBUG_shaver_sort    fputs("before sort:/n", stderr);    for (i = 0; i < IFACES(state); i++) {        fputs("  ", stderr);        print_IID(&HEADER(state)->interface_directory[i].iid, stderr);        fputc('/n', stderr);    }#endif    qsort(HEADER(state)->interface_directory, IFACES(state),          sizeof(*ide), compare_IDEs);#ifdef DEBUG_shaver_sort    fputs("after sort:/n", stderr);    for (i = 0; i < IFACES(state); i++) {        fputs("  ", stderr);        print_IID(&HEADER(state)->interface_directory[i].iid, stderr);        fputc('/n', stderr);    }#endif    for (i = 0; i < IFACES(state); i++) {        ide = HEADER(state)->interface_directory + i;        g_hash_table_insert(IFACE_MAP(state), ide->name, (void *)(i + 1));    }    return;}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:34,


示例3: eequal

rt_public EIF_BOOLEAN eequal(register EIF_REFERENCE target, register EIF_REFERENCE source){	/* Eiffel standard equality: it assumes that dynamic type of Eiffel	 * object refered by `source' conforms to dynamic type of Eiffel	 * object refered by `target'. `source' and `target' cannot be NULL	 * or special objects here.	 * If both `source' and `target' have the same dynamic type and this	 * type is not composite, then perform a block comparison; otherwise	 * perform a field by field comparison.	 * It is the feature `standard_is_equal' of class ANY.	 * Return a boolean.	 */	REQUIRE ("source_not_null", source);	REQUIRE ("target_not_null", target);	if (source == target) {			/* Minor optimization, if references are equal then it is the same object. */		return EIF_TRUE;	}	if (Dftype(source) == Dftype(target)) {		/* Dynamic type are the same: because of the intra-expanded		 * references, we can perform only a block comparison if		 * the target (or the source) is a composite object (i.e: it has		 * expanded attributes): since an attribute keeps expanded or		 * not expanded all the time, we can test either the source or		 * the target.		 */		if (HEADER(source)->ov_flags & EO_SPEC) {				/* Works for both SPECIAL and TUPLE object */				/* Eiffel standard equality on special objects: type check assumes				* the comparison is on areas of the same type (containing the same				* thing). Called by the redefinition of feature `equal' of special				* class. `source' and/or `target' cannot be NULL.				* Return a boolean.				*/				/* First condition: same count */			if				((RT_SPECIAL_COUNT(source) != RT_SPECIAL_COUNT(target)) ||				(RT_SPECIAL_ELEM_SIZE(source) != RT_SPECIAL_ELEM_SIZE(target)))			{				return EIF_FALSE;			} else {					/* Second condition: block equality */				return EIF_TEST(!memcmp (source, target, RT_SPECIAL_VISIBLE_SIZE(source)));			}		} else {			if (!(HEADER(source)->ov_flags & EO_COMP))	/* Perform a block comparison */				return EIF_TEST(!memcmp (source, target, EIF_Size(Dtype(source))));			else				return e_field_equal(target, source);		}	}	/* Field by field comparison */	return EIF_FALSE;}
开发者ID:tioui,项目名称:EiffelStudio,代码行数:60,


示例4: http_request_ok

gboolean http_request_ok (http_request *h) {    guint hdr_len = http_get_hdr_len( h->buffer->str );    guint c_len;    if (hdr_len != 0) {	if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: hdr_len %d", hdr_len );	if ( HEADER("Content-length") && (c_len=atoi(HEADER("Content-length")) <= (h->buffer->len - hdr_len)) ) {	    if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: Parsing query from HTTP-Content." );	    http_parse_query( h, &(h->buffer->str[hdr_len]) );	    h->complete++;	    if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: Query parsing finished, exiting." );	    return TRUE;	}	else if (HEADER("Content-length") && (CONFd("Verbosity") >= 8))             g_warning( "http_request_ok: HEADER was OK, but CONTENT reading failed." );	else if(CONFd("Verbosity") >= 8)             g_warning( "http_request_ok: No Content-length header, parsing query from URI." );	http_parse_query( h, NULL );	if (!h->query) {          if (CONFd("Verbosity") >= 8) g_message("http_request_ok: No QUERY found.");        }	else if (CONFd("Verbosity") >= 8) {	    GString *z;            z = g_hash_as_string( h->query );            g_debug( "http_request_ok: Query: %s", z->str );            g_string_free(z, 1);        }	h->complete++;	if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: Query parsing finished, exiting." );	return TRUE;    }    if(CONFd("Verbosity") >= 6) g_warning( "http_request_ok: Request not HTTP: <CR><LF><CR><LF> (header_end) NOT found" );    return FALSE;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:35,


示例5: eif_std_ref_copy

rt_public void eif_std_ref_copy(register EIF_REFERENCE source, register EIF_REFERENCE target){    /* Copy Eiffel object `source' into Eiffel object `target'.     * Dynamic type of `source' is supposed to be the same as dynamic type     * of `target'. It assumes also that `source' and `target' are not     * references on special objects.     * Problem: updating intra-references on expanded object     * because the garbage collector needs to explore those references.     */    uint16 flags;			/* Source object flags */    union overhead *s_zone;	/* Source object header */    union overhead *t_zone;	/* Target object header */#ifdef ISE_GC    EIF_REFERENCE enclosing;					/* Enclosing target object */#endif    rt_uint_ptr size;    s_zone = HEADER(source);    flags = s_zone->ov_flags;    t_zone = HEADER(target);    if (s_zone->ov_dftype == t_zone->ov_dftype) {        if (flags & EO_COMP) {            /* Case of composite object: updating of references on expanded objects. */            eif_std_field_copy (source, target);        } else {            /* Copy of source object into target object with same dynamic type. Block copy here. */            if (flags & EO_SPEC) {                size = RT_SPECIAL_VISIBLE_SIZE(source);            } else {                size = EIF_Size(s_zone->ov_dtype);            }            memmove(target, source, size);        }#ifdef ISE_GC        /* Precompute the enclosing target object */        enclosing = target;					/* By default */        if (eif_is_nested_expanded(t_zone->ov_flags)) {            enclosing -= t_zone->ov_size & B_SIZE;        }        /* Perform aging tests. We need the address of the enclosing object to         * update the flags there, in case the target is to be memorized.         */        flags = HEADER(enclosing)->ov_flags;        CHECK ("Not forwarded", !(HEADER (enclosing)->ov_size & B_FWD));        if (            flags & EO_OLD &&			/* Object is old */            !(flags & EO_REM)	&&		/* Not remembered */            refers_new_object(target)	/* And copied refers to new objects */        )            erembq(enclosing);			/* Then remember the enclosing object */#endif /* ISE_GC */    }}
开发者ID:ebezault,项目名称:EiffelStudio,代码行数:59,


示例6: cm_TRC_traceLoadMap

void cm_TRC_traceLoadMap(        t_nmfTraceComponentCommandDescription command,        const t_component_instance* component){    if(cm_trace_enabled)    {        struct t_nmfTraceComponent   trace;        /*         * Generate instantiate trace         */        trace.header.v = HEADER(TRACE_TYPE_COMPONENT, sizeof(trace));        trace.command = (t_uint16)command;        trace.domainId = (t_uint16)component->Template->dspId + 1;        trace.componentContext = (t_uint32)component->thisAddress;        trace.componentUserContext = (t_uint32)component;        cm_StringCopy((char*)trace.componentLocalName, component->pathname, MAX_COMPONENT_NAME_LENGTH);        cm_StringCopy((char*)trace.componentTemplateName, component->Template->name, MAX_TEMPLATE_NAME_LENGTH);        writeN((struct t_nmfTraceChannelHeader*)&trace);        if(command == TRACE_COMPONENT_COMMAND_ADD)        {            struct t_nmfTraceMethod tracemethod;            int i, j, k;            /*             * Generate method trace             */            tracemethod.header.v = HEADER(TRACE_TYPE_METHOD, sizeof(tracemethod));            tracemethod.domainId = (t_uint16)component->Template->dspId + 1;            tracemethod.componentContext = (t_uint32)component->thisAddress;            for(i = 0; i < component->Template->provideNumber; i++)            {                t_interface_provide* provide = &component->Template->provides[i];                t_interface_provide_loaded* provideLoaded = &component->Template->providesLoaded[i];                for(j = 0; j < provide->collectionSize; j++)                {                    for(k = 0; k < provide->interface->methodNumber; k++)                    {                        tracemethod.methodId = provideLoaded->indexesLoaded[j][k].methodAddresses;                        cm_StringCopy((char*)tracemethod.methodName, provide->interface->methodNames[k], MAX_INTERFACE_METHOD_NAME_LENGTH);                        writeN((struct t_nmfTraceChannelHeader*)&tracemethod);                    }                }            }        }    }}
开发者ID:791254467,项目名称:u8500_kernel,代码行数:55,


示例7: spcopy

rt_private void spcopy(register EIF_REFERENCE source, register EIF_REFERENCE target){    /* Copy a special Eiffel object into another one. It assumes that     * `source' and `target' are not NULL and that count of `target' is greater     * than count of `source'.     */    rt_uint_ptr field_size;    rt_uint_ptr t_count, s_count;#ifdef ISE_GC    uint16 flags;#endif    REQUIRE ("source not null", source);    REQUIRE ("target not null", target);    REQUIRE ("source is special", HEADER(source)->ov_flags & EO_SPEC);    REQUIRE ("target is special", HEADER(target)->ov_flags & EO_SPEC);    REQUIRE ("target_elem_size_identical", RT_SPECIAL_ELEM_SIZE(target) == RT_SPECIAL_ELEM_SIZE(source));    /* Because we can call copy with special/tuples of different size, we have to take the min size     * of the two objects to know exactly how much we are allowed to copy without causing a     * memory corruption. In case users actually call `copy' directly, not indirectly via `twin',     * the postcondition of `copy' will be violated, although it would have been better to have     * a precondition it is much better than memory corruption.*/    /* FIXME: Once `copy' is not exported anymore to ANY, but just TUPLE/SPECIAL then we will be able     * to add RT_SPECIAL_COUNT(target) == RT_SPECIAL_COUNT(source) as precondition of `spcopy'.*/    t_count = RT_SPECIAL_COUNT(target);    s_count = RT_SPECIAL_COUNT(source);    field_size = (t_count > s_count ? s_count : t_count) * (rt_uint_ptr) RT_SPECIAL_ELEM_SIZE (source);    memmove(target, source, field_size);			/* Block copy */#ifdef ISE_GC    /* Ok, normally we would have to perform age tests, by scanning the special     * object, looking for new objects. But a special object can be really big,     * and can also contain some expanded objects, which should be traversed     * to see if they contain any new objects. Ok, that's enough! This is a     * GC problem and is normally performed by the GC. So, if the special object     * is old and contains some references, I am automatically inserting it     * in the remembered set. The GC will remove it from there at the next     * cycle, if necessary--RAM.     */    flags = HEADER(target)->ov_flags;    CHECK ("Not forwarded", !(HEADER (target)->ov_flags & B_FWD));    if ((flags & (EO_REF | EO_OLD | EO_REM)) == (EO_OLD | EO_REF))        /* May it hold new references? */        eremb(target);	/* Remember it, even if not needed, to fasten								copying process. */#endif /* ISE_GC */}
开发者ID:ebezault,项目名称:EiffelStudio,代码行数:52,


示例8: lynx_image_info

static void lynx_image_info(imgtool_image *img, char *string, const int len){	lynx_image *image=(lynx_image*)img;	char dostext_with_null[33]= { 0 };	char name_with_null[25]={ 0 };	strncpy(dostext_with_null, HEADER(image)->dostext, 32);	strncpy(name_with_null, HEADER(image)->description, 24);	sprintf(string,"%s/n%s/nversion:%.4x max entries:%d",			dostext_with_null,			name_with_null, 			GET_UWORD(HEADER(image)->version),			HEADER(image)->max_entries);}
开发者ID:BirchJD,项目名称:xmame-0.103-RPi,代码行数:13,


示例9: init_dchat_v1

/** * Initializes a DChat V1 structure containing all available and * supported headers of the DChat V1 protocol. * The given structure will be initialized with all headers * available. The header IDs and names will be set and function addresses * pointing to corresponding value parsers will be set too. * @param proto * @return 0 if structure has been initialized successfully, -1 otherwise */intinit_dchat_v1(dchat_v1_t* proto){    int temp_size;    int proto_size;    // available headers    dchat_header_t temp[] =    {        HEADER(HDR_ID_VER, HDR_NAME_VER, 1, ver_str_to_pdu, ver_pdu_to_str),        HEADER(HDR_ID_CTT, HDR_NAME_CTT, 1, ctt_str_to_pdu, ctt_pdu_to_str),        HEADER(HDR_ID_CTL, HDR_NAME_CTL, 1, ctl_str_to_pdu, ctl_pdu_to_str),        HEADER(HDR_ID_ONI, HDR_NAME_ONI, 1, oni_str_to_pdu, oni_pdu_to_str),        HEADER(HDR_ID_LNP, HDR_NAME_LNP, 1, lnp_str_to_pdu, lnp_pdu_to_str),        HEADER(HDR_ID_NIC, HDR_NAME_NIC, 0, nic_str_to_pdu, nic_pdu_to_str),        HEADER(HDR_ID_DAT, HDR_NAME_DAT, 0, dat_str_to_pdu, dat_pdu_to_str),        HEADER(HDR_ID_SRV, HDR_NAME_SRV, 0, srv_str_to_pdu, srv_pdu_to_str)    };    temp_size = sizeof(temp) / sizeof(temp[0]);    if (temp_size > HDR_AMOUNT)    {        return -1;    }    memset(proto, 0, sizeof(*proto));    memcpy(proto->header, &temp, sizeof(temp));    return 0;}
开发者ID:andischmoll,项目名称:DChat-Core,代码行数:37,


示例10: typelib_prolog

static gbooleantypelib_prolog(TreeState *state){    state->priv = calloc(1, sizeof(struct priv_data));    if (!state->priv)        return FALSE;    IFACES(state) = 0;    IFACE_MAP(state) = g_hash_table_new(g_str_hash, g_str_equal);    if (!IFACE_MAP(state)) {        /* XXX report error */        free(state->priv);        return FALSE;    }    /* find all interfaces, top-level and referenced by others */    IDL_tree_walk_in_order(state->tree, find_interfaces, state);    ARENA(state) = XPT_NewArena(1024, sizeof(double), "main xpidl arena");    HEADER(state) = XPT_NewHeader(ARENA(state), IFACES(state),                                   major_version, minor_version);    /* fill IDEs from hash table */    IFACES(state) = 0;    g_hash_table_foreach_remove(IFACE_MAP(state), fill_ide_table, state);    /* if any are left then we must have failed in fill_ide_table */    if (g_hash_table_size(IFACE_MAP(state)))        return FALSE;    /* sort the IDEs by IID order and store indices in the interface map */    sort_ide_block(state);    return TRUE;}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:32,


示例11: FUNC

static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,                                MPEG2RawExtensionData *current){    int err;    HEADER("Extension Data");    ui(8, extension_start_code);    ui(4, extension_start_code_identifier);    switch (current->extension_start_code_identifier) {    case 1:        return FUNC(sequence_extension)            (ctx, rw, &current->data.sequence);    case 2:        return FUNC(sequence_display_extension)            (ctx, rw, &current->data.sequence_display);    case 3:        return FUNC(quant_matrix_extension)            (ctx, rw, &current->data.quant_matrix);    case 7:        return FUNC(picture_display_extension)            (ctx, rw, &current->data.picture_display);    case 8:        return FUNC(picture_coding_extension)            (ctx, rw, &current->data.picture_coding);    default:        av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid extension ID %d./n",               current->extension_start_code_identifier);        return AVERROR_INVALIDDATA;    }}
开发者ID:Innovattic,项目名称:FFmpeg,代码行数:32,


示例12: deletefree

static void deletefree(void *currblock) {  int listcounter = 0;  size_t size = GETSIZE(HEADER(currblock));    for (;(listcounter < LISTS - 1) && (size > 1); listcounter++) {    size >>= 1;  }    if (PREVFREE(currblock) != NULL) {    if (NEXTFREE(currblock) != NULL) {      SETPTR(NEXTPTR(PREVFREE(currblock)), NEXTFREE(currblock));      SETPTR(PREVPTR(NEXTFREE(currblock)), PREVFREE(currblock));    } else {      SETPTR(NEXTPTR(PREVFREE(currblock)), NULL);      free_lists[listcounter] = PREVFREE(currblock);    }  } else {    if (NEXTFREE(currblock) != NULL) {      SETPTR(PREVPTR(NEXTFREE(currblock)), NULL);    } else {      free_lists[listcounter] = NULL;    }  }    return;}
开发者ID:js6450,项目名称:CSO,代码行数:26,


示例13: HEADER

	void Connection::ReadPacket()	{		if(Errors())			return;						/** Handle Reading Packet Type Header. **/		if(SOCKET->available() > 0 && INCOMING->GetHeader() == 255)		{			std::vector<unsigned char> HEADER(1, 255);			if(Read(HEADER, 1) == 1)				INCOMING->SetHeader(HEADER[0]);								return;		}						if(INCOMING->GetHeader() != 255 && !INCOMING->Complete())		{						/** Handle Reading Packet Length Header. **/			if(SOCKET->available() >= 4 && INCOMING->GetLength() == 0)			{				std::vector<unsigned char> BYTES(4, 0);				if(Read(BYTES, 4) == 4)				{					INCOMING->SetLength(BYTES);					Event(0);				}									return;			}								/** Handle Reading Packet Data. **/			unsigned int nAvailable = SOCKET->available();			if(nAvailable > 0 && INCOMING->GetLength() > 0 && INCOMING->GetData().size() < INCOMING->GetLength())			{				std::vector<unsigned char> DATA( std::min(nAvailable, (unsigned int)(INCOMING->GetLength() - INCOMING->GetData().size())), 0);				unsigned int nRead = Read(DATA, DATA.size());									if(nRead == DATA.size())				{					std::vector<unsigned char> dta = INCOMING->GetData();					try					{						dta.insert(dta.end(), DATA.begin(), DATA.end());					}					catch(const std::exception e)					{						return;					}					INCOMING->SetData(dta);					Event(nRead);				}									return;			}		}	}
开发者ID:djm34,项目名称:skminer,代码行数:58,


示例14: GETSIZE

void *mm_realloc(void *currblock, size_t size){  void *new_currblock = currblock;   size_t new_size = size;   int remainder;    int extendsize;   int block_buffer;   if (size == 0)    return NULL;    if (new_size <= DSIZE) {    new_size = 2 * DSIZE;  } else {    new_size = DSIZE * ((new_size + (DSIZE) + (DSIZE - 1)) / DSIZE);  }    new_size += 16;    block_buffer = GETSIZE(HEADER(currblock)) - new_size;    if (block_buffer < 0) {    if (!FULL(HEADER(NEXT(currblock))) || !GETSIZE(HEADER(NEXT(currblock)))) {      remainder = GETSIZE(HEADER(currblock)) + GETSIZE(HEADER(NEXT(currblock))) - new_size;      if (remainder < 0) {        extendsize = ((-remainder)>CHUNKSIZE?(-remainder):CHUNKSIZE);        if (extend_heap(extendsize) == NULL)          return NULL;        remainder += extendsize;      }            deletefree(NEXT(currblock));            CLEARTAG(HEADER(currblock), PACK(new_size + remainder, 1)); // Block header       CLEARTAG(FOOTER(currblock), PACK(new_size + remainder, 1)); // Block footer     } else {      new_currblock = mm_malloc(new_size - DSIZE);      line_count--;      memmove(new_currblock, currblock,((size)<new_size?(size):new_size));      mm_free(currblock);      line_count--;    }    block_buffer = GETSIZE(HEADER(new_currblock)) - new_size;  }    if (block_buffer < 2 * 16)    SETRTAG(HEADER(NEXT(new_currblock)));    line_count++;   if (MMCHECK) {    mm_check('r', currblock, size);     }    return new_currblock;}
开发者ID:js6450,项目名称:CSO,代码行数:55,


示例15: HEADER

void		OvMemoryPool::free_memory_debug(void* _memory){	OvMemHeader*	k_mem_header = NULL;	k_mem_header			=	HEADER(_memory);	k_mem_header->m_iLine	=	-1;	k_mem_header->m_pBlock	=	NULL;	k_mem_header->mNext		=	m_pFreeMemoryList;	m_pFreeMemoryList		=	k_mem_header;}
开发者ID:ultrano,项目名称:OliveBasic,代码行数:9,


示例16: spclone

rt_private EIF_REFERENCE spclone(EIF_REFERENCE source){    /* Clone an of Eiffel object `source'. Assumes that source     * is a special object.     */    EIF_GET_CONTEXT    EIF_REFERENCE result;		/* Clone pointer */    union overhead *zone;		/* Pointer on source header */    uint16 flags;				/* Source object flags */    EIF_TYPE_INDEX dtype, dftype;    if ((EIF_REFERENCE) 0 == source)        return (EIF_REFERENCE) 0;				/* Void source */    RT_GC_PROTECT(source);			/* Protection against GC */    zone = HEADER(source);				/* Allocation of a new object */    flags = zone->ov_flags;    dtype = zone->ov_dtype;    dftype = zone->ov_dftype;    result = spmalloc(RT_SPECIAL_COUNT(source), RT_SPECIAL_ELEM_SIZE(source), EIF_TEST(!(flags & EO_REF)));    /* Keep the reference flag and the composite one and the type */    HEADER(result)->ov_flags |= flags & (EO_REF | EO_COMP);    HEADER(result)->ov_dtype = dtype;    HEADER(result)->ov_dftype = dftype;    /* Keep the count and the element size */    RT_SPECIAL_COUNT(result) = RT_SPECIAL_COUNT(source);    RT_SPECIAL_ELEM_SIZE(result) = RT_SPECIAL_ELEM_SIZE(source);    RT_SPECIAL_CAPACITY(result) = RT_SPECIAL_COUNT(source);    if (!egc_has_old_special_semantic) {        /* If by default allocation does not clear the data of a SPECIAL,         * we actually need to do clear it otherwise we end up with a SPECIAL         * object that is susceptible to be manipulated by the GC while waiting to         * be filled. */        memset(result, 0, RT_SPECIAL_VISIBLE_SIZE(result));    }    RT_GC_WEAN(source);				/* Remove GC protection */    return result;}
开发者ID:ebezault,项目名称:EiffelStudio,代码行数:44,


示例17: placeblock

static void placeblock(void *currblock, size_t asize){  size_t currblock_size = GETSIZE(HEADER(currblock));  size_t remainder = currblock_size - asize;    deletefree(currblock);    if (remainder >= 16) {    PUT(HEADER(currblock), PACK(asize, 1));    PUT(FOOTER(currblock), PACK(asize, 1));    CLEARTAG(HEADER(NEXT(currblock)), PACK(remainder, 0));    CLEARTAG(FOOTER(NEXT(currblock)), PACK(remainder, 0));      insertfree(NEXT(currblock), remainder);  } else {    PUT(HEADER(currblock), PACK(currblock_size, 1));    PUT(FOOTER(currblock), PACK(currblock_size, 1));  }  return;}
开发者ID:js6450,项目名称:CSO,代码行数:19,


示例18: raw_Symbol

Symbol raw_Symbol(const wchar_t* input){    uns_int size   = wcslen(input) + 1;    Symbol result  = NEW_ARRAYED(struct Symbol_t, wchar_t[size]);    HEADER(result) = Symbol_Class;    result->hash   = wchar_hash(input, size);    wcsncpy(result->value, input, size);    result->size   = size - 1;    return result;}
开发者ID:aldavud,项目名称:p,代码行数:10,


示例19: sInterp

/* * This is the core of secret sharing.  This computes the coefficients * used in Lagrange polynomial interpolation, returning the * vector of logarithms of b1(xtarget), b2(xtarget), ..., bn(xtarget). * Takes values from the "xCoordinate" header element, inserts the * results in the "lagrange" header element. * The interpolation values come from the headers of the "shares" array, * plus one additional value, xInput, which is the value we are going * to interpolate to. *  * Returns kPGPError_OK on success, error if not all x[i] are unique. */	static PGPErrorsInterp(PGPByte *shares, PGPSize bodySize, PGPByte xInput, PGPUInt32 nShares){	PGPUInt32		i, j;	PGPByte			xi, xj;	PGPUInt32		numer, denom;#if !PGP_STATIC_SHAMIR_ARRAYS	s_FSetup();#endif /* !PGP_STATIC_SHAMIR_ARRAYS */	/* First, accumulate the numerator, Prod(xInput-x[i],i=0..n) */	numer = 0;	for (i = 0; i < nShares; i++)	{		xi = HEADER(shares,bodySize,i)->xCoordinate;		numer += f_log[ f_sub(xi, xInput) ];	}	/* Preliminary partial reduction */	numer = (numer%FIELD_SIZE) + (numer/FIELD_SIZE);	/* Then, for each coefficient, compute the corresponding denominator */	for (i = 0; i < nShares; i++) {		xi = HEADER(shares,bodySize,i)->xCoordinate;		denom = 0;		for (j = 0; j < nShares; j++) {			xj = (i == j) ? xInput : HEADER(shares,bodySize,j)->xCoordinate;			if (xi == xj)				return -1;			denom += f_log[f_sub(xi,xj)];		}		denom = (denom%FIELD_SIZE)+(denom/FIELD_SIZE);		/* 0 <= denom < 2*FIELD_SIZE-1. */		/* Now find numer/denom.  In log form, that's a subtract. */		denom = numer + 2*FIELD_SIZE-2 - denom;		denom = (denom%FIELD_SIZE)+(denom/FIELD_SIZE);		denom = (denom%FIELD_SIZE)+(denom/FIELD_SIZE);		HEADER(shares,bodySize,i)->lagrange = (PGPByte)denom;	}	return kPGPError_NoErr;	/* Success */}
开发者ID:ysangkok,项目名称:pgp-unix-6.5.8,代码行数:55,


示例20: CLEARTAG

static void *extend_heap(size_t size){  void *currblock;            size_t words = size / WSIZE;  size_t asize;    asize = (words % 2) ? (words + 1) * WSIZE : words * WSIZE;  if ((long)(currblock = mem_sbrk(asize)) == -1)    return NULL;    CLEARTAG(HEADER(currblock), PACK(asize, 0));   CLEARTAG(FOOTER(currblock), PACK(asize, 0));  CLEARTAG(HEADER(NEXT(currblock)), PACK(0, 1));    insertfree(currblock, asize);  return coalesce(currblock);}
开发者ID:js6450,项目名称:CSO,代码行数:19,


示例21: while

void *mm_malloc(size_t size){  size_t asize;   void *currblock = NULL;    int listcounter = 0;     size_t checksize = size; // Copy of request size    if (size == 0)    return NULL;    if (size <= DSIZE) {    asize = 2 * DSIZE;  } else {    asize = DSIZE * ((size + DSIZE + DSIZE - 1) / DSIZE);  }    size = asize;  for (;listcounter < LISTS; listcounter++) {    if ((listcounter == LISTS - 1) || ((asize <= 1) && (free_lists[listcounter] != NULL))) {      currblock = free_lists[listcounter];      while ((currblock != NULL) && ((size > GETSIZE(HEADER(currblock))) || (RTAG(HEADER(currblock))))) {        currblock = PREVFREE(currblock);      }      if (currblock != NULL)        break;    }       asize >>= 1;  }    if (currblock == NULL) {    currblock = extend_heap(size);  }    placeblock(currblock, size);    line_count++;  if(MMCHECK)    mm_check('a', currblock, checksize);    return currblock;}
开发者ID:js6450,项目名称:CSO,代码行数:42,


示例22: new_Array_raw

Array new_Array_raw(uns_int c){    if (c == 0)    {        return empty_Array;    }    Array result = NEW_ARRAYED(struct Array_t, Optr[c]);    HEADER(result) = Array_Class;    SET_SIZE(result, c);    return result;}
开发者ID:o-,项目名称:p,代码行数:11,


示例23: mm_free

void mm_free(void *currblock){  size_t size = GETSIZE(HEADER(currblock)); // Size of block     UNSETRTAG(HEADER(NEXT(currblock)));    PUT(HEADER(currblock), PACK(size, 0));  PUT(FOOTER(currblock), PACK(size, 0));    insertfree(currblock, size);    coalesce(currblock);    line_count++;  if (MMCHECK) {    mm_check('f', currblock, size);  }  return;}
开发者ID:js6450,项目名称:CSO,代码行数:20,



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


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