CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

radixsort.h

00001 /*
00002   Crystal Space In-Place Radix Sort
00003   Copyright (C) 2003 by Jorrit Tyberghein
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Library General Public
00007   License as published by the Free Software Foundation; either
00008   version 2 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Library General Public License for more details.
00014 
00015   You should have received a copy of the GNU Library General Public
00016   License along with this library; if not, write to the Free
00017   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CSUTIL_RADIX_SORT_H__
00021 #define __CSUTIL_RADIX_SORT_H__
00022 
00023 class csRadixSorter
00024 {
00025 private:
00026   // Element counter table. This is used to count the
00027   // distribution of all elements in the input table (for the
00028   // given part of the elements we are sorting).
00029   int counter_table[256];
00030   // Offset table where every element starts in the sorted result.
00031   int offset_table[256];
00032 
00033   // Sort from one table to the other on the given bit-mask.
00034   void Sort (uint32* table_source, uint32* table_dest, int size,
00035         uint32 bit_mask, int shift);
00036 
00037 public:
00043   void Sort (uint32* table, int size, int max_value);
00044 };
00045 
00046 #endif
00047 

Generated for Crystal Space by doxygen 1.2.14