Hi.
If 64bit types are available in the system, shouldn't we use them?
Something like re-defining the functions if 64bit types are available:
#ifdef int64_t
#define PDF_USE_BUILTIN_64BIT_SUPPORT 0
#else
#define PDF_USE_BUILTIN_64BIT_SUPPORT 1
#endif
Ok.
#if PDF_USE_BUILTIN_64BIT_SUPPORT
pdf_status_t pdf_i64_copy(const pdf_i64_t orig, pdf_i64_t *copy)
{
if (copy == NULL)
{
return PDF_ERROR;
}
copy->high = orig.high;
copy->low = orig.low;
return PDF_OK;
}/*end pdf_i64_copy*/
#else
pdf_status_t pdf_i64_copy(const pdf_i64_t orig, pdf_i64_t *copy)
{
*copy=orig;
return PDF_OK;
}
#endif
I would put the conditional code in the code using 64bit integers
instead of the 'pdf_i64' implementation:
/* We need a 64bit number */
pdf_i64_t number; /* May be a native scalar type or a pdf_i64
variable */
...
#ifdef PDF_USE_BUILTIN_64BIT_SUPPORT
/* Use the pdf_i64 implementation */
pdf_i64_set (number, 20);
#else
/* Simply use the scalar type */
number = 20;
#endif
Your approach has the advantage of providing a uniform interface for
the modules using 'pdf_i64', but I am thinking more in the efficiency
of the code and in the fact that most 32bit machines/OS/compilers
provides a native 64bit scalar type (such as long long).
What do you think?
--
Jose E. Marchesi <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
GNU Spain http://es.gnu.org
GNU Project http://www.gnu.org