logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

xdf_closest_type - Returns a compatible data type

Description

xdf_closest_type()  selects among the data types supported by the file referenced by xdf the type that is
       the closest to  the  target  argument.  The  selected  type  can  then  be  safely  used  in  a  call  to
       xdf_set_chconf(3) with the XDF_CF_STOTYPE field.

       The  selection  algorithm  is based on the 3 following criterions (cited by priority, i.e. most important
       cited first): data size, signed/unsigned type, float/integer value. The data size  criterion  forces  the
       selected type to have a data size (number of byte to represent the value) equal or bigger than the one of
       the  target  type  (with  a preference with sizes the closest to the size of target). The signed/unsigned
       criterion tries to select a type that has the same signeness  (signed  or  unsigned  data  type)  as  the
       target.  Finally  the float/integer criterion tries to select a floating point type if target is float or
       double or an integer data type if target is an integer type.

       As a consequence, if target is supported by the underlying file format of xdf, the function is ensured to
       return target.

Errors

EINVAL the xdf pointer is NULL, or the argument type is not an admissible enumxdftype value.

Name

       xdf_closest_type - Returns a compatible data type

Return Value

xdf_closest_type() returns the selected data type in case of success,  otherwise  -1  and  errno  is  set
       appropriately.

See Also

xdf_set_chconf(3)

EPFL                                                  2010                                   XDF_CLOSEST_TYPE(3)

Synopsis

#include<xdfio.h>intxdf_closest_type(structxdf*xdf,enumxdftypetarget);

See Also