To allow users to build a library in multiple precisions, we use the preprocessor macros defined in this file to mangle type and routine names. This header essentially helps simulate a hack-ish C++ template facility.
In order for name mangling to work, the following compile-time macros need to be defined:
At a minimum, the user must define IND_TAG_CHAR and VAL_TAG_CHAR, from which this header will select default expansions for the other macros.
#include <math.h>
Go to the source code of this file.
Mangler for type ID numbers for the default scalar types. | |
#define | MANGLE_CONCAT0(a, b) a ## b |
Direct concatenation of input arguments. | |
#define | MANGLE_CONCAT(a, b) MANGLE_CONCAT0(a, b) |
Macro-expanded concatenation of input arguments. | |
#define | OSKI_IND_ID MANGLE_CONCAT(OSKI_SCALIND_, IND_TYPE_ID) |
Type ID for the default scalar integer index type. | |
#define | OSKI_VAL_ID MANGLE_CONCAT(OSKI_SCALVAL_, VAL_TYPE_ID) |
Type ID for the default scalar non-zero value type. | |
Typed value constants. | |
#define | TVAL_ZERO MANGLE_(TVAL_ZERO) |
#define | TVAL_ONE MANGLE_(TVAL_ONE) |
#define | TVAL_NEG_ONE MANGLE_(TVAL_NEG_ONE) |
#define | TVAL_IMAG MANGLE_(TVAL_IMAG) |
#define | TVAL_NEG_IMAG MANGLE_(TVAL_NEG_IMAG) |
const oski_value_t | TVAL_ZERO |
const oski_value_t | TVAL_ONE |
const oski_value_t | TVAL_NEG_ONE |
const oski_value_t | TVAL_IMAG |
const oski_value_t | TVAL_NEG_IMAG |
Defines | |
#define | INC_OSKI_MANGLE_H |
oski/mangle.h has been included. | |
#define | IS_VAL_COMPLEX ((VAL_TAG_CHAR=='c') || (VAL_TAG_CHAR=='z')) |
Returns 1 if the current default value type is complex. | |
#define | IS_VALPREC_SINGLE ((VAL_TAG_CHAR=='s') || (VAL_TAG_CHAR=='c')) |
Returns 1 if the current default value type is single precision. | |
#define | IS_VALPREC_DOUBLE ((VAL_TAG_CHAR=='d') || (VAL_TAG_CHAR=='z')) |
Returns 1 if the current default value type is single precision. | |
#define | VAL_EPS 1e-7 |
Default machine epsilon. | |
#define | VAL_ZERO (0.0) |
Numerical zero. | |
#define | VAL_ONE (1.0) |
Numerical one. | |
#define | VAL_NEG_ONE (-1.0) |
Numerical negative one. | |
#define | IS_REAL_ZERO(x) ((x) == VAL_ZERO) |
Returns 1 <==> x == 0.0. | |
#define | IS_VAL_ZERO(x) ((x) == VAL_ZERO) |
Returns 1 <==> x == 0.0. | |
#define | IS_VAL_ONE(x) ((x) == VAL_ONE) |
Returns 1 <==> x == 1.0. | |
#define | IS_VAL_NEG_ONE(x) ((x) == VAL_NEG_ONE) |
Returns 1 <==> x == -1.0. | |
#define | VAL_ABS(x) fabs(x) |
Returns as a double-precision value. | |
#define | VAL_SET_ZERO(x) (x) = 0.0 |
Sets x to 0. | |
#define | VAL_SET_ONE(x) (x) = 1.0 |
Sets x to 1. | |
#define | VAL_CONJ(x) |
Conjugates x, i.e., . | |
#define | VAL_ASSIGN(y, x) (y) = (x) |
Set , where are real variables. | |
#define | VAL_ASSIGN_CONJ(y, x) VAL_ASSIGN(y, x) |
Set , where are real variables. | |
#define | VAL_ASSIGN_NEG(y, x) (y) = -(x) |
Set , where are real variables. | |
#define | VAL_ASSIGN_NEG_CONJ(y, x) VAL_ASSIGN_NEG(y, x) |
Set , where are real variables. | |
#define | MAKE_VAL_COMPLEX(x, y) (x) |
Make an initializer record (ignores imaginary part). | |
#define | VAL_SCALE(x, alpha) (x) *= (alpha) |
Compute , where are real numbers. | |
#define | VAL_SCALE_CONJ(x, alpha) VAL_SCALE(x, alpha) |
Compute , where are real numbers. | |
#define | VAL_MAC(y, alpha, x) (y) += (alpha) * (x) |
Compute (multiply-accumulate), where are all real numbers. | |
#define | VAL_MAC_CONJ(y, alpha, x) VAL_MAC(y, alpha, x) |
Compute (multiply-accumulate), where are all real numbers. | |
#define | VAL_MSUB(y, alpha, x) (y) -= (alpha) * (x) |
Compute (multiply-subtract), where are all real numbers. | |
#define | VAL_MSUB_CONJ(y, alpha, x) VAL_MSUB(y, alpha, x) |
Compute (multiply-subtract), where are all real numbers. | |
#define | VAL_DEC(x, a) (x) -= (a) |
Compute (decrease/decrement), where are real numbers. | |
#define | VAL_DEC_CONJ(x, a) VAL_DEC(x, a) |
Compute (decrease/decrement), where are real numbers. | |
#define | VAL_INC(x, a) (x) += (a) |
Compute (increase/increment), where are real numbers. | |
#define | VAL_INC_CONJ(x, a) VAL_INC(x, a) |
Compute (increase/increment), where are real numbers. | |
#define | VAL_MUL(z, x, y) (z) = (x) * (y) |
Computes , where are real, unaliased variables. | |
#define | VAL_MUL_CONJ(z, x, y) VAL_MUL(z, x, y) |
Computes , where are real, unaliased variables. | |
#define | VAL_TRIAD(z, y, alpha, x) (z) = (y) + (alpha) * (x) |
Compute (triad), where are all real numbers. | |
#define | VAL_TRIAD_CONJ(z, y, alpha, x) VAL_TRIAD(z, y, alpha, x) |
Compute (triad), where are all real numbers. | |
#define | VAL_DIVEQ(x, a) (x) /= (a) |
Compute , where and are real. | |
#define | VAL_DIVEQ_CONJ(x, a) VAL_DIVEQ(x, a) |
Compute , where and are real. | |
#define | VAL_INV(y, x) (y) = 1.0/(x) |
Computes , where are real. | |
#define | MAKE_VAL_REAL(x) MAKE_VAL_COMPLEX((x), VAL_ZERO) |
Make a complex initializer record. | |
#define | MAKE_VAL_GENERAL MAKE_VAL_COMPLEX(-9, -9) |
A dummy value to represent a "general" value. | |
#define | CATEGORIZE_VAL(alpha) |
Returns if , or a constant value (see MAKE_VAL_GENERAL) otherwise. | |
#define | MAKETYPENAME0(base, ind, val) base ## _T ## ind ## val |
Makes a type-mangled name, [BASE]_T[IND][VAL]. | |
#define | MAKETYPENAME1(base, ind, val) MAKETYPENAME0(base, ind, val) |
Name mangling helper macro. | |
#define | MAKEMODNAME0(mod, base, ind, val) mod ## _T ## ind ## val ## _LTX_ ## base |
Makes a type-mangled shared library module routine name, [MOD]_T[IND][VAL]_LTX_[BASE]. | |
#define | MAKEMODNAME1(mod, base, ind, val) MAKEMODNAME0(mod, base, ind, val) |
Name mangling helper macro. | |
#define | MANGLE_(base) MAKETYPENAME1(base, IND_TAG, VAL_TAG) |
Mangle a base type name. | |
#define | MANGLE_MOD_(base) MAKEMODNAME1(MOD_NAME, base, IND_TAG, VAL_TAG) |
Mangle a module routine name. | |
#define | OSKI_MAKENAME_FUNCPT(name) oski_ ## name ## _funcpt |
Make a function pointer type name of the form, oski_[name]_funcpt. | |
#define | oski_index_t IND_T |
#define | oski_value_t VAL_T |
|
Value: ( \ (IS_VAL_ONE(alpha) || IS_VAL_ZERO(alpha) || IS_VAL_NEG_ONE(alpha)) \ ? (alpha) : MAKE_VAL_GENERAL \ )
|
|
Returns 1 if the current default value type is complex. This implementation simply checks the currently defined VAL_TAG macro to see if it is 'c' or 'z'. |
|
A dummy value to represent a "general" value. This is used in trace representation. |
|
Makes a type-mangled shared library module routine name, [MOD]_T[IND][VAL]_LTX_[BASE]. This macro immediately concatenates its arguments to make a static-compatible module routine name of the form [mod]_T[ind][val]_LTX_[base] This naming convention allows the LTDL-based module loader to find methods dynamically. |
|
Name mangling helper macro. This macro immediately calls MAKEMODNAME0 with the same arguments. Since mod, base, ind, and/or val will often be macros themselves, this intermediate macro provides a way to force the C preprocessor to expand the macro arguments before concatenation. |
|
Makes a type-mangled name, [BASE]_T[IND][VAL].
|
|
Name mangling helper macro. This macro immediately calls MAKETYPENAME0 with the same arguments. Since base, ind, and/or val will often be macros themselves, this intermediate macro provides a way to force the C preprocessor to expand the macro arguments before concatenation.
|
|
Mangle a base type name.
|
|
Macro-expanded concatenation of input arguments. This macro serves as an intermediate step to ensure that the input arguments, a and b, will be expanded if they are themselves macros. |
|
Mangle a module routine name.
|