void *BucketAvg(bucketset_t set, char *name, void *value) { bucket_t *pbucket = DoFind(set, name); if (!pbucket) return NULL; if (pbucket->type == bt_int) return DoSet(pbucket, bint( AVG((*(int *)DoGet(pbucket)), (*(int *)value), pbucket->nvals))); if (pbucket->type == bt_float) return DoSet(pbucket, bfloat( AVG((*(double *)DoGet(pbucket)), (*(double *)value), pbucket->nvals))); //else, string -- just ignore return DoGet(pbucket); }
// Square root helper function (Newton's method) JML_FLOAT sqrt_aux(JML_FLOAT x) { if (ABS((x*x)-num) < 0.001) //if (good(x)) return x; else return sqrt_aux(AVG(x,num/x)); }
int main(void) { printf("Problem of avg is: %f\n", 2.0/AVG(1, 3)); printf("Problem of area is: %f\n", 1.0/AREA(2, 2)); return 0; }
// assume that the source image is ARGB32 formatted QImage Video::quickScale(const QImage &s, int width, int height) { QImage source; if (source.format() != QImage::Format_ARGB32) source = s.convertToFormat(QImage::Format_ARGB32); else source = s; if (width == 0 || height == 0) { qDebug() << "asked to resize to 0"; return QImage(); } QImage dest(width, height, QImage::Format_ARGB32); int sw = source.width(); int sh = source.height(); int xs = (sw << 8) / width; int ys = (sh << 8) / height; quint32 *dst = reinterpret_cast<quint32*>(dest.bits()); int stride = dest.bytesPerLine() >> 2; for (int y = 0, yi = ys >> 2; y < height; ++y, yi += ys, dst += stride) { const quint32 *src1 = reinterpret_cast<const quint32*>(source.scanLine(yi >> 8)); const quint32 *src2 = reinterpret_cast<const quint32*>(source.scanLine((yi + ys / 2) >> 8)); for (int x = 0, xi1 = xs / 4, xi2 = xs * 3 / 4; x < width; ++x, xi1 += xs, xi2 += xs) { quint32 pixel1 = AVG(src1[xi1 >> 8], src1[xi2 >> 8]); quint32 pixel2 = AVG(src2[xi1 >> 8], src2[xi2 >> 8]); dst[x] = AVG(pixel1, pixel2); } } return dest; }
int main(int argc, char **argv) { Display *dpy = XOpenDisplay(NULL); int screen = DefaultScreen(dpy); Window root = RootWindow(dpy, screen); XRRScreenResources *res = XRRGetScreenResourcesCurrent(dpy, root); int temp = 6500; if (argc > 1) temp = atoi(argv[1]); if (temp < 1000 || temp > 10000) temp = 6500; temp -= 1000; double ratio = temp % 500 / 500.0; #define AVG(c) whitepoints[temp / 500].c * (1 - ratio) + whitepoints[temp / 500 + 1].c * ratio double gammar = AVG(r); double gammag = AVG(g); double gammab = AVG(b); int num_crtcs = res->ncrtc; for (int c = 0; c < res->ncrtc; c++) { int crtcxid = res->crtcs[c]; XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(dpy, res, crtcxid); int size = XRRGetCrtcGammaSize(dpy, crtcxid); XRRCrtcGamma *crtc_gamma = XRRAllocGamma(size); for (int i = 0; i < size; i++) { double g = 65535.0 * i / size; crtc_gamma->red[i] = g * gammar; crtc_gamma->green[i] = g * gammag; crtc_gamma->blue[i] = g * gammab; } XRRSetCrtcGamma(dpy, crtcxid, crtc_gamma); XFree(crtc_gamma); } }
static void cstate_end(double time, struct cpuidle_cstates *cstates) { int last_cstate = cstates->current_cstate; struct cpuidle_cstate *cstate = &cstates->cstate[last_cstate]; struct cpuidle_data *data = &cstate->data[cstate->nrdata]; data->end = time; data->duration = data->end - data->begin; /* * Duration can be < 0 when precision digit in the file exceed * 7 (eg. xxx.1000000). Ignoring the result because I don't * find a way to fix with the sscanf used in the caller. * * For synthetic test material, the duration may be 0. * * In both cases, do not record the entry, but do end the state * regardless. */ if (data->duration <= 0) goto skip_entry; /* convert to us */ data->duration *= USEC_PER_SEC; cstates->actual_residency = as_expected; if (data->duration < cstate->target_residency) { /* over estimated */ cstate->early_wakings++; cstates->actual_residency = too_short; } else { /* under estimated */ int next_cstate = last_cstate + 1; if (next_cstate <= cstates->cstate_max) { int tr = cstates->cstate[next_cstate].target_residency; if (tr > 0 && data->duration >= tr) { cstate->late_wakings++; cstates->actual_residency = too_long; } } } cstate->min_time = MIN(cstate->min_time, data->duration); cstate->max_time = MAX(cstate->max_time, data->duration); cstate->avg_time = AVG(cstate->avg_time, data->duration, cstate->nrdata + 1); cstate->duration += data->duration; cstate->nrdata++; skip_entry: /* CPU is no longer idle */ cstates->current_cstate = -1; }
static void close_current_pstate(struct cpufreq_pstates *ps, double time) { int c = ps->current; struct cpufreq_pstate *p = &(ps->pstate[c]); double elapsed; elapsed = (time - ps->time_enter) * USEC_PER_SEC; if (elapsed <= 0) return; p->min_time = MIN(p->min_time, elapsed); p->max_time = MAX(p->max_time, elapsed); p->avg_time = AVG(p->avg_time, elapsed, p->count + 1); p->duration += elapsed; p->count++; }
/* when done collecting data, calculate average, percentiles, etc */ void calcstats (struct event_statss *event) { u_int p, i, n; n=0; p=1; event->avg = AVG(event->sum, event->num); event->stddev = STDDEV(event->sum, event->sum2, event->num); /* scan histogram, calculating percentiles */ for (i = 0; i < NUM_BINS; i++) { n += event->hist[i]; while (n > (event->num * p / 100)) { assert(p<=100); event->perc[p] = (i + 0.5) * BIN_WIDTH; p++; } } }
void kitchenFrame::fillMain() { ListBox2->Clear(); Lst2.Clear(); ListBox3->Clear(); Lst3.Clear(); ListBox4->Clear(); wxDateTime current = wxDateTime::Now(); mysqlpp::Query query = conn->query(); wxString orderBy; if(ToggleButton2->GetValue()) { orderBy = _T("`time_avg` ASC"); } else if(ToggleButton1->GetValue()) { orderBy = _T("`qty` DESC"); } query << "SELECT SUM( `qty` ) AS `qty`,`orders_dishes`.`name`,MIN(`orders`.`time`) \ AS `time_min`,MAX(`orders`.`time`) AS `time_max`,FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(`orders`.`time`)))\ AS `time_avg` FROM `orders_dishes`,`orders` WHERE `orders`.`time` > '"<< wx2std(current.FormatISODate(), wxConvUI) <<"' \ AND `orders`.`status`=3 AND `orders_dishes`.`kitchen`=1 AND `orders_dishes`.`ready`=0 AND `orders_dishes`.`order_id`=`orders`.`id` \ GROUP BY `orders_dishes`.`name` ORDER BY "<< wx2std(orderBy, wxConvUI); mysqlpp::StoreQueryResult res = query.store(); if (res) { mysqlpp::Row row; mysqlpp::StoreQueryResult::size_type i; bool first = true; wxDateTime avg; for (i = 0; i < res.num_rows(); ++i) { row = res[i]; avg.ParseDateTime(std2wx(std::string(row["time_avg"]),wxConvUI)); wxTimeSpan diff = wxDateTime::Now() - avg; wxString toAppend = _("<font size = 5>") + std2wx(std::string(row["name"]),wxConvUI) + _("</font><br align=center>Avg. time: <b>") + diff.Format(_T("%M")) + _(" min.</b> Quantity: <font size = 5>") + std2wx(std::string(row["qty"]),wxConvUI) + _T("</font>"); if(first) { ListBox2->Append(toAppend); Lst2.Add(std2wx(std::string(row["name"]),wxConvUI)); ListBox2->Append(_T("Preved!Medved")); if(!ListBox2->IsVisible(ListBox2->GetCount()-1)) { first = false; ListBox2->Delete(ListBox2->GetCount()-2); Lst2.RemoveAt(Lst2.GetCount()-1); ListBox3->Append(toAppend); Lst3.Add(std2wx(std::string(row["name"]),wxConvUI)); } ListBox2->Delete(ListBox2->GetCount()-1); } else { ListBox3->Append(toAppend); Lst3.Add(std2wx(std::string(row["name"]),wxConvUI)); } } } //wxMessageBox(toSearch); int Lst2Index = Lst2.Index(toSearch); int Lst3Index = Lst3.Index(toSearch); if(Lst2Index != wxNOT_FOUND || Lst3Index != wxNOT_FOUND ) { if(Lst2Index != wxNOT_FOUND) { //making selection in first listbox fillDetails(Lst2[Lst2Index]); ListBox2->SetSelection(Lst2Index); } else { //making selection in second listbox fillDetails(Lst3[Lst3Index]); ListBox3->SetSelection(Lst3Index); } } else if(Lst2.GetCount() != 0) //if none of those has our dish - just selecting first one { fillDetails(Lst2[0]); ListBox2->SetSelection(0); toSearch = Lst2[0]; } }
void UPGMA2(const DistCalc &DC, Tree &tree, LINKAGE Linkage) { g_uLeafCount.get() = DC.GetCount(); g_uTriangleSize.get() = (g_uLeafCount.get()*(g_uLeafCount.get() - 1))/2; g_uInternalNodeCount.get() = g_uLeafCount.get() - 1; g_Dist.get() = new dist_t[g_uTriangleSize.get()]; g_uNodeIndex.get() = new unsigned[g_uLeafCount.get()]; g_uNearestNeighbor.get() = new unsigned[g_uLeafCount.get()]; g_MinDist.get() = new dist_t[g_uLeafCount.get()]; unsigned *Ids = new unsigned [g_uLeafCount.get()]; char **Names = new char *[g_uLeafCount.get()]; g_uLeft.get() = new unsigned[g_uInternalNodeCount.get()]; g_uRight.get() = new unsigned[g_uInternalNodeCount.get()]; g_Height.get() = new dist_t[g_uInternalNodeCount.get()]; g_LeftLength.get() = new dist_t[g_uInternalNodeCount.get()]; g_RightLength.get() = new dist_t[g_uInternalNodeCount.get()]; for (unsigned i = 0; i < g_uLeafCount.get(); ++i) { g_MinDist.get()[i] = BIG_DIST; g_uNodeIndex.get()[i] = i; g_uNearestNeighbor.get()[i] = uInsane; Ids[i] = DC.GetId(i); Names[i] = strsave(DC.GetName(i)); } for (unsigned i = 0; i < g_uInternalNodeCount.get(); ++i) { g_uLeft.get()[i] = uInsane; g_uRight.get()[i] = uInsane; g_LeftLength.get()[i] = BIG_DIST; g_RightLength.get()[i] = BIG_DIST; g_Height.get()[i] = BIG_DIST; } // Compute initial NxN triangular distance matrix. // Store minimum distance for each full (not triangular) row. // Loop from 1, not 0, because "row" is 0, 1 ... i-1, // so nothing to do when i=0. for (unsigned i = 1; i < g_uLeafCount.get(); ++i) { dist_t *Row = g_Dist.get() + TriangleSubscript(i, 0); DC.CalcDistRange(i, Row); for (unsigned j = 0; j < i; ++j) { const dist_t d = Row[j]; if (d < g_MinDist.get()[i]) { g_MinDist.get()[i] = d; g_uNearestNeighbor.get()[i] = j; } if (d < g_MinDist.get()[j]) { g_MinDist.get()[j] = d; g_uNearestNeighbor.get()[j] = i; } } } #if TRACE Log("Initial state:\n"); ListState(); #endif for (g_uInternalNodeIndex.get() = 0; g_uInternalNodeIndex.get() < g_uLeafCount.get() - 1; ++g_uInternalNodeIndex.get()) { #if TRACE Log("\n"); Log("Internal node index %5u\n", g_uInternalNodeIndex.get()); Log("-------------------------\n"); #endif // Find nearest neighbors unsigned Lmin = uInsane; unsigned Rmin = uInsane; dist_t dtMinDist = BIG_DIST; for (unsigned j = 0; j < g_uLeafCount.get(); ++j) { if (uInsane == g_uNodeIndex.get()[j]) continue; dist_t d = g_MinDist.get()[j]; if (d < dtMinDist) { dtMinDist = d; Lmin = j; Rmin = g_uNearestNeighbor.get()[j]; assert(uInsane != Rmin); assert(uInsane != g_uNodeIndex.get()[Rmin]); } } assert(Lmin != uInsane); assert(Rmin != uInsane); assert(dtMinDist != BIG_DIST); #if TRACE Log("Nearest neighbors Lmin %u[=%u] Rmin %u[=%u] dist %.3g\n", Lmin, g_uNodeIndex.get()[Lmin], Rmin, g_uNodeIndex.get()[Rmin], dtMinDist); #endif // Compute distances to new node // New node overwrites row currently assigned to Lmin dist_t dtNewMinDist = BIG_DIST; unsigned uNewNearestNeighbor = uInsane; for (unsigned j = 0; j < g_uLeafCount.get(); ++j) { if (j == Lmin || j == Rmin) continue; if (uInsane == g_uNodeIndex.get()[j]) continue; const unsigned vL = TriangleSubscript(Lmin, j); const unsigned vR = TriangleSubscript(Rmin, j); const dist_t dL = g_Dist.get()[vL]; const dist_t dR = g_Dist.get()[vR]; dist_t dtNewDist; switch (Linkage) { case LINKAGE_Avg: dtNewDist = AVG(dL, dR); break; case LINKAGE_Min: dtNewDist = MIN(dL, dR); break; case LINKAGE_Max: dtNewDist = MAX(dL, dR); break; case LINKAGE_Biased: dtNewDist = g_dSUEFF.get()*AVG(dL, dR) + (1 - g_dSUEFF.get())*MIN(dL, dR); break; default: Quit("UPGMA2: Invalid LINKAGE_%u", Linkage); } // Nasty special case. // If nearest neighbor of j is Lmin or Rmin, then make the new // node (which overwrites the row currently occupied by Lmin) // the nearest neighbor. This situation can occur when there are // equal distances in the matrix. If we don't make this fix, // the nearest neighbor pointer for j would become invalid. // (We don't need to test for == Lmin, because in that case // the net change needed is zero due to the change in row // numbering). if (g_uNearestNeighbor.get()[j] == Rmin) g_uNearestNeighbor.get()[j] = Lmin; #if TRACE Log("New dist to %u = (%u/%.3g + %u/%.3g)/2 = %.3g\n", j, Lmin, dL, Rmin, dR, dtNewDist); #endif g_Dist.get()[vL] = dtNewDist; if (dtNewDist < dtNewMinDist) { dtNewMinDist = dtNewDist; uNewNearestNeighbor = j; } } assert(g_uInternalNodeIndex.get() < g_uLeafCount.get() - 1 || BIG_DIST != dtNewMinDist); assert(g_uInternalNodeIndex.get() < g_uLeafCount.get() - 1 || uInsane != uNewNearestNeighbor); const unsigned v = TriangleSubscript(Lmin, Rmin); const dist_t dLR = g_Dist.get()[v]; const dist_t dHeightNew = dLR/2; const unsigned uLeft = g_uNodeIndex.get()[Lmin]; const unsigned uRight = g_uNodeIndex.get()[Rmin]; const dist_t HeightLeft = uLeft < g_uLeafCount.get() ? 0 : g_Height.get()[uLeft - g_uLeafCount.get()]; const dist_t HeightRight = uRight < g_uLeafCount.get() ? 0 : g_Height.get()[uRight - g_uLeafCount.get()]; g_uLeft.get()[g_uInternalNodeIndex.get()] = uLeft; g_uRight.get()[g_uInternalNodeIndex.get()] = uRight; g_LeftLength.get()[g_uInternalNodeIndex.get()] = dHeightNew - HeightLeft; g_RightLength.get()[g_uInternalNodeIndex.get()] = dHeightNew - HeightRight; g_Height.get()[g_uInternalNodeIndex.get()] = dHeightNew; // Row for left child overwritten by row for new node g_uNodeIndex.get()[Lmin] = g_uLeafCount.get() + g_uInternalNodeIndex.get(); g_uNearestNeighbor.get()[Lmin] = uNewNearestNeighbor; g_MinDist.get()[Lmin] = dtNewMinDist; // Delete row for right child g_uNodeIndex.get()[Rmin] = uInsane; #if TRACE Log("\nInternalNodeIndex=%u Lmin=%u Rmin=%u\n", g_uInternalNodeIndex.get(), Lmin, Rmin); ListState(); #endif } unsigned uRoot = g_uLeafCount.get() - 2; tree.Create(g_uLeafCount.get(), uRoot, g_uLeft.get(), g_uRight.get(), g_LeftLength.get(), g_RightLength.get(), Ids, Names); #if TRACE tree.LogMe(); #endif delete[] g_Dist.get(); delete[] g_uNodeIndex.get(); delete[] g_uNearestNeighbor.get(); delete[] g_MinDist.get(); delete[] g_Height.get(); delete[] g_uLeft.get(); delete[] g_uRight.get(); delete[] g_LeftLength.get(); delete[] g_RightLength.get(); for (unsigned i = 0; i < g_uLeafCount.get(); ++i) free(Names[i]); delete[] Names; delete[] Ids; }
int main() { SDL_Surface *screen; SDL_Surface *tmp; SDL_Surface *bitmap; SDL_Surface *bitmap2; /* 8-Bit */ SDL_Rect src, src2, dest, dest2; if(SDL_Init(SDL_INIT_VIDEO)){ printf("Error with SDL init\n"); } screen = SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF); if(!screen) printf("Error with screen\n"); tmp = SDL_LoadBMP("data/FLAG_B24.BMP"); if(!tmp) printf("Error loading file\n"); bitmap = SDL_DisplayFormat(tmp); bitmap2 = SDL_DisplayFormat(tmp); SDL_FreeSurface(tmp); src.x = 0; src.y = 0; src.w = bitmap->w; src.h = bitmap->h; dest.x = 50; dest.y = 50; dest.w = bitmap->w; dest.h = bitmap->h; src2.x = 0; src2.y = 0; src2.w = bitmap2->w; src2.h = bitmap2->h; dest2.x = 200; dest2.y = 200; dest2.w = bitmap2->w; dest2.h = bitmap2->h; Uint16 *pixels = (Uint16*)bitmap->pixels; int i; //printf("val: %x - r:%x - g:%x - b:%x - avg:%d\n", pixels[0], //R(pixels[0]), G(pixels[0]), B(pixels[0]), //AVG(B(pixels[0]),G(pixels[0]),R(pixels[0]))); for(i = 0; i < bitmap->w*bitmap->h; i++){ pixels[i] = AVG(B(pixels[i]),G(pixels[i]),R(pixels[i])); } // R G B //00000 000000 00000 bitmap->pixels = (Uint16*)pixels; SDL_BlitSurface(bitmap, &src, screen, &dest); SDL_BlitSurface(bitmap2, &src2, screen, &dest2); printf("Bytes per pixel: %d", bitmap->format->BitsPerPixel); SDL_Flip(screen); SDL_Delay(2500); atexit(SDL_Quit); return 0; }
static ssize_t fsl_dcm_sysfs_result(struct device *dev, struct device_attribute *attr, char *buf) { struct fsl_dcm_data *dcm = dev_get_drvdata(dev); const struct dcm_board *board = dcm->board; unsigned int i, vindex; ssize_t len; char *str; unsigned int num[MAX_RECORD], max[MAX_RECORD], avg[MAX_RECORD]; const char *unit[MAX_RECORD]; len = sprintf(buf, "Name Average\n" "==================== ================\n"); vindex = 0; for (i = 0; i < board->num; i++) { num[i] = (dcm->rec[i].qty1 << 8) | (dcm->rec[i].qty2); switch (board->types[i]) { case CR_V: max[i] = voltage_convert[board->voltage_fun[vindex]]( dcm->rec[i].max); avg[i] = voltage_convert[board->voltage_fun[vindex]]( AVG(dcm->rec[i].acc, num[i])); vindex++; unit[i] = "mV"; break; case CR_C: max[i] = board->convert_iout(dcm->rec[i].max, board->ical); avg[i] = board->convert_iout(AVG(dcm->rec[i].acc, num[i]), board->ical); unit[i] = "mA"; break; case CR_T: max[i] = board->convert_tout(dcm->rec[i].max); avg[i] = board->convert_tout(AVG(dcm->rec[i].acc, num[i])); unit[i] = "C "; break; default: continue; } } str = strstr(board->compatible, "tetra-fpga"); if (str) { /* T4240 board */ unsigned int idd; idd = avg[2] + avg[3] + avg[4] + avg[5]; len += sprintf(buf + len, "CPU voltage: %-6u (mV)\n", avg[0]); len += sprintf(buf + len, "CPU current: %-6u (mA)\n", idd); len += sprintf(buf + len, "DDR voltage: %-6u (mV)\n", avg[6]); len += sprintf(buf + len, "DDR current: %-6u (mA)\n", avg[7]); len += sprintf(buf + len, "CPU temperature: %-6u (C)\n", avg[8]); } else { /* for else */ for (i = 0; i < board->num; i++) len += sprintf(buf + len, "%-8s %-6d %s\n", board->names[i], avg[i], unit[i]); } return len; }
/* Show compression statistics */ static void showStats(tcprivCtx h) { #define AVG(v, c) ((int32_t)((c) ? (double)(v) / (c) + .5 : 0)) tcCtx g = h->g; int i; struct { long nSubrs; long subrSize; long nChars; long charSize; long flatSize; } comp; long compOther; long compDataSize; comp.nSubrs = 0; comp.subrSize = 0; comp.nChars = 0; comp.charSize = 0; comp.flatSize = 0; for (i = 0; i < h->set.cnt; i++) { Font *font = &h->set.array[i]; if (!(font->flags & (FONT_SYNTHETIC | FONT_CHAMELEON))) { comp.nSubrs += font->subrs.nStrings; comp.subrSize += (font->subrs.nStrings == 0) ? 0 : font->subrs.offset[font->subrs.nStrings - 1]; comp.nChars += font->chars.nStrings; comp.charSize += font->chars.offset[font->chars.nStrings - 1]; comp.flatSize += font->flatSize; } } if (g->stats.gather == 1) { fprintf(stderr, "%8ld %8ld %.1f %s (orig/comp/%%orig/FontName)\n", g->stats.fontSize, h->FontSet.size, h->FontSet.size * 100.0 / g->stats.fontSize, (h->set.cnt == 1) ? h->set.array[0].FontName : "set"); } else { long origOther; long origDataSize; printf( " ------------orig-----------" " ---------------comp----------------\n" " count size avg.size" " count size avg.size orig %%\n" " ---------------------------" " -----------------------------------\n" "flat %8ld %9ld %8d %8ld#%9ld %8d %6.1f%%\n", g->stats.nChars, g->stats.flatSize, AVG(g->stats.flatSize, g->stats.nChars), comp.nChars, comp.flatSize, AVG(comp.flatSize, comp.nChars), ((double)comp.flatSize * g->stats.nChars * 100.0) / ((double)comp.nChars * g->stats.flatSize)); printf("subrs %8ld %9ld*%8d %8ld %9ld %8d -\n", g->stats.nSubrs, g->stats.subrSize, AVG(g->stats.subrSize, g->stats.nSubrs), comp.nSubrs, comp.subrSize, AVG(comp.subrSize, comp.nSubrs)); origDataSize = g->stats.subrSize + g->stats.charSize; compDataSize = comp.subrSize + comp.charSize; printf("chars %8ld %9ld*%8d %8ld#%9ld %8d %6.1f%%$\n", g->stats.nChars, g->stats.charSize, AVG(g->stats.charSize, g->stats.nChars), comp.nChars, comp.charSize, AVG(comp.charSize, comp.nChars), (((double)g->stats.nChars * (comp.subrSize + comp.charSize) * 100.0) / ((double)comp.nChars * (g->stats.subrSize + g->stats.charSize)))); origOther = g->stats.fontSize - (g->stats.subrSize + g->stats.charSize); compOther = h->FontSet.size - (comp.subrSize + comp.charSize); printf("other@ %8ld %9ld %8d %8ld %9ld %8d %6.1f%%\n", h->set.cnt, origOther, AVG(origOther, h->set.cnt), h->set.cnt, compOther, AVG(compOther, h->set.cnt), compOther * 100.0 / origOther); printf( "fonts %8ld %9ld %8d %8ld %9ld %8d %6.1f%%\n" "\n" "* original subr and char sizes without lenIV bytes.\n" "@ other.size=fonts.size-(subrs.size+chars.size)\n" "# comp.count may be <orig.count if synthetic fonts included.\n" "$ orig %%=(orig.count*(comp.subr.size+comp.char.size)*100)/\n" " (comp.count*(orig.subr.size+orig.char.size)).\n", h->set.cnt, g->stats.fontSize, AVG(g->stats.fontSize, h->set.cnt), h->set.cnt, h->FontSet.size, AVG(h->FontSet.size, h->set.cnt), h->FontSet.size * 100.0 / g->stats.fontSize); } #undef AVG }
/* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", M6502, MASTER_CLOCK / 8) MCFG_DEVICE_PROGRAM_MAP(bwidow_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(bwidow_state, irq0_line_assert, CLOCK_3KHZ / 12) MCFG_DEVICE_ADD("earom", ER2055) /* video hardware */ MCFG_VECTOR_ADD("vector") MCFG_SCREEN_ADD("screen", VECTOR) MCFG_SCREEN_REFRESH_RATE(CLOCK_3KHZ / 12 / 4) MCFG_SCREEN_SIZE(400, 300) MCFG_SCREEN_VISIBLE_AREA(0, 480, 0, 440) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) avg_device &avg(AVG(config, "avg", 0)); avg.set_vector_tag("vector"); /* sound hardware */ bwidow_audio(config); MACHINE_CONFIG_END MACHINE_CONFIG_START(bwidow_state::bwidowp) bwidow(config); MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(bwidowp_map) WATCHDOG_TIMER(config, "watchdog"); MACHINE_CONFIG_END