CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 #include "csextern.h"
00024 
00025 class CS_CSUTIL_EXPORT csRadixSorter
00026 {
00027 private:
00028   // Element counter table. This is used to count the
00029   // distribution of all elements in the input table (for the
00030   // given part of the elements we are sorting).
00031   int counter_table[256];
00032   // Offset table where every element starts in the sorted result.
00033   int offset_table[256];
00034 
00035   // Sort from one table to the other on the given bit-mask.
00036   void Sort (uint32* table_source, uint32* table_dest, int size,
00037         uint32 bit_mask, int shift);
00038 
00039 public:
00045   void Sort (uint32* table, int size, int max_value);
00046 };
00047 
00048 #endif
00049 

Generated for Crystal Space by doxygen 1.3.9.1