• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ data_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dp_to_di

void ciMethodData::print_data_on(outputStream* st) {
  ResourceMark rm;
  ciProfileData* data;
  for (data = first_data(); is_valid(data); data = next_data(data)) {
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
  st->print_cr("--- Extra data:");
  DataLayout* dp  = data_layout_at(data_size());
  DataLayout* end = data_layout_at(data_size() + extra_data_size());
  for (; dp < end; dp = methodDataOopDesc::next_extra(dp)) {
    if (dp->tag() == DataLayout::no_tag)  continue;
    if (dp->tag() == DataLayout::bit_data_tag) {
      data = new BitData(dp);
    } else {
      assert(dp->tag() == DataLayout::arg_info_data_tag, "must be BitData or ArgInfo");
      data = new ciArgInfoData(dp);
      dp = end; // ArgInfoData is at the end of extra data section.
    }
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:25,代码来源:ciMethodData.cpp


示例2: data_size

void mc146818_device::nvram_default()
{
	// populate from a memory region if present
	if (m_region != NULL)
	{
		UINT32 bytes = m_region->bytes();

		if (bytes > data_size())
			bytes = data_size();

		memcpy(&m_data[0], m_region->base(), bytes);
	}
	else
	{
		memset(&m_data[0], 0, data_size());
	}

	if(m_binary)
		m_data[REG_B] |= REG_B_DM;
	if(m_hour)
		m_data[REG_B] |= REG_B_24_12;

	set_base_datetime();
	update_timer();
	update_irq();
}
开发者ID:robsonfr,项目名称:mame,代码行数:26,代码来源:mc146818.cpp


示例3: data_before

// Translate a bci to its corresponding data, or NULL.
ciProfileData* ciMethodData::bci_to_data(int bci) {
  ciProfileData* data = data_before(bci);
  for ( ; is_valid(data); data = next_data(data)) {
    if (data->bci() == bci) {
      set_hint_di(dp_to_di(data->dp()));
      return data;
    } else if (data->bci() > bci) {
      break;
    }
  }
  // bci_to_extra_data(bci) ...
  DataLayout* dp  = data_layout_at(data_size());
  DataLayout* end = data_layout_at(data_size() + extra_data_size());
  for (; dp < end; dp = methodDataOopDesc::next_extra(dp)) {
    if (dp->tag() == DataLayout::no_tag) {
      _saw_free_extra_data = true;  // observed an empty slot (common case)
      return NULL;
    }
    if (dp->tag() == DataLayout::arg_info_data_tag) {
      break; // ArgInfoData is at the end of extra data section.
    }
    if (dp->bci() == bci) {
      assert(dp->tag() == DataLayout::bit_data_tag, "sane");
      return new ciBitData(dp);
    }
  }
  return NULL;
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:29,代码来源:ciMethodData.cpp


示例4: etot

///////////////////////////////////////////////////////////////////////////////
//
// calculates the rate of change of e^2 with each parameter in 'p' at 'p'
// returning the result in 'deriv'.
//
// assumes e is up to date with p
// 
///////////////////////////////////////////////////////////////////////////////
void FSolver::df(VecDoub_I &p, VecDoub_O &deriv) {
  coord		etot(3);	// total error vector
  int		i,j,n;


  // std::cout << "in df" << std::endl;

  for(n=0; n<data_size(); ++n) {
    e[n] = 0.0;
    for(i=0; i<3; ++i) {
      for(j=0; j<3; ++j) {
	e[n] += qp[n][i] * p[3*i+j] * q[n][j];
      }
    }
  }


  for(i = 0; i<3; ++i) {
    for(j = 0; j<3; ++j) {
      deriv[3*i+j] = 0.0; 
      for(n=0; n<data_size(); ++n) {
	deriv[3*i+j] += 2.0 * e[n] * qp[n][i] * q[n][j];
      }
    }
  }

  // --- add scale forcing
  // ---------------------
  double t;
  t = 4.0*(p[2]*p[2] + p[5]*p[5] + p[8]*p[8] - 0.694722);
  deriv[2] += t*p[2];
  deriv[5] += t*p[5];
  deriv[8] += t*p[8];

  // --- add determinant forcing
  // ---------------------------
  /******
  t = 2.0*(p[0]*p[4]*p[8] + p[1]*p[5]*p[6] + p[2]*p[3]*p[7] -
    p[2]*p[4]*p[6] - p[1]*p[3]*p[8]  - p[0]*p[5]*p[7]);
  deriv[0] += t*(p[4]*p[8] - p[5]*p[7]);
  deriv[1] += t*(p[5]*p[6] - p[3]*p[8]);
  deriv[2] += t*(p[3]*p[7] - p[4]*p[6]);
  deriv[3] += t*(p[2]*p[7] - p[1]*p[8]);
  deriv[4] += t*(p[0]*p[8] - p[2]*p[6]);
  deriv[5] += t*(p[1]*p[6] - p[0]*p[7]);
  deriv[6] += t*(p[1]*p[5] - p[2]*p[4]);
  deriv[7] += t*(p[2]*p[3] - p[0]*p[5]);
  deriv[8] += t*(p[0]*p[4] - p[1]*p[3]);
  *****/

  /****
  for(n=0; n<deriv.size(); ++n) {
    std::cout << deriv[n] << " ";
  }
  std::cout << std::endl;
  ***/
}
开发者ID:elliotwoods,项目名称:ProCamSolver,代码行数:65,代码来源:FSolver.cpp


示例5: data_layout_at

ciArgInfoData *ciMethodData::arg_info() const {
  // Should be last, have to skip all traps.
  DataLayout* dp  = data_layout_at(data_size());
  DataLayout* end = data_layout_at(data_size() + extra_data_size());
  for (; dp < end; dp = methodDataOopDesc::next_extra(dp)) {
    if (dp->tag() == DataLayout::arg_info_data_tag)
      return new ciArgInfoData(dp);
  }
  return NULL;
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:10,代码来源:ciMethodData.cpp


示例6: sizeof

void*data_calloc(ambixtest_presentationformat_t fmt, size_t nmembers) {
  size_t nmemb=nmembers*data_size(fmt)/sizeof(float64_t)+1;
  size_t size = sizeof(float64_t);
  void*data=calloc(nmemb, size);
  //printf("%dx%d[%d] allocated %d of %d bytes to %p\n", (int)frames, channels, fmt, (int)nmemb, (int)size, data);
  return data;
}
开发者ID:iem-projects,项目名称:ambix,代码行数:7,代码来源:common.c


示例7: R_NEW

R_API struct r_anal_refline_t *r_anal_reflines_get(struct r_anal_t *anal,
	ut64 addr, ut8 *buf, ut64 len, int nlines, int linesout, int linescall)
{
	RAnalRefline *list2, *list = R_NEW (RAnalRefline);
	RAnalOp op = {0};
	ut8 *ptr = buf;
	ut8 *end = buf + len;
	ut64 opc = addr;
	int sz = 0, index = 0;

	INIT_LIST_HEAD (&(list->list));

	end -= 8; // XXX Fix some segfaults when r_anal backends are buggy
	/* analyze code block */
	while (ptr<end) {
		if (nlines != -1 && --nlines == 0)
			break;
#if 0
		if (config.interrupted)
			break;
		int dt = data_type(config.seek+bsz);
		if (dt != DATA_FUN && dt != DATA_CODE) {
			ut64 sz = data_size (config.seek+bsz);
			if (sz > 0) {
				ptr += sz;
				bsz += sz;
				continue;
			}
		}
#endif
		addr += sz;
		// This can segflauta if opcode length and buffer check fails
		r_anal_op_fini (&op);
		sz = r_anal_op (anal, &op, addr, ptr, (int)(end-ptr));
		if (sz > 0) {
			/* store data */
			switch (op.type) {
			case R_ANAL_OP_TYPE_CALL:
				if (!linescall)
					break;
			case R_ANAL_OP_TYPE_CJMP:
			case R_ANAL_OP_TYPE_JMP:
				if (!linesout && (op.jump > opc+len || op.jump < opc))
					goto __next;
				if (op.jump == 0LL)
					goto __next;
				list2 = R_NEW (RAnalRefline);
				list2->from = addr;
				list2->to = op.jump;
				list2->index = index++;
				list_add_tail (&(list2->list), &(list->list));
				break;
			}
		} else sz = 1;
	__next:
		ptr += sz;
	}
	r_anal_op_fini (&op);
	return list;
}
开发者ID:ReverseLab,项目名称:radare2,代码行数:60,代码来源:reflines.c


示例8: init

void Texture::assign(const Texture& t)
{
  _width = t._width;
  _height = t._height;
  init();
  memcpy(_data, t._data, data_size());
}
开发者ID:mrdooz,项目名称:TextureTjong,代码行数:7,代码来源:Texture.cpp


示例9: Java_edu_asu_sma_ContentHelper_create

JNIEXPORT void JNICALL Java_edu_asu_sma_ContentHelper_create(JNIEnv* env,
                                                             jobject thiz,
                                                             jobjectArray jtypes,
                                                             jstring jname,
                                                             jbyteArray jdata,
                                                             jlong jsize)
{
  int types_count = env->GetArrayLength(jtypes);
  std::vector<sma::ContentType> types;

  for (std::size_t i = 0; i < types_count; ++i) {
    jstring j_stype = (jstring)env->GetObjectArrayElement(jtypes, i);
    char const* c_stype = env->GetStringUTFChars(j_stype, NULL);
    types.emplace_back(std::string(c_stype));
    env->ReleaseStringUTFChars(j_stype, c_stype);
  }

  char const* c_name = env->GetStringUTFChars(jname, NULL);
  std::string name(c_name);
  env->ReleaseStringUTFChars(jname, c_name);

  std::size_t data_size(jsize);
  std::uint8_t* data = new std::uint8_t[data_size];
  jbyte* c_data = env->GetByteArrayElements(jdata, NULL);
  std::memcpy(data, c_data, data_size);
  env->ReleaseByteArrayElements(jdata, c_data, JNI_ABORT);

  sma::content_helper->create_new(std::move(types), sma::ContentName(name), data, data_size);

  delete[] data;
}
开发者ID:culiu,项目名称:sma,代码行数:31,代码来源:jnicontenthelper.cpp


示例10: data

int FileMapInfo::FileMapHeader::compute_crc() {
  char* header = data();
  // start computing from the field after _crc
  char* buf = (char*)&_crc + sizeof(int);
  size_t sz = data_size() - (buf - header);
  int crc = ClassLoader::crc32(0, buf, (jint)sz);
  return crc;
}
开发者ID:shelan,项目名称:jdk9-mirror,代码行数:8,代码来源:filemap.cpp


示例11: find

const Sector &Track::get_sector (const Header &header) const
{
	auto it = find(header);
	if (it == end() || it->data_size() < header.sector_size())
		throw util::exception(CylHead(header.cyl, header.head), " sector ", header.sector, " not found");

	return *it;
}
开发者ID:d235j,项目名称:samdisk,代码行数:8,代码来源:Track.cpp


示例12: data_size

void mc146818_device::nvram_read(emu_file &file)
{
	file.read(m_data, data_size());

	set_base_datetime();
	update_timer();
	update_irq();
}
开发者ID:dezi,项目名称:mame-libretro-odroid,代码行数:8,代码来源:mc146818.c


示例13: main

int main(int argc, char *argv[])
{			
	int choice = 1;

	choice = check_model();

	switch(choice) {
		//test the data size on kernel and application.
		case 1:
		{
			data_size(argc, argv);
			break;
		}

		//test the fasync signal handle method.
		case 2:
		{
			fasync_handle(argc, argv);
			break;
		}

		//test the input and output method by poll.
		case 3:
		{
			io_poll(argc, argv);
			break;
		}

		//test the concole which recv the kernel message.
		case 4:
		{
			concole_ctl(argc, argv);
			break;
		}

		//test the page difference by compared dev map addr.
		case 5:
		{
			mem_cmp(argc, argv);
			break;
		}

		//test the input and ouput on all dev ports.
		case 6:
		{
			port_io(argc, argv);
			break;
		}

		//default do nothing
		default:
		{
			break;
		}
	}
	
	return 0;
}
开发者ID:beike2020,项目名称:source,代码行数:58,代码来源:kernel_app.c


示例14: data_size

void MapBlock::copyFrom(VoxelManipulator &dst)
{
	v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
	VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
	
	// Copy from VoxelManipulator to data
	dst.copyTo(data, data_area, v3s16(0,0,0),
			getPosRelative(), data_size);
}
开发者ID:wowiamdiamonds,项目名称:minetest,代码行数:9,代码来源:mapblock.cpp


示例15: data_size

void MeshMakeData::fillBlockData(const v3s16 &block_offset, MapNode *data)
{
	v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
	VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));

	v3s16 bp = m_blockpos + block_offset;
	v3s16 blockpos_nodes = bp * MAP_BLOCKSIZE;
	m_vmanip.copyFrom(data, data_area, v3s16(0,0,0), blockpos_nodes, data_size);
}
开发者ID:kaadmy,项目名称:minetest,代码行数:9,代码来源:mapblock_mesh.cpp


示例16: data_before

 ciProfileData* data_before(int bci) {
   // avoid SEGV on this edge case
   if (data_size() == 0)
     return NULL;
   int hint = hint_di();
   if (data_layout_at(hint)->bci() <= bci)
     return data_at(hint);
   return first_data();
 }
开发者ID:guanxiaohua,项目名称:TransGC,代码行数:9,代码来源:ciMethodData.hpp


示例17: auto_alloc_array

void mc146818_device::device_start()
{
	m_data= auto_alloc_array(machine(), UINT8, data_size());
	m_last_refresh = machine().time();
	m_clock_timer = timer_alloc(TIMER_CLOCK);
	m_periodic_timer = timer_alloc(TIMER_PERIODIC);

	m_write_irq.resolve_safe();
}
开发者ID:dezi,项目名称:mame-libretro-odroid,代码行数:9,代码来源:mc146818.c


示例18: lock_shared_rec

void MapBlock::copyTo(VoxelManipulator &dst)
{
	auto lock = lock_shared_rec();
	v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
	VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));

	// Copy from data to VoxelManipulator
	dst.copyFrom(data, data_area, v3s16(0,0,0),
			getPosRelative(), data_size);
}
开发者ID:daniel-santos,项目名称:freeminer,代码行数:10,代码来源:mapblock.cpp


示例19: test_file

int test_file(const std::string & test_data_filepath,
        const std::string & label_prefix) {
    int fails = 0;
    std::vector<pstrudel::TreeShape>  trees;
    pstrudel::treeio::read_from_filepath(trees, test_data_filepath, "nexus");
    unsigned long tree_idx = 0;
    for (auto & tree : trees) {
        std::string label = label_prefix + ":" + std::to_string(tree_idx + 1);
        pstrudel::LineageThroughTimeProfileCalculator ltt_calc(tree);
        auto profiles = ltt_calc.build_lineage_splitting_time_profile();
        auto lst_profile = profiles.first;
        auto scaled_lst_profile = profiles.second;
        std::ostringstream o;
        TREE_WRITER.write(o, tree);
        o << "\n";
        assert(lst_profile.data_size() == scaled_lst_profile.data_size());
        auto rds = lst_profile.data_size();
        for (unsigned long idx = 0; idx < rds; ++idx) {
            o << std::fixed << std::setprecision(22) << lst_profile.raw_data(idx);
            o << "\t" << std::fixed << std::setprecision(22) << scaled_lst_profile.raw_data(idx);
            o << "\n";
        }
        colugo::Subprocess ps({"python", CHECK_SCRIPT, "-f", "newick", "-l", label});
        try {
            auto result = ps.communicate(o.str());
            if (ps.returncode() != 0) {
                std::cerr << "(test '" << label << "' returned error: " << ps.returncode() << ")\n";
                // TREE_WRITER.write(std::cerr, tree);
                // std::cerr << std::endl;
                std::cerr << result.first;
                std::cerr << result.second;
                fails += 1;
            // } else {
            //     std::cerr << result.second;
            }
        } catch (const colugo::SubprocessTimeOutException & e) {
            std::cerr << "(test '" << label << "' timed out)\n";
            exit(1);
        }
        ++tree_idx;
    }
    return fails;
}
开发者ID:jeetsukumaran,项目名称:pstrudel,代码行数:43,代码来源:lineage_splitting_time.cpp


示例20: init_data

int init_data(double * x, int p, int P, int N)
{
    int n = data_size(p, P, N);
    srand(p+1);
    for (int i = 0; i<n; i++)
    {
        x[i] = (double)rand()/((long)RAND_MAX+1);
    }

    return n;
}
开发者ID:carolineKer,项目名称:parallelSorts,代码行数:11,代码来源:init_data.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ data_type函数代码示例发布时间:2022-05-30
下一篇:
C++ data_query函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap