Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

C language binding of P1888 operations, especially min and max



> So for each "k", it is necessary 2^(k+1) variants.
> This is a combinatoric explosure.
> How can I bind this in C ?

Input arguments can be widened to the widest-supported type.  This avoids
combinatorial explosion; you only need one function per target type.
Several functions, including min/max, don't involve rounding, so you can
generate a wide result and round it once to the target type.

Functions like min/max are often expressed as macros in C, again avoiding
type issues.  Indeed, macros using the compile-time built-in typeof() can
provide the appearance of polymorphism.

Michel.
---Sent: 2013-10-06 20:09:50 UTC