Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/LZH/HuffStatTmp.cpp File Reference

Go to the source code of this file.

Defines

#define __J2K__LZH__HuffStatTmp_CPP__

Functions

int cmpHuffStatTmpStruct (const HuffStatTmpStruct &a, const HuffStatTmpStruct &b)
int operator< (const HuffStatTmpStruct &a, const HuffStatTmpStruct &b)
int __cdecl _cmpStat (const void *a_, const void *b_)
void shellSort (HuffStatTmpStruct *a, int N)


Define Documentation

#define __J2K__LZH__HuffStatTmp_CPP__
 

Definition at line 2 of file HuffStatTmp.cpp.


Function Documentation

int __cdecl _cmpStat const void *    a_,
const void *    b_
[static]
 

Definition at line 17 of file HuffStatTmp.cpp.

00017                                                               {
00018   HuffStatTmpStruct* a = (HuffStatTmpStruct*)a_;
00019   HuffStatTmpStruct* b = (HuffStatTmpStruct*)b_;
00020   return cmpHuffStatTmpStruct( *a, *b );
00021 }

int cmpHuffStatTmpStruct const HuffStatTmpStruct   a,
const HuffStatTmpStruct   b
[inline]
 

Definition at line 4 of file HuffStatTmp.cpp.

Referenced by _cmpStat(), and operator<().

00006 {
00007   int cmp = b.n - a.n;
00008   return ( cmp ? cmp : b.i - a.i );
00009 }

int operator< const HuffStatTmpStruct   a,
const HuffStatTmpStruct   b
[inline]
 

Definition at line 11 of file HuffStatTmp.cpp.

00013 {
00014   return cmpHuffStatTmpStruct( a, b ) < 0;
00015 }

void shellSort HuffStatTmpStruct   a,
int    N
 

Definition at line 23 of file HuffStatTmp.cpp.

Referenced by HuffStat::makeSortedTmp().

00023                                               {
00024   int i, j;
00025   HuffStatTmpStruct v;
00026 
00027   /*
00028     for ( int h = 1; h <= N/9; h = ( 3 * h + 1 ) )// determine the value for h
00029     ;
00030   */
00031 
00032   assert( 13 <= N / 9 );
00033   assert( 40 > N / 9 ); 
00034 
00035   int h = 40;
00036 
00037   for ( ; h > 0; h /= 3 ) {       // h = 40, 13, 4, 1
00038     for ( i = h + 1; i <= N; ++i ) {
00039        v = a[i];
00040        j = i;
00041 
00042        while ( ( j > h ) && ( v < a[j - h] ) ) {
00043           a[j] = a[j-h];
00044           j -= h;
00045        }
00046 
00047        a[j] = v;
00048     }
00049   }
00050 }


Generated on Sun Oct 14 18:47:41 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001