Lines Matching refs:cache
29 mpfr_init_cache (mpfr_cache_t cache, int (*func)(mpfr_ptr, mpfr_rnd_t))
31 MPFR_PREC (cache->x) = 0; /* Invalid prec to detect that the cache is not
33 cache->func = func;
38 mpfr_clear_cache (mpfr_cache_t cache) in mpfr_clear_cache() argument
40 if (MPFR_UNLIKELY (MPFR_PREC (cache->x) != 0)) in mpfr_clear_cache()
43 MPFR_LOCK_WRITE(cache->lock); in mpfr_clear_cache()
45 if (MPFR_LIKELY (MPFR_PREC (cache->x) != 0)) in mpfr_clear_cache()
47 mpfr_clear (cache->x); in mpfr_clear_cache()
48 MPFR_PREC (cache->x) = 0; in mpfr_clear_cache()
52 MPFR_UNLOCK_WRITE(cache->lock); in mpfr_clear_cache()
57 mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mpfr_rnd_t rnd) in mpfr_cache() argument
65 MPFR_DEFERRED_INIT_CALL(cache); in mpfr_cache()
70 MPFR_LOCK_READ(cache->lock); in mpfr_cache()
72 cprec = MPFR_PREC (cache->x); in mpfr_cache()
77 MPFR_LOCK_READ2WRITE(cache->lock); in mpfr_cache()
81 cprec = MPFR_PREC (cache->x); in mpfr_cache()
89 mpfr_init2 (cache->x, cprec); in mpfr_cache()
100 mpfr_set_prec (cache->x, cprec); in mpfr_cache()
103 cache->inexact = (*cache->func) (cache->x, MPFR_RNDN); in mpfr_cache()
108 MPFR_LOCK_WRITE2READ(cache->lock); in mpfr_cache()
113 MPFR_ASSERTD (MPFR_PREC (cache->x) == cprec); in mpfr_cache()
122 MPFR_ASSERTN (MPFR_IS_POS (cache->x)); /* TODO... */ in mpfr_cache()
123 sign = MPFR_SIGN (cache->x); in mpfr_cache()
124 MPFR_EXP (dest) = MPFR_GET_EXP (cache->x); in mpfr_cache()
131 MPFR_MANT (cache->x), cprec, rnd, sign, in mpfr_cache()
132 if (MPFR_UNLIKELY (cache->inexact == 0)) in mpfr_cache()
142 else if (cache->inexact < 0) in mpfr_cache()
155 if (MPFR_LIKELY (cache->inexact != 0)) in mpfr_cache()
163 inexact = cache->inexact; in mpfr_cache()
175 inexact = cache->inexact; in mpfr_cache()
185 inexact = cache->inexact; in mpfr_cache()
193 MPFR_UNLOCK_READ(cache->lock); in mpfr_cache()