本文整理汇总了C++中ValueType类的典型用法代码示例。如果您正苦于以下问题:C++ ValueType类的具体用法?C++ ValueType怎么用?C++ ValueType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gException
const GurlsOption* GurlsOptionsList::getOpt(std::string key) const
{
if(key.empty())
throw gException(Exception_Parameter_Not_Definied_Yet + "( )");
std::vector<std::string> names;
boost::split(names, key, boost::is_any_of("."));
const GurlsOption* gout = this;
ValueType *tab;
for(std::vector<std::string>::iterator n_it = names.begin(); n_it != names.end(); ++n_it)
{
tab = GurlsOptionsList::dynacast(gout)->table;
std::map<std::string, GurlsOption* >::iterator it = tab->find(*n_it);
if(it == tab->end())
throw gException(Exception_Parameter_Not_Definied_Yet + "( " + *n_it + " )");
gout = it->second;
}
return gout;
}
示例2: operator
int operator()(const InputType &x, ValueType& fvec) const {
m_decoder.Decode(m_rots, x);
Vector3 v = sik.endPosition(m_rots);
v -= m_goal;
fvec.setZero();
fvec.head<3>() = Eigen::Vector3f::Map(&v.x);
// limit-exceed panelaty
auto limpanl = fvec.tail(x.size());
for (int i = 0; i < x.size(); i++)
{
if (x[i] < m_min[i])
limpanl[i] = m_limitPanalty*(x[i] - m_min[i])*(x[i] - m_min[i]);
else if (x[i] > m_max[i])
limpanl[i] = m_limitPanalty*(x[i] - m_max[i])*(x[i] - m_max[i]);
}
if (m_useRef)
{
limpanl += m_refWeights *(x - m_ref);
}
return 0;
}
示例3: valueType
void
SwitchIRBuilder::SetProfiledInstruction(IR::Instr * instr, Js::ProfileId profileId)
{
m_profiledSwitchInstr = instr;
m_switchOptBuildBail = true;
//don't optimize if the switch expression is not an Integer (obtained via dynamic profiling data of the BeginSwitch opcode)
bool hasProfile = m_profiledSwitchInstr->IsProfiledInstr() && m_profiledSwitchInstr->m_func->HasProfileInfo();
if (hasProfile)
{
const ValueType valueType(m_profiledSwitchInstr->m_func->GetReadOnlyProfileInfo()->GetSwitchProfileInfo(profileId));
instr->AsProfiledInstr()->u.FldInfo().valueType = valueType;
m_switchIntDynProfile = valueType.IsLikelyTaggedInt();
m_switchStrDynProfile = valueType.IsLikelyString();
if (PHASE_TESTTRACE1(Js::SwitchOptPhase))
{
char valueTypeStr[VALUE_TYPE_MAX_STRING_SIZE];
valueType.ToString(valueTypeStr);
#if ENABLE_DEBUG_CONFIG_OPTIONS
char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
#endif
PHASE_PRINT_TESTTRACE1(Js::SwitchOptPhase, _u("Func %s, Switch %d: Expression Type : %S\n"),
m_profiledSwitchInstr->m_func->GetDebugNumberSet(debugStringBuffer),
m_profiledSwitchInstr->AsProfiledInstr()->u.profileId, valueTypeStr);
}
}
}
示例4: switch
void Canonicalizer::do_ShiftOp (ShiftOp* x) {
ValueType* t = x->x()->type();
ValueType* t2 = x->y()->type();
if (t->is_constant()) {
switch (t->tag()) {
case intTag : if (t->as_IntConstant()->value() == 0) { set_constant(0); return; } break;
case longTag : if (t->as_LongConstant()->value() == (jlong)0) { set_constant(jlong_cast(0)); return; } break;
default : ShouldNotReachHere();
}
if (t2->is_constant()) {
if (t->tag() == intTag) {
int value = t->as_IntConstant()->value();
int shift = t2->as_IntConstant()->value() & 31;
jint mask = ~(~0 << (32 - shift));
if (shift == 0) mask = ~0;
switch (x->op()) {
case Bytecodes::_ishl: set_constant(value << shift); return;
case Bytecodes::_ishr: set_constant(value >> shift); return;
case Bytecodes::_iushr: set_constant((value >> shift) & mask); return;
}
} else if (t->tag() == longTag) {
jlong value = t->as_LongConstant()->value();
int shift = t2->as_IntConstant()->value() & 63;
jlong mask = ~(~jlong_cast(0) << (64 - shift));
if (shift == 0) mask = ~jlong_cast(0);
switch (x->op()) {
case Bytecodes::_lshl: set_constant(value << shift); return;
case Bytecodes::_lshr: set_constant(value >> shift); return;
case Bytecodes::_lushr: set_constant((value >> shift) & mask); return;
}
}
示例5: print_object
void InstructionPrinter::print_object(Value obj) {
ValueType* type = obj->type();
if (type->as_ObjectConstant() != NULL) {
ciObject* value = type->as_ObjectConstant()->value();
if (value->is_null_object()) {
output()->print("null");
} else if (!value->is_loaded()) {
output()->print("<unloaded object %p>",value);
} else if (value->is_method()) {
ciMethod* m = (ciMethod*)value;
output()->print("<method %s.%s>", m->holder()->name()->as_utf8(), m->name()->as_utf8());
} else {
output()->print("<object %p>",value->encoding());
}
} else if (type->as_InstanceConstant() != NULL) {
output()->print("<instance %p>",type->as_InstanceConstant()->value()->encoding());
} else if (type->as_ArrayConstant() != NULL) {
output()->print("<array %p>",type->as_ArrayConstant()->value()->encoding());
} else if (type->as_ClassConstant() != NULL) {
ciInstanceKlass* klass = type->as_ClassConstant()->value();
if (!klass->is_loaded()) {
output()->print("<unloaded> ");
}
output()->print("class ");
print_klass(klass);
} else {
output()->print("???");
}
}
示例6: print_object
void InstructionPrinter::print_object(Value obj) {
ValueType* type = obj->type();
if (type->as_ObjectConstant() != NULL) {
ciObject* value = type->as_ObjectConstant()->value();
if (value->is_null_object()) {
tty->print("null");
} else if (!value->is_loaded()) {
tty->print("<unloaded object 0x%x>", value);
} else {
tty->print("<object 0x%x>", value->encoding());
}
} else if (type->as_InstanceConstant() != NULL) {
tty->print("<instance 0x%x>", type->as_InstanceConstant()->value()->encoding());
} else if (type->as_ArrayConstant() != NULL) {
tty->print("<array 0x%x>", type->as_ArrayConstant()->value()->encoding());
} else if (type->as_ClassConstant() != NULL) {
ciInstanceKlass* klass = type->as_ClassConstant()->value();
if (!klass->is_loaded()) {
tty->print("<unloaded class>");
} else {
tty->print("<class 0x%x>", klass->encoding());
}
} else {
tty->print("???");
}
}
示例7:
bool
NormalizedConstraintSet::StringRange::Intersects(const StringRange& aOther) const
{
if (!mExact.size() || !aOther.mExact.size()) {
return true;
}
ValueType intersection;
set_intersection(mExact.begin(), mExact.end(),
aOther.mExact.begin(), aOther.mExact.end(),
std::inserter(intersection, intersection.begin()));
return !!intersection.size();
}
示例8: is
int DataValue::read(const std::string& buf)
{
std::istringstream is(buf);
int tmp;
ValueType val;
while (!(is.eof())) {
is >> tmp;
if (is.fail()) return 1;
val.push_back(static_cast<byte>(tmp));
}
value_.swap(val);
return 0;
}
示例9: Intersect
bool
NormalizedConstraintSet::StringRange::Merge(const StringRange& aOther)
{
if (!Intersects(aOther)) {
return false;
}
Intersect(aOther);
ValueType unioned;
set_union(mIdeal.begin(), mIdeal.end(),
aOther.mIdeal.begin(), aOther.mIdeal.end(),
std::inserter(unioned, unioned.begin()));
mIdeal = unioned;
return true;
}
示例10: Assert
bool
JITTimeWorkItem::TryGetValueType(uint symId, ValueType * valueType) const
{
Assert(IsLoopBody());
uint index = symId - m_jitBody.GetConstCount();
if (symId >= m_jitBody.GetConstCount() && index < m_workItemData->symIdToValueTypeMapCount)
{
ValueType type = ((ValueType*)m_workItemData->symIdToValueTypeMap)[index];
if (type.GetRawData() != 0)
{
*valueType = type;
return true;
}
}
return false;
}
示例11: Assert
int
GlobOpt::GetBoundCheckOffsetForSimd(ValueType arrValueType, const IR::Instr *instr, const int oldOffset /* = -1 */)
{
#ifdef ENABLE_SIMDJS
if (!(Js::IsSimd128LoadStore(instr->m_opcode)))
{
return oldOffset;
}
if (!arrValueType.IsTypedArray())
{
// no need to adjust for other array types, we will not type-spec (see Simd128DoTypeSpecLoadStore)
return oldOffset;
}
Assert(instr->dataWidth == 4 || instr->dataWidth == 8 || instr->dataWidth == 12 || instr->dataWidth == 16);
int numOfElems = Lowerer::SimdGetElementCountFromBytes(arrValueType, instr->dataWidth);
// we want to make bound checks more conservative. We compute how many extra elements we need to add to the bound check
// e.g. if original bound check is value <= Length + offset, and dataWidth is 16 bytes on Float32 array, then we need room for 4 elements. The bound check guarantees room for 1 element.
// Hence, we need to ensure 3 more: value <= Length + offset - 3
// We round up since dataWidth may span a partial lane (e.g. dataWidth = 12, bpe = 8 bytes)
int offsetBias = -(numOfElems - 1);
// we should always make an existing bound-check more conservative.
Assert(offsetBias <= 0);
return oldOffset + offsetBias;
#else
return oldOffset;
#endif
}
示例12: switch
void Canonicalizer::do_ShiftOp (ShiftOp* x) {
ValueType* t = x->x()->type();
if (t->is_constant()) {
switch (t->tag()) {
case intTag : if (t->as_IntConstant()->value() == 0) set_constant(0); return;
case longTag : if (t->as_LongConstant()->value() == (jlong)0) set_constant(jlong_cast(0)); return;
default : ShouldNotReachHere();
}
}
ValueType* t2 = x->y()->type();
if (t2->is_constant()) {
switch (t2->tag()) {
case intTag : if (t2->as_IntConstant()->value() == 0) set_canonical(x->x()); return;
default : ShouldNotReachHere();
}
}
}
示例13: do_Constant
void InstructionPrinter::do_Constant(Constant* x) {
ValueType* t = x->type();
switch (t->tag()) {
case intTag :
output()->print("%d" , t->as_IntConstant ()->value());
break;
case longTag :
output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value());
output()->print("L");
break;
case floatTag :
output()->print("%g" , t->as_FloatConstant ()->value());
break;
case doubleTag :
output()->print("%gD" , t->as_DoubleConstant()->value());
break;
case objectTag :
print_object(x);
break;
case addressTag:
output()->print("bci:%d", t->as_AddressConstant()->value());
break;
default :
output()->print("???");
break;
}
}
示例14: GetIRTypeFromValueType
IRType GlobOpt::GetIRTypeFromValueType(const ValueType &valueType)
{
if (valueType.IsFloat())
{
return TyFloat64;
}
else if (valueType.IsInt())
{
return TyInt32;
}
else if (valueType.IsSimd128Float32x4())
{
return TySimd128F4;
}
else
{
Assert(valueType.IsSimd128Int32x4());
return TySimd128I4;
}
}
示例15: print_fields
void print_fields( const ValueType& t ) {
t.visit( to_json_visitor(std::cout) );
/*
slog( "printing fields: %1%", t.size() );
boost::reflect::const_iterator itr = t.begin();
while( itr != t.end() ) {
slog( "%3% %1% = %2%", itr.key(), itr.value().as<std::string>(), itr.value().type() );
++itr;
}
*/
}