本文整理汇总了C++中Scalar::Double方法的典型用法代码示例。如果您正苦于以下问题:C++ Scalar::Double方法的具体用法?C++ Scalar::Double怎么用?C++ Scalar::Double使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scalar
的用法示例。
在下文中一共展示了Scalar::Double方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEncoding
bool
CompilerType::SetValueFromScalar (const Scalar &value, Stream &strm)
{
if (!IsValid())
return false;
// Aggregate types don't have scalar values
if (!IsAggregateType ())
{
strm.GetFlags().Set(Stream::eBinary);
uint64_t count = 0;
lldb::Encoding encoding = GetEncoding (count);
if (encoding == lldb::eEncodingInvalid || count != 1)
return false;
const uint64_t bit_width = GetBitSize(nullptr);
// This function doesn't currently handle non-byte aligned assignments
if ((bit_width % 8) != 0)
return false;
const uint64_t byte_size = (bit_width + 7 ) / 8;
switch (encoding)
{
case lldb::eEncodingInvalid:
break;
case lldb::eEncodingVector:
break;
case lldb::eEncodingUint:
switch (byte_size)
{
case 1: strm.PutHex8(value.UInt()); return true;
case 2: strm.PutHex16(value.UInt()); return true;
case 4: strm.PutHex32(value.UInt()); return true;
case 8: strm.PutHex64(value.ULongLong()); return true;
default:
break;
}
break;
case lldb::eEncodingSint:
switch (byte_size)
{
case 1: strm.PutHex8(value.SInt()); return true;
case 2: strm.PutHex16(value.SInt()); return true;
case 4: strm.PutHex32(value.SInt()); return true;
case 8: strm.PutHex64(value.SLongLong()); return true;
default:
break;
}
break;
case lldb::eEncodingIEEE754:
if (byte_size <= sizeof(long double))
{
if (byte_size == sizeof(float))
{
strm.PutFloat(value.Float());
return true;
}
else
if (byte_size == sizeof(double))
{
strm.PutDouble(value.Double());
return true;
}
else
if (byte_size == sizeof(long double))
{
strm.PutDouble(value.LongDouble());
return true;
}
}
break;
}
}
return false;
}