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


C++ set_val函数代码示例

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


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

示例1: 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,代码来源:mm-seg-best.c

示例2: lean_assert

template <typename T, typename X> void permutation_matrix<T, X>::transpose_from_right(unsigned i, unsigned j) {
    // the result will be this = this * (i,j)
    lean_assert(i < size() && j < size() && i != j);
    auto pi = m_permutation[i];
    auto pj = m_permutation[j];
    set_val(i, pj);
    set_val(j, pi);
}
开发者ID:GallagherCommaJack,项目名称:lean,代码行数:8,代码来源:permutation_matrix.cpp

示例3: alloc_body

inline body_type * alloc_body(std::size_t capacity, const char * first, std::size_t len)
{
    auto * body = alloc_body<body_type>(capacity);
    set_val(body->capacity, capacity);
    set_val(body->size, len);
    std::memcpy(body->buffer, first, len);
    return body;
}
开发者ID:dmlys,项目名称:extlib,代码行数:8,代码来源:compact_string_body.hpp

示例4: alloc_body_nothrow

inline body_type * alloc_body_nothrow(std::size_t capacity, const char * first, std::size_t len)
{
    auto * body = alloc_body_nothrow<body_type>(capacity);
    if (body == nullptr) return nullptr;

    set_val(body->capacity, capacity);
    set_val(body->size, len);
    std::memcpy(body->buffer, first, len);
    return body;
}
开发者ID:dmlys,项目名称:extlib,代码行数:10,代码来源:compact_string_body.hpp

示例5: realloc_body

inline typename std::enable_if<std::is_same<body_type, other_body_type>::value, body_type>::type *
realloc_body(other_body_type * other, std::size_t newcap)
{
    auto * body = static_cast<body_type *>(::realloc(other, sizeof(body_type) + newcap));
    if (body == nullptr) throw std::bad_alloc();

    set_val(body->capacity, newcap);
    if (body->size > newcap) set_val(body->size, newcap);
    return body;
}
开发者ID:dmlys,项目名称:extlib,代码行数:10,代码来源:compact_string_body.hpp

示例6: set_val

void Range::set_unit_value(double p_value) {
	if (shared->exp_unit_value && get_min()>0) {

		double exp_min = Math::log(get_min())/Math::log(2);
		double exp_max = Math::log(get_max())/Math::log(2);
		double v = Math::pow(2,exp_min+(exp_max-exp_min)*p_value);

		set_val( v );
	} else {
		set_val( (get_max() - get_min()) * p_value + get_min() );
	}
}
开发者ID:BradWBeer,项目名称:godot,代码行数:12,代码来源:range.cpp

示例7: realloc_body_nothrow

inline typename std::enable_if< ! std::is_same<body_type, other_body_type>::value, body_type>::type *
realloc_body_nothrow(other_body_type * other, std::size_t newcap)
{
    std::size_t size = std::min<std::size_t>(other->size, newcap);
    auto * body = static_cast<body_type *>(::realloc(other, sizeof(body_type) + newcap));
    if (body == nullptr) return nullptr;

    std::memmove(body->buffer, other->buffer, size);
    set_val(body->size, size);
    set_val(body->capacity, newcap);
    return body;
}
开发者ID:dmlys,项目名称:extlib,代码行数:12,代码来源:compact_string_body.hpp

示例8: env_update_cb

/*
 * Update callback function
 * db: the database
 * key: key dbt of the kv pair
 * old_val: old_val of the key dbt, if its null, we must create val
 * extra: the struct we pass to db->update function
 * set_val: set value function, should be provided by tokudb
 * set_extra: argument for set_val callback
 */
static int
env_update_cb(DB *db, const DBT *key, const DBT *old_val, const DBT *extra,
              void (*set_val)(const DBT *newval, void *set_extra),
              void *set_extra)
{
	int ret;
	DBT val;
	size_t newval_size;
	void *newval;

	BUG_ON(db == NULL || key == NULL || extra == NULL ||
	       extra->data == NULL);
	// there is no meta update currently
	BUG_ON(IS_META_KEY_DBT(key));

	ret = block_update_cb(&newval, &newval_size, old_val, extra->data);

	if (!ret) {
		dbt_init(&val, newval, newval_size);
		set_val(&val, set_extra);
		kfree(newval);
	}

	return ret;
}
开发者ID:tonytcl,项目名称:betrfs,代码行数:34,代码来源:ftfs_bstore.c

示例9: set_val

  JNIEXPORT jint JNICALL Java_edu_berkeley_bid_CUMAT_setval
  (JNIEnv *env, jobject obj, jobject jA, jfloat vv, jint length) 
  {
    float *nativeA = (float*)getPointer(env, jA);

    return set_val(nativeA, vv, length);
  }
开发者ID:wangdongfrank,项目名称:BIDMat,代码行数:7,代码来源:BIDMat_CUMAT.cpp

示例10: auryn_vector_float_clip

void IF2Group::check_thresholds()
{
	auryn_vector_float_clip( mem, e_rev );

	AurynState * thr_ptr = thr->data;
	for ( AurynState * i = mem->data ; i != mem->data+get_rank_size() ; ++i ) { // it's important to use rank_size here otherwise there might be spikes from units that do not exist
    	if ( *i > ( thr_rest + *thr_ptr ) ) {
			NeuronID unit = i-mem->data;
			push_spike(unit);
		    set_val (mem, unit, e_rest); // reset
	        set_val (thr, unit, dthr); //refractory
		} 
		thr_ptr++;
	}

}
开发者ID:eneftci,项目名称:auryn,代码行数:16,代码来源:IF2Group.cpp

示例11: exec_step_dovr

int exec_step_dovr(struct band_list_el *bll){

  unsigned char *adrs;
  long double val;
  void *ptr;
  int tip, size, artsin, sayqac;

  tip = bll->tip;
  size = bll->size;
  ptr = pop_from_stek(&adrstk);
  adrs = (unsigned char *)ptr;
  val  = get_value(adrs, tip, size);
  sayqac = (int)val;
  /* !!! do not free ptr popped from adrstk   */ 

  ptr = pop_from_stek(&valstk);
  val = *(long double *)ptr;
  artsin = (int)val;
  free(ptr);

  if (artsin)
    sayqac++;
  else
    sayqac--;

  val = (long double)sayqac;
  set_val(adrs, val, tip);

  return bll->head_pos;
}
开发者ID:Ceyhunn,项目名称:src,代码行数:30,代码来源:interp_new.cpp

示例12: set_val

  JNIEXPORT jint JNICALL Java_edu_berkeley_bid_CUMATD_setval
  (JNIEnv *env, jobject obj, jobject jA, jdouble vv, jint length) 
  {
    double *nativeA = (double*)getPointer(env, jA);

    return set_val(nativeA, vv, length);
  }
开发者ID:Sandy4321,项目名称:BIDMat,代码行数:7,代码来源:BIDMat_CUMATD.cpp

示例13: set_size

// Set the size of the given block in multiples of 4 bytes
static inline void set_size(uint32_t* const block, unsigned int size) {
    REQUIRES(block != NULL);
    REQUIRES(in_heap(block));
    REQUIRES(size % 2 == 0);


    set_val(block, size);
}
开发者ID:mindbergh,项目名称:malloc,代码行数:9,代码来源:mm-seg-best.c

示例14: clone_m_permutation

template <typename T, typename X> void permutation_matrix<T, X>::multiply_by_reverse_from_right(permutation_matrix<T, X> & q){ // todo : condensed permutations ?
    auto clone = clone_m_permutation();
    // the result is this = this*q(-1)
    unsigned i = size();
    while (i-- > 0) {
        set_val(i, q.m_rev[clone[i]]); // we have m(P)*m(Q) = m(QP), where m is the matrix of the permutation
    }
    delete [] clone;
}
开发者ID:GallagherCommaJack,项目名称:lean,代码行数:9,代码来源:permutation_matrix.cpp

示例15: SetValGTM

/*
 * Set values for sequence
 */
int
SetValGTM(char *seqname, GTM_Sequence nextval, bool iscalled)
{
	GTM_SequenceKeyData seqkey;
#ifdef XCP
	char   *coordName = IS_PGXC_COORDINATOR ? PGXCNodeName : MyCoordName;
	int		coordPid = IS_PGXC_COORDINATOR ? MyProcPid : MyCoordPid;
#endif
	CheckConnection();
	seqkey.gsk_keylen = strlen(seqname) + 1;
	seqkey.gsk_key = seqname;

#ifdef XCP
	return conn ? set_val(conn, &seqkey, coordName, coordPid, nextval, iscalled) : -1;
#else
	return conn ? set_val(conn, &seqkey, nextval, iscalled) : -1;
#endif
}
开发者ID:techdragon,项目名称:Postgres-XL,代码行数:21,代码来源:gtm.c


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