hmmer-3.3/easel/esl_huffman.c
/* sort_canonical()
 * Sorting function for esl_quicksort(), putting symbols into
 * canonical Huffman order: primarily by ascending code length,
 * secondarily by ascending symbol code.
 */
sort_canonical()
Sorting function for esl_quicksort(), putting symbols into
canonical Huffman order: primarily by ascending code length,
secondarily by ascending symbol code.
sort_canonical () Sorting function for esl_quicksort () putting symbols into canonical Huffman order : primarily by ascending code length secondarily by ascending symbol code .
static int
sort_canonical(const void *data, int e1, int e2)
{
  ESL_HUFFMAN *hc = (ESL_HUFFMAN *) data;
  int          L1 = hc->len[e1];
  int          L2 = hc->len[e2];
  if      (L2 == 0) return -1;   
  else if (L1 == 0) return 1;
  else if (L1 < L2) return -1;
  else if (L1 > L2) return 1;
  else if (e1 < e2) return -1;
  else if (e1 > e2) return 1;
  else              return 0;
}
static int sort_canonical ( const void * data , int e1 , int e2 ) { ESL_HUFFMAN * hc = ( ESL_HUFFMAN * ) data ; int L1 = hc -> len [ e1 ] ; int L2 = hc -> len [ e2 ] ; if ( L2 == 0 ) return -1 ; else if ( L1 == 0 ) return 1 ; else if ( L1 < L2 ) return -1 ; else if ( L1 > L2 ) return 1 ; else if ( e1 < e2 ) return -1 ; else if ( e1 > e2 ) return 1 ; else return 0 ; }
sort_canonical()
 Sorting function for esl_quicksort(), putting symbols into
 canonical Huffman order: primarily by ascending code length,
 secondarily by ascending symbol code.
sort_canonical () Sorting function for esl_quicksort () putting symbols into canonical Huffman order : primarily by ascending code length secondarily by ascending symbol code .
// len=0 means symbol isn't encoded at all, doesn't occur