41 template <
int Bits,
bool Signed = true>
51 using T =
typename std::conditional<kSigned, int, unsigned>::type;
76 : storage(reinterpret_cast<
Storage const &>(value) & kMask) {}
80 : storage(reinterpret_cast<
Storage const &>(value) & kMask) {}
86 storage =
reinterpret_cast<Storage const &
>(tmp) & kMask;
94 if (storage &
Storage(1 << (kBits - 1))) {
95 return T(storage) | ~
T(kMask);
117 if (storage & (1 << (kBits - 1))) {
128 if (storage & (1 << (kBits - 1))) {
138 return !(*
this < rhs);
144 return !(rhs < *
this);
165 static int const value = 1;
171 static int const value = 4;
177 static int const value = 4;
Definition: aligned_buffer.h:35
4-bit signed integer type
Definition: integer_subbyte.h:42
CUTLASS_HOST_DEVICE integer_subbyte(int value)
Conversion from integer type.
Definition: integer_subbyte.h:75
static Storage const kMask
Bitmask used to truncate from larger integers.
Definition: integer_subbyte.h:57
CUTLASS_HOST_DEVICE bool operator==(integer_subbyte const &rhs) const
Equality.
Definition: integer_subbyte.h:103
typename std::conditional< kSigned, int, unsigned >::type T
External type.
Definition: integer_subbyte.h:51
static bool const kSigned
Whether type is signed.
Definition: integer_subbyte.h:48
Defines the size of an element in bits.
Definition: numeric_types.h:42
CUTLASS_HOST_DEVICE integer_subbyte(unsigned value)
Definition: integer_subbyte.h:79
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
static int const kBits
Number of bits.
Definition: integer_subbyte.h:45
Storage storage
Definition: integer_subbyte.h:63
CUTLASS_HOST_DEVICE integer_subbyte()
No operation.
Definition: integer_subbyte.h:71
CUTLASS_HOST_DEVICE bool operator>=(integer_subbyte const &rhs) const
Greater than or equal.
Definition: integer_subbyte.h:137
CUTLASS_HOST_DEVICE bool operator!=(integer_subbyte const &rhs) const
Inequality.
Definition: integer_subbyte.h:109
CUTLASS_HOST_DEVICE integer_subbyte(double value)
Conversion from double.
Definition: integer_subbyte.h:84
uint8_t Storage
Storage type.
Definition: integer_subbyte.h:54
CUTLASS_HOST_DEVICE bool operator<=(integer_subbyte const &rhs) const
Less than or equal.
Definition: integer_subbyte.h:115
CUTLASS_HOST_DEVICE bool operator>(integer_subbyte const &rhs) const
Greater than.
Definition: integer_subbyte.h:143
CUTLASS_HOST_DEVICE bool operator<(integer_subbyte const &rhs) const
Less than.
Definition: integer_subbyte.h:126