您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uint16_t函数代码示例

51自学网 2021-06-03 09:07:21
  C++
这篇教程C++ uint16_t函数代码示例写得很实用,希望能帮到您。

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

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

示例1: opcodeName

const char* opcodeName(Opcode opcode) {  return OpInfo[uint16_t(opcode)].name;}
开发者ID:abhiskaushik,项目名称:hhvm,代码行数:3,


示例2: _main_

//.........这里部分代码省略.........					if (showScissorRects)					{						bgfx::TransientVertexBuffer tvb;						bgfx::TransientIndexBuffer tib;						if (bgfx::allocTransientBuffers(&tvb, DebugVertex::ms_decl, 4, &tib, 8) )						{							uint32_t abgr = 0x8000ff00;							DebugVertex* vertex = (DebugVertex*)tvb.data;							vertex->m_x = x0;							vertex->m_y = y0;							vertex->m_z = 0.0f;							vertex->m_abgr = abgr;							++vertex;							vertex->m_x = x1;							vertex->m_y = y0;							vertex->m_z = 0.0f;							vertex->m_abgr = abgr;							++vertex;							vertex->m_x = x1;							vertex->m_y = y1;							vertex->m_z = 0.0f;							vertex->m_abgr = abgr;							++vertex;							vertex->m_x = x0;							vertex->m_y = y1;							vertex->m_z = 0.0f;							vertex->m_abgr = abgr;							uint16_t* indices = (uint16_t*)tib.data;							*indices++ = 0;							*indices++ = 1;							*indices++ = 1;							*indices++ = 2;							*indices++ = 2;							*indices++ = 3;							*indices++ = 3;							*indices++ = 0;							bgfx::setProgram(lineProgram);							bgfx::setVertexBuffer(&tvb);							bgfx::setIndexBuffer(&tib);							bgfx::setState(0								| BGFX_STATE_RGB_WRITE								| BGFX_STATE_PT_LINES								| BGFX_STATE_BLEND_ALPHA								);							bgfx::submit(RENDER_PASS_DEBUG_LIGHTS_ID);						}					}					uint8_t val = light&7;					float lightRgbInnerR[4] =					{						val & 0x1 ? 1.0f : 0.25f,						val & 0x2 ? 1.0f : 0.25f,						val & 0x4 ? 1.0f : 0.25f,						0.8f,					};					// Draw light.					bgfx::setUniform(u_lightPosRadius, &lightPosRadius);
开发者ID:MisterTea,项目名称:MAMEHub,代码行数:67,


示例3: main

// *****************************************************************************// Mainint main(int argc, char* const argv[]){try {    if (argc != 2) {        std::cout << "Usage: " << argv[0] << " file/n";        return 1;    }    std::string file(argv[1]);    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);    assert (image.get() != 0);    image->readMetadata();    Exiv2::ExifData &ed = image->exifData();    if (ed.empty()) {        std::string error = file + ": No Exif data found in the file";        throw Exiv2::Error(1, error);    }    std::cout << "Copy construction, non-intrusive changes/n";    Exiv2::ExifData ed1(ed);    ed1["Exif.Image.DateTime"] = "Sunday, 11am";    ed1["Exif.Image.Orientation"] = uint16_t(2);    ed1["Exif.Photo.DateTimeOriginal"] = "Sunday, 11am";    ed1["Exif.Photo.MeteringMode"] = uint16_t(1);    ed1["Exif.Iop.InteroperabilityIndex"] = "123";//    ed1["Exif.Thumbnail.Orientation"] = uint16_t(2);    write(file, ed1);    print(file);    std::cout << "----------------------------------------------/n";    std::cout << "Copy construction, intrusive changes/n";    Exiv2::ExifData ed2(ed);    ed2["Exif.Image.DateTime"] = "Sunday, 11am and ten minutes";    ed2["Exif.Image.Orientation"] = "2 3 4 5";    ed2["Exif.Photo.DateTimeOriginal"] = "Sunday, 11am and ten minutes";    ed2["Exif.Photo.MeteringMode"] = "1 2 3 4 5 6";    ed2["Exif.Iop.InteroperabilityIndex"] = "1234";    ed2["Exif.Thumbnail.Orientation"] = "2 3 4 5 6";    write(file, ed2);    print(file);    std::cout << "----------------------------------------------/n";    std::cout << "Assignment, non-intrusive changes/n";    Exiv2::ExifData ed3;    ed3["Exif.Iop.InteroperabilityVersion"] = "Test 6 Iop tag";    ed3["Exif.Thumbnail.Artist"] = "Test 6 Ifd1 tag";    ed3 = ed;    ed3["Exif.Image.DateTime"] = "Sunday, 11am";    ed3["Exif.Image.Orientation"] = uint16_t(2);    ed3["Exif.Photo.DateTimeOriginal"] = "Sunday, 11am";    ed3["Exif.Photo.MeteringMode"] = uint16_t(1);    ed3["Exif.Iop.InteroperabilityIndex"] = "123";//    ed3["Exif.Thumbnail.Orientation"] = uint16_t(2);    write(file, ed3);    print(file);    std::cout << "----------------------------------------------/n";    std::cout << "Assignment, intrusive changes/n";    Exiv2::ExifData ed4;    ed4["Exif.Iop.InteroperabilityVersion"] = "Test 6 Iop tag";    ed4["Exif.Thumbnail.Artist"] = "Test 6 Ifd1 tag";    ed4 = ed;    ed4["Exif.Image.DateTime"] = "Sunday, 11am and ten minutes";    ed4["Exif.Image.Orientation"] = "2 3 4 5";    ed4["Exif.Photo.DateTimeOriginal"] = "Sunday, 11am and ten minutes";    ed4["Exif.Photo.MeteringMode"] = uint16_t(1);    ed4["Exif.Iop.InteroperabilityIndex"] = "123";    ed4["Exif.Thumbnail.Orientation"] = uint16_t(2);    write(file, ed4);    print(file);    return 0;}catch (Exiv2::AnyError& e) {    std::cout << "Caught Exiv2 exception '" << e << "'/n";    return -1;}}
开发者ID:obklar,项目名称:exiv2,代码行数:81,


示例4: functionById

Status* InterpreterCodeImpl::execute(std::vector<Var*>& vars) {    ByteStack stack;    typedef std::map<uint16_t, ByteStorage> VarMap;    VarMap var_map;    for (std::vector<Var*>::iterator it = vars.begin(); it != vars.end(); ++it) {        if ((*it)->name() == "#__INTERPRETER_TRACING__#") {            m_trace = true;        }    }    BytecodeFunction* function = (BytecodeFunction*) functionById(0);    Bytecode* bytecode = function->bytecode();    for (size_t bci = 0; bci < bytecode->length();) {        Instruction insn = BC_INVALID;        size_t length = 1;  // size of the BC_INVALID        decodeInsn(bytecode, bci, insn, length);        switch (insn) {            case BC_INVALID:                return new Status("BC_INVALID", bci);                break;            case BC_DLOAD:                stack.pushTyped(bytecode->getDouble(bci + 1));                break;            case BC_ILOAD:                stack.pushTyped(bytecode->getInt64(bci + 1));                break;            case BC_SLOAD:                stack.pushTyped(bytecode->getUInt16(bci + 1));                break;            case BC_DLOAD0:                stack.pushTyped(double(0));                break;            case BC_ILOAD0:                stack.pushTyped(int64_t(0));                break;            case BC_SLOAD0:                stack.pushTyped(uint16_t(0));                break;            case BC_DLOAD1:                stack.pushTyped(double(1));                break;            case BC_ILOAD1:                stack.pushTyped(int64_t(1));                break;            case BC_DADD:                stack.pushDouble(stack.popDouble() + stack.popDouble());                break;            case BC_IADD:                stack.pushInt64(stack.popInt64() + stack.popInt64());                break;            case BC_DSUB:                stack.pushDouble(stack.popDouble() - stack.popDouble());                break;            case BC_ISUB:                stack.pushInt64(stack.popInt64() - stack.popInt64());                break;            case BC_DMUL:                stack.pushDouble(stack.popDouble() * stack.popDouble());                break;            case BC_IMUL:                stack.pushInt64(stack.popInt64() * stack.popInt64());                break;            case BC_DDIV:                stack.pushDouble(stack.popDouble() / stack.popDouble());                break;            case BC_IDIV:                stack.pushInt64(stack.popInt64() / stack.popInt64());                break;            case BC_IMOD:                stack.pushInt64(stack.popInt64() % stack.popInt64());                break;            case BC_DNEG:                stack.pushDouble(-stack.popDouble());                break;            case BC_INEG:                stack.pushInt64(-stack.popInt64());                break;            case BC_IPRINT:                std::cout << stack.popInt64();                break;            case BC_DPRINT:                std::cout << stack.popDouble();                break;            case BC_SPRINT:                std::cout << constantById(stack.popUInt16());                break;            case BC_POP:                stack.pop();                break;            case BC_LOADDVAR0:                stack.pushDouble(var_map[0].getDouble());                break;            case BC_LOADDVAR1://.........这里部分代码省略.........
开发者ID:nvmd,项目名称:spbau-mathvm,代码行数:101,


示例5: MOZ_ASSERT

// The MediaStreamGraph guarantees that this is actually one block, for// AudioNodeStreams.voidAudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags){  uint16_t outputCount = mLastChunks.Length();  MOZ_ASSERT(outputCount == std::max(uint16_t(1), mEngine->OutputCount()));  if (!mIsActive) {    // mLastChunks are already null.#ifdef DEBUG    for (const auto& chunk : mLastChunks) {      MOZ_ASSERT(chunk.IsNull());    }#endif  } else if (InMutedCycle()) {    mInputChunks.Clear();    for (uint16_t i = 0; i < outputCount; ++i) {      mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);    }  } else {    // We need to generate at least one input    uint16_t maxInputs = std::max(uint16_t(1), mEngine->InputCount());    mInputChunks.SetLength(maxInputs);    for (uint16_t i = 0; i < maxInputs; ++i) {      ObtainInputBlock(mInputChunks[i], i);    }    bool finished = false;    if (mPassThrough) {      MOZ_ASSERT(outputCount == 1, "For now, we only support nodes that have one output port");      mLastChunks[0] = mInputChunks[0];    } else {      if (maxInputs <= 1 && outputCount <= 1) {        mEngine->ProcessBlock(this, aFrom,                              mInputChunks[0], &mLastChunks[0], &finished);      } else {        mEngine->ProcessBlocksOnPorts(this, mInputChunks, mLastChunks, &finished);      }    }    for (uint16_t i = 0; i < outputCount; ++i) {      NS_ASSERTION(mLastChunks[i].GetDuration() == WEBAUDIO_BLOCK_SIZE,                   "Invalid WebAudio chunk size");    }    if (finished) {      mMarkAsFinishedAfterThisBlock = true;      if (mIsActive) {        ScheduleCheckForInactive();      }    }    if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {      for (uint32_t i = 0; i < outputCount; ++i) {        mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);      }    }  }  if (!mFinished) {    // Don't output anything while finished    if (mFlags & EXTERNAL_OUTPUT) {      AdvanceOutputSegment();    }    if (mMarkAsFinishedAfterThisBlock && (aFlags & ALLOW_FINISH)) {      // This stream was finished the last time that we looked at it, and all      // of the depending streams have finished their output as well, so now      // it's time to mark this stream as finished.      if (mFlags & EXTERNAL_OUTPUT) {        FinishOutput();      }      FinishOnGraphThread();    }  }}
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:73,


示例6: millis

/*   Check for automatic takeoff conditions being met using the following sequence: *   1) Check for adequate GPS lock - if not return false *   2) Check the gravity compensated longitudinal acceleration against the threshold and start the timer if true *   3) Wait until the timer has reached the specified value (increments of 0.1 sec) and then check the GPS speed against the threshold *   4) If the GPS speed is above the threshold and the attitude is within limits then return true and reset the timer *   5) If the GPS speed and attitude within limits has not been achieved after 2.5 seconds, return false and reset the timer *   6) If the time lapsed since the last timecheck is greater than 0.2 seconds, return false and reset the timer *   NOTE : This function relies on the TECS 50Hz processing for its acceleration measure. */bool Plane::auto_takeoff_check(void){    // this is a more advanced check that relies on TECS    uint32_t now = millis();    static bool launchTimerStarted;    static uint32_t last_tkoff_arm_time;    static uint32_t last_check_ms;    uint16_t wait_time_ms = min(uint16_t(g.takeoff_throttle_delay)*100,12700);    // Reset states if process has been interrupted    if (last_check_ms && (now - last_check_ms) > 200) {        gcs_send_text_fmt(PSTR("Timer Interrupted AUTO"));	    launchTimerStarted = false;	    last_tkoff_arm_time = 0;        last_check_ms = now;        return false;    }    last_check_ms = now;    // Check for bad GPS    if (gps.status() < AP_GPS::GPS_OK_FIX_3D) {        // no auto takeoff without GPS lock        return false;    }    // Check for launch acceleration or timer started. NOTE: relies on TECS 50Hz processing    if (!launchTimerStarted &&        !is_zero(g.takeoff_throttle_min_accel) &&        SpdHgt_Controller->get_VXdot() < g.takeoff_throttle_min_accel) {        goto no_launch;    }    // we've reached the acceleration threshold, so start the timer    if (!launchTimerStarted) {        launchTimerStarted = true;        last_tkoff_arm_time = now;        gcs_send_text_fmt(PSTR("Armed AUTO, xaccel = %.1f m/s/s, waiting %.1f sec"),                 (double)SpdHgt_Controller->get_VXdot(), (double)(wait_time_ms*0.001f));    }    // Only perform velocity check if not timed out    if ((now - last_tkoff_arm_time) > wait_time_ms+100U) {        gcs_send_text_fmt(PSTR("Timeout AUTO"));        goto no_launch;    }    // Check aircraft attitude for bad launch    if (ahrs.pitch_sensor <= -3000 ||        ahrs.pitch_sensor >= 4500 ||        abs(ahrs.roll_sensor) > 3000) {        gcs_send_text_fmt(PSTR("Bad Launch AUTO"));        goto no_launch;    }    // Check ground speed and time delay    if (((gps.ground_speed() > g.takeoff_throttle_min_speed || is_zero(g.takeoff_throttle_min_speed))) &&        ((now - last_tkoff_arm_time) >= wait_time_ms)) {        gcs_send_text_fmt(PSTR("Triggered AUTO, GPSspd = %.1f"), (double)gps.ground_speed());        launchTimerStarted = false;        last_tkoff_arm_time = 0;        return true;    }    // we're not launching yet, but the timer is still going    return false;no_launch:    launchTimerStarted = false;    last_tkoff_arm_time = 0;    return false;}
开发者ID:PureRockets,项目名称:ardupilot,代码行数:81,


示例7: setupFrame

    void setupFrame(bool _doLightAdapt, bool _doBloom, bool _doFxaa)    {        m_doLightAdapt = _doLightAdapt;        m_doBloom      = _doBloom;        m_doFxaa       = _doFxaa;        float screenProj[16];        float windowProj[16];        bx::mtxOrtho(screenProj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);        bx::mtxOrtho(windowProj, 0.0f, (float)m_width, (float)m_height, 0.0f, 0.0f, 1000.0f);        bgfx::setViewRect(ViewIdSkybox, 0, 0, (uint16_t)m_width, (uint16_t)m_height);        bgfx::setViewRect(ViewIdMesh,   0, 0, (uint16_t)m_width, (uint16_t)m_height);        bgfx::setViewTransform(ViewIdSkybox, NULL, screenProj);        //bgfx::setViewTransform for ViewIdMesh is called in 'setActiveCamera()'.        bgfx::setViewFrameBuffer(ViewIdSkybox, m_fbMain);        bgfx::setViewFrameBuffer(ViewIdMesh,   m_fbMain);        bgfx::setViewClear(ViewIdSkybox, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH, 0x303030ff, 1.0f, 0);        if (m_doLightAdapt)        {            bgfx::setViewRect(ViewIdLum0, 0, 0, 256, 256);            bgfx::setViewRect(ViewIdLum1, 0, 0,  64,  64);            bgfx::setViewRect(ViewIdLum2, 0, 0,  16,  16);            bgfx::setViewRect(ViewIdLum3, 0, 0,   4,   4);            bgfx::setViewRect(ViewIdLum4, 0, 0,   1,   1);            bgfx::setViewRect(ViewIdUpdateLastLum, 0, 0, 1, 1);            bgfx::setViewTransform(ViewIdLum0, NULL, screenProj);            bgfx::setViewTransform(ViewIdLum1, NULL, screenProj);            bgfx::setViewTransform(ViewIdLum2, NULL, screenProj);            bgfx::setViewTransform(ViewIdLum3, NULL, screenProj);            bgfx::setViewTransform(ViewIdLum4, NULL, screenProj);            bgfx::setViewTransform(ViewIdUpdateLastLum, NULL, screenProj);            bgfx::setViewFrameBuffer(ViewIdLum0, m_fbLumCalc[0]);            bgfx::setViewFrameBuffer(ViewIdLum1, m_fbLumCalc[1]);            bgfx::setViewFrameBuffer(ViewIdLum2, m_fbLumCalc[2]);            bgfx::setViewFrameBuffer(ViewIdLum3, m_fbLumCalc[3]);            bgfx::setViewFrameBuffer(ViewIdLum4, m_fbLumCur);            bgfx::setViewFrameBuffer(ViewIdUpdateLastLum, m_fbLumLast);        }        if (m_doBloom)        {            bgfx::setViewRect(ViewIdBright, 0, 0, uint16_t(m_brightWidth), uint16_t(m_brightHeight));            bgfx::setViewRect(ViewIdBloom,  0, 0, uint16_t(m_blurWidth),   uint16_t(m_blurHeight));            bgfx::setViewTransform(ViewIdBright, NULL, screenProj);            bgfx::setViewTransform(ViewIdBloom,  NULL, screenProj);            bgfx::setViewFrameBuffer(ViewIdBright, m_fbBright);            bgfx::setViewFrameBuffer(ViewIdBloom,  m_fbBlur);        }        bgfx::setViewRect(ViewIdTonemap, 0, 0, (uint16_t)m_width, (uint16_t)m_height);        bgfx::setViewTransform(ViewIdTonemap, NULL, screenProj);        if (m_doFxaa)        {            bgfx::setViewFrameBuffer(ViewIdTonemap, m_fbPost);            bgfx::setViewRect(ViewIdFxaa, 0, 0, (uint16_t)m_width, (uint16_t)m_height);            bgfx::setViewTransform(ViewIdFxaa, NULL, screenProj);        }        else        {            const bgfx::FrameBufferHandle invalidHandle = BGFX_INVALID_HANDLE;            bgfx::setViewFrameBuffer(ViewIdTonemap, invalidHandle);        }#if CS_DEBUG_LUMAVG        bgfx::setViewRect(ViewIdDebug0, 0, 0, uint16_t(m_width), uint16_t(m_height));        bgfx::setViewRect(ViewIdDebug1,  306,     10, 512, 512);        bgfx::setViewRect(ViewIdDebug2,  823,     10, 512, 512);        bgfx::setViewRect(ViewIdDebug3,  306, 512+20, 512, 512);        bgfx::setViewRect(ViewIdDebug4,  823, 512+20, 512, 512);        bgfx::setViewRect(ViewIdDebug5, 1340, 512+20, 512, 512);        bgfx::setViewTransform(ViewIdDebug0, NULL, screenProj);        bgfx::setViewTransform(ViewIdDebug1, NULL, screenProj);        bgfx::setViewTransform(ViewIdDebug2, NULL, screenProj);        bgfx::setViewTransform(ViewIdDebug3, NULL, screenProj);        bgfx::setViewTransform(ViewIdDebug4, NULL, screenProj);        bgfx::setViewTransform(ViewIdDebug5, NULL, screenProj);#endif //CS_DEBUG_LUMAVG    }
开发者ID:bobbyzhu,项目名称:cmftStudio,代码行数:89,


示例8: WriteFloatRGBA

static void WriteFloatRGBA(std::array<float, 4> rgba,                           std::byte *target,                           _Interchange_buffer::pixel_layout layout,                           _Interchange_buffer::alpha_mode alpha_mode){    // following calculations assume little-endian architecture.        switch (alpha_mode) {        case _Interchange_buffer::alpha_mode::ignore:            rgba[3] = 1.f;            break;        case _Interchange_buffer::alpha_mode::straight:            break;        case _Interchange_buffer::alpha_mode::premultiplied:            if( 1.f - rgba[3] > numeric_limits<float>::min() ) {                rgba[0] = rgba[0] * rgba[3];                rgba[1] = rgba[1] * rgba[3];                rgba[2] = rgba[2] * rgba[3];            }            break;    }            switch (layout) {        case _Interchange_buffer::pixel_layout::b8g8r8a8: {            auto p = (uint8_t *)target;            p[2] = uint8_t(rgba[0] * 255.f + 0.5f);            p[1] = uint8_t(rgba[1] * 255.f + 0.5f);            p[0] = uint8_t(rgba[2] * 255.f + 0.5f);            p[3] = uint8_t(rgba[3] * 255.f + 0.5f);            break;        }           case _Interchange_buffer::pixel_layout::a8r8g8b8: {            auto p = (uint8_t *)target;            p[1] = uint8_t(rgba[0] * 255.f + 0.5f);            p[2] = uint8_t(rgba[1] * 255.f + 0.5f);            p[3] = uint8_t(rgba[2] * 255.f + 0.5f);            p[0] = uint8_t(rgba[3] * 255.f + 0.5f);            break;                    }        case _Interchange_buffer::pixel_layout::r8g8b8a8: {            auto p = (uint8_t *)target;            p[0] = uint8_t(rgba[0] * 255.f + 0.5f);            p[1] = uint8_t(rgba[1] * 255.f + 0.5f);            p[2] = uint8_t(rgba[2] * 255.f + 0.5f);            p[3] = uint8_t(rgba[3] * 255.f + 0.5f);            break;                      }        case _Interchange_buffer::pixel_layout::a8b8g8r8: {            auto p = (uint8_t *)target;            p[3] = uint8_t(rgba[0] * 255.f + 0.5f);            p[2] = uint8_t(rgba[1] * 255.f + 0.5f);            p[1] = uint8_t(rgba[2] * 255.f + 0.5f);            p[0] = uint8_t(rgba[3] * 255.f + 0.5f);            break;                        }        case _Interchange_buffer::pixel_layout::r5g6b5: {            auto &p = *(uint16_t *)target;            p = (uint16_t(rgba[0] * 31.f + 0.5f) << 0) |                (uint16_t(rgba[1] * 63.f + 0.5f) << 5) |                (uint16_t(rgba[2] * 31.f + 0.5f) << 11);            break;        }        case _Interchange_buffer::pixel_layout::b5g6r5: {            auto &p = *(uint16_t *)target;                        p = (uint16_t(rgba[0] * 31.f + 0.5f) << 11)|                (uint16_t(rgba[1] * 63.f + 0.5f) << 5) |                (uint16_t(rgba[2] * 31.f + 0.5f) << 0) ;            break;                    }        case _Interchange_buffer::pixel_layout::r5g5b5a1: {            auto &p = *(uint16_t *)target;                        p = (uint16_t(rgba[0] * 31.f + 0.5f) << 0) |                (uint16_t(rgba[1] * 31.f + 0.5f) << 5) |                (uint16_t(rgba[2] * 31.f + 0.5f) << 10)|                (uint16_t(rgba[3]        + 0.5f) << 15);                        break;        }        case _Interchange_buffer::pixel_layout::b5g5r5a1: {            auto &p = *(uint16_t *)target;            p = (uint16_t(rgba[0] * 31.f + 0.5f) << 10)|                (uint16_t(rgba[1] * 31.f + 0.5f) << 5) |                (uint16_t(rgba[2] * 31.f + 0.5f) << 0) |                (uint16_t(rgba[3]        + 0.5f) << 15);            break;        }                case _Interchange_buffer::pixel_layout::a1r5g5b5: {            auto &p = *(uint16_t *)target;                        p = (uint16_t(rgba[0] * 31.f + 0.5f) << 1) |                (uint16_t(rgba[1] * 31.f + 0.5f) << 6) |                (uint16_t(rgba[2] * 31.f + 0.5f) << 11)|                (uint16_t(rgba[3]        + 0.5f) << 0) ;                        break;        }        case _Interchange_buffer::pixel_layout::a1b5g5r5: {            auto &p = *(uint16_t *)target;            p = (uint16_t(rgba[0] * 31.f + 0.5f) << 11)|                (uint16_t(rgba[1] * 31.f + 0.5f) << 6) |                (uint16_t(rgba[2] * 31.f + 0.5f) << 1) |                (uint16_t(rgba[3]        + 0.5f) << 0) ;            break;//.........这里部分代码省略.........
开发者ID:mikebmcl,项目名称:N3888_RefImpl,代码行数:101,


示例9: millis

/*   Check for automatic takeoff conditions being met using the following sequence: *   1) Check for adequate GPS lock - if not return false *   2) Check the gravity compensated longitudinal acceleration against the threshold and start the timer if true *   3) Wait until the timer has reached the specified value (increments of 0.1 sec) and then check the GPS speed against the threshold *   4) If the GPS speed is above the threshold and the attitude is within limits then return true and reset the timer *   5) If the GPS speed and attitude within limits has not been achieved after 2.5 seconds, return false and reset the timer *   6) If the time lapsed since the last timecheck is greater than 0.2 seconds, return false and reset the timer *   NOTE : This function relies on the TECS 50Hz processing for its acceleration measure. */bool Plane::auto_takeoff_check(void){    // this is a more advanced check that relies on TECS    uint32_t now = millis();    uint16_t wait_time_ms = MIN(uint16_t(g.takeoff_throttle_delay)*100,12700);    // Reset states if process has been interrupted    if (takeoff_state.last_check_ms && (now - takeoff_state.last_check_ms) > 200) {        gcs_send_text_fmt(MAV_SEVERITY_WARNING, "Timer interrupted AUTO");	    takeoff_state.launchTimerStarted = false;	    takeoff_state.last_tkoff_arm_time = 0;        takeoff_state.last_check_ms = now;        return false;    }    takeoff_state.last_check_ms = now;    // Check for bad GPS    if (gps.status() < AP_GPS::GPS_OK_FIX_3D) {        // no auto takeoff without GPS lock        return false;    }    // Check for launch acceleration if set. NOTE: relies on TECS 50Hz processing    if (!is_zero(g.takeoff_throttle_min_accel) &&        SpdHgt_Controller->get_VXdot() < g.takeoff_throttle_min_accel) {        goto no_launch;    }    // we've reached the acceleration threshold, so start the timer    if (!takeoff_state.launchTimerStarted) {        takeoff_state.launchTimerStarted = true;        takeoff_state.last_tkoff_arm_time = now;        if (now - takeoff_state.last_report_ms > 2000) {            gcs_send_text_fmt(MAV_SEVERITY_INFO, "Armed AUTO, xaccel = %.1f m/s/s, waiting %.1f sec",                              (double)SpdHgt_Controller->get_VXdot(), (double)(wait_time_ms*0.001f));            takeoff_state.last_report_ms = now;        }    }    // Only perform velocity check if not timed out    if ((now - takeoff_state.last_tkoff_arm_time) > wait_time_ms+100U) {        if (now - takeoff_state.last_report_ms > 2000) {            gcs_send_text_fmt(MAV_SEVERITY_WARNING, "Timeout AUTO");            takeoff_state.last_report_ms = now;        }        goto no_launch;    }    // Check aircraft attitude for bad launch    if (ahrs.pitch_sensor <= -3000 ||        ahrs.pitch_sensor >= 4500 ||        (!fly_inverted() && labs(ahrs.roll_sensor) > 3000)) {        gcs_send_text_fmt(MAV_SEVERITY_WARNING, "Bad launch AUTO");        goto no_launch;    }    // Check ground speed and time delay    if (((gps.ground_speed() > g.takeoff_throttle_min_speed || is_zero(g.takeoff_throttle_min_speed))) &&        ((now - takeoff_state.last_tkoff_arm_time) >= wait_time_ms)) {        gcs_send_text_fmt(MAV_SEVERITY_INFO, "Triggered AUTO. GPS speed = %.1f", (double)gps.ground_speed());        takeoff_state.launchTimerStarted = false;        takeoff_state.last_tkoff_arm_time = 0;        steer_state.locked_course_err = 0; // use current heading without any error offset        return true;    }    // we're not launching yet, but the timer is still going    return false;no_launch:    takeoff_state.launchTimerStarted = false;    takeoff_state.last_tkoff_arm_time = 0;    return false;}
开发者ID:develduan,项目名称:ardupilot,代码行数:84,


示例10: eeRestoreModel

const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name){  char *buf = reusableBuffer.modelsel.mainname;  FIL restoreFile;  UINT read;  eeCheck(true);  if (!sdMounted()) {    return STR_NO_SDCARD;  }  strcpy(buf, STR_MODELS_PATH);  buf[sizeof(MODELS_PATH)-1] = '/';  strcpy(&buf[sizeof(MODELS_PATH)], model_name);  strcpy(&buf[strlen(buf)], STR_MODELS_EXT);  FRESULT result = f_open(&restoreFile, buf, FA_OPEN_EXISTING | FA_READ);  if (result != FR_OK) {    return SDCARD_ERROR(result);  }  if (f_size(&restoreFile) < 8) {    f_close(&restoreFile);    return STR_INCOMPATIBLE;  }  result = f_read(&restoreFile, (uint8_t *)buf, 8, &read);  if (result != FR_OK || read != 8) {    f_close(&restoreFile);    return SDCARD_ERROR(result);  }  uint8_t version = (uint8_t)buf[4];  if (*(uint32_t*)&buf[0] != O9X_FOURCC || version < FIRST_CONV_EEPROM_VER || version > EEPROM_VER || buf[5] != 'M') {    f_close(&restoreFile);    return STR_INCOMPATIBLE;  }  if (eeModelExists(i_fileDst)) {    eeDeleteModel(i_fileDst);  }  uint16_t size = min<uint16_t>(sizeof(g_model), *(uint16_t*)&buf[6]);  uint32_t address = eepromHeader.files[i_fileDst+1].zoneIndex * EEPROM_ZONE_SIZE;  // erase blocks  eepromEraseBlock(address);  eepromEraseBlock(address+EEPROM_BLOCK_SIZE);  // write header  EepromFileHeader header = { uint16_t(i_fileDst+1), size };  eepromWrite(address, (uint8_t *)&header, sizeof(header));  address += sizeof(header);  // write model  while (size > 0) {    uint16_t blockSize = min<uint16_t>(size, EEPROM_BUFFER_SIZE);    result = f_read(&restoreFile, eepromWriteBuffer, blockSize, &read);    if (result != FR_OK || read != blockSize) {      f_close(&g_oLogFile);      return SDCARD_ERROR(result);    }    eepromWrite(address, eepromWriteBuffer, blockSize);    size -= blockSize;    address += blockSize;  }  // write FAT  eepromHeader.files[i_fileDst+1].exists = 1;  eepromIncFatAddr();  eepromWriteState = EEPROM_WRITE_NEW_FAT;  eepromWriteWait();  eeLoadModelHeader(i_fileDst, &modelHeaders[i_fileDst]);#if defined(PCBSKY9X)  if (version < EEPROM_VER) {    ConvertModel(i_fileDst, version);    loadModel(g_eeGeneral.currModel);  }#endif  return NULL;}
开发者ID:kamnxt,项目名称:opentx,代码行数:85,


示例11: PPC

/*        For PPC (AIX & MAC), the first 8 integral and the first 13 f.p. parameters         arrive in a separate chunk of data that has been loaded from the registers.         The args pointer has been set to the start of the parameters BEYOND the ones        arriving in registers*/extern "C" nsresult ATTRIBUTE_USEDPrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args, uint32_t *gprData, double *fprData){    typedef struct {        uint32_t hi;        uint32_t lo;      // have to move 64 bit entities as 32 bit halves since    } DU;               // stack slots are not guaranteed 16 byte aligned#define PARAM_BUFFER_COUNT     16#define PARAM_GPR_COUNT         7      nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];    nsXPTCMiniVariant* dispatchParams = nullptr;    const nsXPTMethodInfo* info = nullptr;    uint8_t paramCount;    uint8_t i;    nsresult result = NS_ERROR_FAILURE;    NS_ASSERTION(self,"no self");    self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);    NS_ASSERTION(info,"no method info");    paramCount = info->GetParamCount();    // setup variant array pointer    if(paramCount > PARAM_BUFFER_COUNT)        dispatchParams = new nsXPTCMiniVariant[paramCount];    else        dispatchParams = paramBuffer;    NS_ASSERTION(dispatchParams,"no place for params");    uint32_t* ap = args;    uint32_t iCount = 0;    uint32_t fpCount = 0;    for(i = 0; i < paramCount; i++)    {        const nsXPTParamInfo& param = info->GetParam(i);        const nsXPTType& type = param.GetType();        nsXPTCMiniVariant* dp = &dispatchParams[i];        if(param.IsOut() || !type.IsArithmetic())        {            if (iCount < PARAM_GPR_COUNT)                dp->val.p = (void*) gprData[iCount++];            else                dp->val.p = (void*) *ap++;            continue;        }        // else        switch(type)        {        case nsXPTType::T_I8      :  if (iCount < PARAM_GPR_COUNT)                                         dp->val.i8  = (int8_t) gprData[iCount++];                                     else                                         dp->val.i8  = (int8_t)  *ap++;                                     break;        case nsXPTType::T_I16     :  if (iCount < PARAM_GPR_COUNT)                                         dp->val.i16  = (int16_t) gprData[iCount++];                                     else                                         dp->val.i16  = (int16_t)  *ap++;                                     break;        case nsXPTType::T_I32     :  if (iCount < PARAM_GPR_COUNT)                                         dp->val.i32  = (int32_t) gprData[iCount++];                                     else                                         dp->val.i32  = (int32_t)  *ap++;                                     break;        case nsXPTType::T_I64     :  if (iCount < PARAM_GPR_COUNT)                                         ((DU *)dp)->hi  = (int32_t) gprData[iCount++];                                     else                                         ((DU *)dp)->hi  = (int32_t)  *ap++;                                     if (iCount < PARAM_GPR_COUNT)                                         ((DU *)dp)->lo  = (uint32_t) gprData[iCount++];                                     else                                         ((DU *)dp)->lo  = (uint32_t)  *ap++;                                     break;        case nsXPTType::T_U8      :  if (iCount < PARAM_GPR_COUNT)                                         dp->val.u8  = (uint8_t) gprData[iCount++];                                     else                                         dp->val.u8  = (uint8_t)  *ap++;                                     break;        case nsXPTType::T_U16     :  if (iCount < PARAM_GPR_COUNT)                                         dp->val.u16  = (uint16_t) gprData[iCount++];                                     else                                         dp->val.u16  = (uint16_t)  *ap++;                                     break;        case nsXPTType::T_U32     :  if (iCount < PARAM_GPR_COUNT)                                         dp->val.u32  = (uint32_t) gprData[iCount++];                                     else                                         dp->val.u32  = (uint32_t)  *ap++;                                     break;        case nsXPTType::T_U64     :  if (iCount < PARAM_GPR_COUNT)                                         ((DU *)dp)->hi  = (uint32_t) gprData[iCount++];                                     else//.........这里部分代码省略.........
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:101,


示例12: uint16_t

byte tinyFAT::initFAT(byte speed){	mmc::initialize(speed);// Read MBR	if (RES_OK == mmc::readSector(buffer, 0))	{		if ((buffer[0x01FE]==0x55) && (buffer[0x01FF]==0xAA))		{			MBR.part1Type=buffer[450];			MBR.part1Start = uint16_t(buffer[454])+(uint16_t(buffer[455])<<8)+(uint32_t(buffer[456])<<16)+(uint32_t(buffer[457])<<24);			MBR.part1Size = uint16_t(buffer[458])+(uint16_t(buffer[459])<<8)+(uint32_t(buffer[460])<<16)+(uint32_t(buffer[461])<<24);		}		else		{			return ERROR_MBR_SIGNATURE;		}	}	else		return ERROR_MBR_READ_ERROR;	if ((MBR.part1Type!=0x04) && (MBR.part1Type!=0x06) && (MBR.part1Type!=0x86))	{		return ERROR_MBR_INVALID_FS;	}// Read Boot Sector	if (RES_OK == mmc::readSector(buffer, MBR.part1Start))    {		if ((buffer[0x01FE]==0x55) && (buffer[0x01FF]==0xAA))		{			BS.sectorsPerCluster = buffer[0x0D];			BS.reservedSectors = uint16_t(buffer[0x0E])+(uint16_t(buffer[0x0F])<<8);			BS.fatCopies = buffer[0x10];			BS.rootDirectoryEntries = uint16_t(buffer[0x11])+(uint16_t(buffer[0x12])<<8);			BS.totalFilesystemSectors = uint16_t(buffer[0x13])+(uint16_t(buffer[0x14])<<8);			if (BS.totalFilesystemSectors==0)				BS.totalFilesystemSectors = uint16_t(buffer[0x20])+(uint16_t(buffer[0x21])<<8)+(uint32_t(buffer[0x22])<<16)+(uint32_t(buffer[0x23])<<24);			BS.sectorsPerFAT = uint16_t(buffer[0x16])+(uint16_t(buffer[0x17])<<8);			BS.hiddenSectors = uint16_t(buffer[0x1C])+(uint16_t(buffer[0x1D])<<8)+(uint32_t(buffer[0x1E])<<16)+(uint32_t(buffer[0x1F])<<24);			BS.partitionSerialNum = uint16_t(buffer[0x27])+(uint16_t(buffer[0x28])<<8)+(uint32_t(buffer[0x29])<<16)+(uint32_t(buffer[0x2A])<<24);			firstDirSector = MBR.part1Start + BS.reservedSectors + (BS.fatCopies * BS.sectorsPerFAT);			BS.fat1Start = MBR.part1Start + BS.reservedSectors;			BS.fat2Start = BS.fat1Start + BS.sectorsPerFAT;			BS.partitionSize = float((MBR.part1Size*512)/float(1048576));		}		else			return ERROR_BOOTSEC_SIGNATURE;	}	else		return ERROR_BOOTSEC_READ_ERROR;	_inited=true;	return 0x00;}
开发者ID:0x1abin,项目名称:Gamebuino,代码行数:54,


示例13: read_16

int16_t read_16(int32_t &address){	uint8_t l = read_8(address);	uint8_t h = read_8(address);	return ((uint16_t(h) & 0xff) << 8) | (uint16_t(l) & 0xff);}
开发者ID:ddparker,项目名称:franklin,代码行数:6,


示例14: opcodeHasFlags

bool opcodeHasFlags(Opcode opcode, uint64_t flags) {  return OpInfo[uint16_t(opcode)].flags & flags;}
开发者ID:abhiskaushik,项目名称:hhvm,代码行数:3,


示例15: fit

bool RectanglePacker::addRectangle(uint16_t _width, uint16_t _height, uint16_t& _outX, uint16_t& _outY){	int best_height, best_index;	int32_t best_width;	Node* node;	Node* prev;	_outX = 0;	_outY = 0;	best_height = INT_MAX;	best_index = -1;	best_width = INT_MAX;	for (uint16_t ii = 0, num = uint16_t(m_skyline.size() ); ii < num; ++ii)	{		int32_t yy = fit(ii, _width, _height);		if (yy >= 0)		{			node = &m_skyline[ii];			if ( ( (yy + _height) < best_height)			|| ( ( (yy + _height) == best_height) && (node->width < best_width) ) )			{				best_height = uint16_t(yy) + _height;				best_index = ii;				best_width = node->width;				_outX = node->x;				_outY = uint16_t(yy);			}		}	}	if (best_index == -1)	{		return false;	}	Node newNode(_outX, _outY + _height, _width);	m_skyline.insert(m_skyline.begin() + best_index, newNode);	for (uint16_t ii = uint16_t(best_index + 1), num = uint16_t(m_skyline.size() ); ii < num; ++ii)	{		node = &m_skyline[ii];		prev = &m_skyline[ii - 1];		if (node->x < (prev->x + prev->width) )		{			uint16_t shrink = uint16_t(prev->x + prev->width - node->x);			node->x += shrink;			node->width -= shrink;			if (node->width <= 0)			{				m_skyline.erase(m_skyline.begin() + ii);				--ii;				--num;			}			else			{				break;			}		}		else		{			break;		}	}	merge();	m_usedSpace += _width * _height;	return true;}
开发者ID:Enverex,项目名称:mame,代码行数:68,


示例16: uint16_t

void	ProxyRwCpp <SplFmt_INT16>::write_no_clip (const Ptr::Type &ptr, int src){	ptr [0] = uint16_t (src);}
开发者ID:4re,项目名称:fmtconv,代码行数:4,


示例17: setCommon

void XBeeResponse::getZBRxResponse(XBeeResponse &rxResponse) {	ZBRxResponse* zb = static_cast<ZBRxResponse*>(&rxResponse);	//TODO verify response api id matches this api for this response	// pass pointer array to subclass	zb->setFrameData(getFrameData());	setCommon(rxResponse);	zb->getRemoteAddress64().setMsb((uint32_t(getFrameData()[0]) << 24) + (uint32_t(getFrameData()[1]) << 16) + (uint16_t(getFrameData()[2]) << 8) + getFrameData()[3]);	zb->getRemoteAddress64().setLsb((uint32_t(getFrameData()[4]) << 24) + (uint32_t(getFrameData()[5]) << 16) + (uint16_t(getFrameData()[6]) << 8) + (getFrameData()[7]));}
开发者ID:lsaavedr,项目名称:XBee-Digimesh-API-Library,代码行数:13,


示例18: lcd_menu_print_select

void lcd_menu_print_select(){    if (!card.sdInserted)    {        LED_GLOW();        lcd_lib_encoder_pos = MAIN_MENU_ITEM_POS(0);        lcd_info_screen(lcd_menu_main);        lcd_lib_draw_string_centerP(15, PSTR("No SD-CARD!"));        lcd_lib_draw_string_centerP(25, PSTR("Please insert card"));        lcd_lib_update_screen();        card.release();        return;    }    if (!card.isOk())    {        lcd_info_screen(lcd_menu_main);        lcd_lib_draw_string_centerP(16, PSTR("Reading card..."));        lcd_lib_update_screen();        lcd_clear_cache();        card.initsd();        return;    }        if (LCD_CACHE_NR_OF_FILES() == 0xFF)        LCD_CACHE_NR_OF_FILES() = card.getnrfilenames();    if (card.errorCode())    {        LCD_CACHE_NR_OF_FILES() = 0xFF;        return;    }    uint8_t nrOfFiles = LCD_CACHE_NR_OF_FILES();    if (nrOfFiles == 0)    {        if (card.atRoot())            lcd_info_screen(lcd_menu_main, NULL, PSTR("OK"));        else            lcd_info_screen(lcd_menu_print_select, cardUpdir, PSTR("OK"));        lcd_lib_draw_string_centerP(25, PSTR("No files found!"));        lcd_lib_update_screen();        lcd_clear_cache();        return;    }        if (lcd_lib_button_pressed)    {        uint8_t selIndex = uint16_t(SELECTED_SCROLL_MENU_ITEM());        if (selIndex == 0)        {            if (card.atRoot())            {                lcd_change_to_menu(lcd_menu_main);            }else{                lcd_clear_cache();                lcd_lib_beep();                card.updir();            }        }else{            card.getfilename(selIndex - 1);            if (!card.filenameIsDir)            {                //Start print                active_extruder = 0;                card.openFile(card.filename, true);                if (card.isFileOpen() && !is_command_queued())                {                    if (led_mode == LED_MODE_WHILE_PRINTING || led_mode == LED_MODE_BLINK_ON_DONE)                        analogWrite(LED_PIN, 255 * int(led_brightness_level) / 100);                    if (!card.longFilename[0])                        strcpy(card.longFilename, card.filename);                    card.longFilename[20] = '/0';                    if (strchr(card.longFilename, '.')) strchr(card.longFilename, '.')[0] = '/0';                                        char buffer[64];                    card.fgets(buffer, sizeof(buffer));                    buffer[sizeof(buffer)-1] = '/0';                    while (strlen(buffer) > 0 && buffer[strlen(buffer)-1] < ' ') buffer[strlen(buffer)-1] = '/0';                    if (strcmp_P(buffer, PSTR(";FLAVOR:UltiGCode")) != 0)                    {                        card.fgets(buffer, sizeof(buffer));                        buffer[sizeof(buffer)-1] = '/0';                        while (strlen(buffer) > 0 && buffer[strlen(buffer)-1] < ' ') buffer[strlen(buffer)-1] = '/0';                    }                    card.setIndex(0);                    if (strcmp_P(buffer, PSTR(";FLAVOR:UltiGCode")) == 0)                    {                        //New style GCode flavor without start/end code.                        // Temperature settings, filament settings, fan settings, start and end-code are machine controlled.                        target_temperature_bed = 0;                        fanSpeedPercent = 0;                        for(uint8_t e=0; e<EXTRUDERS; e++)                        {                            if (LCD_DETAIL_CACHE_MATERIAL(e) < 1)                                continue;                            target_temperature[e] = 0;//material[e].temperature;                            target_temperature_bed = max(target_temperature_bed, material[e].bed_temperature);                            fanSpeedPercent = max(fanSpeedPercent, material[0].fan_speed);                            volume_to_filament_length[e] = 1.0 / (M_PI * (material[e].diameter / 2.0) * (material[e].diameter / 2.0));                            extrudemultiply[e] = material[e].flow;                        }                        //.........这里部分代码省略.........
开发者ID:krasin,项目名称:Ultimaker2Marlin,代码行数:101,


示例19: DCHECK

void AsyncUDPSocket::detachEventBase() {  DCHECK(eventBase_ && eventBase_->isInEventBaseThread());  registerHandler(uint16_t(NONE));  eventBase_ = nullptr;  EventHandler::detachEventBase();}
开发者ID:alittlefish1,项目名称:folly,代码行数:6,


示例20: PrepareAndDispatch

extern "C" nsresultPrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,                   uint64_t * args, uint64_t * gpregs, double *fpregs){    nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];    nsXPTCMiniVariant* dispatchParams = nullptr;    const nsXPTMethodInfo* info;    uint32_t paramCount;    uint32_t i;    nsresult result = NS_ERROR_FAILURE;    NS_ASSERTION(self,"no self");    self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);    NS_ASSERTION(info,"no method info");    if (!info)        return NS_ERROR_UNEXPECTED;    paramCount = info->GetParamCount();    // setup variant array pointer    if (paramCount > PARAM_BUFFER_COUNT)        dispatchParams = new nsXPTCMiniVariant[paramCount];    else        dispatchParams = paramBuffer;    NS_ASSERTION(dispatchParams,"no place for params");    if (!dispatchParams)        return NS_ERROR_OUT_OF_MEMORY;    uint64_t* ap = args;    uint32_t nr_gpr = 1;    // skip one GPR register for 'that'    uint32_t nr_fpr = 0;    uint64_t value;    for (i = 0; i < paramCount; i++) {        const nsXPTParamInfo& param = info->GetParam(i);        const nsXPTType& type = param.GetType();        nsXPTCMiniVariant* dp = &dispatchParams[i];	        if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {            if (nr_fpr < FPR_COUNT)                dp->val.d = fpregs[nr_fpr++];            else                dp->val.d = *(double*) ap++;            continue;        }        else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {            if (nr_fpr < FPR_COUNT)                // The value in %xmm register is already prepared to                // be retrieved as a float. Therefore, we pass the                // value verbatim, as a double without conversion.                dp->val.d = fpregs[nr_fpr++];            else                dp->val.f = *(float*) ap++;            continue;        }        else {            if (nr_gpr < GPR_COUNT)                value = gpregs[nr_gpr++];            else                value = *ap++;        }        if (param.IsOut() || !type.IsArithmetic()) {            dp->val.p = (void*) value;            continue;        }        switch (type) {        case nsXPTType::T_I8:      dp->val.i8  = (int8_t)   value; break;        case nsXPTType::T_I16:     dp->val.i16 = (int16_t)  value; break;        case nsXPTType::T_I32:     dp->val.i32 = (int32_t)  value; break;        case nsXPTType::T_I64:     dp->val.i64 = (int64_t)  value; break;        case nsXPTType::T_U8:      dp->val.u8  = (uint8_t)  value; break;        case nsXPTType::T_U16:     dp->val.u16 = (uint16_t) value; break;        case nsXPTType::T_U32:     dp->val.u32 = (uint32_t) value; break;        case nsXPTType::T_U64:     dp->val.u64 = (uint64_t) value; break;        // Cast to uint8_t first, to remove garbage on upper 56 bits.        case nsXPTType::T_BOOL:    dp->val.b   = (bool)(uint8_t)   value; break;        case nsXPTType::T_CHAR:    dp->val.c   = (char)     value; break;        case nsXPTType::T_WCHAR:   dp->val.wc  = (wchar_t)  value; break;        default:            NS_ERROR("bad type");            break;        }    }    result = self->mOuter->CallMethod((uint16_t) methodIndex, info, dispatchParams);    if (dispatchParams != paramBuffer)        delete [] dispatchParams;    return result;}
开发者ID:galexcode,项目名称:mozilla-central,代码行数:96,


示例21: PrepareAndDispatch

extern "C" nsresultPrepareAndDispatch(nsXPTCStubBase* self,                   uint64_t methodIndex,                   uint64_t* args,                   uint64_t *gprData,                   double *fprData){    nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];    nsXPTCMiniVariant* dispatchParams = NULL;    const nsXPTMethodInfo* info;    uint32_t paramCount;    uint32_t i;    nsresult result = NS_ERROR_FAILURE;    NS_ASSERTION(self,"no self");    self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);    NS_ASSERTION(info,"no method info");    if (! info)        return NS_ERROR_UNEXPECTED;    paramCount = info->GetParamCount();    // setup variant array pointer    if(paramCount > PARAM_BUFFER_COUNT)        dispatchParams = new nsXPTCMiniVariant[paramCount];    else        dispatchParams = paramBuffer;    NS_ASSERTION(dispatchParams,"no place for params");    if (! dispatchParams)        return NS_ERROR_OUT_OF_MEMORY;    uint64_t* ap = args;    uint64_t tempu64;    for(i = 0; i < paramCount; i++) {        const nsXPTParamInfo& param = info->GetParam(i);        const nsXPTType& type = param.GetType();        nsXPTCMiniVariant* dp = &dispatchParams[i];	        if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {            if (i < FPR_COUNT)                dp->val.d = fprData[i];            else                dp->val.d = *(double*) ap;        } else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {            if (i < FPR_COUNT)                dp->val.f = (float) fprData[i]; // in registers floats are passed as doubles            else {                float *p = (float *)ap;                p++;                dp->val.f = *p;            }        } else { /* integer type or pointer */            if (i < GPR_COUNT)                tempu64 = gprData[i];            else                tempu64 = *ap;            if (param.IsOut() || !type.IsArithmetic())                dp->val.p = (void*) tempu64;            else if (type == nsXPTType::T_I8)                dp->val.i8  = (int8_t)   tempu64;            else if (type == nsXPTType::T_I16)                dp->val.i16 = (int16_t)  tempu64;            else if (type == nsXPTType::T_I32)                dp->val.i32 = (int32_t)  tempu64;            else if (type == nsXPTType::T_I64)                dp->val.i64 = (int64_t)  tempu64;            else if (type == nsXPTType::T_U8)                dp->val.u8  = (uint8_t)  tempu64;            else if (type == nsXPTType::T_U16)                dp->val.u16 = (uint16_t) tempu64;            else if (type == nsXPTType::T_U32)                dp->val.u32 = (uint32_t) tempu64;            else if (type == nsXPTType::T_U64)                dp->val.u64 = (uint64_t) tempu64;            else if (type == nsXPTType::T_BOOL)                dp->val.b   = (bool)   tempu64;            else if (type == nsXPTType::T_CHAR)                dp->val.c   = (char)     tempu64;            else if (type == nsXPTType::T_WCHAR)                dp->val.wc  = (wchar_t)  tempu64;            else                NS_ERROR("bad type");        }        if (i >= 7)            ap++;    }    result = self->mOuter->CallMethod((uint16_t) methodIndex, info,                                      dispatchParams);    if (dispatchParams != paramBuffer)        delete [] dispatchParams;    return result;}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:100,


示例22: switch

	// Returns true if a node was read successfully, false on EOF	bool XMLReader::ReadInternal()	{		switch (mNodeType) {			case kNone:				FillInputBuffer();				if ((mInputEnd - mInputStart) >= 2) {					uint16_t x = (uint16_t(mInputBuffer[0]) << 8) | mInputBuffer[1];					switch (x) {						case 0xFEFF:						case 0x003C:							mConverter.Reset(TextEncoding::UTF16BE());							break;						case 0xFFFE:						case 0x3C00:							mConverter.Reset(TextEncoding::UTF16LE());							break;					}				}				mNodeType = kDocument;				return true;						case kDocument:				// An XML document can start with:				// document	::= prolog element Misc*				// prolog	::= XMLDecl? Misc* (doctypedecl Misc*)?				// XMLDecl	::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'				// Misc ::= Comment | PI | S				// doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'				// Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'				// PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'				// S ::= (#x20 | #x9 | #xD | #xA)+				// If the XML file starts with a byte order mark, throw it away.				// The earlier code for the kNone case has already used it to				// set the default encoding.				ParseChar(UnicodeChar(0xFEFF));				if (BufferStartsWith("<?xml")) {					if (! ParseXmlDeclaration()) return false;					UnicodeString encodingName = GetAttribute("encoding");					if (encodingName.empty()) return true;					TextEncoding newEncoding = TextEncoding::WebCharset(encodingName.c_str());					if (newEncoding == mConverter.GetSourceEncoding()) return true;					// The encoding in the XML declaration is different from the one					// we assumed, so we have to reset all the input buffering and					// re-parse the XmlDeclaration.					mConverter.Reset(newEncoding);					mInput.Restart();					mInputStart = mInputEnd = mInputBuffer;					mOutputStart = mOutputEnd = mOutputBuffer;					ParseChar(UnicodeChar(0xFEFF));					return ParseXmlDeclaration();				}				else if (StartsWithWhitespace()) return ParseRequiredWhitespace();				//else if (BufferStartsWith("<!--")) return ParseComment();				//else if (BufferStartsWith("<?")) return ParseProcessingInstruction();				//else if (BufferStartsWith("<!DOCTYPE")) return ParseDocumentType();				else if (BufferStartsWith("<")) return ParseElement();				else return false;			case kXmlDeclaration:			case kElement:			case kEndElement:			case kText:		    case kWhitespace:				if (BufferStartsWith("</")) return ParseEndElement();				else if (BufferStartsWith("<")) return ParseElement();				else return ParseText();		}		return false;	}
开发者ID:BackupTheBerlios,项目名称:llamaxml-svn,代码行数:73,


示例23: while

//.........这里部分代码省略.........        mSkipBytes = mElement.mSize.mValue;        mState = SKIP_DATA;        mNextState = READ_ELEMENT_ID;        break;      }      break;    case READ_VINT: {      unsigned char c = *p++;      uint32_t mask;      mVInt.mLength = VIntLength(c, &mask);      mVIntLeft = mVInt.mLength - 1;      mVInt.mValue = mVIntRaw ? c : c & ~mask;      mState = READ_VINT_REST;      break;    }    case READ_VINT_REST:      if (mVIntLeft) {        mVInt.mValue <<= 8;        mVInt.mValue |= *p++;        mVIntLeft -= 1;      } else {        mState = mNextState;      }      break;    case READ_TIMECODESCALE:      MOZ_ASSERT(mGotTimecodeScale);      mTimecodeScale = mVInt.mValue;      mState = READ_ELEMENT_ID;      break;    case READ_CLUSTER_TIMECODE:      mClusterTimecode = mVInt.mValue;      mState = READ_ELEMENT_ID;      break;    case READ_BLOCK_TIMECODE:      if (mBlockTimecodeLength) {        mBlockTimecode <<= 8;        mBlockTimecode |= *p++;        mBlockTimecodeLength -= 1;      } else {        // It's possible we've parsed this data before, so avoid inserting        // duplicate WebMTimeDataOffset entries.        {          ReentrantMonitorAutoEnter mon(aReentrantMonitor);          int64_t endOffset = mBlockOffset + mBlockSize +                              mElement.mID.mLength + mElement.mSize.mLength;          uint32_t idx = aMapping.IndexOfFirstElementGt(endOffset);          if (idx == 0 || aMapping[idx - 1] != endOffset) {            // Don't insert invalid negative timecodes.            if (mBlockTimecode >= 0 || mClusterTimecode >= uint16_t(abs(mBlockTimecode))) {              MOZ_ASSERT(mGotTimecodeScale);              uint64_t absTimecode = mClusterTimecode + mBlockTimecode;              absTimecode *= mTimecodeScale;              WebMTimeDataOffset entry(endOffset, absTimecode, mLastInitStartOffset,                                       mClusterOffset, mClusterEndOffset);              aMapping.InsertElementAt(idx, entry);            }          }        }        // Skip rest of block header and the block's payload.        mBlockSize -= mVInt.mLength;        mBlockSize -= BLOCK_TIMECODE_LENGTH;        mSkipBytes = uint32_t(mBlockSize);        mState = SKIP_DATA;        mNextState = READ_ELEMENT_ID;      }      break;    case SKIP_DATA:      if (mSkipBytes) {        uint32_t left = aLength - (p - aBuffer);        left = std::min(left, mSkipBytes);        p += left;        mSkipBytes -= left;      }      if (!mSkipBytes) {        mBlockEndOffset = mCurrentOffset + (p - aBuffer);        mState = mNextState;      }      break;    case CHECK_INIT_FOUND:      if (mSkipBytes) {        uint32_t left = aLength - (p - aBuffer);        left = std::min(left, mSkipBytes);        p += left;        mSkipBytes -= left;      }      if (!mSkipBytes) {        if (mInitEndOffset < 0) {          mInitEndOffset = mCurrentOffset + (p - aBuffer);          mBlockEndOffset = mCurrentOffset + (p - aBuffer);        }        mState = READ_ELEMENT_ID;      }      break;    }  }  NS_ASSERTION(p == aBuffer + aLength, "Must have parsed to end of data.");  mCurrentOffset += aLength;}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:101,


示例24: SOCKET_LOG

nsresultnsSocketTransportService::DoPollIteration(TimeDuration *pollDuration){    SOCKET_LOG(("STS poll iter/n"));    int32_t i, count;    //    // poll loop    //    // walk active list backwards to see if any sockets should actually be    // idle, then walk the idle list backwards to see if any idle sockets    // should become active.  take care to check only idle sockets that    // were idle to begin with ;-)    //    count = mIdleCount;    for (i=mActiveCount-1; i>=0; --i) {        //---        SOCKET_LOG(("  active [%u] { handler=%p condition=%x pollflags=%hu }/n", i,            mActiveList[i].mHandler,            mActiveList[i].mHandler->mCondition,            mActiveList[i].mHandler->mPollFlags));        //---        if (NS_FAILED(mActiveList[i].mHandler->mCondition))            DetachSocket(mActiveList, &mActiveList[i]);        else {            uint16_t in_flags = mActiveList[i].mHandler->mPollFlags;            if (in_flags == 0)                MoveToIdleList(&mActiveList[i]);            else {                // update poll flags                mPollList[i+1].in_flags = in_flags;                mPollList[i+1].out_flags = 0;            }        }    }    for (i=count-1; i>=0; --i) {        //---        SOCKET_LOG(("  idle [%u] { handler=%p condition=%x pollflags=%hu }/n", i,            mIdleList[i].mHandler,            mIdleList[i].mHandler->mCondition,            mIdleList[i].mHandler->mPollFlags));        //---        if (NS_FAILED(mIdleList[i].mHandler->mCondition))            DetachSocket(mIdleList, &mIdleList[i]);        else if (mIdleList[i].mHandler->mPollFlags != 0)            MoveToPollList(&mIdleList[i]);    }    SOCKET_LOG(("  calling PR_Poll [active=%u idle=%u]/n", mActiveCount, mIdleCount));#if defined(XP_WIN)    // 30 active connections is the historic limit before firefox 7's 256. A few    //  windows systems have troubles with the higher limit, so actively probe a    // limit the first time we exceed 30.    if ((mActiveCount > 30) && !mProbedMaxCount)        ProbeMaxCount();#endif    // Measures seconds spent while blocked on PR_Poll    uint32_t pollInterval = 0;    int32_t n = 0;    *pollDuration = 0;    if (!gIOService->IsNetTearingDown()) {        // Let's not do polling during shutdown.        n = Poll(&pollInterval, pollDuration);    }    if (n < 0) {        SOCKET_LOG(("  PR_Poll error [%d] os error [%d]/n", PR_GetError(),                    PR_GetOSError()));    }    else {        //        // service "active" sockets...        //        uint32_t numberOfOnSocketReadyCalls = 0;        for (i=0; i<int32_t(mActiveCount); ++i) {            PRPollDesc &desc = mPollList[i+1];            SocketContext &s = mActiveList[i];            if (n > 0 && desc.out_flags != 0) {                s.mElapsedTime = 0;                s.mHandler->OnSocketReady(desc.fd, desc.out_flags);                numberOfOnSocketReadyCalls++;            }            // check for timeout errors unless disabled...            else if (s.mHandler->mPollTimeout != UINT16_MAX) {                // update elapsed time counter                // (NOTE: We explicitly cast UINT16_MAX to be an unsigned value                // here -- otherwise, some compilers will treat it as signed,                // which makes them fire signed/unsigned-comparison build                // warnings for the comparison against 'pollInterval'.)                if (MOZ_UNLIKELY(pollInterval >                                static_cast<uint32_t>(UINT16_MAX) -                                s.mElapsedTime))                    s.mElapsedTime = UINT16_MAX;                else                    s.mElapsedTime += uint16_t(pollInterval);                // check for timeout expiration                 if (s.mElapsedTime >= s.mHandler->mPollTimeout) {                    s.mElapsedTime = 0;//.........这里部分代码省略.........
开发者ID:emilio,项目名称:gecko-dev,代码行数:101,


示例25: kinect_scan_msg

void depth_to_laser::depth2laser(const sensor_msgs::ImageConstPtr& depth_msg, sensor_msgs::LaserScanPtr scan_msg, const Params param){	// Calculate vars	double unit_scaling = depthimage_to_laserscan::DepthTraits<uint16_t>::toMeters(uint16_t(1));	float constant_x = unit_scaling / param._f;	uint32_t ranges_size = depth_msg->width;	double kinect_angle_max = -atan2((double)(0 - param._c_u) * constant_x, unit_scaling);	double kinect_angle_min = -atan2((double)(depth_msg->width-1 - param._c_u) * constant_x, unit_scaling);	double kinect_angle_increment = (kinect_angle_max - kinect_angle_min) / (depth_msg->width - 1);	// Fill the kinect fixed message	sensor_msgs::LaserScanPtr kinect_scan_msg(new sensor_msgs::LaserScan());	kinect_scan_msg->header = depth_msg->header;	kinect_scan_msg->header.frame_id = "kinect2";	kinect_scan_msg->time_increment = 0.0;	kinect_scan_msg->scan_time = 0.033;	kinect_scan_msg->range_min = 0.45;    	kinect_scan_msg->range_max = 5.0;	kinect_scan_msg->angle_min = kinect_angle_min;	kinect_scan_msg->angle_max = kinect_angle_max;  	kinect_scan_msg->angle_increment = kinect_angle_increment;	kinect_scan_msg->ranges.resize(ranges_size);	kinect_scan_msg->ranges.assign(ranges_size, std::numeric_limits<float>::quiet_NaN());	kinect_scan_msg->intensities.assign(ranges_size, 0.5);	const uint16_t* depth_row = reinterpret_cast<const uint16_t*>(&depth_msg->data[0]);	int row_step = depth_msg->step / sizeof(uint16_t);	int offset = (int)(param._c_v-param._scan_height/2);	depth_row += offset*row_step; 	for(int v = offset; v < offset+param._scan_height; v++, depth_row += row_step)	{		for (int u = 0; u < (int)depth_msg->width; u++) // Loop in row		{				uint16_t depth = depth_row[u];			double kinect_r = depth; // Assign to pass through NaNs and Infs			double kinect_th = -atan2((double)(u - param._c_u) * constant_x, unit_scaling); // -atan2(x, z)			int kinect_index = (kinect_th - kinect_scan_msg->angle_min) / kinect_scan_msg->angle_increment;			if (depthimage_to_laserscan::DepthTraits<uint16_t>::valid(depth)) // Not NaN or Inf			{				// Calculate in XYZ				double kinect_x = (u - param._c_u) * depth * constant_x;				double kinect_z = depthimage_to_laserscan::DepthTraits<uint16_t>::toMeters(depth);				// Calculate actual distance				kinect_r = sqrt(pow(kinect_x, 2.0) + pow(kinect_z, 2.0));			}			// Determine if this point should be used.			if (use_point(kinect_r, kinect_scan_msg->ranges[kinect_index], kinect_scan_msg->range_min, kinect_scan_msg->range_max))			{				kinect_scan_msg->ranges[kinect_index] = kinect_r;				kinect_scan_msg->intensities[kinect_index] = 0.5;			}		}	}					// Fill the robot fixed message	sensor_msgs::LaserScanPtr robot_scan_msg(new sensor_msgs::LaserScan());	robot_scan_msg->header = depth_msg->header;	robot_scan_msg->header.frame_id = "robot";	robot_scan_msg->time_increment = 0.0;	robot_scan_msg->scan_time = 0.033;	robot_scan_msg->range_min = 0.45;    	robot_scan_msg->range_max = 5.0;	double robot_min_x = -robot_scan_msg->range_max * sin(kinect_scan_msg->angle_min) + param._kinect_to_laser_x + param._laser_to_robot_x;	double robot_min_z =  robot_scan_msg->range_max * cos(kinect_scan_msg->angle_min) + param._kinect_to_laser_z + param._laser_to_robot_z;	double robot_max_x = -robot_scan_msg->range_max * sin(kinect_scan_msg->angle_max) + param._kinect_to_laser_x + param._laser_to_robot_x;	double robot_max_z =  robot_scan_msg->range_max * cos(kinect_scan_msg->angle_max) + param._kinect_to_laser_z + param._laser_to_robot_z;		double robot_angle_min = -atan2(robot_min_x, robot_min_z) + param._kinect_to_laser_theta;	double robot_angle_max = -atan2(robot_max_x, robot_max_z) + param._kinect_to_laser_theta;  	double robot_angle_increment = (robot_angle_max - robot_angle_min) / (depth_msg->width - 1);	robot_scan_msg->angle_min = robot_angle_min;	robot_scan_msg->angle_max = robot_angle_max;  	robot_scan_msg->angle_increment = robot_angle_increment;	robot_scan_msg->ranges.resize(ranges_size);	robot_scan_msg->ranges.assign(ranges_size, std::numeric_limits<float>::quiet_NaN());	robot_scan_msg->intensities.assign(ranges_size, 0.5);	for (int i = 0; i < ranges_size; i++)	{		double kinect_r = kinect_scan_msg->ranges[i];		double kinect_th = kinect_angle_min + i * kinect_angle_increment;		// New point (In the robot coordinate)		double robot_x = -kinect_r * sin(kinect_th + param._kinect_to_laser_theta) + param._kinect_to_laser_x + param._laser_to_robot_x;		double robot_z =  kinect_r * cos(kinect_th + param._kinect_to_laser_theta) + param._kinect_to_laser_z + param._laser_to_robot_z;		// New angle (In the robot coordinate)		double robot_th = -atan2(robot_x, robot_z);//.........这里部分代码省略.........
开发者ID:jfqiu-git,项目名称:bankrobot,代码行数:101,


示例26: write_pod

// special write function for stringsvoid write_pod(std::string &buffer, const std::string &value) {    uint16_t len = uint16_t(value.size()); write_pod(buffer, len);    buffer.append(value);}
开发者ID:chagge,项目名称:Cry_Project,代码行数:5,


示例27: PrepareAndDispatch

extern "C" nsresult ATTRIBUTE_USEDPrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args){#define PARAM_BUFFER_COUNT     16    nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];    nsXPTCMiniVariant* dispatchParams = nullptr;    const nsXPTMethodInfo* info;    uint8_t paramCount;    uint8_t i;    nsresult result = NS_ERROR_FAILURE;    NS_ASSERTION(self,"no self");    self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);    NS_ASSERTION(info,"no interface info");    paramCount = info->GetParamCount();    // setup variant array pointer    if(paramCount > PARAM_BUFFER_COUNT)        dispatchParams = new nsXPTCMiniVariant[paramCount];    else        dispatchParams = paramBuffer;    NS_ASSERTION(dispatchParams,"no place for params");    uint64_t* ap = args;    for(i = 0; i < paramCount; i++, ap++)    {        const nsXPTParamInfo& param = info->GetParam(i);        const nsXPTType& type = param.GetType();        nsXPTCMiniVariant* dp = &dispatchParams[i];        if(param.IsOut() || !type.IsArithmetic())        {            dp->val.p = (void*) *ap;            continue;        }        // else        switch(type)        {        case nsXPTType::T_I8     : dp->val.i8  = *((int64_t*) ap);       break;        case nsXPTType::T_I16    : dp->val.i16 = *((int64_t*) ap);       break;        case nsXPTType::T_I32    : dp->val.i32 = *((int64_t*) ap);       break;        case nsXPTType::T_DOUBLE : dp->val.d   = *((double*)  ap);       break;        case nsXPTType::T_U64    : dp->val.u64 = *((uint64_t*)ap);       break;        case nsXPTType::T_I64    : dp->val.i64 = *((int64_t*) ap);       break;        case nsXPTType::T_U8     : dp->val.u8  = *((uint64_t*)ap);       break;        case nsXPTType::T_U16    : dp->val.u16 = *((uint64_t*)ap);       break;        case nsXPTType::T_U32    : dp->val.u32 = *((uint64_t*)ap);       break;        case nsXPTType::T_FLOAT  : dp->val.f   =  ((float*)   ap)[1];    break;        case nsXPTType::T_BOOL   : dp->val.b   = *((uint64_t*)ap);       break;        case nsXPTType::T_CHAR   : dp->val.c   = *((uint64_t*)ap);       break;        case nsXPTType::T_WCHAR  : dp->val.wc  = *((int64_t*) ap);       break;        default:            NS_ERROR("bad type");            break;        }    }    result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);    if(dispatchParams != paramBuffer)        delete [] dispatchParams;    return result;}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:68,


示例28: M7501

 TED7360::TED7360() : M7501() {   tedRegisters[0x07] = uint8_t(0x00);         // default to PAL mode   for (int i = 0; i < int(sizeof(callbacks) / sizeof(TEDCallback)); i++) {     callbacks[i].func = (void (*)(void *)) 0;     callbacks[i].userData = (void *) 0;     callbacks[i].nxt0 = (TEDCallback *) 0;     callbacks[i].nxt1 = (TEDCallback *) 0;   }   firstCallback0 = (TEDCallback *) 0;   firstCallback1 = (TEDCallback *) 0;   // create initial memory map   ramSegments = 0;   ramPatternCode = 0UL;   randomSeed = 0;   Plus4Emu::setRandomSeed(randomSeed,                           Plus4Emu::Timer::getRandomSeedFromTime());   for (int i = 0; i < 256; i++)     segmentTable[i] = (uint8_t *) 0;   try {     setRAMSize(64);   }   catch (...) {     for (int i = 0; i < 256; i++) {       if (segmentTable[i] != (uint8_t *) 0) {         delete[] segmentTable[i];         segmentTable[i] = (uint8_t *) 0;       }     }     throw;   }   setMemoryCallbackUserData(this);   for (uint16_t i = 0x0000; i <= 0x0FFF; i++) {     setMemoryReadCallback(i, &read_memory_0000_to_0FFF);     setMemoryWriteCallback(i, &write_memory_0000_to_0FFF);   }   for (uint16_t i = 0x1000; i <= 0x3FFF; i++) {     setMemoryReadCallback(i, &read_memory_1000_to_3FFF);     setMemoryWriteCallback(i, &write_memory_1000_to_3FFF);   }   for (uint16_t i = 0x4000; i <= 0x7FFF; i++) {     setMemoryReadCallback(i, &read_memory_4000_to_7FFF);     setMemoryWriteCallback(i, &write_memory_4000_to_7FFF);   }   for (uint16_t i = 0x8000; i <= 0xBFFF; i++) {     setMemoryReadCallback(i, &read_memory_8000_to_BFFF);     setMemoryWriteCallback(i, &write_memory_8000_to_BFFF);   }   for (uint16_t i = 0xC000; i <= 0xFBFF; i++) {     setMemoryReadCallback(i, &read_memory_C000_to_FBFF);     setMemoryWriteCallback(i, &write_memory_C000_to_FBFF);   }   for (uint16_t i = 0xFC00; i <= 0xFCFF; i++) {     setMemoryReadCallback(i, &read_memory_FC00_to_FCFF);     setMemoryWriteCallback(i, &write_memory_FC00_to_FCFF);   }   for (uint16_t i = 0xFD00; i <= 0xFEFF; i++) {     setMemoryReadCallback(i, &read_memory_FD00_to_FEFF);     setMemoryWriteCallback(i, &write_memory_FD00_to_FEFF);   }   for (uint16_t i = 0xFF00; i <= 0xFF1F; i++) {     setMemoryReadCallback(i, &read_register_FFxx);     setMemoryWriteCallback(i, &write_register_FFxx);   }   for (uint32_t i = 0xFF20; i <= 0xFFFF; i++) {     setMemoryReadCallback(uint16_t(i), &read_memory_FF00_to_FFFF);     setMemoryWriteCallback(uint16_t(i), &write_memory_FF00_to_FFFF);   }   // TED register read   setMemoryReadCallback(0x0000, &read_register_0000);   setMemoryReadCallback(0x0001, &read_register_0001);   for (uint16_t i = 0xFD00; i <= 0xFD0F; i++)     setMemoryReadCallback(i, &read_register_FD0x);   for (uint16_t i = 0xFD10; i <= 0xFD1F; i++)     setMemoryReadCallback(i, &read_register_FD1x);   setMemoryReadCallback(0xFD16, &read_register_FD16);   for (uint16_t i = 0xFD30; i <= 0xFD3F; i++)     setMemoryReadCallback(i, &read_register_FD3x);   setMemoryReadCallback(0xFF00, &read_register_FF00);   setMemoryReadCallback(0xFF01, &read_register_FF01);   setMemoryReadCallback(0xFF02, &read_register_FF02);   setMemoryReadCallback(0xFF03, &read_register_FF03);   setMemoryReadCallback(0xFF04, &read_register_FF04);   setMemoryReadCallback(0xFF05, &read_register_FF05);   setMemoryReadCallback(0xFF06, &read_register_FF06);   setMemoryReadCallback(0xFF09, &read_register_FF09);   setMemoryReadCallback(0xFF0A, &read_register_FF0A);   setMemoryReadCallback(0xFF0C, &read_register_FF0C);   setMemoryReadCallback(0xFF10, &read_register_FF10);   setMemoryReadCallback(0xFF12, &read_register_FF12);   setMemoryReadCallback(0xFF13, &read_register_FF13);   setMemoryReadCallback(0xFF14, &read_register_FF14);   setMemoryReadCallback(0xFF1A, &read_register_FF1A);   setMemoryReadCallback(0xFF1B, &read_register_FF1B);   setMemoryReadCallback(0xFF1C, &read_register_FF1C);   setMemoryReadCallback(0xFF1E, &read_register_FF1E);   setMemoryReadCallback(0xFF1F, &read_register_FF1F);   setMemoryReadCallback(0xFF3E, &read_register_FF3E_FF3F);   setMemoryReadCallback(0xFF3F, &read_register_FF3E_FF3F);   // TED register write//.........这里部分代码省略.........
开发者ID:lucaregini,项目名称:plus4emu,代码行数:101,



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


C++ uint16_to_bin函数代码示例
C++ uint16_fromregion函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。