Status Value(SequenceArray array, ElementType *element, int dimension, ...) { va_list ap; va_start(ap, dimension); int offset = getOffset(array, dimension, ap); va_end(ap); *element = (array -> base)[offset]; return OK; }
triton::uint64 Elf::getOffsetFromAddress(triton::uint64 vaddr) const { for (auto it = this->programHeaders.begin(); it != this->programHeaders.end(); it++) { if (it->getType() == triton::format::elf::PT_LOAD) { if (vaddr >= it->getVaddr() && vaddr < (it->getVaddr() + it->getFilesz())) { return ((vaddr - it->getVaddr()) + it->getOffset()); } } } return 0; }
int32_t RuleBasedTimeZone::getRawOffset(void) const { // Note: This implementation returns standard GMT offset // as of current time. UErrorCode status = U_ZERO_ERROR; int32_t raw, dst; getOffset(uprv_getUTCtime() * U_MILLIS_PER_SECOND, FALSE, raw, dst, status); return raw; }
void ObjectClassProperty::setValue(Object *obj, pointer_diff offset, Object *v) const { if (useGetSetMethods) { (obj->*setMethod)(v); } else { *((Object **)((char *)obj + getOffset() + offset)) = v; if (updateAfterWrite != NULL) { (obj->*updateAfterWrite)(); } } }
Location CodeGen::flushToStack(Location reg, RegisterState*) { // flush register to its corresponding location on the stack if (isRegister(reg)) { Location breg; fint offset = getOffset(reg, breg); assert(breg == SP, "should be SP-relative"); a.StoreI(SP, offset, reg); // flush reg to stack } return reg; // just the same on SPARC, different when we have a machine where there is no fixed mapping }
unsigned int PerformLDF(const unsigned int opcode) { unsigned int __user *pBase, *pAddress, *pFinal; unsigned int nRc = 1, write_back = WRITE_BACK(opcode); pBase = (unsigned int __user *) readRegister(getRn(opcode)); if (REG_PC == getRn(opcode)) { pBase += 2; write_back = 0; } pFinal = pBase; if (BIT_UP_SET(opcode)) pFinal += getOffset(opcode); else pFinal -= getOffset(opcode); if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; switch (opcode & MASK_TRANSFER_LENGTH) { case TRANSFER_SINGLE: loadSingle(getFd(opcode), pAddress); break; case TRANSFER_DOUBLE: loadDouble(getFd(opcode), pAddress); break; #ifdef CONFIG_FPE_NWFPE_XP case TRANSFER_EXTENDED: loadExtended(getFd(opcode), pAddress); break; #endif default: nRc = 0; } if (write_back) writeRegister(getRn(opcode), (unsigned long) pFinal); return nRc; }
void VariableArrayElementEditor::openEditor( MetaClass * mc, card32 index ) { delete m_ActEditor; m_ActPropertyEditor = (PropertyEditor *)mc->newInstance(); pointer_diff offset = getOffset() + m_Property->getDiff( m_Object, index ); m_ActPropertyEditor->setup( m_Object, offset, m_Property->getElementClassProperty() ); m_ActEditor = m_ActPropertyEditor->makeEditor( m_EditorParent, m_ReadOnly ); m_EditorParent->layout()->addWidget( m_ActEditor ); connect( m_ActEditor, SIGNAL( destroyed(QObject*)), SLOT(sltEditorDestroyed(QObject *))); connect( m_ActEditor, SIGNAL( sigModified()), SLOT(sltModified())); }
bool XAGYLWheel::getStartupData() { bool rc1 = getFirmwareInfo(); bool rc2 = getSettingInfo(); for (int i=0; i < OffsetNP.nnp; i++) getOffset(i); return (rc1 && rc2); }
char* CTexto::getTexto(){ if(texto) return texto; if( parent && parent->getTexto() && getOffset() > -1 && getTamanho() > -1){ texto = parent->texto + offset; //printf("Pegando o texto do nivel superior %p\n", texto); } return texto; }
//----------------------------------------------------------------------------- // Function: FieldGraphItem::getLastAddress() //----------------------------------------------------------------------------- quint64 FieldGraphItem::getLastAddress() const { const int MSB = getOffset() + getBitWidth(); if (MSB == 0) { return 0; } return MSB -1; }
// Used for simulation and virtual subsystems void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Get default value from type uint32_t uiDefaultValue = static_cast<const CParameterType*>(getTypeElement())->getDefaultValue(); // Write blackboard CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); // Beware this code works on little endian architectures only! pBlackboard->writeInteger(&uiDefaultValue, getSize(), getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext.isBigEndianSubsystem()); }
UBool CollationElementIterator::operator==( const CollationElementIterator& that) const { if (this == &that || m_data_ == that.m_data_) { return TRUE; } // option comparison if (m_data_->iteratordata_.coll != that.m_data_->iteratordata_.coll) { return FALSE; } // the constructor and setText always sets a length // and we only compare the string not the contents of the normalization // buffer int thislength = (int)(m_data_->iteratordata_.endp - m_data_->iteratordata_.string); int thatlength = (int)(that.m_data_->iteratordata_.endp - that.m_data_->iteratordata_.string); if (thislength != thatlength) { return FALSE; } if (uprv_memcmp(m_data_->iteratordata_.string, that.m_data_->iteratordata_.string, thislength * U_SIZEOF_UCHAR) != 0) { return FALSE; } if (getOffset() != that.getOffset()) { return FALSE; } // checking normalization buffer if ((m_data_->iteratordata_.flags & UCOL_ITER_HASLEN) == 0) { if ((that.m_data_->iteratordata_.flags & UCOL_ITER_HASLEN) != 0) { return FALSE; } // both are in the normalization buffer if (m_data_->iteratordata_.pos - m_data_->iteratordata_.writableBuffer.getBuffer() != that.m_data_->iteratordata_.pos - that.m_data_->iteratordata_.writableBuffer.getBuffer()) { // not in the same position in the normalization buffer return FALSE; } } else if ((that.m_data_->iteratordata_.flags & UCOL_ITER_HASLEN) == 0) { return FALSE; } // checking ce position return (m_data_->iteratordata_.CEpos - m_data_->iteratordata_.CEs) == (that.m_data_->iteratordata_.CEpos - that.m_data_->iteratordata_.CEs); }
void RtlRecord::calcRowOffsets(size_t * variableOffsets, const void * _row) const { const byte * row = static_cast<const byte *>(_row); for (unsigned i = 0; i < numVarFields; i++) { unsigned fieldIndex = variableFieldIds[i]; size_t offset = getOffset(variableOffsets, fieldIndex); size_t fieldSize = queryType(fieldIndex)->size(row + offset, row); variableOffsets[i+1] = offset+fieldSize; } }
void VertexDeclaration::calculateStrides() { uint8 vertexSize = getVertexSize(); for(size_t i = 0; i < decls.size(); ++i) { VertexElement& elem = decls[i]; elem.stride = vertexSize; elem.offset = getOffset(elem.attribute); } }
void VirtualMemberFunctionTable::construct( void* a_pInstance ) { if(sharesMemberFunctions()) { m_pBaseTable->construct(a_pInstance); return; } void*** pppWhere = (void***)((byte*)a_pInstance + getOffset()); size_t count = getMemberFunctionCount(); if(m_ppClosures == nullptr) { if(m_pBaseTable) { size_t size = std::max(count, m_pBaseTable->getMemberFunctionCount()); m_ppClosures = (void**)o_malloc(size * sizeof(void*)); } else { m_ppClosures = (void**)o_malloc(count * sizeof(void*)); } void* non_init_ptr; memset(&non_init_ptr, 0xda, sizeof(void*)); if(memcmp(pppWhere, &non_init_ptr, sizeof(void*)) != 0) // memory not equals 0xdadadada => closures already present => a base vtable has been installed here { memcpy(m_ppClosures, *pppWhere, count*sizeof(void*)); // extract native vtable closures } for(size_t i = 0; i<count; ++i) { if((*m_pMemberFunctions)[i]) { void* pVTableClosure = (*m_pMemberFunctions)[i]->getVTableClosure(getOffset()); if(pVTableClosure) { m_ppClosures[i] = pVTableClosure; // write (resp. overwrite) closures (resp. base closures) } // o_assert(m_ppClosures[i], "No vtable closure found for given vtable offset, ensure your compiler has provided all the closures for each possible multi-inheritance this adjustment (thunk)"); } } *pppWhere = m_ppClosures; // write (resp. overwrite) vtable pointer (resp. base vtable pointer) } }
void QComHardwareRenderer::render( const void *data, size_t size, void *platformPrivate) { size_t offset; if (!getOffset(platformPrivate, &offset)) { return; } mISurface->postBuffer(offset); //Average FPS Profiling if (mStatistics) AverageFPSProfiling(); }
I32 EditorMap::getTileOffset(Tile t) const { if (t.first == nullptr) return 0; I32 texOffset = getOffset(t.first); I32 x = t.second[3](0) * t.first->w() / mTileWidth; I32 y = t.second[3](1) * t.first->h() / mTileHeight; return texOffset + (y * ((F32)t.first->w() / mTileWidth) + x) + 1; }
//----------------------------------------------------------------------------- // Function: RegisterGraphItem::getLastAddress() //----------------------------------------------------------------------------- quint64 RegisterGraphItem::getLastAddress() const { quint64 size = getSizeInAUB(); if (size == 0) { return 0; } // the last address contained in the register return getOffset() + size - 1; }
//--------------------------------------------------------------- // Get Trellis button/LED ID from X/Y values byte Adafruit_Trellis_XY::getTrellisId(byte xValue, byte yValue) { byte xOffset; byte yOffset; byte tileNumber = 0; // get offset values xOffset = getOffset(xValue); yOffset = getOffset(yValue); // get tile number for(byte t = 0; t < 8; t++) { if(offsets[t][0] == xOffset && offsets[t][1] == yOffset) { tileNumber = t; // get values for last tile xValue = xValue - offsets[t][0]; yValue = yValue - offsets[t][1]; break; } } return 16 * tileNumber + XyToTrellis[xValue][yValue]; }
int check_bus_shift(bus_shift* bss, int num, int base, int bIdx, int comp, int cIdx) { int ret = 0; int b_offset = getOffset(bss, num, base, bIdx); int c_offset = getOffset(bss, num, comp, cIdx); printf("\n"); if(b_offset == -1 || c_offset == -1) { printf("Error\n"); ret = 1; } else { showBusSwapShift(bss, num, base, bIdx, comp, cIdx, b_offset, c_offset); printf("\nPress any key to continue...\n"); getchar(); } Sleep(1000); //sleep(1); return ret; }
void Button::update(const sf::RenderWindow& screen, const float time, const sf::Vector2i& mouseOffset) { auto position = getPosition(); auto offset = getOffset(); sf::IntRect buttonRect(static_cast<int>(position.x + offset.x + m_style.mouseRect.left - getSize().x / 2), static_cast<int>(position.y + offset.y + m_style.mouseRect.top), m_style.mouseRect.width, m_style.mouseRect.height); auto mousePosition = getCursorPosition(screen); if(buttonRect.contains(mousePosition + mouseOffset) && isVisible()) { if(!m_playHoverSound && m_style.hoverStyle.sound) { m_playHoverSound = true; m_style.hoverStyle.sound->play(); } m_showToolTip = true; m_toolTip.setPosition(static_cast<const sf::Vector2f>(mousePosition), screen); if(utility::Mouse.leftButtonPressed()) { m_sprite = &m_style.pressedStyle.sprite; m_label = &m_style.pressedStyle.label; onPositionChanged(); if(!m_playPressedSound && m_style.pressedStyle.sound) { m_playPressedSound = true; m_style.pressedStyle.sound->play(); } } else { m_playPressedSound = false; m_sprite = &m_style.hoverStyle.sprite; m_label = &m_style.hoverStyle.label; onPositionChanged(); if(m_isTriggering && utility::Mouse.leftButtonReleased() && m_callback != nullptr) m_callback(*this); } } else { m_playHoverSound = false; m_playPressedSound = false; m_sprite = &m_style.idleStyle.sprite; m_label = &m_style.idleStyle.label; onPositionChanged(); m_showToolTip = false; } }
static std::vector<MemoryBufferRef> getMachOFatMemoryBuffers(StringRef Filename, MemoryBuffer &Mem, object::MachOUniversalBinary &Fat) { std::vector<MemoryBufferRef> Buffers; StringRef FatData = Fat.getData(); for (auto It = Fat.begin_objects(), End = Fat.end_objects(); It != End; ++It) { StringRef ObjData = FatData.substr(It->getOffset(), It->getSize()); Buffers.emplace_back(ObjData, Filename); } return Buffers; }
UBool RuleBasedTimeZone::inDaylightTime(UDate date, UErrorCode& status) const { if (U_FAILURE(status)) { return FALSE; } int32_t raw, dst; getOffset(date, FALSE, raw, dst, status); if (dst != 0) { return TRUE; } return FALSE; }
void Reliapack::addPacket(char *buf, int length) { int offset = getOffset(buf); int index = offset / MAX_DATA_LENGTH; if(index >= numPackets) { printf("error, received packet with an offset too high.\n"); return; } packets[index] = new char[length]; memcpy(packets[index], buf, length); lengths[index] = length; ftime(&lastEventTime); }
BOOL CALLBACK SymbolEnumumeration ( PTSTR SymbolName, ULONG SymbolAddress, ULONG SymbolSize, PVOID UserContext) { char undecoratedName[1024]; DWORD r=getOffset(SymbolAddress-BASE_SHIFT); if(DEBUG) { printf("Sym = "); printf("%s \t",SymbolName); printf("[%08X:%d (%d)] \t\n",SymbolAddress,SymbolSize,r); } if((r >= maxDebug) || (r<=0) ) { printf(" Non-Code \n"); nonCode[nonCodeCount].address = SymbolAddress; nonCode[nonCodeCount].size = SymbolSize; if( ((char*)SymbolName)[0] =='?') { UnDecorateSymbolName(SymbolName,undecoratedName, 1023,UNDNAME_COMPLETE); strcpy(names + namesSize,undecoratedName); nonCode[nonCodeCount].namePtr = namesSize; namesSize += strlen(undecoratedName)+1; nonCodeCount++; } else { strcpy(names + namesSize,SymbolName); nonCode[nonCodeCount].namePtr = namesSize; namesSize += strlen(SymbolName)+1; nonCodeCount++; } printf("\n"); return TRUE; } if( ((char*)SymbolName)[0] =='?') { UnDecorateSymbolName(SymbolName,undecoratedName, 1023,UNDNAME_COMPLETE); strcpy(names + namesSize,undecoratedName); hasDebug[r] = namesSize; namesSize += strlen(undecoratedName)+1; printf("%s",undecoratedName); } else { strcpy(names + namesSize,SymbolName); hasDebug[r] = namesSize; namesSize += strlen(SymbolName)+1; } printf("\n"); return TRUE; }
void mount(struct HDTBPartition *table, struct PartitionHandle *ph, STRPTR name, struct DosEnvec *de) { struct ExpansionBase *ExpansionBase; struct DeviceNode *dn; struct DosEnvec *nde; IPTR *params; ULONG i; D(bug("[HDToolBox] mount('%s')\n", name)); #error "TODO: pass DOS device name in params[0] and set handler name manually" #warning "TODO: get filesystem" if ((de->de_DosType & 0xFFFFFF00) == BBNAME_DOS) { ExpansionBase = (struct ExpansionBase *)OpenLibrary("expansion.library",41); if (ExpansionBase) { params = (IPTR *)AllocVec(sizeof(struct DosEnvec)+sizeof(IPTR)*4, MEMF_PUBLIC | MEMF_CLEAR); if (params) { nde = (struct DosEnvec *)¶ms[4]; CopyMem(de, nde, sizeof(struct DosEnvec)); params[0] = (IPTR)"afs.handler"; params[1] = (IPTR)table->hd->devname; params[2] = (IPTR)table->hd->unit; params[3] = 0; i = getOffset(ph->root); nde->de_LowCyl += i; nde->de_HighCyl += i; dn = MakeDosNode(params); if (dn) { dn->dn_Name = MKBADDR(AllocVec(AROS_BSTR_MEMSIZE4LEN(strlen(name)), MEMF_PUBLIC)); dn->dn_Ext.dn_AROS.dn_DevName = AROS_BSTR_ADDR(dn->dn_Name); i = 0; do { AROS_BSTR_putchar(dn->dn_Name, i, name[i]); } while (name[i++]); AROS_BSTR_setstrlen(dn->dn_Name, i-1); AddDosNode(nde->de_BootPri, ADNF_STARTPROC, dn); } else FreeVec(params); } CloseLibrary((struct Library *)ExpansionBase); } } else kprintf("ignored %s: unknown FS (0x%lx)\n", name, de->de_DosType); }
uint16_t PixelBone_Matrix::getPixelColor(int16_t x, int16_t y) { // uint32_t color = expandColor(PixelBone_Pixel::getPixelColor(getOffset(x,y))); // uint8_t r = (uint8_t) (color & 0xFF); // first 8 bits // uint8_t g = (uint8_t) ((color >> 8) & 0xFF); // second 8 bits // uint8_t b = (uint8_t) ((color >> 16) & 0xFF); // third 8 bits pixel_t *const p = PixelBone_Pixel::getPixel(getOffset(x,y)); // printf("Red color: 0x%x\n", p->r); // printf("Green color: 0x%x\n", p->g); // printf("Blue color: 0x%x\n", p->b); return PixelBone_Matrix::Color(p->r, p->g, p->b); }
bool ColorPalette::checkColor(ofPoint _pos, ofColor& _color){ bool overSomething = false; if (bVertical) { if ( _pos.x < getOffset() ){ if (( _pos.y > margins ) && (_pos.y < height-margins)){ float totalHeight = height-margins*2.0; float elementHeight = totalHeight/schemes[nScheme].size(); int index = (_pos.y-margins)/elementHeight; _color = schemes[nScheme][index]; overSomething = true; } } } else { if ( _pos.y < getOffset() ){ if (( _pos.x > margins ) && (_pos.x < width-margins)){ float totalWidth = width-margins*2.0; float elementWidth = totalWidth/schemes[nScheme].size(); int index = (_pos.x-margins)/elementWidth; _color = schemes[nScheme][index]; overSomething = true; } } } setVisible(false); return overSomething; }
void testOffset(void) { Foo foo = { "Foo" }; Bar bar = { 3 }; ASSERT(getOffset(&foo, &bar) == (((char *)&foo) + 3)); }
void Manager::setSetpoint(uint8_t devid, int16_t setpoint) { // Lookup device auto dev = m_registry->getDevice(devid); if (dev == nullptr) return; // Get group and offset for device auto group = m_registry->getGroup(dev->getGroup()); if (group == nullptr) return; auto offset = dev->getOffset(); // Write new setpoint group->setSetpoint(offset, setpoint); }