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

C++ read_uint函数代码示例

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

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



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

示例1: read_uint

EnumSig *Parser::parse_enum_sig() {
    size_t id = read_uint();

    EnumSigState *sig = lookup(enums, id);

    if (!sig) {
        /* parse the signature */
        sig = new EnumSigState;
        sig->id = id;
        sig->num_values = read_uint();
        EnumValue *values = new EnumValue[sig->num_values];
        for (EnumValue *it = values; it != values + sig->num_values; ++it) {
            it->name = read_string();
            it->value = read_sint();
        }
        sig->values = values;
        sig->fileOffset = file->currentOffset();
        enums[id] = sig;
    } else if (file->currentOffset() < sig->fileOffset) {
        /* skip over the signature */
        int num_values = read_uint();
        for (int i = 0; i < num_values; ++i) {
            skip_string(); /*name */
            skip_sint(); /* value */
        }
    }

    assert(sig);
    return sig;
}
开发者ID:casseveritt,项目名称:apitrace,代码行数:30,代码来源:trace_parser.cpp


示例2: read_uint

Value *Parser::parse_wstring() {
    size_t len = read_uint();
    wchar_t * value = new wchar_t[len + 1];
    for (size_t i = 0; i < len; ++i) {
        value[i] = read_uint();
    }
    value[len] = 0;
#if TRACE_VERBOSE
    std::cerr << "\tWSTRING \"" << value << "\"\n";
#endif
    return new WString(value);
}
开发者ID:bbvch,项目名称:OpenGLStreamingWithQt,代码行数:12,代码来源:trace_parser.cpp


示例3: set_label

void Version::from_bip(char*& cursor)
{
	set_label(read_string(cursor));
	if(!label().empty()) set_exists();
	int num_deps = read_uint(cursor);
	_deps.clear();
	_deps.reserve(num_deps);
	for(int i=0; i < num_deps; i++)
	{
		Package::Ptr pkg = dataset.package(read_uint(cursor));
		Version::Ptr dep = pkg->version(time());
		add_dep(dep);
	}
}
开发者ID:Recmo,项目名称:depgraph,代码行数:14,代码来源:version.cpp


示例4: lbm_read_state_binary

void lbm_read_state_binary(FILE * handle, LbmState * lbm_state)
{
	size_t i;

	read_uint(handle, &lbm_state->lx);
	read_uint(handle, &lbm_state->ly);

	size_t nodes = lbm_state->lx * lbm_state->ly;

	for(i = 0; i < Q; ++i)
		read_n_doubles(handle, lbm_state->f[i], nodes);
	for(i = 0; i < Q; ++i)
		read_n_doubles(handle, lbm_state->f_next[i], nodes);
}
开发者ID:dawuweijun,项目名称:clbm,代码行数:14,代码来源:clbm.c


示例5: switch

bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) {
    result->fStyle = (SkTypeface::Style)stream->readPackedUInt();

    SkAutoSTMalloc<4, SkFixed> axis;
    size_t axisCount = 0;
    size_t index = 0;
    for (size_t id; (id = stream->readPackedUInt()) != kSentinel;) {
        switch (id) {
            case kFontFamilyName:
                read_string(stream, &result->fFamilyName);
                break;
            case kFullName:
                read_string(stream, &result->fFullName);
                break;
            case kPostscriptName:
                read_string(stream, &result->fPostscriptName);
                break;
            case kFontAxes:
                axisCount = read_uint(stream);
                axis.reset(axisCount);
                for (size_t i = 0; i < axisCount; ++i) {
                    axis[i] = read_uint(stream);
                }
                break;
            case kFontIndex:
                index = read_uint(stream);
                break;
            case kFontFileName:  // Remove when MIN_PICTURE_VERSION > 41
                skip_string(stream);
                break;
            default:
                SkDEBUGFAIL("Unknown id used by a font descriptor");
                return false;
        }
    }

    size_t length = stream->readPackedUInt();
    if (length > 0) {
        SkAutoTUnref<SkData> data(SkData::NewUninitialized(length));
        if (stream->read(data->writable_data(), length) == length) {
            result->fFontData.reset(new SkFontData(new SkMemoryStream(data),
                                                   index, axis, axisCount));
        } else {
            SkDEBUGFAIL("Could not read font data");
            return false;
        }
    }
    return true;
}
开发者ID:YangchenVR,项目名称:skia,代码行数:49,代码来源:SkFontDescriptor.cpp


示例6: assert

bool Parser::open(const char *filename) {
    assert(!file);
    if (filename)
    {
#ifndef __EMSCRIPTEN__
        file = File::createForRead(filename);
#endif
        if (!file) {
            return false;
        }

        version = read_uint();
        if (version > TRACE_VERSION) {
            std::cerr << "error: unsupported trace format version " << version << "\n";
            delete file;
            file = NULL;
            return false;
        }
    }
    else {
        version = 5; // TODO version is temporary hard coded
        file = File::createBufferReader();
        if (!file) {
            return false;
        }
        file->open("", File::Mode::ReadWrite);

    }
    api = API_UNKNOWN;

    return true;
}
开发者ID:bbvch,项目名称:OpenGLStreamingWithQt,代码行数:32,代码来源:trace_parser.cpp


示例7: rd_monster

static void rd_monster(monster_type *m_ptr)
{
	start_section_read("monster");

	/* Hack -- wipe */
	WIPE(m_ptr, monster_type);

	skip_value("name");

	/* Read the monster race */
	m_ptr->r_idx = read_int("r_idx");

	/* Read the other information */
	m_ptr->fy = read_int("fy");
	m_ptr->fx = read_int("fx");
	m_ptr->dun_depth = read_int("dun_depth");
	m_ptr->hp = read_int("hp");
	m_ptr->maxhp = read_int("maxhp");
	m_ptr->csleep = read_int("csleep");
	m_ptr->mspeed = read_int("mspeed");
	m_ptr->energy = read_uint("energy");
	m_ptr->stunned = read_int("stunned");
	m_ptr->confused = read_int("confused");
	m_ptr->monfear = read_int("afraid");

	end_section_read("monster");
}
开发者ID:evileye-uk,项目名称:mangband,代码行数:27,代码来源:load2.c


示例8: read_uint

/*
 * Old enum signatures would cover a single name/value only:
 *
 *   enum_sig = id name value
 *            | id
 */
EnumSig *Parser::parse_old_enum_sig() {
    size_t id = read_uint();

    EnumSigState *sig = lookup(enums, id);

    if (!sig) {
        /* parse the signature */
        sig = new EnumSigState;
        sig->id = id;
        sig->num_values = 1;
        EnumValue *values = new EnumValue[sig->num_values];
        values->name = read_string();
        values->value = read_sint();
        sig->values = values;
        sig->offset = file->currentOffset();
        enums[id] = sig;
    } else if (file->currentOffset() < sig->offset) {
        /* skip over the signature */
        skip_string(); /*name*/
        scan_value();
    }

    assert(sig);
    return sig;
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:31,代码来源:trace_parser.cpp


示例9: parse_bitmask_sig

Value *Parser::parse_bitmask() {
    BitmaskSig *sig = parse_bitmask_sig();

    unsigned long long value = read_uint();

    return new Bitmask(sig, value);
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:7,代码来源:trace_parser.cpp


示例10: read_byte

/*
 * For the time being, a signed int is encoded as any other value, but we here parse
 * it without the extra baggage of the Value class.
 */
signed long long
Parser::read_sint(void) {
    int c;
    c = read_byte();
    switch (c) {
    case trace::TYPE_SINT:
        return -read_uint();
    case trace::TYPE_UINT:
        return read_uint();
    default:
        std::cerr << "error: unexpected type " << c << "\n";
        exit(1);
    case -1:
        return 0;
    }
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:20,代码来源:trace_parser.cpp


示例11: test_small_writes

/* Test writing single values of various types to board's global memory.
 * The test passes if we read back what we wrote. */
void test_small_writes  (ssize_t f) {

  unsigned char     uc;
  unsigned short    us;
  unsigned int      ui;
  unsigned long int uli;

  write_uchar     (f, 0, 0, 19);
  uc = read_uchar (f, 0, 0);
  assert (uc == 19);
  
  write_ushort    (f, 0, 0, 13);
  us = read_ushort(f, 0, 0);
  assert (us == 13);

  write_ulong      (f, 0, 0, 0x3037383633352030);
  uli = read_ulong (f, 0, 0);
  assert (uli == 0x3037383633352030);
  
  write_uint     (f, 0, 0, 18987983);
  ui = read_uint (f, 0, 0);
  assert (ui == 18987983);
  
  printf ("test_small_writes PASSED\n");
}
开发者ID:eddiehung,项目名称:dox-legup,代码行数:27,代码来源:user.c


示例12: if

bool
Model::load(std::istream & ifs) {
  char chunk[16];
  ifs.read(chunk, 16);

  if (!strcmp(chunk, SEGMENTOR_MODEL_FULL)) {
    full = true;
  } else if (!strcmp(chunk, SEGMENTOR_MODEL) ||
      !strcmp(chunk, SEGMENTOR_MODEL_MINIMAL)) {
    full = false;
  } else {
    return false;
  }

  if (full) {
    ifs.read(reinterpret_cast<char *>(&end_time), sizeof(int));
  } else {
    end_time = 0;
  }

  unsigned labels_offset    = read_uint(ifs);
  unsigned lexicon_offset   = read_uint(ifs);
  unsigned feature_offset   = read_uint(ifs);
  unsigned parameter_offset = read_uint(ifs);

  ifs.seekg(labels_offset);
  if (!labels.load(ifs)) {
    return false;
  }

  ifs.seekg(lexicon_offset);
  if (!internal_lexicon.load(ifs)) {
    return false;
  }

  ifs.seekg(feature_offset);
  if (!space.load(labels.size(), ifs)) {
    return false;
  }

  ifs.seekg(parameter_offset);
  if (!param.load(ifs, full)) {
    return false;
  }

  return true;
}
开发者ID:XiaoboYuan,项目名称:ltp,代码行数:47,代码来源:model.cpp


示例13: read_uint

void Parser::parse_arg(Call *call) {
    unsigned index = read_uint();
    Value *value = parse_value();
    if (index >= call->args.size()) {
        call->args.resize(index + 1);
    }
    call->args[index] = value;
}
开发者ID:pzick,项目名称:apitrace,代码行数:8,代码来源:trace_parser.cpp


示例14: rd_wild

static void rd_wild(int n)
{
	wilderness_type *w_ptr = &wild_info[-n];
	
	/* the flags */
	w_ptr->flags = read_uint("flags");
	
}
开发者ID:evileye-uk,项目名称:mangband,代码行数:8,代码来源:load2.c


示例15: load_qstr

STATIC qstr load_qstr(mp_reader_t *reader) {
    size_t len = read_uint(reader);
    char *str = m_new(char, len);
    read_bytes(reader, (byte*)str, len);
    qstr qst = qstr_from_strn(str, len);
    m_del(char, str, len);
    return qst;
}
开发者ID:BWhitten,项目名称:micropython,代码行数:8,代码来源:persistentcode.c


示例16: read_version

/* read a.b.c */
static long
read_version(char **s)
{
  long a, b, c;
  a = read_uint(s);
  b = read_dot_uint(s);
  c = read_dot_uint(s);
  return PARI_VERSION(a,b,c);
}
开发者ID:jkeuffer,项目名称:pari,代码行数:10,代码来源:gplib.c


示例17: rd_birthoptions

/*
 * Read the birth options
 */
static errr rd_birthoptions(player_type *p_ptr)
{
	s32b i, id;
	u16b tmp16u, ind;

	if (!section_exists("options"))
	{
		/* Fine, no options */
		return (0);
	}

	/* Begin */
	start_section_read("options");

	/* Read number */
	tmp16u = read_int("num");

	/* Read each record */
	id = 0;
	for (i = 0; i < OPT_MAX; i++)
	{
		const option_type *opt_ptr = &option_info[i];

		/* Real index is in the o_uid! */
		ind = option_info[i].o_uid;

		if (opt_ptr->o_page != 1) continue;

		/* Next entry is what we expect */
		if (value_exists(opt_ptr->o_text))
		{
			/* Read it */
			u32b val = read_uint(opt_ptr->o_text);

			/* Set it */
			p_ptr->options[ind] = val ? TRUE : FALSE;
		}
		else
		{
			end_section_read("options");

			/* Unexpected option */
			return (29);
		}

		id++;
		/* Don't read anymore */
		if (id >= tmp16u) break;
	}

	/* Done */
	end_section_read("options");

	/* Success */
	return (0);
}
开发者ID:evileye-uk,项目名称:mangband,代码行数:59,代码来源:load2.c


示例18: set_cluster

void Package::from_bip(char*& cursor)
{
	set_cluster(dataset.cluster(read_uint(cursor)));
	set_label(read_string(cursor));
	for(int t=0; t < max_t; t++)
	{
		_versions[t]->set_package(dataset.package(id()));
		_versions[t]->from_bip(cursor);
	}
}
开发者ID:Recmo,项目名称:depgraph,代码行数:10,代码来源:package.cpp


示例19:

boost::int32_t BitsReader::read_sint(unsigned short bitcount)
{
	boost::int32_t	value = boost::int32_t(read_uint(bitcount));

	// Sign extend...
	if (value & (1 << (bitcount - 1))) 
		value |= -1 << bitcount;

	return value;
}
开发者ID:jlopez,项目名称:gnash,代码行数:10,代码来源:BitsReader.cpp


示例20: mnist_read_labels

mmath_matrix* mnist_read_labels (const char *path)
{
	FILE *f;
	mmath_matrix *r = NULL;
	unsigned i, rows;
	
	if ((f = fopen(path, "r"))) {
		if (read_uint(f) == (MAGIC_UNSIGNED_BYTE | 1)) {
			rows = read_uint(f);
			r = mmath_malloc(rows, 1, MMATH_ROW_MAJOR);

			for (i = 0; i < r->rows; ++i) {
				mmath_set(r, i, 0, (double)getc(f));
			}
		}
		fclose(f);
	}

	return r;
}
开发者ID:adam-s-clark,项目名称:mnist,代码行数:20,代码来源:mnist.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ read_uint16函数代码示例发布时间:2022-05-30
下一篇:
C++ read_type函数代码示例发布时间: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