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

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

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

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

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

示例1: initSemaphores

int initSemaphores( INOUT KERNEL_DATA *krnlDataPtr )	{	int i, status;	assert( isWritePtr( krnlDataPtr, sizeof( KERNEL_DATA ) ) );	static_assert( MUTEX_LAST == 4, "Mutex value" );	/* Set up the reference to the kernel data block */	krnlData = krnlDataPtr;	/* Clear the semaphore table */	for( i = 0; i < SEMAPHORE_LAST; i++ )		krnlData->semaphoreInfo[ i ] = SEMAPHORE_INFO_TEMPLATE;	/* Initialize any data structures required to make the semaphore table	   thread-safe */	MUTEX_CREATE( semaphore, status );	ENSURES( cryptStatusOK( status ) );	/* Initialize the mutexes */	MUTEX_CREATE( mutex1, status );	ENSURES( cryptStatusOK( status ) );	MUTEX_CREATE( mutex2, status );	ENSURES( cryptStatusOK( status ) );	MUTEX_CREATE( mutex3, status );	ENSURES( cryptStatusOK( status ) );	return( CRYPT_OK );	}
开发者ID:TellarHK,项目名称:wwiv,代码行数:30,


示例2: set_ptr

/* * Set the pred and succ of the given free block * Since the whole memory space is 2^32 bytes * I can compress the 8 bytes address into 4 bytes * by computing its offest to heap_listp */static inline void set_ptr(uint32_t* const block,                           uint32_t* const pred_block,                           uint32_t* const succ_block) {    REQUIRES(block != NULL);    REQUIRES(in_heap(block));    unsigned int pred_offest;     unsigned int succ_offest;    if (pred_block == NULL)        pred_offest = 0;    else         pred_offest = pred_block - heap_listp;    if (succ_block == NULL)        succ_offest = 0;    else        succ_offest = succ_block - heap_listp;    //printf("pred_off = %d, succ_off = %d/n", pred_offest, succ_offest);    set_val(block + 1 , pred_offest);    set_val(block + 2 , succ_offest);    ENSURES(block_pred(block) == pred_block);    ENSURES(block_succ(block) == succ_block);    }
开发者ID:mindbergh,项目名称:malloc,代码行数:31,


示例3: REQUIRES

/* * Extends the heap with a new free block * Return: the pointer to the new free block  *         NULL on error. */static void *extend_heap(unsigned int words) {    REQUIRES(words > 4);    uint32_t *block;    uint32_t *next;        /* Ask for 2 more words for header and footer */    words = (words % 2) ? (words + 1) : words;    if (VERBOSE)        printf("Extend Words = %d bytes/n", words * 4);    if ((long)(block = mem_sbrk(words * WSIZE)) == -1)        return NULL;    block--;          // back step 1 since the last one is the epi block    set_size(block, words - 2);    block_mark(block, FREE);    ENSURES(block != NULL);    // New eqilogue block    next = block_next(block);        set_size(next, 0);    *next |= 0x40000000;    //block_mark(block_next(block), ALLOCATED);    ENSURES(!block_free(next));    ENSURES(block_size(next) == 0);    block = coalesce(block);    // Coalesce if necessary    ENSURES(in_list(block));    return block; }
开发者ID:mindbergh,项目名称:malloc,代码行数:36,


示例4: place

/* * Place the block and potentially split the block * Return: Nothing */static void place(void *block, unsigned int awords) {    REQUIRES(awords >= 2 && awords % 2 == 0);    REQUIRES(block != NULL);    REQUIRES(in_heap(block));    REQUIRES(in_list(block));    unsigned int cwords = block_size(block); //the size of the given freeblock    block_delete(block);      // delete block from the seg list        ENSURES(!in_list(block));    if ((cwords - awords) >= 4) {        set_size(block, awords);        block_mark(block, ALLOCATED);        block = block_next(block);        set_size(block, cwords - awords - 2);        block_mark(block, FREE);        block_insert(block);        ENSURES(in_list(block));    } else {        set_size(block, cwords);        block_mark(block, ALLOCATED);    }     }
开发者ID:mindbergh,项目名称:malloc,代码行数:29,


示例5: reserve_memory

	void* reserve_memory(size_t size)	{#ifdef _WIN32		void* ret = VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);		ENSURES(ret != NULL);#else		void* ret = mmap(nullptr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);		ENSURES(ret != 0);#endif		return ret;	}
开发者ID:DreadIsBack,项目名称:rpcs3,代码行数:11,


示例6: xmalloc

queue *queue_new() {  queue *Q = xmalloc(sizeof(queue));  list *p = xmalloc(sizeof(list));  /* Dummy node: does not need to be initialized! */  Q->front = p;  Q->back = p;  ENSURES(is_queue(Q));  ENSURES(queue_empty(Q));  return Q;}
开发者ID:mpai227,项目名称:Lightsout-Solver,代码行数:11,


示例7: block_succ

// Return the header to the successor free blockstatic inline uint32_t* block_succ(uint32_t* const block) {    REQUIRES(block != NULL);    REQUIRES(in_heap(block));    uint32_t * address = heap_listp + block[2];    ENSURES(address != NULL);    ENSURES(in_heap(address));    if (address == heap_listp)        return NULL;    else         return address;}
开发者ID:mindbergh,项目名称:malloc,代码行数:15,


示例8: readGeneralInfo

static int readGeneralInfo( INOUT STREAM *stream, 							INOUT CMP_PROTOCOL_INFO *protocolInfo )	{	long endPos;	int length, iterationCount, status;	assert( isWritePtr( stream, sizeof( STREAM ) ) );	assert( isWritePtr( protocolInfo, sizeof( CMP_PROTOCOL_INFO ) ) );	/* Go through the various attributes looking for anything that we can	   use */	readConstructed( stream, NULL, CTAG_PH_GENERALINFO );	status = readSequence( stream, &length );	if( cryptStatusError( status ) )		return( status );	endPos = stell( stream ) + length;	for( iterationCount = 0; 		 stell( stream ) < endPos && /			iterationCount < FAILSAFE_ITERATIONS_MED; iterationCount++ )		{		status = readGeneralInfoAttribute( stream, protocolInfo );		if( cryptStatusError( status ) )			return( status );		}	ENSURES( iterationCount < FAILSAFE_ITERATIONS_MED );	return( status );	}
开发者ID:VlaBst6,项目名称:cryptlib-history,代码行数:28,


示例9: findDnInGeneralName

static int findDnInGeneralName( INOUT CERT_INFO *certInfoPtr,								const BOOLEAN updateCursor )	{	ATTRIBUTE_PTR *attributePtr;	DN_PTR **dnPtr;	int status;	assert( isWritePtr( certInfoPtr, sizeof( CERT_INFO ) ) );	/* We're inside a GeneralName, clear any possible saved selection */	certInfoPtr->currentSelection.generalName = CRYPT_ATTRIBUTE_NONE;	REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );	/* Search for a DN in the current GeneralName */	attributePtr = findDnInAttribute( certInfoPtr->attributeCursor );	if( attributePtr == NULL )		return( CRYPT_ERROR_NOTFOUND );	/* We found a DN, select it */	status = getAttributeDataDN( attributePtr, &dnPtr );	if( cryptStatusError( status ) )		return( status );	certInfoPtr->currentSelection.dnPtr = dnPtr;	if( updateCursor )		certInfoPtr->attributeCursor = attributePtr;	certInfoPtr->currentSelection.dnInExtension = TRUE;	ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );	return( CRYPT_OK );	}
开发者ID:TellarHK,项目名称:wwiv,代码行数:32,


示例10: find_free_block

// Returns a pointer if block of sufficient size is available // will allocate a new block if none are freestatic void* find_free_block(int index, size_t size){    REQUIRES(0 <= index && index < NUM_FREE_LISTS);    void* block;    void* current;    int new_index = index;     while(new_index < NUM_FREE_LISTS){    	current = free_lists[new_index];    	while(current != NULL){    		if(block_size(current) >= size){    			// if(new_index > index){    			// 	block = split_block(new_index);    			// 	block_mark(block, 0);    			// 	return block;    			// }    			block = current;    			block_mark(block, 0);    			remove_block_from_list(new_index, block);    		}    		current = block_next(current);    	}        new_index++;    }    assert(aligned(block));    block = allocate_block(size);    ENSURES(block != NULL);    return block;}
开发者ID:sunpan9209,项目名称:15213,代码行数:33,


示例11: tree_insert

tree* tree_insert(tree* T, elem x, bst B){  REQUIRES(is_tree(T, B));  REQUIRES(x != NULL);  if (T == NULL) {    T = xmalloc(sizeof(tree));    T->height = 1;    T->data = x;    T->left = NULL;    T->right = NULL;  } else {    int r = B->elem_compare(x, T->data);    if (r == 0) {      T->data = x;    } else if (r < 0) {      T->left = tree_insert(T->left, x, B);      T = rebalance_left(T, B);    } else {      T->right = tree_insert(T->right, x, B);      T = rebalance_right(T, B);    }  }  ENSURES(is_tree(T, B));  return T;}
开发者ID:zhengguan,项目名称:15122,代码行数:27,


示例12: transpose_submit

void transpose_submit(int M, int N, int A[N][M], int B[M][N]){    REQUIRES(M > 0);    REQUIRES(N > 0);    ENSURES(is_transpose(M, N, A, B));}
开发者ID:TorinYu,项目名称:15213,代码行数:7,


示例13: REQUIRES

hostptr_t Buddy::get(size_t &size){    REQUIRES(size > 0);    hostptr_t ret = __impl::util::allocator::Buddy::get(size);    ENSURES(ret == NULL || (ret >= addr_ && ret <= (addr_ + size_ - size)));    return ret;}
开发者ID:GMAC-lib,项目名称:gmac,代码行数:7,


示例14: sift_down

void sift_down(heap H, int i){  REQUIRES(is_safe_heap(H));  REQUIRES(H->next > 1 && is_heap_except_down(H, i));  while (2*i < H->next)  {    ASSERT(1 <= i && i < H->next);    ASSERT(is_heap_except_down(H, i));    ASSERT(grandparent_check(H, i));    int left = 2*i;    int right = left + 1;    if (ok_above(H, i, left)        && (right >= H->next || ok_above(H, i, right))) {      return;    }    else if (right >= H->next || ok_above(H, left, right)) {      swap_up(H, left);      i = left;    }    else {      ASSERT(right < H->next && ok_above(H, right, left));      swap_up(H, right);      i = right;    }  }  ASSERT(i < H->next && 2*i >= H->next);  ASSERT(is_heap_except_down(H, i));  ENSURES(is_heap(H));}
开发者ID:deedeethan,项目名称:Practice,代码行数:30,


示例15: get_offset

static void *find_fit(size_t asize){   /* First fit search */  void* bp;  //  print_list();  int offset = get_offset(asize);  //printf("in first fit search  /n");  for (int i = offset; i < 9; i++)    {      //printf ("In bucket %d /n",i);      for (bp =((void*) (*(long*)GET_BUCKET(root, i)));           bp != NULL ; bp = get_succ(bp) )        {          // printf("bp %p /n",bp);          REQUIRES ((void*)bp != NULL);          REQUIRES (((size_t)(bp))%8 == 0);          size_t size =  GET_SIZE(HDRP((bp)));          if (!GET_ALLOC( HDRP(((bp) ) )) &&              (asize <= size))            {              ENSURES ( (size_t)(bp)%8 == 0);              size_t diff = size - asize;              return first_best_fit((void*)bp,asize, diff) ;            }        }    }  return NULL; /* No fit */}
开发者ID:msr23trini,项目名称:malloclab,代码行数:29,


示例16: sizeofMessageDigest

CHECK_RETVAL_LENGTH /int sizeofMessageDigest( IN_ALGO const CRYPT_ALGO_TYPE hashAlgo,                         IN_LENGTH_HASH const int hashSize ){    const int hashParam = isParameterisedHashAlgo( hashAlgo ) ? hashSize : 0;    int algoInfoSize, hashInfoSize;    REQUIRES( isHashAlgo( hashAlgo ) );    REQUIRES( hashSize >= 16 && hashSize <= CRYPT_MAX_HASHSIZE );    algoInfoSize = sizeofAlgoIDex( hashAlgo, hashParam, 0 );    hashInfoSize = sizeofObject( hashSize );    ENSURES( algoInfoSize > 8 && algoInfoSize < MAX_INTLENGTH_SHORT );    ENSURES( hashInfoSize > hashSize && hashInfoSize < MAX_INTLENGTH_SHORT );    return( sizeofObject( algoInfoSize + hashInfoSize ) );}
开发者ID:randombit,项目名称:hacrypto,代码行数:17,


示例17: malloc

void *calloc (size_t nmemb, size_t size) {  size_t bytes = nmemb * size;  void *newptr;  //printf ("calloc %d/n" ,(int)size);  newptr = malloc(bytes);  memset(newptr, 0, bytes);  ENSURES ( (size_t)(newptr)%8 == 0);  return newptr;}
开发者ID:msr23trini,项目名称:malloclab,代码行数:9,


示例18: enq

void enq(queue *Q, queue_elem x) {  REQUIRES(is_queue(Q));  Q->back->data = x;  Q->back->next = xmalloc(sizeof(list));  Q->back = Q->back->next;  ENSURES(is_queue(Q) && !queue_empty(Q));}
开发者ID:mpai227,项目名称:Lightsout-Solver,代码行数:9,


示例19: REQUIRES

voidMode::registerKernel(gmac_kernel_id_t k, KernelImpl &kernel){    REQUIRES(kernels_.find(k) == kernels_.end());    Parent::registerKernel(k, kernel);    ENSURES(kernels_.find(k) != kernels_.end());}
开发者ID:GMAC-lib,项目名称:gmac,代码行数:9,


示例20: bst_lookup

elem bst_lookup(bst B, elem x){  REQUIRES(is_bst(B) && x != NULL);  elem r = tree_lookup(B->root, x, B);  ENSURES(r == NULL || B->elem_compare(r, x) == 0);  return r;}
开发者ID:zhengguan,项目名称:15122,代码行数:9,


示例21: insertMemBlock

static int insertMemBlock( INOUT MEM_INFO_HEADER **allocatedListHeadPtr, 						   INOUT MEM_INFO_HEADER **allocatedListTailPtr, 						   INOUT MEM_INFO_HEADER *memHdrPtr )	{	MEM_INFO_HEADER *allocatedListHead = *allocatedListHeadPtr;	MEM_INFO_HEADER *allocatedListTail = *allocatedListTailPtr;	assert( isWritePtr( allocatedListHeadPtr, sizeof( MEM_INFO_HEADER * ) ) );	assert( allocatedListHead == NULL || /			isWritePtr( allocatedListHead, sizeof( MEM_INFO_HEADER ) ) );	assert( isWritePtr( allocatedListTailPtr, sizeof( MEM_INFO_HEADER * ) ) );	assert( allocatedListTail == NULL || /			isWritePtr( allocatedListTail, sizeof( MEM_INFO_HEADER ) ) );	assert( isWritePtr( memHdrPtr, sizeof( MEM_INFO_HEADER * ) ) );	/* Precondition: The memory block list is empty, or there's at least a 	   one-entry list present */	REQUIRES( ( allocatedListHead == NULL && allocatedListTail == NULL ) || /			  ( allocatedListHead != NULL && allocatedListTail != NULL ) );	/* If it's a new list, set up the head and tail pointers and return */	if( allocatedListHead == NULL )		{		/* In yet another of gcc's endless supply of compiler bugs, if the		   following two lines of code are combined into a single line then		   the write to the first value, *allocatedListHeadPtr, ends up 		   going to some arbitrary memory location and only the second		   write goes to the correct location (completely different code is		   generated for the two writes)  This leaves 		   krnlData->allocatedListHead as a NULL pointer, leading to an		   exception being triggered the next time that it's accessed */#if defined( __GNUC__ ) && ( __GNUC__ == 4 )		*allocatedListHeadPtr = memHdrPtr;		*allocatedListTailPtr = memHdrPtr;#else		*allocatedListHeadPtr = *allocatedListTailPtr = memHdrPtr;#endif /* gcc 4.x compiler bug */		return( CRYPT_OK );		}	/* It's an existing list, add the new element to the end */	REQUIRES( checkMemBlockHdr( allocatedListTail ) );	allocatedListTail->next = memHdrPtr;	setMemChecksum( allocatedListTail );	memHdrPtr->prev = allocatedListTail;	*allocatedListTailPtr = memHdrPtr;	/* Postcondition: The new block has been linked into the end of the 	   list */	ENSURES( allocatedListTail->next == memHdrPtr && /			 memHdrPtr->prev == allocatedListTail && /			 memHdrPtr->next == NULL );	return( CRYPT_OK );	}
开发者ID:VlaBst6,项目名称:cryptlib-history,代码行数:56,


示例22: bst_insert

void bst_insert(bst B, elem x){  REQUIRES(is_bst(B));  REQUIRES(x != NULL);  B->root = tree_insert(B->root, x, B);  ENSURES(is_bst(B));  return;}
开发者ID:zhengguan,项目名称:15122,代码行数:10,


示例23: selfTest

CHECK_RETVAL /static int selfTest( void )	{	CONTEXT_INFO contextInfo;	PKC_INFO contextData, *pkcInfo = &contextData;	int status;	/* Initialise the key components */	status = staticInitContext( &contextInfo, CONTEXT_PKC, 								getDHCapability(), &contextData, 								sizeof( PKC_INFO ), NULL );	if( cryptStatusError( status ) )		return( CRYPT_ERROR_FAILED );	status = importBignum( &pkcInfo->dlpParam_p, dlpTestKey.p, 						   dlpTestKey.pLen, DLPPARAM_MIN_P, 						   DLPPARAM_MAX_P, NULL, KEYSIZE_CHECK_PKC );	if( cryptStatusOK( status ) )		status = importBignum( &pkcInfo->dlpParam_g, dlpTestKey.g, 							   dlpTestKey.gLen, DLPPARAM_MIN_G, 							   DLPPARAM_MAX_G, &pkcInfo->dlpParam_p,							   KEYSIZE_CHECK_NONE );	if( cryptStatusOK( status ) )		status = importBignum( &pkcInfo->dlpParam_q, dlpTestKey.q, 							   dlpTestKey.qLen, DLPPARAM_MIN_Q, 							   DLPPARAM_MAX_Q, &pkcInfo->dlpParam_p,							   KEYSIZE_CHECK_NONE );	if( cryptStatusOK( status ) )		status = importBignum( &pkcInfo->dlpParam_y, dlpTestKey.y, 							   dlpTestKey.yLen, DLPPARAM_MIN_Y, 							   DLPPARAM_MAX_Y, &pkcInfo->dlpParam_p,							   KEYSIZE_CHECK_NONE );	if( cryptStatusOK( status ) )		status = importBignum( &pkcInfo->dlpParam_x, dlpTestKey.x, 							   dlpTestKey.xLen, DLPPARAM_MIN_X, 							   DLPPARAM_MAX_X, &pkcInfo->dlpParam_p,							   KEYSIZE_CHECK_NONE );	if( cryptStatusError( status ) )		{		staticDestroyContext( &contextInfo );		retIntError();		}	ENSURES( sanityCheckPKCInfo( pkcInfo ) );	/* Perform the test key exchange on a block of data */	status = contextInfo.capabilityInfo->initKeyFunction( &contextInfo, NULL, 0 );	if( cryptStatusOK( status ) && /		!pairwiseConsistencyTest( &contextInfo ) )		status = CRYPT_ERROR_FAILED;	/* Clean up */	staticDestroyContext( &contextInfo );	return( status );	}
开发者ID:gitter-badger,项目名称:OpenCKMS,代码行数:55,


示例24: updateMacInfo

static int updateMacInfo( INOUT SESSION_INFO *sessionInfoPtr,						  INOUT CMP_PROTOCOL_INFO *protocolInfo,						  INOUT STREAM *stream,						  const BOOLEAN isRevocation )	{	const ATTRIBUTE_LIST *passwordPtr = /					findSessionInfo( sessionInfoPtr->attributeList,									 CRYPT_SESSINFO_PASSWORD );	BYTE macKey[ 64 + 8 ];	BOOLEAN decodedMacKey = FALSE;	const void *macKeyPtr;	const int streamPos = stell( stream );	int macKeyLength, status;	REQUIRES( passwordPtr != NULL );	sseek( stream, protocolInfo->macInfoPos );	if( isRevocation && protocolInfo->altMacKeySize > 0 )		{		/* If it's a revocation and we're using a distinct revocation		   password (which we've already decoded into a MAC key), use		   that */		macKeyPtr = protocolInfo->altMacKey;		macKeyLength = protocolInfo->altMacKeySize;		}	else		{		/* It's a standard issue (or we're using the same password/key		   for the issue and revocation), use that */		if( passwordPtr->flags & ATTR_FLAG_ENCODEDVALUE )			{			/* It's an encoded value, get the decoded form */			macKeyPtr = macKey;			status = decodePKIUserValue( macKey, 64, &macKeyLength, 										 passwordPtr->value, 										 passwordPtr->valueLength );			ENSURES( cryptStatusOK( status ) );			decodedMacKey = TRUE;			}		else			{			macKeyPtr = passwordPtr->value;			macKeyLength = passwordPtr->valueLength;			}		}	status = readMacInfo( stream, protocolInfo, macKeyPtr,						  macKeyLength, SESSION_ERRINFO );	if( decodedMacKey )		zeroise( macKey, 64 );	if( cryptStatusError( status ) )		return( status );	sseek( stream, streamPos );	return( CRYPT_OK );	}
开发者ID:VlaBst6,项目名称:cryptlib-history,代码行数:55,


示例25: heap_new

heap heap_new(int capacity, higher_priority_fn *prior){  REQUIRES(capacity > 0 && prior != NULL);  heap H = malloc(sizeof(struct heap_header));  H->next = 1;  H->limit = capacity + 1;  H->data = malloc(sizeof(void*) * H->limit);  H->prior = prior;  ENSURES(is_heap(H) && heap_empty(H));  return H;}
开发者ID:deedeethan,项目名称:Practice,代码行数:11,


示例26: block_insert

// Insert the given free block into seg list according to its sizestatic inline void block_insert(uint32_t* block) {    REQUIRES(block != NULL);    REQUIRES(in_heap(block));    int index = find_index(block_size(block));    //printf("index = %d, size = %d/n", index, block_size(block));    uint32_t *old_block = seg_list[index];    if (old_block == NULL) { // this list is empty        set_ptr(block, NULL, NULL);        seg_list[index] = block;    } else {                 // this list is not empty        ENSURES(block_pred(old_block) == NULL);        ENSURES(block_succ(old_block) == NULL || in_heap(block_succ(old_block)));        set_ptr(old_block, block, block_succ(old_block));        set_ptr(block, NULL, old_block);        seg_list[index] = block;    }    ENSURES(in_list(block));}
开发者ID:mindbergh,项目名称:malloc,代码行数:22,


示例27: deq

queue_elem deq(queue *Q) {  REQUIRES(is_queue(Q));  REQUIRES(!queue_empty(Q));  queue_elem x = Q->front->data;  /* save old queue element to return */  list *q = Q->front;             /* save old list node to free */  Q->front = Q->front->next;  free(q);                      /* free old list node */  ENSURES(is_queue(Q));  return x;                     /* return old queue element */}
开发者ID:mpai227,项目名称:Lightsout-Solver,代码行数:12,


示例28: loadECCparams

static int loadECCparams( INOUT CONTEXT_INFO *contextInfoPtr )	{	PKC_INFO *pkcInfo = contextInfoPtr->ctxPKC;	const ECC_DOMAIN_PARAMS *eccParams = NULL;	int curveSize, i, bnStatus = BN_STATUS;	assert( isWritePtr( contextInfoPtr, sizeof( CONTEXT_INFO ) ) );	/* Find the parameter info for this curve */	for( i = 0; domainParamTbl[ i ].paramType != CRYPT_ECCCURVE_NONE && /				i < FAILSAFE_ARRAYSIZE( domainParamTbl, ECC_DOMAIN_PARAMS ); 		 i++ )		{		if( domainParamTbl[ i ].paramType == pkcInfo->curveType )			{			eccParams = &domainParamTbl[ i ];			break;			}		}	ENSURES( i < FAILSAFE_ARRAYSIZE( domainParamTbl, ECC_DOMAIN_PARAMS ) );	ENSURES( eccParams != NULL );	/* For the named curve the key size is defined by exective fiat based	   on the curve type rather than being taken from the public-key value 	   (which in this case is the magnitude of the point Q on the curve), so 	   we set it explicitly based on the curve type */	pkcInfo->keySizeBits = eccParams->curveSizeBits;	curveSize = bitsToBytes( eccParams->curveSizeBits );	/* Load the parameters into the context bignums */	CKPTR( BN_bin2bn( eccParams->p, curveSize, &pkcInfo->eccParam_p ) );	CKPTR( BN_bin2bn( eccParams->a, curveSize, &pkcInfo->eccParam_a ) );	CKPTR( BN_bin2bn( eccParams->b, curveSize, &pkcInfo->eccParam_b ) );	CKPTR( BN_bin2bn( eccParams->gx, curveSize, &pkcInfo->eccParam_gx ) );	CKPTR( BN_bin2bn( eccParams->gy, curveSize, &pkcInfo->eccParam_gy ) );	CKPTR( BN_bin2bn( eccParams->n, curveSize, &pkcInfo->eccParam_n ) );	CKPTR( BN_bin2bn( eccParams->h, curveSize, &pkcInfo->eccParam_h ) );	return( getBnStatus( bnStatus ) );	}
开发者ID:TellarHK,项目名称:wwiv,代码行数:40,


示例29: heap_rem_elem

/* * heap_rem_elem - Removes an arbitrary element in the heap by finding *                 its index with linear search and then swapping *                 and deleting with the bottom-most, right-most element. */void heap_rem_elem(heap H, elem x){  REQUIRES(is_heap(H) && !heap_empty(H));  int idx = find_elem(H, x);  H->next--;  if (H->next > 1) {    H->data[idx] = H->data[H->next];    sift_down(H, idx);  }  ENSURES(is_heap(H));}
开发者ID:deedeethan,项目名称:Practice,代码行数:18,



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


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