10#include <kernel/util/half.hpp>
11#include <kernel/util/string.hpp>
15#if defined(FEAT_HAVE_FLOATX) && !defined(__CUDACC__)
35 return (
size_t) feature_hash&0xFFFFFFFF;
41 return (feature_hash&(uint64_t(1)<<32)) != uint64_t(0);
47 return (feature_hash&(uint64_t(1)<<33)) != uint64_t(0);
53 return (feature_hash&(uint64_t(1)<<34)) != uint64_t(0);
71 template<
typename DT_>
94 static constexpr bool is_int =
false;
96 static constexpr bool is_float =
true;
98 static constexpr bool is_bool =
false;
100 static constexpr bool is_signed =
true;
114 return uint64_t(
sizeof(
float)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
128 static constexpr bool is_int =
false;
130 static constexpr bool is_float =
true;
132 static constexpr bool is_bool =
false;
134 static constexpr bool is_signed =
true;
148 return uint64_t(
sizeof(
double)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
162 static constexpr bool is_int =
false;
164 static constexpr bool is_float =
true;
166 static constexpr bool is_bool =
false;
168 static constexpr bool is_signed =
true;
176 return "long double";
182 return uint64_t(
sizeof(
long double)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
196 static constexpr bool is_int =
true;
198 static constexpr bool is_float =
false;
200 static constexpr bool is_bool =
false;
202 static constexpr bool is_signed =
false;
210 return "unsigned int";
216 return uint64_t(
sizeof(
unsigned int)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
230 static constexpr bool is_int =
true;
232 static constexpr bool is_float =
false;
234 static constexpr bool is_bool =
false;
236 static constexpr bool is_signed =
true;
250 return uint64_t(
sizeof(
signed int)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
264 static constexpr bool is_int =
true;
266 static constexpr bool is_float =
false;
268 static constexpr bool is_bool =
false;
270 static constexpr bool is_signed =
false;
278 return "unsigned char";
284 return uint64_t(
sizeof(
unsigned char)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
298 static constexpr bool is_int =
true;
300 static constexpr bool is_float =
false;
302 static constexpr bool is_bool =
false;
304 static constexpr bool is_signed =
true;
312 return "signed char";
318 return uint64_t(
sizeof(
signed char)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
332 static constexpr bool is_int =
true;
334 static constexpr bool is_float =
false;
336 static constexpr bool is_bool =
false;
338 static constexpr bool is_signed =
false;
346 return "unsigned short";
352 return uint64_t(
sizeof(
unsigned short)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
366 static constexpr bool is_int =
true;
368 static constexpr bool is_float =
false;
370 static constexpr bool is_bool =
false;
372 static constexpr bool is_signed =
true;
380 return "signed short";
386 return uint64_t(
sizeof(
signed short)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
400 static constexpr bool is_int =
true;
402 static constexpr bool is_float =
false;
404 static constexpr bool is_bool =
false;
406 static constexpr bool is_signed =
false;
414 return "unsigned long";
420 return uint64_t(
sizeof(
unsigned long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
434 static constexpr bool is_int =
true;
436 static constexpr bool is_float =
false;
438 static constexpr bool is_bool =
false;
440 static constexpr bool is_signed =
true;
448 return "signed long";
454 return uint64_t(
sizeof(
signed long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
468 static constexpr bool is_int =
true;
470 static constexpr bool is_float =
false;
472 static constexpr bool is_bool =
false;
474 static constexpr bool is_signed =
false;
482 return "unsigned long long";
488 return uint64_t(
sizeof(
unsigned long long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
502 static constexpr bool is_int =
true;
504 static constexpr bool is_float =
false;
506 static constexpr bool is_bool =
false;
508 static constexpr bool is_signed =
true;
516 return "signed long long";
522 return uint64_t(
sizeof(
signed long long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
536 static constexpr bool is_int =
false;
538 static constexpr bool is_float =
false;
540 static constexpr bool is_bool =
true;
542 static constexpr bool is_signed =
false;
556 return uint64_t(
sizeof(
bool)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
560#if defined(FEAT_HAVE_QUADMATH) && !defined(__CUDACC__)
567 struct Traits<__float128>
570 static constexpr bool is_int =
false;
572 static constexpr bool is_float =
true;
574 static constexpr bool is_bool =
false;
576 static constexpr bool is_signed =
true;
588 static uint64_t feature_hash()
590 return uint64_t(
sizeof(__float128)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
595#if defined(FEAT_HAVE_HALFMATH)
605 static constexpr bool is_int =
false;
607 static constexpr bool is_float =
true;
609 static constexpr bool is_bool =
false;
611 static constexpr bool is_signed =
true;
623 static uint64_t feature_hash()
625 return uint64_t(
sizeof(
Half)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
630#if defined(FEAT_HAVE_FLOATX) && !defined(__CUDACC__)
636 template<
int exp_bits_,
int sig_bits_,
typename Backend_>
637 struct Traits<flx::floatx<exp_bits_, sig_bits_, Backend_>>
640 static constexpr bool is_int =
false;
642 static constexpr bool is_float =
true;
644 static constexpr bool is_bool =
false;
646 static constexpr bool is_signed =
true;
658 static uint64_t feature_hash()
662 return uint64_t(
sizeof(Backend_)) | uint64_t(exp_bits_) << 16 | uint64_t(sig_bits_) << 24
663 | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
String class implementation.
Tag class for any data type not matching any other type class.
Tag class for the one and only boolean data type.
Tag class for floating data types.
Tag class for integral data types.
String stringify(const T_ &item)
Converts an item into a String.
__half Half
Half data type.
static bool extract_signedness(uint64_t feature_hash)
extracts sign feature from a given types feature hash
static bool extract_intness(uint64_t feature_hash)
extracts integral feature from a given types feature hash
static bool extract_floatness(uint64_t feature_hash)
extracts floating point feature from a given types feature hash
static size_t extract_type_size(uint64_t feature_hash)
extracts sizeof datatype from a given types feature hash
BooleanClass TypeClass
this type is of boolean class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
FloatingClass TypeClass
this type is of floating class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
FloatingClass TypeClass
this type is of floating class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
FloatingClass TypeClass
this type is of floating class
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
IntegralClass TypeClass
this type is of integral class
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
IntegralClass TypeClass
this type is of integral class
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static String name()
returns a string identifying the datatype
AnotherClass TypeClass
this type is of another class