sort.cpp File Reference

#include "sort.h"
#include <common.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <boost/static_assert.hpp>

Go to the source code of this file.

Defines

#define FLIP_FLOAT(f)   (f) ^ (-((f) >> 31) | 0x80000000)
#define FLIP_FLOAT_INVERSE(f)   (f) ^ ((((f) >> 31) - 1) | 0x80000000)
#define FLIP_DOUBLE(d)   (d) ^ (-((d) >> 63) | 0x800000000000000ULL)
#define FLIP_DOUBLE_INVERSE(d)   (d) ^ ((((d) >> 63) - 1) | 0x800000000000000ULL)
#define SWAP(x, y)

Functions

 BOOST_STATIC_ASSERT (sizeof(unsigned int)==sizeof(int))
 BOOST_STATIC_ASSERT (sizeof(unsigned long long)==sizeof(double))
 BOOST_STATIC_ASSERT (std::numeric_limits< unsigned int >::digits==32)
 BOOST_STATIC_ASSERT (std::numeric_limits< unsigned long long >::digits==64)
template<typename T>
void quickSort (T *a, const int p, const int q)
template<>
void radixSort (unsigned int *a, unsigned int *b, const unsigned int n)
template<>
void radixSort (int *a, int *b, const unsigned int n)
template<>
void radixSort (float *a, float *b, const unsigned int n)
template<>
void radixSort (double *a, double *b, const unsigned int n)
template<>
void radixSortIndices (unsigned int *a, unsigned int *indices, unsigned int *b, const unsigned int n)
template<>
void radixSortIndices (double *a, unsigned int *indices, unsigned int *b, const unsigned int n)


Define Documentation

#define FLIP_DOUBLE (  )     (d) ^ (-((d) >> 63) | 0x800000000000000ULL)

Definition at line 49 of file sort.cpp.

#define FLIP_DOUBLE_INVERSE (  )     (d) ^ ((((d) >> 63) - 1) | 0x800000000000000ULL)

Definition at line 52 of file sort.cpp.

#define FLIP_FLOAT (  )     (f) ^ (-((f) >> 31) | 0x80000000)

See also:
http://www.stereopsis.com/radix.html for notes which inspired these floating point radix sort implementations

Definition at line 42 of file sort.cpp.

#define FLIP_FLOAT_INVERSE (  )     (f) ^ ((((f) >> 31) - 1) | 0x80000000)

Definition at line 45 of file sort.cpp.

#define SWAP ( x,
 ) 

Value:

do {            \
      (x) ^= (y);  \
      (y) ^= (x);  \
      (x) ^= (y);  \
   } while(0)

Definition at line 70 of file sort.cpp.


Function Documentation

BOOST_STATIC_ASSERT ( std::numeric_limits< unsigned long long >::digits  = =64  ) 

BOOST_STATIC_ASSERT ( std::numeric_limits< unsigned int >::digits  = =32  ) 

BOOST_STATIC_ASSERT ( sizeof(unsigned long long)  = =sizeof(double)  ) 

BOOST_STATIC_ASSERT ( sizeof(unsigned int)  = =sizeof(int)  ) 

template<typename T>
void quickSort ( T *  a,
const int  p,
const int  q 
) [inline]

Definition at line 81 of file sort.cpp.

template<>
void radixSort ( double *  a,
double *  b,
const unsigned int  n 
) [inline]

Definition at line 182 of file sort.cpp.

template<>
void radixSort ( float *  a,
float *  b,
const unsigned int  n 
) [inline]

Definition at line 158 of file sort.cpp.

template<>
void radixSort ( int *  a,
int *  b,
const unsigned int  n 
) [inline]

Definition at line 132 of file sort.cpp.

template<>
void radixSort ( unsigned int *  a,
unsigned int *  b,
const unsigned int  n 
) [inline]

Definition at line 116 of file sort.cpp.

template<>
void radixSortIndices ( double *  a,
unsigned int *  indices,
unsigned int *  b,
const unsigned int  n 
) [inline]

Definition at line 277 of file sort.cpp.

template<>
void radixSortIndices ( unsigned int *  a,
unsigned int *  indices,
unsigned int *  b,
const unsigned int  n 
) [inline]

Definition at line 259 of file sort.cpp.


Generated on 28 Feb 2009 for Milton by doxygen 1.5.6