## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csutil/radixsort.h

Go to the documentation of this file.

    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
    00027 #include "csextern.h"
    00028
    00032 class CS_CRYSTALSPACE_EXPORT csRadixSorter
    00033 {
    00034 private:
    00035   // Element counter table. This is used to count the
    00036   // distribution of all elements in the input table (for the
    00037   // given part of the elements we are sorting).
    00038   int counter_table[256];
    00039   // Offset table where every element starts in the sorted result.
    00040   int offset_table[256];
    00041
    00042   // Sort from one table to the other on the given bit-mask.
    00043   void Sort (uint32* table_source, uint32* table_dest, int size,
    00044         uint32 bit_mask, int shift);
    00045
    00046 public:
    00052   void Sort (uint32* table, int size, int max_value);
    00053 };
    00054
    00055 #endif