Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __E_KT_H
- #define __E_KT_H
- #include <math.h>
- template<typename T> T *kT(K x);
- template<typename T> int KTY();
- template<typename T> T KNULL();
- template<typename T> bool KISNULL(T v);
- template<typename T> char *strT(T x);
- template<> inline I *kT<I>(K x) { return kI(x); }
- template<> inline J *kT<J>(K x) { return kJ(x); }
- template<> inline F *kT<F>(K x) { return kF(x); }
- template<> inline int KTY<I>() { return KI; }
- template<> inline int KTY<J>() { return KJ; }
- template<> inline int KTY<F>() { return KF; }
- template<> inline char * strT<I>(I x) {
- static char b[100];
- sprintf(b,"%d",x);
- return b;
- }
- template<int ty> class KTy {};
- template<> class KTy<KJ> { using type = J; };
- template<> class KTy<KI> { using type = I; };
- template<> class KTy<KF> { using type = F; };
- template<> inline F KNULL<F>() { return nf; }
- template<> inline I KNULL<I>() { return 0x7FFFFFFF; }
- template<> inline J KNULL<J>() { return 0x7FFFFFFFFFFFFFFFL; }
- template<> inline bool KISNULL<F>(F v) { return isnan(v); }
- template<> inline bool KISNULL<I>(I v) { return v == KNULL<I>(); }
- template<> inline bool KISNULL<J>(J v) { return v == KNULL<J>(); }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment