SANE_Fixed is used for variables that can take fixed
point values in the range
to
with a resolution
of
. The C declarations relating to this type are given
below.
#define SANE_FIXED_SCALE_SHIFT 16 typedef SANE_Word SANE_Fixed;The macro SANE_FIXED_SCALE_SHIFT gives the location of the fixed binary point. This standard defines that value to be 16, which yields a resolution of
Note that SANE_Fixed is simply an alias of SANE_Word.
It is therefore always legal to use the latter type in place of the
former. However, for clarity, it is recommended to use
SANE_Fixed whenever a given variable or formal argument has a
fixed interpretation as a fixed-point object.
For convenience, SANE also defines two macros that convert fixed-point values to and from C double floating point values.
SANE_UNFIX(SANE_FIX(d)) == d SANE_FIX(SANE_UNFIX(w)) == wIn other words, conversion between fixed and double values may be lossy. It is therefore recommended to avoid repeated conversions between the two representations.