当前位置: 首页>>代码示例>>C++>>正文


C++ Scalar::UInt方法代码示例

本文整理汇总了C++中Scalar::UInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Scalar::UInt方法的具体用法?C++ Scalar::UInt怎么用?C++ Scalar::UInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scalar的用法示例。


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

示例1: WriteRegisterSet

bool
RegisterContextMach_i386::WriteRegisterValue (uint32_t reg, const Scalar &value)
{
    int set = GetSetForNativeRegNum (reg);

    if (set == -1)
        return false;

    if (ReadRegisterSet(set, false) != KERN_SUCCESS)
        return false;

    switch (reg)
    {
    case gpr_eax:
    case gpr_ebx:
    case gpr_ecx:
    case gpr_edx:
    case gpr_edi:
    case gpr_esi:
    case gpr_ebp:
    case gpr_esp:
    case gpr_ss:
    case gpr_eflags:
    case gpr_eip:
    case gpr_cs:
    case gpr_ds:
    case gpr_es:
    case gpr_fs:
    case gpr_gs:
        (&gpr.eax)[reg - gpr_eax] = value.UInt(0);
        break;

    case fpu_fcw:
        fpu.fcw = value.UInt(0);
        break;

    case fpu_fsw:
        fpu.fsw = value.UInt(0);
        break;

    case fpu_ftw:
        fpu.ftw = value.UInt(0);
        break;

    case fpu_fop:
        fpu.fop = value.UInt(0);
        break;

    case fpu_ip:
        fpu.ip = value.UInt(0);
        break;

    case fpu_cs:
        fpu.cs = value.UInt(0);
        break;

    case fpu_dp:
        fpu.dp = value.UInt(0);
        break;

    case fpu_ds:
        fpu.ds = value.UInt(0);
        break;

    case fpu_mxcsr:
        fpu.mxcsr = value.UInt(0);
        break;

    case fpu_mxcsrmask:
        fpu.mxcsrmask = value.UInt(0);
        break;

    case fpu_stmm0:
    case fpu_stmm1:
    case fpu_stmm2:
    case fpu_stmm3:
    case fpu_stmm4:
    case fpu_stmm5:
    case fpu_stmm6:
    case fpu_stmm7:
        // These values don't fit into scalar types, RegisterContext::ReadRegisterBytes()
        // must be used for these registers
        //::memcpy (fpu.stmm[reg - fpu_stmm0].bytes, reg_value.value.vector.uint8, 10);
        return false;

    case fpu_xmm0:
    case fpu_xmm1:
    case fpu_xmm2:
    case fpu_xmm3:
    case fpu_xmm4:
    case fpu_xmm5:
    case fpu_xmm6:
    case fpu_xmm7:
        // These values don't fit into scalar types, RegisterContext::ReadRegisterBytes()
        // must be used for these registers
        //::memcpy (fpu.xmm[reg - fpu_xmm0].bytes, reg_value.value.vector.uint8, 16);
        return false;

    case exc_trapno:
        exc.trapno = value.UInt(0);
//.........这里部分代码省略.........
开发者ID:eightcien,项目名称:lldb,代码行数:101,代码来源:RegisterContextMach_i386.cpp

示例2: 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;
}
开发者ID:atrick,项目名称:swift-lldb,代码行数:78,代码来源:CompilerType.cpp


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