bool RESN_INFO_1005::createBlock(QByteArray & data) { dbgFile << "Writing RESN_INFO_1005"; QBuffer buf(&data); startBlock(buf, PSDImageResourceSection::RESN_INFO, 16); // Convert to 16.16 fixed point Fixed h = hRes * 65536.0 + 0.5; dbgFile << "h" << h << "hRes" << hRes; psdwrite(&buf, (quint32)h); psdwrite(&buf, hResUnit); psdwrite(&buf, widthUnit); // Convert to 16.16 fixed point Fixed v = vRes * 65536.0 + 0.5; dbgFile << "v" << v << "vRes" << vRes; psdwrite(&buf, (quint32)v); psdwrite(&buf, vResUnit); psdwrite(&buf, heightUnit); buf.close(); return true; }
static void parseBlock( const Block *block ) { startBlock(block); auto p = block->chunk->getData(); auto header = p; SKIP(uint32_t, version, p); SKIP(uint256_t, prevBlkHash, p); SKIP(uint256_t, blkMerkleRoot, p); SKIP(uint32_t, blkTime, p); SKIP(uint32_t, blkBits, p); SKIP(uint32_t, blkNonce, p); #if defined PROTOSHARES SKIP(uint32_t, nBirthdayA, p); SKIP(uint32_t, nBirthdayB, p); #endif startTXs(p); LOAD_VARINT(nbTX, p); for(uint64_t txIndex=0; likely(txIndex<nbTX); ++txIndex) { parseTX<false>(block, p); } endTXs(p); #if defined(PEERCOIN) || defined(CLAM) || defined(JUMBUCKS) LOAD_VARINT(vchBlockSigSize, p); p += vchBlockSigSize; #endif block->chunk->releaseData(); endBlock(block); }
void JitWriter::writeBlockStart(const FrameState* frame) { AvmAssert((!current_block_ || current_block_->start <= frame->abc_pc) && "didn't expect blocks out of order"); const uint8_t* pc = frame->abc_pc; if (current_block_ && current_block_->start < pc) { abc_->analyzeEnd(current_block_, pc); finishBlock(pc); } startBlock(frame); analyze(OP_label, pc, frame); }
void vmStarted() { // tell vm what mode we are in, if necessary // get blocks started Block *block; Q_FOREACH(block, getBlockList(), blockLink) { startBlock(block); }
bool ICC_PROFILE_1039::createBlock(QByteArray &data) { dbgFile << "Writing ICC_PROFILE_1039"; if (icc.size() == 0) { error = "ICC_PROFILE_1039: Trying to save an empty profile"; return false; } QBuffer buf(&data); startBlock(buf, PSDImageResourceSection::ICC_PROFILE, icc.size()); buf.write(icc.constData(), icc.size()); buf.close(); return true; }
void JitWriter::writePrologue(const FrameState* frame, const uint8_t* pc, CodegenDriver*) { AvmAssert(frame->abc_pc == pc); (void) frame; (void) pc; jit_mgr_ = JitManager::init(method_->pool()); #ifdef AVMPLUS_VERBOSE if (enable_welcome) console_ << "analyze " << method_ << "\n"; #endif abc_ = new (alloc_) AbcGraph(method_); if (enable_profiler) { profiled_info_ = new (alloc_) ProfiledInformation(); } startBlock(frame); }
static void parseBlock( const Block *block ) { startBlock(block); const uint8_t *p = block->data; const uint8_t *header = p; SKIP(uint32_t, version, p); SKIP(uint256_t, prevBlkHash, p); SKIP(uint256_t, blkMerkleRoot, p); SKIP(uint32_t, blkTime, p); SKIP(uint32_t, blkBits, p); SKIP(uint32_t, blkNonce, p); LOAD_VARINT(nbTX, p); for(uint64_t txIndex=0; likely(txIndex<nbTX); ++txIndex) parseTX<false>(p); endBlock(block); }
BlockStatement* Tree::startBlock() { Location location; return startBlock(location); }
static void buildBlockHeaders() { info("pass 1 -- walk all blocks and build headers ..."); size_t nbBlocks = 0; size_t baseOffset = 0; size_t earlyMissCnt = 0; uint8_t buf[8+gHeaderSize]; const auto sz = sizeof(buf); const auto startTime = usecs(); const auto oneMeg = 1024 * 1024; for(const auto &map : mapVec) { startMap(0); while(1) { auto nbRead = read(map.fd, buf, sz); if(nbRead<(signed)sz) { break; } startBlock((uint8_t*)0); uint8_t *hash = 0; Block *prevBlock = 0; size_t blockSize = 0; getBlockHeader(blockSize, prevBlock, hash, earlyMissCnt, buf); if(unlikely(0==hash)) { break; } auto where = lseek(map.fd, (blockSize + 8) - sz, SEEK_CUR); auto blockOffset = where - blockSize; if(where<0) { break; } auto block = Block::alloc(); block->init(hash, &map, blockSize, prevBlock, blockOffset); gBlockMap[hash] = block; endBlock((uint8_t*)0); ++nbBlocks; } baseOffset += map.size; auto now = usecs(); auto elapsed = now - startTime; auto bytesPerSec = baseOffset / (elapsed*1e-6); auto bytesLeft = gChainSize - baseOffset; auto secsLeft = bytesLeft / bytesPerSec; fprintf( stderr, "%.2f%% (%.2f/%.2f Gigs) -- %6d blocks -- %.2f Megs/sec -- ETA %.0f secs -- ELAPSED %.0f secs \r", (100.0*baseOffset)/gChainSize, baseOffset/(1000.0*oneMeg), gChainSize/(1000.0*oneMeg), (int)nbBlocks, bytesPerSec*1e-6, secsLeft, elapsed*1e-6 ); fflush(stderr); endMap(0); } if(0==nbBlocks) { warning("found no blocks - giving up"); exit(1); } char msg[128]; msg[0] = 0; if(0<earlyMissCnt) { sprintf(msg, ", %d early link misses", (int)earlyMissCnt); } auto elapsed = 1e-6*(usecs() - startTime); info( "pass 1 -- took %.0f secs, %6d blocks, %.2f Gigs, %.2f Megs/secs %s ", elapsed, (int)nbBlocks, (gChainSize * 1e-9), (gChainSize * 1e-6) / elapsed, msg ); }