本文整理汇总了C++中getSize函数的典型用法代码示例。如果您正苦于以下问题:C++ getSize函数的具体用法?C++ getSize怎么用?C++ getSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: replace
template <class T, typename S> T* ArrayBase<T,S>::add(const ArrayBase<T,S>& other)
{
return replace(getSize(), getSize(), other);
}
开发者ID:AllioNicholas,项目名称:CG_AS1,代码行数:4,代码来源:Array.hpp
示例2: glPointSize
void PointChunk::changeFrom(DrawEnv *pEnv,
StateChunk *old_chunk,
UInt32 )
{
PointChunk *old = dynamic_cast<PointChunk *>(old_chunk);
#ifndef OSG_OGL_ES2
if(getSize() != old->getSize())
glPointSize(getSize());
#endif
#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
if(getSmooth() && !old->getSmooth())
{
glEnable(GL_POINT_SMOOTH);
}
else if(!getSmooth() && old->getSmooth())
{
glDisable(GL_POINT_SMOOTH);
}
#endif
Window *pWin = pEnv->getWindow();
osgSinkUnusedWarning(pWin);
#if GL_ARB_point_parameters
if(getMinSize() >= 0.f)
{
if(pEnv->getWindow()->hasExtOrVersion(_extPointParameters, 0x0104))
{
OSGGETGLFUNCBYID_GL3( glPointParameterf,
osgGlPointParameterf,
_funcIdPointParameterf,
pWin);
#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
OSGGETGLFUNCBYID_GL3( glPointParameterfv,
osgGlPointParameterfv,
_funcIdPointParameterfv,
pWin);
osgGlPointParameterf(GL_POINT_SIZE_MIN_ARB, getMinSize());
osgGlPointParameterf(GL_POINT_SIZE_MAX_ARB, getMaxSize());
#endif
osgGlPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_ARB,
getFadeThreshold());
#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
GLfloat att[3] = { getConstantAttenuation (),
getLinearAttenuation (),
getQuadraticAttenuation() };
osgGlPointParameterfv(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
#endif
}
}
else if(old->getMinSize() >= 0.f)
{
if(pEnv->getWindow()->hasExtOrVersion(_extPointParameters, 0x0104))
{
OSGGETGLFUNCBYID_GL3( glPointParameterf,
osgGlPointParameterf,
_funcIdPointParameterf,
pWin);
#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
OSGGETGLFUNCBYID_GL3( glPointParameterfv,
osgGlPointParameterfv,
_funcIdPointParameterfv,
pWin);
osgGlPointParameterf(GL_POINT_SIZE_MIN_ARB, 0);
osgGlPointParameterf(GL_POINT_SIZE_MAX_ARB, 1e10);
#endif
osgGlPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1);
#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
GLfloat att[3] = { 1, 0, 0 };
osgGlPointParameterfv(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
#endif
}
}
#endif
#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
#if GL_ARB_point_sprite
if(getSprite() && !old->getSprite())
{
if(pEnv->getWindow()->hasExtOrVersion(_extPointSpriteARB, 0x0200))
{
#if GL_NV_point_sprite
if(pEnv->getWindow()->hasExtension(_extPointSpriteNV))
{
OSGGETGLFUNCBYID_GL3( glPointParameterf,
osgGlPointParameterf,
_funcIdPointParameterf,
pWin);
osgGlPointParameterf(GL_POINT_SPRITE_R_MODE_NV,
//.........这里部分代码省略.........
开发者ID:vrsource,项目名称:OpenSGDevMaster,代码行数:101,代码来源:OSGPointChunk.cpp
示例3: r
void BackgroundSync::produce() {
// this oplog reader does not do a handshake because we don't want the server it's syncing
// from to track how far it has synced
OplogReader r(false /* doHandshake */);
// find a target to sync from the last op time written
getOplogReader(r);
// no server found
{
boost::unique_lock<boost::mutex> lock(_mutex);
if (_currentSyncTarget == NULL) {
lock.unlock();
sleepsecs(1);
// if there is no one to sync from
return;
}
r.tailingQueryGTE(rsoplog, _lastOpTimeFetched);
}
// if target cut connections between connecting and querying (for
// example, because it stepped down) we might not have a cursor
if (!r.haveCursor()) {
return;
}
while (MONGO_FAIL_POINT(rsBgSyncProduce)) {
sleepmillis(0);
}
uassert(1000, "replSet source for syncing doesn't seem to be await capable -- is it an older version of mongodb?", r.awaitCapable() );
if (isRollbackRequired(r)) {
stop();
return;
}
while (!inShutdown()) {
while (!inShutdown()) {
if (!r.moreInCurrentBatch()) {
if (theReplSet->gotForceSync()) {
return;
}
if (isAssumingPrimary() || theReplSet->isPrimary()) {
return;
}
// re-evaluate quality of sync target
if (shouldChangeSyncTarget()) {
return;
}
//record time for each getmore
{
TimerHolder batchTimer(&getmoreReplStats);
r.more();
}
//increment
networkByteStats.increment(r.currentBatchMessageSize());
}
if (!r.more())
break;
BSONObj o = r.nextSafe().getOwned();
opsReadStats.increment();
{
boost::unique_lock<boost::mutex> lock(_mutex);
_appliedBuffer = false;
}
OCCASIONALLY {
LOG(2) << "bgsync buffer has " << _buffer.size() << " bytes" << rsLog;
}
// the blocking queue will wait (forever) until there's room for us to push
_buffer.push(o);
bufferCountGauge.increment();
bufferSizeGauge.increment(getSize(o));
{
boost::unique_lock<boost::mutex> lock(_mutex);
_lastH = o["h"].numberLong();
_lastOpTimeFetched = o["ts"]._opTime();
}
} // end while
{
boost::unique_lock<boost::mutex> lock(_mutex);
if (_pause || !_currentSyncTarget || !_currentSyncTarget->hbinfo().hbstate.readable()) {
return;
}
}
r.tailCheck();
//.........这里部分代码省略.........
开发者ID:524777134,项目名称:mongo,代码行数:101,代码来源:bgsync.cpp
示例4: scopedMutexLock
// Add new job to the end of queue
void JobQueue::pushHighPriorityJob(boost::shared_ptr<Job> job)
{
{ // scope
ScopedMutexLock scopedMutexLock(_queueMutex);
_queue.push_front(job);
LOG4CXX_TRACE(logger, "JobQueue::pushHighPriorityJob: Q ("<<this<<") size = "<<getSize());
}
// We are releasing semaphore after unlocking mutex to
// prevent unwanted _queueMutex sleeping in popJob.
_queueSemaphore.release();
}
开发者ID:Goon83,项目名称:scidb,代码行数:12,代码来源:JobQueue.cpp
示例5: createPage
Layout* PageView::createPage()
{
Layout* newPage = Layout::create();
newPage->setSize(getSize());
return newPage;
}
开发者ID:darling0825,项目名称:cocos2dx_tz_lib,代码行数:6,代码来源:UIPageView.cpp
示例6: GuiComponent
GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector<MetaDataDecl>& mdd, ScraperSearchParams scraperParams,
const std::string& /*header*/, std::function<void()> saveCallback, std::function<void()> deleteFunc) : GuiComponent(window),
mScraperParams(scraperParams),
mBackground(window, ":/frame.png"),
mGrid(window, Vector2i(1, 3)),
mMetaDataDecl(mdd),
mMetaData(md),
mSavedCallback(saveCallback), mDeleteFunc(deleteFunc)
{
addChild(&mBackground);
addChild(&mGrid);
mHeaderGrid = std::make_shared<ComponentGrid>(mWindow, Vector2i(1, 5));
mTitle = std::make_shared<TextComponent>(mWindow, "EDIT METADATA", Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
mSubtitle = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(Utils::FileSystem::getFileName(scraperParams.game->getPath())),
Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER);
mHeaderGrid->setEntry(mTitle, Vector2i(0, 1), false, true);
mHeaderGrid->setEntry(mSubtitle, Vector2i(0, 3), false, true);
mGrid.setEntry(mHeaderGrid, Vector2i(0, 0), false, true);
mList = std::make_shared<ComponentList>(mWindow);
mGrid.setEntry(mList, Vector2i(0, 1), true, true);
// populate list
for(auto iter = mdd.cbegin(); iter != mdd.cend(); iter++)
{
std::shared_ptr<GuiComponent> ed;
// don't add statistics
if(iter->isStatistic)
continue;
// create ed and add it (and any related components) to mMenu
// ed's value will be set below
ComponentListRow row;
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(iter->displayName), Font::get(FONT_SIZE_SMALL), 0x777777FF);
row.addElement(lbl, true); // label
switch(iter->type)
{
case MD_BOOL:
{
ed = std::make_shared<SwitchComponent>(window);
row.addElement(ed, false, true);
break;
}
case MD_RATING:
{
ed = std::make_shared<RatingComponent>(window);
const float height = lbl->getSize().y() * 0.71f;
ed->setSize(0, height);
row.addElement(ed, false, true);
auto spacer = std::make_shared<GuiComponent>(mWindow);
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
row.addElement(spacer, false);
// pass input to the actual RatingComponent instead of the spacer
row.input_handler = std::bind(&GuiComponent::input, ed.get(), std::placeholders::_1, std::placeholders::_2);
break;
}
case MD_DATE:
{
ed = std::make_shared<DateTimeEditComponent>(window);
row.addElement(ed, false);
auto spacer = std::make_shared<GuiComponent>(mWindow);
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
row.addElement(spacer, false);
// pass input to the actual DateTimeEditComponent instead of the spacer
row.input_handler = std::bind(&GuiComponent::input, ed.get(), std::placeholders::_1, std::placeholders::_2);
break;
}
case MD_TIME:
{
ed = std::make_shared<DateTimeEditComponent>(window, DateTimeEditComponent::DISP_RELATIVE_TO_NOW);
row.addElement(ed, false);
break;
}
case MD_MULTILINE_STRING:
default:
{
// MD_STRING
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT);
row.addElement(ed, true);
auto spacer = std::make_shared<GuiComponent>(mWindow);
spacer->setSize(Renderer::getScreenWidth() * 0.005f, 0);
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>(mWindow);
bracket->setImage(":/arrow.svg");
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
//.........这里部分代码省略.........
开发者ID:jacobfk20,项目名称:EmulationStation,代码行数:101,代码来源:GuiMetaDataEd.cpp
示例7: return
bool RingBuffer::isEmpty()
{
return ( getSize() == 0 );
}
开发者ID:sankaryg,项目名称:MWEngine,代码行数:4,代码来源:ringbuffer.cpp
示例8: onSizeChanged
void TextComponent::onSizeChanged()
{
mAutoCalcExtent << (getSize().x() == 0), (getSize().y() == 0);
onTextChanged();
}
开发者ID:310weber,项目名称:EmulationStation,代码行数:5,代码来源:TextComponent.cpp
示例9: return
puint32 PStreamAsset::getPosition()
{
return (puint32)(getSize() - pAssetgetRemainingLength(&m_asset));
}
开发者ID:alonecat06,项目名称:FutureInterface,代码行数:4,代码来源:pstreamasset.cpp
示例10: getPath
DeviceItem *
PlatformUdisks::getNewDevice(QString devicePath)
{
QString path, model, vendor;
DeviceItem *devItem = new DeviceItem;
path = getPath(devicePath);
if (path == "")
return(NULL);
if (!getIsDrive(devicePath))
return(NULL);
model = getModel(devicePath);
vendor = getVendor(devicePath);
devItem->setUDI(devicePath);
devItem->setPath(path);
devItem->setIsRemovable(getIsRemovable(devicePath));
devItem->setSize(getSize(devicePath));
devItem->setModelString(model);
if (vendor == "")
{
if (mKioskMode)
devItem->setVendorString("SUSE Studio USB Key");
else
devItem->setVendorString("Unknown Device");
}
else
{
devItem->setVendorString(vendor);
}
QString newDisplayString = QString("%1 %2 - %3 (%4 MB)")
.arg(devItem->getVendorString())
.arg(devItem->getModelString())
.arg(devItem->getPath())
.arg(devItem->getSize() / 1048576);
devItem->setDisplayString(newDisplayString);
if (mKioskMode)
{
if((devItem->getSize() / 1048576) > 200000)
{
delete devItem;
return(NULL);
}
}
// If a device is 0 megs we might as well just not list it
if ((devItem->getSize() / 1048576) > 0)
{
itemList << devItem;
}
else
{
delete devItem;
devItem = NULL;
}
return(devItem);
}
开发者ID:kkoppul2,项目名称:imagewriter,代码行数:61,代码来源:PlatformUdisks.cpp
示例11: update
void Refineries::update( ) {
for ( int i = 0; i < ( int )getSize( ); i++ ) {
RefineryPtr refinery = std::dynamic_pointer_cast< Refinery >( get( i ) );
refinery->update( );
}
}
开发者ID:tcagame,项目名称:HoneyMiner,代码行数:6,代码来源:Refineries.cpp
示例12: SwitchStateButton
void Credits::load(){
//// entities
backButton = std::shared_ptr<SwitchStateButton>(new SwitchStateButton(game->stateManager, "mainmenu"));
backButton->addSound(game->sounds["button_click"]);
auto texture = game->textures["logo"];
auto obj = std::shared_ptr<bb::Object2D>(new bb::Object2D());
auto logo = std::shared_ptr<bb::Entity>(new bb::Entity());
logo->addComponent("Texture", texture);
logo->addComponent("Position", std::shared_ptr<bb::Position2D>(new bb::Position2D(bb::vec2(60, game->wndSize[1]-texture->height()/2-60), bb::vec2(400.0f, 150.0f))));
logo->addComponent("Object2D", obj);
texture = game->textures["back"];
auto back = std::shared_ptr<Button>(new Button("back", backButton));
back->addComponent("Texture", texture);
back->addComponent("Position", std::shared_ptr<bb::Position2D>(new bb::Position2D(bb::vec2(game->wndSize[0]-400+222, 60), texture->getSize())));
back->addComponent("Object2D", obj);
auto title = std::shared_ptr<bb::Text>(new bb::Text());
title->addComponent("Position", std::shared_ptr<bb::Position2D>(new bb::Position2D(bb::vec2(140, game->wndSize[1]-240), bb::vec2(60.0f))));
title->addComponent("Object2D", obj);
title->addComponent("Mesh", std::shared_ptr<bb::Mesh>(new bb::Mesh()));
title->addComponent("Font", game->font);
title->setText("Credits");
auto content0 = std::shared_ptr<bb::Text>(new bb::Text());
content0->addComponent("Position", std::shared_ptr<bb::Position2D>(new bb::Position2D(bb::vec2(200, game->wndSize[1]/2+200), bb::vec2(40.0f))));
content0->addComponent("Object2D", obj);
content0->addComponent("Mesh", std::shared_ptr<bb::Mesh>(new bb::Mesh()));
content0->addComponent("Font", game->font);
content0->setText("This game was created by Marvin Blum.\nGet the game and source code on GitHub:\n\n\t\thttps://github.com/DeKugelschieber/LineRunner2\n\nMain menu music: \"Revolve\" by cinematrik:\n\t\thttp://ccmixter.org/files/hisboyelroy/430\nIngame music: \"TONTURA\" by URB:\n\t\thttp://freemusicarchive.org/music/URB/U_END/09_urb_-_tontura\n\nWindows port by EuadeLuxe");
//// systems
input = std::shared_ptr<bb::Input>(new bb::Input());
game->input = input;
game->input->add(back);
renderer = std::unique_ptr<Renderer>(new Renderer(game->shader, game->camera));
renderer->addEntity(logo);
renderer->addEntity(back);
textRenderer = std::unique_ptr<TextRenderer>(new TextRenderer(game->shader, game->camera, game->font->texture));
textRenderer->addEntity(title);
textRenderer->addEntity(content0);
hasStarted = true;
}
开发者ID:EuadeLuxe,项目名称:LineRunner2,代码行数:53,代码来源:Credits.cpp
示例13: lastIndexOf
template <class T, typename S> S ArrayBase<T,S>::lastIndexOf(const T& item) const
{
return lastIndexOf(item, getSize() - 1);
}
开发者ID:AllioNicholas,项目名称:CG_AS1,代码行数:4,代码来源:Array.hpp
示例14: lock
//.........这里部分代码省略.........
if (_rollbackIfNeeded(txn, _syncSourceReader)) {
stop();
return;
}
while (!inShutdown()) {
if (!_syncSourceReader.moreInCurrentBatch()) {
// Check some things periodically
// (whenever we run out of items in the
// current cursor batch)
int bs = _syncSourceReader.currentBatchMessageSize();
if( bs > 0 && bs < BatchIsSmallish ) {
// on a very low latency network, if we don't wait a little, we'll be
// getting ops to write almost one at a time. this will both be expensive
// for the upstream server as well as potentially defeating our parallel
// application of batches on the secondary.
//
// the inference here is basically if the batch is really small, we are
// "caught up".
//
sleepmillis(SleepToAllowBatchingMillis);
}
// If we are transitioning to primary state, we need to leave
// this loop in order to go into bgsync-pause mode.
if (_replCoord->isWaitingForApplierToDrain() ||
_replCoord->getCurrentMemberState().primary()) {
return;
}
// re-evaluate quality of sync target
if (shouldChangeSyncSource()) {
return;
}
{
//record time for each getmore
TimerHolder batchTimer(&getmoreReplStats);
// This calls receiveMore() on the oplogreader cursor.
// It can wait up to five seconds for more data.
_syncSourceReader.more();
}
networkByteStats.increment(_syncSourceReader.currentBatchMessageSize());
if (!_syncSourceReader.moreInCurrentBatch()) {
// If there is still no data from upstream, check a few more things
// and then loop back for another pass at getting more data
{
boost::unique_lock<boost::mutex> lock(_mutex);
if (_pause) {
return;
}
}
_syncSourceReader.tailCheck();
if( !_syncSourceReader.haveCursor() ) {
LOG(1) << "replSet end syncTail pass";
return;
}
continue;
}
}
// If we are transitioning to primary state, we need to leave
// this loop in order to go into bgsync-pause mode.
if (_replCoord->isWaitingForApplierToDrain() ||
_replCoord->getCurrentMemberState().primary()) {
LOG(1) << "waiting for draining or we are primary, not adding more ops to buffer";
return;
}
// At this point, we are guaranteed to have at least one thing to read out
// of the oplogreader cursor.
BSONObj o = _syncSourceReader.nextSafe().getOwned();
opsReadStats.increment();
{
boost::unique_lock<boost::mutex> lock(_mutex);
_appliedBuffer = false;
}
OCCASIONALLY {
LOG(2) << "bgsync buffer has " << _buffer.size() << " bytes";
}
bufferCountGauge.increment();
bufferSizeGauge.increment(getSize(o));
_buffer.push(o);
{
boost::unique_lock<boost::mutex> lock(_mutex);
_lastFetchedHash = o["h"].numberLong();
_lastOpTimeFetched = o["ts"]._opTime();
LOG(3) << "replSet lastOpTimeFetched: " << _lastOpTimeFetched.toStringPretty();
}
}
}
开发者ID:3rf,项目名称:mongo,代码行数:101,代码来源:bgsync.cpp
示例15: getSize
size_t File::available()
{
return getSize() - tell();
}
开发者ID:leafnsand,项目名称:only2d,代码行数:4,代码来源:File.cpp
示例16: compact
void GarbageCollector::compact()
{
auto heap = memoryManager->getHeap();
auto lowestAddress = heap->getAddressSpace();
auto endAddress = lowestAddress + heap->getSize();
//--------------------------------------------------------------------------
// First Pass
// Compute the forwarding locations.
auto freeAddress = lowestAddress;
auto live = lowestAddress;
uint64_t freeCount = 0;
while(live < endAddress)
{
auto liveHeader = reinterpret_cast<AllocatedObject*> (live);
auto liveSize = liveHeader->computeSize();
// Is this object not condemned?
if(liveHeader->header().gcColor != White)
{
liveHeader->setForwardingPointer(freeAddress + sizeof(void*));
freeAddress += liveSize;
}
else
{
//printf("Free %s\n", memoryManager->getContext()->getClassNameOfObject(Oop::fromPointer(&liveHeader->header)).c_str());
liveHeader->setForwardingPointer(nullptr);
++freeCount;
}
// Process the next object.
live += liveSize;
}
assert(freeAddress <= live);
assert(live == endAddress);
// Are we freeing objects.
if(!freeCount)
{
// Abort the compaction.
abortCompaction();
return;
}
//--------------------------------------------------------------------------
// Second Pass
// Update the object pointers.
live = lowestAddress;
while(live < endAddress)
{
auto liveHeader = reinterpret_cast<AllocatedObject*> (live);
auto liveSize = liveHeader->computeSize();
// Is this object not condemned?
if(liveHeader->header().gcColor != White)
updatePointersOf(Oop::fromPointer(&liveHeader->header()));
// Process the next object.
live += liveSize;
}
assert(live == endAddress);
// Update the root pointers.
onRootsDo([&](Oop &pointer) {
updatePointer(&pointer);
});
// Some elements were not allocated by myself. Update their pointers.
for(auto &nativeObject : nativeObjects)
updatePointersOf(nativeObject);
//--------------------------------------------------------------------------
// Third Pass
// Move the objects
live = lowestAddress;
while(live < endAddress)
{
auto liveHeader = reinterpret_cast<AllocatedObject*> (live);
auto liveSize = liveHeader->computeSize();
// Is this object not condemned?
if(liveHeader->header().gcColor != White)
{
// Clear the color of the object for the next garbage collection.
liveHeader->header().gcColor = White;
// Move the object.
auto destination = liveHeader->getForwardingDestination();
//printf("Move %p %p\n", destination, liveHeader);
memmove(destination, liveHeader, liveSize);
}
// Process the next object.
live += liveSize;
}
assert(live == endAddress);
// Set the white color of the native objects.
//.........这里部分代码省略.........
开发者ID:ronsaldo,项目名称:lodtalk,代码行数:101,代码来源:MemoryManager.cpp
示例17: cdbTypeInfo
/*-----------------------------------------------------------------*/
void
cdbTypeInfo (sym_link * type)
{
fprintf (cdbFilePtr, "{%d}", getSize (type));
while (type)
{
if (IS_DECL (type))
{
switch (DCL_TYPE (type))
{
case FUNCTION: fprintf (cdbFilePtr, "DF,"); break;
case GPOINTER: fprintf (cdbFilePtr, "DG,"); break;
case CPOINTER: fprintf (cdbFilePtr, "DC,"); break;
case FPOINTER: fprintf (cdbFilePtr, "DX,"); break;
case POINTER: fprintf (cdbFilePtr, "DD,"); break;
case IPOINTER: fprintf (cdbFilePtr, "DI,"); break;
case PPOINTER: fprintf (cdbFilePtr, "DP,"); break;
case EEPPOINTER: fprintf (cdbFilePtr, "DA,"); break;
case ARRAY: fprintf (cdbFilePtr, "DA%ud,", (unsigned int) DCL_ELEM (type)); break;
default: break;
}
}
else
{
switch (SPEC_NOUN (type))
{
case V_INT:
if (IS_LONG (type))
fprintf (cdbFilePtr, "SL");
else
fprintf (cdbFilePtr, "SI");
break;
case V_CHAR: fprintf (cdbFilePtr, "SC"); break;
case V_VOID: fprintf (cdbFilePtr, "SV"); break;
case V_FLOAT: fprintf (cdbFilePtr, "SF"); break;
case V_FIXED16X16: fprintf(cdbFilePtr, "SQ"); break;
case V_STRUCT:
fprintf (cdbFilePtr, "ST%s", SPEC_STRUCT (type)->tag);
break;
case V_SBIT: fprintf (cdbFilePtr, "SX"); break;
case V_BIT:
case V_BITFIELD:
fprintf (cdbFilePtr, "SB%d$%d", SPEC_BSTR (type),
SPEC_BLEN (type));
break;
default:
break;
}
fputs (":", cdbFilePtr);
if (SPEC_USIGN (type))
fputs ("U", cdbFilePtr);
else
fputs ("S", cdbFilePtr);
}
type = type->next;
}
}
开发者ID:Derpybunneh,项目名称:cpctelera,代码行数:62,代码来源:cdbFile.c
示例18: is_constructible
static BOOLEAN is_constructible(LEXEME **lex, SYMBOL *funcsp, SYMBOL *sym, TYPE **tp, EXPRESSION **exp)
{
INITLIST *lst;
BOOLEAN rv = FALSE;
FUNCTIONCALL funcparams;
memset(&funcparams, 0, sizeof(funcparams));
funcparams.sp = sym;
*lex = getTypeList(*lex, funcsp, &funcparams.arguments);
lst = funcparams.arguments;
while (lst)
{
lst->tp = PerformDeferredInitialization(lst->tp, NULL);
lst = lst->next;
}
if (funcparams.arguments)
{
TYPE *tp2 = funcparams.arguments->tp;
if (isarray(tp2))
{
while (isarray(tp2) && tp2->size != 0)
tp2 = tp2->btp;
if (isarray(tp2))
{
tp2 = FALSE;
}
}
if (tp2)
{
if (isarithmetic(tp2) || ispointer(tp2) || basetype(tp2)->type == bt_enum)
{
if (!funcparams.arguments->next)
{
rv = TRUE;
}
else if (!funcparams.arguments->next->next)
{
rv = comparetypes(tp2, funcparams.arguments->next->tp, TRUE);
}
}
else if (isref(tp2))
{
if (funcparams.arguments->next && !funcparams.arguments->next->next)
{
rv = comparetypes(tp2, funcparams.arguments->next->tp, TRUE);
}
}
else if (isstructured(tp2))
{
TYPE *ctp = tp2;
EXPRESSION *cexp = NULL;
SYMBOL *cons = search(overloadNameTab[CI_CONSTRUCTOR], basetype(tp2)->syms);
funcparams.thisptr = intNode(en_c_i, 0);
funcparams.thistp = Alloc(sizeof(TYPE));
funcparams.thistp->type = bt_pointer;
funcparams.thistp->btp = basetype(tp2);
funcparams.thistp->size = getSize(bt_pointer);
funcparams.ascall = TRUE;
funcparams.arguments = funcparams.arguments->next;
rv = GetOverloadedFunction(tp, &funcparams.fcall, cons, &funcparams, NULL, FALSE,
FALSE, FALSE, _F_SIZEOF) != NULL;
}
}
}
*exp = intNode(en_c_i, rv);
*tp = &stdint;
return TRUE;
}
开发者ID:bencz,项目名称:OrangeC,代码行数:69,代码来源:libcxx.c
示例19: produce
void produce(unsigned int n, void *(*func)(void *)) {
int maxHandle = 8, readyId=-1, nC = 0;
Heap *wHeap = NULL, *restHeap = NULL;
wHeap = initHeap(wHeap, loadComp, freeLoad);
restHeap = initHeap(restHeap, loadComp, freeLoad);
unsigned int minThreshold = maxHandle > n ? n : maxHandle;
pthread_t thList[minThreshold];
pthread_attr_t attr;
pthread_attr_init(&attr);
#ifdef __linux__
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
#endif
for (readyId=0; readyId < minThreshold; ++readyId) {
unsigned int *iNew = (unsigned int *)malloc(sizeof(unsigned int));
*iNew = readyId;
Load *l = createLoad(iNew);
l->thId = readyId;
addLoad(wHeap, l);
pthread_create(thList + readyId, &attr, func, l);
}
int i, minFreeLoadCount = minThreshold >> 1;
if (readyId < n) {
heapifyFromHead(wHeap);
i = readyId;
int chillThId = -1;
Load *wHead = NULL;
while (i < n) {
printf("\033[32mwHeap: "); printHeap(wHeap, printLoad);
printf("\n\033[33mrHeap: "); printHeap(restHeap, printLoad);
printf("\ni:%d n:%d chillThId: %d\033[00m\n", i, n, chillThId);
if ((wHead = peek(wHeap)) != NULL) {
printf("wHead: %d\n", wHead->id);
void *data = NULL;
int join = pthread_join(thList[wHead->thId], &data);
printf("newJoin: %d\n", join);
if (! join) {
printf("joined: %d\n", wHead->thId);
if (data != NULL) {
printf("\033[36m\nRetr %s :%d\033[00m\n", (char *)data, wHead->thId);
free(data);
}
chillThId = wHead->thId;
printf("chillThId: %d\n", chillThId);
#ifdef DEBUG
printf("wHead->thId: %d\n", wHead->thId);
#endif
heapExtract(wHeap, (const void **)&wHead);
wHead->id = getAvailableId(restHeap);
addLoad(restHeap, wHead);
printf("rHeap"); printHeap(restHeap, printLoad);
wHead = NULL;
}
}
if (getSize(wHeap) < minFreeLoadCount && peek(restHeap) != NULL) {
#ifdef DEBUG
printf("Peeked: %p\n", peek(restHeap));
printf("\nrestHeap\n");
#endif
heapExtract(restHeap, (const void **)&wHead);
if (wHead == NULL) continue;
#ifdef DEBUG
printf("wHead->thId:: %p\n", wHead);
#endif
wHead->thId = chillThId;
*((int *)wHead->data) = i;
addLoad(wHeap, wHead);
int createStatus =\
pthread_create(thList + wHead->thId, &attr, func, wHead);
printf("createdStatus: %d i: %d\n", createStatus, i);
if (! createStatus) {
++i;
}
}
}
}
while (! isEmpty(wHeap)) {
Load *tmpHead = NULL;
if (! heapExtract(wHeap, (const void **)&tmpHead) && tmpHead != NULL) {
void *data = NULL;
if (! pthread_join(thList[tmpHead->thId], &data)) {
if (data != NULL) {
printf("i: %d Joined msg: %s\n", i, (char *)data);
free(data);
}
}
}
freeLoad(tmpHead);
}
destroyHeap(wHeap);
destroyHeap(restHeap);
}
开发者ID:odeke-em,项目名称:rodats,代码行数:99,代码来源:loadQ.c
示例20: compile
//.........这里部分代码省略.........
sh_to_reg(op.rs1, mov, call_regs[0]);
sh_to_reg(op.rs3, add, call_regs[0]);
if (size != 8)
sh_to_reg(op.rs2, mov, call_regs[1]);
else
sh_to_reg(op.rs2, mov, call_regs64[1]);
if (size == 1)
call((void*)WriteMem8);
else if (size == 2)
call((void*)WriteMem16);
else if (size == 4)
call((void*)WriteMem32);
else if (size == 8)
call((void*)WriteMem64);
else {
die("1..8 bytes");
}
}
break;
default:
shil_chf[op.op](&op);
break;
}
}
mov(rax, (size_t)&next_pc);
switch (block->BlockType) {
case BET_StaticJump:
case BET_StaticCall:
//next_pc = block->BranchBlock;
mov(dword[rax], block->BranchBlock);
break;
case BET_Cond_0:
case BET_Cond_1:
{
//next_pc = next_pc_value;
//if (*jdyn == 0)
//next_pc = branch_pc_value;
mov(dword[rax], block->NextBlock);
if (block->has_jcond)
mov(rdx, (size_t)&Sh4cntx.jdyn);
else
mov(rdx, (size_t)&sr.T);
cmp(dword[rdx], block->BlockType & 1);
Xbyak::Label branch_not_taken;
jne(branch_not_taken, T_SHORT);
mov(dword[rax], block->BranchBlock);
L(branch_not_taken);
}
break;
case BET_DynamicJump:
case BET_DynamicCall:
case BET_DynamicRet:
//next_pc = *jdyn;
mov(rdx, (size_t)&Sh4cntx.jdyn);
mov(edx, dword[rdx]);
mov(dword[rax], edx);
break;
case BET_DynamicIntr:
case BET_StaticIntr:
if (block->BlockType == BET_DynamicIntr) {
//next_pc = *jdyn;
mov(rdx, (size_t)&Sh4cntx.jdyn);
mov(edx, dword[rdx]);
mov(dword[rax], edx);
}
else {
//next_pc = next_pc_value;
mov(dword[rax], block->NextBlock);
}
call((void*)UpdateINTC);
break;
default:
die("Invalid block end type");
}
add(rsp, 0x28);
ret();
ready();
block->code = (DynarecCodeEntryPtr)getCode();
emit_Skip(getSize());
}
开发者ID:rasterico,项目名称:reicast-emulator,代码行数:101,代码来源:rec_x64.cpp
注:本文中的getSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论