uint64_t t1ha2_atonce(const void *data, size_t length, uint64_t seed) { t1ha_state256_t state; init_ab(&state, seed, length); #if T1HA_SYS_UNALIGNED_ACCESS == T1HA_UNALIGNED_ACCESS__EFFICIENT if (unlikely(length > 32)) { init_cd(&state, seed, length); T1HA2_LOOP(le, unaligned, &state, data, length); squash(&state); length &= 31; } T1HA2_TAIL_AB(le, unaligned, &state, data, length); #else const bool misaligned = (((uintptr_t)data) & (ALIGNMENT_64 - 1)) != 0; if (misaligned) { if (unlikely(length > 32)) { init_cd(&state, seed, length); T1HA2_LOOP(le, unaligned, &state, data, length); squash(&state); length &= 31; } T1HA2_TAIL_AB(le, unaligned, &state, data, length); } else { if (unlikely(length > 32)) { init_cd(&state, seed, length); T1HA2_LOOP(le, aligned, &state, data, length); squash(&state); length &= 31; } T1HA2_TAIL_AB(le, aligned, &state, data, length); } #endif }
void ConcatPeephole::append(const Bytecode& op, const State& state, const std::vector<Op>& srcStack) { FTRACE(1, "ConcatPeephole::append {}\n", show(op)); assert(state.stack.size() == srcStack.size()); int nstack = state.stack.size(); // Size of the stack at the previous Concat. int prevsz = m_working.empty() ? -1 : m_working.back().stacksz; // Squash the innermost concat stream if we consumed its concat result. if (nstack < prevsz - 1 || (nstack == prevsz - 1 && srcStack[nstack - 1] != Op::Concat)) { squash(); } if (op.op == Op::Concat) { auto ind1 = nstack - 1; auto ind2 = nstack - 2; // Non-string concat; just append, squashing if this terminates a stream. if (!state.stack[ind1].subtypeOf(TStr) || !state.stack[ind2].subtypeOf(TStr)) { if (nstack == prevsz) { squash(); } return push_back(op); } // If the first concat operand is from the previous concat in the stream, // continue the current stream. if (srcStack[ind2] == Op::Concat && nstack == prevsz) { return push_back(op, true); } // Correction for cases where we might have bizarre opcode sequences like // [stk: 2] Concat, [stk: 1] CGetL2, [stk: 2] Concat, where it's unsafe // to reorder. if (nstack == prevsz) { squash(); } // Start a new stream. m_working.push_back({{}, nstack, 0}); return push_back(op, true); } // Just push by default. push_back(op); }
int crook(d00d *master) { d00d *copy; b8 *mc, *cc; b8 pos, val=0, dummy; if(!(copy=(d00d *)malloc(sizeof(d00d)))) { fputs("crook: RAM denied, 0", stderr); exit(0); } if(first(master, &pos)) { mc=&master->i_v[pos]; cc=©->i_v[pos]; } else return 0; while(trial(mc, &val)) { *copy=*master; *cc=(((b8)val)|open|may_b[val]); if(squash(copy)){ rm(mc,val); /* should i check? :\ */ if(idea(master, &pos, &dummy)&&(dummy>val)) { free(copy); return 1; } } else val++; } free(copy); return 0; }
int DominatorTree::eval(int v) { if (ANCESTOR(v) < 0) return v; squash(v); return LABEL(v); }
static void bal() { assert(stage_context[1].decoded==NULL); squash(); regs[8] = stage_context[2].pc+1;//save return address reg_valid_bits[8]=1; PC=stage_context[2].decoded->literal + stage_context[2].decoded->src1; }
void apply(database &db, const operation &o, const options_type &opts) { auto undo_session = db.start_undo_session(!(opts & skip_undo_operation)); db.pre_apply_operation(o); o.visit(apply_operation_visitor(db, opts)); db.post_apply_operation(o); undo_session.squash(); }
static void bz() { if(ZF) {//branch is taken //squash the instructions in fetch stage and D/RF stage by turning them into nop assert( stage_context[1].decoded==NULL); squash(); PC = stage_context[2].pc+stage_context[2].decoded->literal; } }
Stretch::Stretch() { int pi=0; for (int x=-2047; x<=2047; ++x) { // invert squash() int i=squash(x); for (int j=pi; j<=i; ++j) t[j]=x; pi=i+1; } t[4095]=2047; }
void DominatorTree::squash(int v) { if (ANCESTOR(ANCESTOR(v)) >= 0) { squash(ANCESTOR(v)); if (SEMI(LABEL(ANCESTOR(v))) < SEMI(LABEL(v))) LABEL(v) = LABEL(ANCESTOR(v)); ANCESTOR(v) = ANCESTOR(ANCESTOR(v)); } }
/* solves input dudoku by hook or crook coroutines returns 1 if input is incorrect */ int main(int argc, char **argv){ d00d *master; char *in; if(!(master = (d00d *)malloc(sizeof(d00d)))) { fputs("main: RAM denied, 0", stderr); return 0; } in=argc>1?argv[1]:def; D00D(in, master); if(squash(master)) fputs("invalid constraints\n",stderr); free(master); return 0; }
void StaticLstmLayer::gradient(Parameters& w, Parameters& grad, FwdState&, BwdState& d, Matrix&, Matrix& x, Matrix& ) { //! \f$\frac{dE}{dW_ZX} += \frac{dE}{da_Z} * x(t)\f$ //! \f$\frac{dE}{dW_FX} += \frac{dE}{da_F} * x(t)\f$ //! \f$\frac{dE}{dW_IX} += \frac{dE}{da_I} * x(t)\f$ //! \f$\frac{dE}{dW_OX} += \frac{dE}{da_O} * x(t)\f$ grad.IX.set_all_elements_to(0.0); grad.ZX.set_all_elements_to(0.0); grad.FX.set_all_elements_to(0.0); grad.OX.set_all_elements_to(0.0); for (size_t t(1); t < x.n_slices; ++t) { mult_add(d.Za.slice(t), x.row_slice(w.I_bias.n_rows, x.n_rows).slice(t).T(), grad.ZX); // 1.0 / 1.0); //(double) n_time); mult_add(d.Fa.slice(t), x.row_slice(w.I_bias.n_rows, x.n_rows).slice(t).T(), grad.FX); // 1.0 / 1.0); //(double) n_time); mult_add(d.Ia.slice(t), x.row_slice(w.I_bias.n_rows, x.n_rows).slice(t).T(), grad.IX); //1.0 / 1.0); //(double) n_time); mult_add(d.Oa.slice(t), x.row_slice(w.I_bias.n_rows, x.n_rows).slice(t).T(), grad.OX); // 1.0 / 1.0); //(double) n_time); } squash(d.Ia, grad.I_bias); //, 1.0 / (double) n_time); squash(d.Fa, grad.F_bias); //, 1.0 / (double) n_time); squash(d.Za, grad.Z_bias); //, 1.0 / (double) n_time); squash(d.Oa, grad.O_bias); //, 1.0 / (double)n_time); //, 1.0 / (double) n_time); }
void BBFind::clipSquash(Map3 &map, int numPasses, float initialMax) { // This gently reigns in the higher values while minimizing clipping. // Brings values into the range 0 - 1 float inc = (initialMax - 1.0f) / (numPasses * 2); for(int p = 0; p < numPasses; p++) { clip(map, 0.0f, initialMax); initialMax -= inc; squash(map, 0.0f, initialMax); initialMax -= inc; } }
const char *pick_move(MazeMap *mm, int distsq) { Point dst; find_distance(mm, dist, mm->loc.r, mm->loc.c); if (mm_count_squares(mm) < WIDTH*HEIGHT) dst = explore(mm); else /* mm_count_squares(mm) == WIDTH*HEIGHT */ dst = squash(mm, distsq); if (dst.r == mm->loc.r && dst.c == mm->loc.c) return "T"; return construct_turn(mm, dist, mm->loc.r, mm->loc.c, mm->dir, dst.r, dst.c, NULL, NULL); }
void BBFind::accumulateIntoPrev(Map3 &prevMap, const Map3 ¤tMap, float accumulateAmt, float frameMemory, float scaleMin, float scaleMax) { // This is the entire update step for the previous confidence values // buffer. We add currentMap * accumulateAmt to the prevMap buffer, // then decay it by e ^ (-1 / frameMemory). Lastly, we clip any values // that have grown too large and squash the values back to an acceptable // range. This ends up functioning as a form of competition, as large // new values cause older values to be squashed. int numCategories = currentMap.size(); int mapWidth = currentMap[0][0].size(); int mapHeight = currentMap[0].size(); float fadeFactor = exp(-1.0f / frameMemory); if(prevMap.empty()) { prevMap = currentMap; for(int c = 0; c < numCategories; c++) { for(int y = 0; y < mapHeight; y++) { for(int x = 0; x < mapWidth; x++) { prevMap[c][y][x] = scaleMin; } } } } #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for #endif for(int c = 0; c < numCategories; c++) { for(int y = 0; y < mapHeight; y++) { for(int x = 0; x < mapWidth; x++) { float val = (prevMap[c][y][x] + currentMap[c][y][x] * accumulateAmt) * fadeFactor; if(val > scaleMax) val = scaleMax + (val - scaleMax) * accumulateAmt; //hard knee prevMap[c][y][x] = val; } } } clip(prevMap, scaleMin, scaleMax * 1.5f); squash(prevMap, scaleMin, scaleMax); }
void down (BOARD *b) { int i; int s[4]; for (i = 0; i < 4; i++) { s[0] = b->cells[3][i]; s[1] = b->cells[2][i]; s[2] = b->cells[1][i]; s[3] = b->cells[0][i]; b->score += squash (s); b->cells[3][i] = s[0]; b->cells[2][i] = s[1]; b->cells[1][i] = s[2]; b->cells[0][i] = s[3]; } }
void right (BOARD *b) { int i; int s[4]; for (i = 0; i < 4; i++) { s[0] = b->cells[i][3]; s[1] = b->cells[i][2]; s[2] = b->cells[i][1]; s[3] = b->cells[i][0]; b->score += squash (s); b->cells[i][3] = s[0]; b->cells[i][2] = s[1]; b->cells[i][1] = s[2]; b->cells[i][0] = s[3]; } }
void apply(database &db, const signed_transaction &t, const options_type &opts) { auto undo_session = db.start_undo_session(!(opts & skip_undo_transaction)); db.pre_apply_transaction(t); db.create<transaction_object>([&](transaction_object &trx) { trx.trx_id = t.id(); trx.block_num = db.head_block().block_num; auto pack_size = fc::raw::pack_size(t); trx.packed_transaction.resize(pack_size); fc::datastream<char *> ds(trx.packed_transaction.data(), pack_size); fc::raw::pack(ds, t); }); for (const auto &op : t.operations) { apply(db, op, opts); } db.post_apply_transaction(t); undo_session.squash(); }
void bpnn_layerforward(float *l1, float *l2, float **conn, int n1, int n2) { float sum; int j, k; /*** Set up thresholding unit ***/ l1[0] = 1.0; #ifdef OPEN omp_set_num_threads(NUM_THREAD); #pragma omp parallel for shared(conn, n1, n2, l1) private(k, j) reduction(+: sum) schedule(static) #endif /*** For each unit in second layer ***/ for (j = 1; j <= n2; j++) { /*** Compute weighted sum of its inputs ***/ sum = 0.0; for (k = 0; k <= n1; k++) { sum += conn[k][j] * l1[k]; } l2[j] = squash(sum); } }
// show compression component statistics int Predictor::stat(int id) { printf("Memory utilization:\n"); int cp=7; for (int i=0; i<z.header[6]; ++i) { assert(cp<z.header.isize()); int type=z.header[cp]; assert(compsize[type]>0); printf("%2d %s", i, compname[type]); for (int j=1; j<compsize[type]; ++j) printf(" %d", z.header[cp+j]); Component& cr=comp[i]; if (type==MATCH) { size_t count=0; for (size_t j=0; j<cr.cm.size(); ++j) if (cr.cm[j]) ++count; printf(": buffer=%1.0f/%1.0f index=%1.0f/%1.0f (%1.2f%%)", cr.limit/8.0, double(cr.ht.size()), double(count), double(cr.cm.size()), count*100.0/cr.cm.size()); } else if (type==SSE) { size_t count=0; for (size_t j=0; j<cr.cm.size(); ++j) { if (int(cr.cm[j])!=(squash((j&31)*64-992)<<17|z.header[cp+3])) ++count; } printf(": %1.0f/%1.0f (%1.2f%%)", double(count), double(cr.cm.size()), count*100.0/cr.cm.size()); } else if (type==CM) { size_t count=0; for (size_t j=0; j<cr.cm.size(); ++j) if (cr.cm[j]!=0x80000000) ++count; printf(": %1.0f/%1.0f (%1.2f%%)", double(count), double(cr.cm.size()), count*100.0/cr.cm.size()); } else if (type==MIX) { size_t count=0; int m=z.header[cp+3]; assert(m>0); for (size_t j=0; j<cr.cm.size(); ++j) if (int(cr.cm[j])!=65536/m) ++count; printf(": %1.0f/%1.0f (%1.2f%%)", double(count), double(cr.cm.size()), count*100.0/cr.cm.size()); } else if (type==MIX2) { size_t count=0; for (size_t j=0; j<cr.a16.size(); ++j) if (int(cr.a16[j])!=32768) ++count; printf(": %1.0f/%1.0f (%1.2f%%)", double(count), double(cr.a16.size()), count*100.0/cr.a16.size()); } else if (cr.ht.size()>0) { double hcount=0; for (size_t j=0; j<cr.ht.size(); ++j) if (cr.ht[j]>0) ++hcount; printf(": %1.0f/%1.0f (%1.2f%%)", double(hcount), double(cr.ht.size()), hcount*100.0/cr.ht.size()); } cp+=compsize[type]; printf("\n"); } printf("\n"); return 0; }
void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* shift) { LLGLDisable stencil(GL_STENCIL_TEST); if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1) { //move mBounds to the agent space if necessary LLVector4a bounds[2]; bounds[0] = mBounds[0]; bounds[1] = mBounds[1]; if(shift != NULL) { bounds[0].add(*shift); } // Don't cull hole/edge water, unless we have the GL_ARB_depth_clamp extension if (earlyFail(camera, bounds)) { LLFastTimer t(FTM_OCCLUSION_EARLY_FAIL); setOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY); assert_states_valid(this); clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF); assert_states_valid(this); } else { if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY)) { { //no query pending, or previous query to be discarded LLFastTimer t(FTM_RENDER_OCCLUSION); if (!mOcclusionQuery[LLViewerCamera::sCurCameraID]) { LLFastTimer t(FTM_OCCLUSION_ALLOCATE); mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName(); } // Depth clamp all water to avoid it being culled as a result of being // behind the far clip plane, and in the case of edge water to avoid // it being culled while still visible. bool const use_depth_clamp = gGLManager.mHasDepthClamp && (mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER || mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER); LLGLEnable clamp(use_depth_clamp ? GL_DEPTH_CLAMP : 0); #if !LL_DARWIN U32 mode = gGLManager.mHasOcclusionQuery2 ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED_ARB; #else U32 mode = GL_SAMPLES_PASSED_ARB; #endif #if LL_TRACK_PENDING_OCCLUSION_QUERIES sPendingQueries.insert(mOcclusionQuery[LLViewerCamera::sCurCameraID]); #endif { LLFastTimer t(FTM_PUSH_OCCLUSION_VERTS); //store which frame this query was issued on mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount; { LLFastTimer t(FTM_OCCLUSION_BEGIN_QUERY); glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]); } LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; llassert(shader); shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, bounds[0].getF32ptr()); //static LLVector4a fudge(SG_OCCLUSION_FUDGE); static LLCachedControl<F32> vel("SHOcclusionFudge",SG_OCCLUSION_FUDGE); LLVector4a fudge(SG_OCCLUSION_FUDGE); static LLVector4a fudged_bounds; fudged_bounds.setAdd(fudge, bounds[1]); shader->uniform3fv(LLShaderMgr::BOX_SIZE, 1, fudged_bounds.getF32ptr()); if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER) { LLFastTimer t(FTM_OCCLUSION_DRAW_WATER); LLGLSquashToFarClip squash(glh_get_current_projection(), 1); if (camera->getOrigin().isExactlyZero()) { //origin is invalid, draw entire box gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0); gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8); } else { gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0])); } } else { LLFastTimer t(FTM_OCCLUSION_DRAW); if (camera->getOrigin().isExactlyZero()) { //origin is invalid, draw entire box gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0); gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8); } else { gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0])); } } { LLFastTimer t(FTM_OCCLUSION_END_QUERY); glEndQueryARB(mode); } } } { LLFastTimer t(FTM_SET_OCCLUSION_STATE); setOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING); clearOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY); } } } } }
static void jump() { assert(stage_context[1].decoded==NULL); squash(); PC=stage_context[2].decoded->literal + stage_context[2].decoded->src1; }
void ConcatPeephole::finalize() { while (!m_working.empty()) { squash(); } m_next.finalize(); }
HIDDEN void do_Char(int c, int xpos, int ypos, int odd) { register int i, j; int base; int totwid = font.width; int down; static float resbuf[FONTBUFSZ]; static RGBpixel fbline[FONTBUFSZ]; #if DEBUG_STRINGS fb_log( "do_Char: c='%c' xpos=%d ypos=%d odd=%d\n", c, xpos, ypos, odd ); #endif /* read in character bit map, with two blank lines on each end */ for (i = 0; i < 2; i++) clear_buf (totwid, filterbuf[i]); for (i = font.height + 1; i >= 2; i--) fill_buf (font.width, filterbuf[i]); for (i = font.height + 2; i < font.height + 4; i++) clear_buf (totwid, filterbuf[i]); (void)SignedChar( font.dir[c].up ); down = SignedChar( font.dir[c].down ); /* Initial base line for filtering depends on odd flag. */ base = (odd ? 1 : 2); /* Produce a RGBpixel buffer from a description of the character and the read back data from the frame buffer for anti-aliasing. */ for (i = font.height + base; i >= base; i--) { squash( filterbuf[i - 1], /* filter info */ filterbuf[i], filterbuf[i + 1], resbuf, totwid + 4 ); fb_read( fbp, xpos, ypos - down + i, (unsigned char *)fbline, totwid+3); for (j = 0; j < (totwid + 3) - 1; j++) { register int tmp; /* EDITOR'S NOTE : do not rearrange this code, the SUN compiler can't handle more complex expressions. */ tmp = fbline[j][RED] & 0377; fbline[j][RED] = (int)(paint[RED]*resbuf[j]+(1-resbuf[j])*tmp); fbline[j][RED] &= 0377; tmp = fbline[j][GRN] & 0377; fbline[j][GRN] = (int)(paint[GRN]*resbuf[j]+(1-resbuf[j])*tmp); fbline[j][GRN] &= 0377; tmp = fbline[j][BLU] & 0377; fbline[j][BLU] = (int)(paint[BLU]*resbuf[j]+(1-resbuf[j])*tmp); fbline[j][BLU] &= 0377; } fb_write( fbp, xpos, ypos - down + i, (unsigned char *)fbline, totwid+3 ); } return; }
void SMPCache::doReceiveFromBelow(SMPMemRequest *sreq) { MemOperation memOp = sreq->getMemOperation(); //printf("Symbolic Name: %s\n",symbolicName); // request from other caches, need to process them accordingly PAddr addr= sreq->getPAddr(); Line *l = cache->findLine(addr); //READ HIT/MISS------------ if(memOp == MemRead) { #ifdef TLS //check if cache has line marked with epoch //Add the chache flags to the request if(sreq->isDataReq() && l) { if (sreq->needsData()) //READ MISS was broadcast { MemRequest *oreq=sreq->getOriginalRequest(); //If Line epoch is < request epoch set Others exposed long int tmpclk=((oreq->getEpoch())->getClock()); if ((l->getEpoch())->getClock()<tmpclk) { l->getCacheFlags()->setOE(); } //READ MISS--- then Add line cache flags to request if (sreq->needsData()) { //HACK: some bug causes this value already set to disappear (l->getCacheFlags())->setEpoch(l->getEpoch()); sreq->setCacheFlags(l->getCacheFlags()); } } else //READ HIT was broadcast { MemRequest *oreq=sreq->getOriginalRequest(); //If Line epoch is < request epoch set Others exposed long int tmpclk=((oreq->getEpoch())->getClock()); if ((l->getEpoch())->getClock()<tmpclk) { l->getCacheFlags()->setOE(); } } } #endif protocol->readMissHandler(sreq); return; } //WRITE HIT/MISS---------- if(memOp == MemReadW) { //L1 Write Miss if(sreq->needsData()) { #ifdef TLS //Write miss -check if cache has line marked with epoch if (sreq->isDataReq() && l) { MemRequest *oreq=sreq->getOriginalRequest(); //SQUASH EPOCH!!! if (((l->getEpoch())->getClock()>((oreq->getEpoch())->getClock())) && l->getCacheFlags()->getWordER(getOffsetInLine(addr))) { //realInvalidateTLS(addr,cache->getLineSize()); int sqhCount=squash(l->getEpoch()); printf("Backend Squash: Invalidated lines- %ld\n",sqhCount); squashes.inc(); } //WRITE MISS--- then Add line cache flags to request else if (sreq->needsData()) { //HACK: some bug causes this value already set to disappear (l->getCacheFlags())->setEpoch(l->getEpoch()); sreq->setCacheFlags(l->getCacheFlags()); } } #endif protocol->writeMissHandler(sreq); return; } else{ //WRITE HIT #ifdef TLS //Write Hit -check if cache has line marked with epoch if (sreq->isDataReq() && l) { MemRequest *oreq=sreq->getOriginalRequest(); //SQUASH EPOCH!!! if (((l->getEpoch())->getClock()>((oreq->getEpoch())->getClock())) && l->getCacheFlags()->getWordER(getOffsetInLine(addr))) { //realInvalidateTLS(addr,cache->getLineSize()); int sqhCount=squash(l->getEpoch()); printf("Backend Squash: Invalidated lines- %ld\n",sqhCount); squashes.inc(); } //WRITE Hit--- then Add line cache flags to request else if (sreq->needsData()) { //HACK: some bug causes this value already set to disappear (l->getCacheFlags())->setEpoch(l->getEpoch()); sreq->setCacheFlags(l->getCacheFlags()); } } protocol->writeMissHandler(sreq); return; #else protocol->invalidateHandler(sreq); #endif } return; } #ifdef TLS //L1 HIT,L2 HIT //INVALIDATION MESSAGE FROM ANOTHER CACHE AS IT WANTS IT IN EXCLUSIVE STATE if(memOp == MemWrite) { protocol->invalidateHandler(sreq); return; } #else if(memOp == MemWrite) { I(!sreq->needsData()); protocol->invalidateHandler(sreq); return; } #endif #ifdef TLS if (memOp==MemPush) { if (l) { MemRequest *oreq=sreq->getOriginalRequest(); //All epochs preceeding the one being written back MUST be commited if ((l->getEpoch())->getClock()<((oreq->getEpoch())->getClock())) { //HACK: some bug causes this value already set to disappear (l->getCacheFlags())->setEpoch(l->getEpoch()); sreq->setCacheFlags(l->getCacheFlags()); realInvalidateTLS(addr,cache->getLineSize()); } } sreq->goDown(0, lowerLevel[0]); return; } #else I(0); // this routine should not be called for any other memory request #endif }
void do_char(struct vfont *vfp, struct vfont_dispatch *vdp, int x, int y) { int i, j; int base; int totwid = width; int ln; static float resbuf[FONTBUFSZ]; static RGBpixel fbline[FONTBUFSZ]; int bytes_wide; /* # bytes/row in bitmap */ bytes_wide = (width+7)>>3; /* Read in the character bit map, with two blank lines on each end. */ for (i = 0; i < 2; i++) memset((char *)&filterbuf[i][0], 0, (totwid+4)*sizeof(int)); for (ln=0, i = height + 1; i >= 2; i--, ln++) fill_buf (width, &filterbuf[i][0], &vfp->vf_bits[vdp->vd_addr + bytes_wide*ln]); for (i = height + 2; i < height + 4; i++) memset((char *)&filterbuf[i][0], 0, (totwid+4)*sizeof(int)); /* Initial base line for filtering depends on odd flag. */ if (vdp->vd_down % 2) base = 1; else base = 2; /* Produce a RGBpixel buffer from a description of the character * and the read back data from the frame buffer for anti-aliasing. */ for (i = height + base; i >= base; i--) { squash(filterbuf[i - 1], /* filter info */ filterbuf[i], filterbuf[i + 1], resbuf, totwid + 4 ); fb_read(fbp, x, y - vdp->vd_down + i, (unsigned char *)fbline, totwid+3); for (j = 0; j < (totwid + 3) - 1; j++) { int tmp; /* EDITOR'S NOTE : do not rearrange this code, the SUN * compiler can't handle more complex expressions. */ tmp = fbline[j][RED] & 0377; fbline[j][RED] = (int)(pixcolor[RED]*resbuf[j]+(1-resbuf[j])*tmp); fbline[j][RED] &= 0377; tmp = fbline[j][GRN] & 0377; fbline[j][GRN] = (int)(pixcolor[GRN]*resbuf[j]+(1-resbuf[j])*tmp); fbline[j][GRN] &= 0377; tmp = fbline[j][BLU] & 0377; fbline[j][BLU] = (int)(pixcolor[BLU]*resbuf[j]+(1-resbuf[j])*tmp); fbline[j][BLU] &= 0377; } if (fb_write(fbp, x, y-vdp->vd_down+i, (unsigned char *)fbline, totwid+3) < totwid+3) { fprintf(stderr, "fblabel: pixel write error\n"); bu_exit(1, NULL); } } }