CrystalSpace

Public API Reference

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

Generated for Crystal Space by doxygen 1.4.4