Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IceRevisitedRadix.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICERADIXSORT_H__
13 #define __ICERADIXSORT_H__
14 
16  #define RADIX_LOCAL_RAM
17 
18  enum RadixHint
19  {
22 
23  RADIX_FORCE_DWORD = 0x7fffffff
24  };
25 
27  {
28  public:
29  // Constructor/Destructor
30  RadixSort();
31  ~RadixSort();
32  // Sorting methods
33  RadixSort& Sort(const udword* input, udword nb, RadixHint hint=RADIX_SIGNED);
34  RadixSort& Sort(const float* input, udword nb);
35 
37  inline_ const udword* GetRanks() const { return mRanks; }
38 
40  inline_ udword* GetRecyclable() const { return mRanks2; }
41 
42  // Stats
43  udword GetUsedRam() const;
45  inline_ udword GetNbTotalCalls() const { return mTotalCalls; }
47  inline_ udword GetNbHits() const { return mNbHits; }
48 
49  private:
50 #ifndef RADIX_LOCAL_RAM
51  udword* mHistogram;
52  udword* mOffset;
53 #endif
54  udword mCurrentSize;
55  udword* mRanks;
56  udword* mRanks2;
57  // Stats
58  udword mTotalCalls;
59  udword mNbHits;
60  // Internal methods
61  void CheckResize(udword nb);
62  bool Resize(udword nb);
63  };
64 
65 #endif // __ICERADIXSORT_H__