本文整理汇总了C++中set_val函数的典型用法代码示例。如果您正苦于以下问题:C++ set_val函数的具体用法?C++ set_val怎么用?C++ set_val使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_val函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: do_sh_range
void do_sh_range(double *ystart, double *yend) {
double parlo, parhi, dpar, temp;
int npar, i, j, ierr;
int side, cycle, icol, color;
char bob[50];
if (set_up_sh_range() == 0)
return;
swap_color(&color, 0);
parhi = shoot_range.phigh;
parlo = shoot_range.plow;
npar = shoot_range.steps;
dpar = (parhi - parlo) / (double)npar;
side = shoot_range.side;
cycle = shoot_range.cycle;
storind = 0;
icol = 0;
if (shoot_range.movie == 1)
reset_film();
for (i = 0; i <= npar; i++) {
temp = parlo + dpar * (double)i;
set_val(shoot_range.item, temp);
sprintf(bob, "%s=%.16g", shoot_range.item, temp);
x11_status_bar_set_text(main_status_bar, bob);
if (shoot_range.movie == 1)
clr_scrn();
bvshoot(ystart, yend, BVP_TOL, BVP_EPS, BVP_MAXIT, &ierr, NODE, 0, 0, 0, 0,
0.0);
if (ierr == ABORT)
continue;
if (ierr < 0) {
bad_shoot(ierr);
set_browser_data(storage, storind, NEQ + 1);
swap_color(&color, 1);
return;
}
storage[0][storind] = temp;
if (side == 0)
for (j = 0; j < NODE; j++)
storage[j + 1][storind] = ystart[j];
else
for (j = 0; j < NODE; j++)
storage[j + 1][storind] = yend[j];
storind++;
set_cycle(cycle, &icol);
get_ic(0, ystart);
last_shot(0);
if (shoot_range.movie == 1)
film_clip();
ping();
}
set_browser_data(storage, storind, NEQ + 1);
auto_freeze_it();
swap_color(&color, 1);
}
开发者ID:tommie,项目名称:xppaut,代码行数:57,代码来源:pp_shoot.c
示例17: SetValGTM
/*
* Set values for sequence
*/
int
SetValGTM(char *seqname, GTM_Sequence nextval, bool iscalled)
{
GTM_SequenceKeyData seqkey;
CheckConnection();
seqkey.gsk_keylen = strlen(seqname) + 1;
seqkey.gsk_key = seqname;
return conn ? set_val(conn, &seqkey, nextval, iscalled) : -1;
}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:13,代码来源:gtm.c
示例18: set_val
Demo_Subject2::Demo_Subject2(demo_subject_2_key_t key_2, demo_subject_2_value_t val_2)
: cache_entry_subject<key_class<demo_subject_2_key_t>, demo_subject_2_value_t>(key_class<demo_subject_2_key_t>(key_2))
{
set_val(val_2);
printf("new subject of type 1: \n");
printf("\t key = %d, value = %d\n", key_2, val_2);
}
开发者ID:alantsev,项目名称:libvma,代码行数:11,代码来源:DemoSubject.cpp
示例19: do_calc
int do_calc(char *temp, double *z) {
char val[15];
int ok;
int i;
double newz;
if (strlen(temp) == 0) {
*z = 0.0;
return (1);
}
if (has_eq(temp, val, &i)) {
newz = calculate(&temp[i], &ok); /* calculate quantity */
if (ok == 0)
return (-1);
i = find_user_name(PARAMBOX, val);
if (i > -1) {
set_val(val, newz); /* a parameter set to value */
*z = newz;
redraw_params();
} else {
i = find_user_name(ICBOX, val);
if (i < 0) {
err_msg("No such name!");
return (-1);
}
set_val(val, newz);
last_ic[i] = newz;
*z = newz;
redraw_ics();
}
return (0);
}
newz = calculate(temp, &ok);
if (ok == 0)
return (-1);
*z = newz;
return (1);
}
开发者ID:tommie,项目名称:xppaut,代码行数:41,代码来源:calc.c
示例20: main
int main(int argc, char* argv[])
{
float b[10];
unsigned int i;
for (i = 0; i < 10; ++i)
{
set_val(&b[i], 30000);
}
return 0;
}
开发者ID:dsxcai,项目名称:test-valgrind,代码行数:12,代码来源:out-of-bound3.c
注:本文中的set_val函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论