#include <limits.h>
#include <math.h>
static uint
precision(int maxexp, uint maxprec, int minexp, int dims)
{
#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
#else
return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
#endif
}
static Scalar
_t1(dequantize, Scalar)(Int x, int e)
{
return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
}
static void
_t1(inv_cast, Scalar)(const Int* iblock, Scalar* fblock, uint n, int emax)
{
Scalar s = _t1(dequantize, Scalar)(1, emax);
do
*fblock++ = (Scalar)(s * *iblock++);
while (--n);
}