const SkMipMap* SkMipMapCache::AddAndRef(const SkBitmap& src, SkResourceCache* localCache) { SkMipMap* mipmap = SkMipMap::Build(src, get_fact(localCache)); if (mipmap) { MipMapRec* rec = SkNEW_ARGS(MipMapRec, (src, mipmap)); CHECK_LOCAL(localCache, add, Add, rec); src.pixelRef()->notifyAddedToCache(); } return mipmap; }
long get_fact(int n){ if (n < 0) return 0; else if (n == 0) return 1; else if (n == 1) return 1; else return n * get_fact(n-1); }
const SkMipMap* SkMipMapCache::AddAndRef(const SkBitmap& src, SkSourceGammaTreatment treatment, SkResourceCache* localCache) { SkMipMap* mipmap = SkMipMap::Build(src, treatment, get_fact(localCache)); if (mipmap) { MipMapRec* rec = new MipMapRec(src, treatment, mipmap); CHECK_LOCAL(localCache, add, Add, rec); src.pixelRef()->notifyAddedToCache(); } return mipmap; }
int main(int argc, char *argv[]){ int num; if(argv[1] == NULL){ printf("No number provided!\n"); return 1; } else { num = atoi(argv[1]); printf("Factorial of %d is %ld\n", num, get_fact(num)); return 0; } }
static int v4l2_rx_start_func (void **data, int low_freq, int high_freq, int default_freq, int grid) { char *dev = DEFAULT_DEVICE; fm_v4l2_data* session; ALOGI("%s:\n", __FUNCTION__); ALOGI("low_freq %d, high_freq %d, default_freq %d, grid %d\n", low_freq, high_freq, default_freq, grid); session = malloc(sizeof(fm_v4l2_data)); if (session== NULL){ ALOGE("error on malloc"); return -1; } memset(session, 0, sizeof(fm_v4l2_data)); *data = session; session->fd = open_dev(dev); if (session->fd < 0){ ALOGE("error on open dev\n"); return -1; } if (get_tun_radio_cap(session->fd) !=1) { ALOGE("error on check tunner radio capability"); return -1; } session->vt.index=0; if ( get_v4l2_tuner(session->fd, &session->vt) <0 ){ ALOGE("error on get V4L tuner\n"); return -1; } session->fact = get_fact(session->fd, &session->vt); if ( session->fact < 0) { ALOGE("error on get fact\n"); return -1; } session->freq = get_proprietary_freq(default_freq, session->fact); session->low_freq = get_proprietary_freq(low_freq, session->fact); session->high_freq = get_proprietary_freq(high_freq, session->fact); session->grid = get_proprietary_freq(grid, session->fact); session->threshold = DEFAULT_THRESHOLD; if (set_freq(session->fd, session->freq) < 0 ){ ALOGE("error on set freq\n"); return -1; } if (set_volume(session->fd, DEFAULT_VOLUME)<0){ ALOGE("error on set volume\n"); return -1; } if (set_mute(session->fd, MUTE_OFF) <0){ ALOGE("error on mute\n"); return -1; } return 0; }
ctext zp_obj::get_template() { const z_obj_fact* ei=get_fact(); Z_ASSERT(0); return ei->parse_string; }
ctext zp_obj::get_map_key() { const z_obj_fact* ei=get_fact(); Z_ASSERT((ei)); return z_obj_fact_get_name(get_fact()); }
ctext zp_obj::get_parse_string() { return get_fact()->parse_string; }
void table_base::row_interface::display(std::ostream & out) const { table_fact fact; get_fact(fact); print_container(fact, out); out << "\n"; }