All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Static Public Methods | List of all members
cub::BaseDigitExtractor< KeyT > Struct Template Reference

Detailed description

template< typename KeyT>
struct cub::BaseDigitExtractor< KeyT >

Base struct for digit extractor. Contains common code to provide special handling for floating-point -0.0.

This handles correctly both the case when the keys are bitwise-complemented after twiddling for descending sort (in onesweep) as well as when the keys are not bit-negated, but the implementation handles descending sort separately (in other implementations in CUB). Twiddling alone maps -0.0f to 0x7fffffff and +0.0f to 0x80000000 for float, which are subsequent bit patterns and bitwise complements of each other. For onesweep, both -0.0f and +0.0f are mapped to the bit pattern of +0.0f (0x80000000) for ascending sort, and to the pattern of -0.0f (0x7fffffff) for descending sort. For all other sorting implementations in CUB, both are always mapped to +0.0f. Since bit patterns for both -0.0f and +0.0f are next to each other and only one of them is used, the sorting works correctly. For double, the same applies, but with 64-bit patterns.
Inheritance diagram for cub::BaseDigitExtractor< KeyT >:
cub::BFEDigitExtractor< KeyT > cub::ShiftDigitExtractor< KeyT >

Public Types

typedef Traits< KeyT > TraitsT
typedef TraitsT::UnsignedBits UnsignedBits

Static Public Methods

static __device__
__forceinline__ UnsignedBits 
ProcessFloatMinusZero (UnsignedBits key)

Member Typedef Documentation

template<typename KeyT >
typedef Traits<KeyT> cub::BaseDigitExtractor< KeyT >::TraitsT
template<typename KeyT >
typedef TraitsT::UnsignedBits cub::BaseDigitExtractor< KeyT >::UnsignedBits

Member Enumeration Documentation

template<typename KeyT >
anonymous enum

Member Function Documentation

template<typename KeyT >
static __device__ __forceinline__ UnsignedBits cub::BaseDigitExtractor< KeyT >::ProcessFloatMinusZero ( UnsignedBits  key)

The documentation for this struct was generated from the following file: