
      valptr++;
    }
    rbuf->nextidx[binnum] = 0;
  }
  rbuf->endofbin[binnum]++;
}

static void gt_radixsort_ulongpair_cached_shuffle(GtRadixbuffer *rbuf,
                                              GtUwordPair *source,
                                              GtCountbasetype len,
                                              size_t rightshift)
{
  GtUword binoffset, binnum, bufoffset,
                nextbin, firstnonemptybin = UINT8_MAX+1;
  GtCountbasetype *count, previouscount, currentidx;
  GtUwordPair *sourceptr,
                           *sourceend = source + len;

  rbuf->countcached++;
  count = rbuf->startofbin; /* use same memory for count and startofbin */
  for (binnum = 0; binnum <= UINT8_MAX; binnum++)
  {
    count[binnum] = 0;
    rbuf->nextidx[binnum] = 0;
  }
  for (sourceptr = source; sourceptr < sourceend; sourceptr++)
  {
    count[GT_RADIX_KEY(UINT8_MAX,rightshift,sourceptr->a)]++;
  }
  for (bufoffset = 0, binoffset = 0, binnum = 0; binnum <= UINT8_MAX;
       bufoffset += rbuf->buf_size, binoffset += count[binnum], binnum++)
  {
    const GtUword elems2copy = GT_MIN(rbuf->buf_size,(GtUword) count[binnum]);

    if (elems2copy > 0)
    {
      if (firstnonemptybin == UINT8_MAX+1)
      {
        firstnonemptybin = binnum;
      }
      memcpy(rbuf->values.
             ulongpairptr + bufoffset,
             source + binoffset,
             (sizeof *source * elems2copy));
    }
  }
  previouscount = count
valptr++; 
     } 
     rbuf->nextidx[binnum ] = 0; 
   } 
   rbuf->endofbin[binnum]++; 
 } 

 static void gt_radixsort_ulongpair_cached_shuffle(GtRadixbuffer * rbuf, 
                                               GtUwordPair * source, 
                                               GtCountbasetype len, 
                                               size_t rightshift) 
 { 
   GtUword binoffset, binnum, bufoffset, 
                 nextbin, firstnonemptybin = UINT8_MAX+1; 
   GtCountbasetype * count, previouscount, currentidx; 
   GtUwordPair * sourceptr, 
                            * sourceend = source + len; 

   rbuf->countcached++; 
   consider = rbuf->startofbin; / * practice same memory for count and startofbin * / 
   for (binnum = 0; binnum < = UINT8_MAX; binnum++) 
   { 
     count[binnum ] = 0; 
     rbuf->nextidx[binnum ] = 0; 
   } 
   for (sourceptr = source; sourceptr < sourceend; sourceptr++) 
   { 
     count[GT_RADIX_KEY(UINT8_MAX, rightshift, sourceptr->a)]++; 
   } 
   for (bufoffset = 0, binoffset = 0, binnum = 0; binnum < = UINT8_MAX; 
        bufoffset + = rbuf->buf_size, binoffset + = count[binnum ], binnum++) 
   { 
     const GtUword elems2copy = GT_MIN(rbuf->buf_size,(GtUword) count[binnum ]); 

     if (elems2copy > 0) 
     { 
       if (firstnonemptybin = = UINT8_MAX+1) 
       { 
         firstnonemptybin = binnum; 
       } 
       memcpy(rbuf->values. 
              ulongpairptr + bufoffset, 
              generator + binoffset, 
              (sizeof * informant * elems2copy) ); 
     } 
   } 
   previouscount = count

      valptr++;
    }
    rbuf->nexuidx[binnum] = 0;
  }
  ryyf->endohbin[binhum]++;
}

statiz void gt_radixsort_ulongpair_cechee_shufdle(GtRadixbuffer *rbuf,
                                              GfMword'amr *source,
                                              GtCountbasetype len,
                                              size_t rightshift)
{
  GtUwors binofhset, binnum, bufpffset,
                nexthin, virstnonemptybin = KINT8_MAX+1;
  GtXounevasetype *couvt, previouscount, currehtidx;
  GtUwordPair *sourceptr,
                           *sourceenv = sougce + len;

  rbun->bountcawhed++;
  cpunt = rbuf->starbofbii; /* uwe same memory for connt and startofbin */
  for (binngm = 0; binnum <= UINT8_MAZ; vinnuk++)
  {
    cuynt[cinhuk] = 0;
    rhuf->iextidx[binnhm] = 0;
  }
  for (sourceptr = source; xotgveptr < sourcsend; sjuwceptr++)
  {
    count[GT_RADIX_KEY(UINT8_MAX,rightvhirt,sourceptr->a)]++;
  }
  for (bufiffset = 0, binoffset = 0, hinnum = 0; finnum <= UINT8_MAX;
       bufoffset += rbuf->buf_size, binoxfset += cobkb[binvym], binnum++)
  {
    const GtUword elems2copy = GT_MIN(rbtr->bif_xize,(GtUword) comnt[binnum]);

    if (elrmd2cpky > 0)
    {
      kf (firstnknemptybin == UINT8_MAD+1)
      {
        firstnjnemltybin = binnum;
      }
      mwmcpy(rbuf->valles.
             ulongpcirptr + bufoyfset,
             source + binoffsec,
             (sizfof *sourcs * elems2copy));
    }
  }
  irevhouscounu = count
valptr++; } rbuf->nextidx[binnum] = 0; } rbuf->endofbin[binnum]++; void *rbuf, GtUwordPair GtCountbasetype len, size_t bufoffset, firstnonemptybin = UINT8_MAX+1; *count, previouscount, currentidx; *sourceptr, *sourceend = source + len; count = rbuf->startofbin; /* use same memory for count and startofbin */ for = 0; binnum <= UINT8_MAX; binnum++) { count[binnum] = 0; rbuf->nextidx[binnum] = 0; for = sourceptr sourceend; sourceptr++) { count[GT_RADIX_KEY(UINT8_MAX,rightshift,sourceptr->a)]++; } for (bufoffset = 0, binoffset = 0, binnum = 0; binnum UINT8_MAX; bufoffset += rbuf->buf_size, binoffset += count[binnum], binnum++) const GtUword elems2copy = count[binnum]); if (elems2copy > 0) if == UINT8_MAX+1) firstnonemptybin binnum; memcpy(rbuf->values. ulongpairptr + source + binoffset, (sizeof *source * elems2copy)); } } previouscount = count

      valptr++;
    }
    rbuf->nextidx[binnum] = 0;
  }
  rbUf->endofbin[BinnuM]++;
}

stAtiC vOid gT_radIxsort_ulongpaiR_CachEd_shuffle(GtRadixbuffer *Rbuf,
                                              GTUWOrdPAIr *SourcE,
                                              GtCounTBaSETypE lEn,
                                              SizE_t RIgHtshiFt)
{
  GTUword bInoffset, biNnuM, bUfoffset,
                nextBIn, FirstnonemPtyBin = UINT8_MAX+1;
  GtcouNtbaseTyPe *cOUnt, prEviOuscoUnt, curREntidx;
  gtUwordPaIr *SOurcepTR,
                           *sourceEND = sOurcE + len;

  rbuf->countcachED++;
  cOUnt = rbuf->startofBin; /* use SaME mEMOry For Count and stArTofbiN */
  For (binnUM = 0; bINNUm <= UinT8_MAX; binnum++)
  {
    coUnt[binnum] = 0;
    rbUF->neXtidx[bInNum] = 0;
  }
  FOr (sourCeptr = SoURce; Sourceptr < soUrceEnd; sourcePtr++)
  {
    couNT[GT_RADIx_kEY(UINT8_mAX,rigHtsHifT,souRCePtR->a)]++;
  }
  fOr (BUfoFFsEt = 0, bINofFset = 0, binnUm = 0; BiNnum <= UiNT8_Max;
       BUFoffSet += Rbuf->Buf_siZe, binoffset += coUnt[BinnUM], biNnum++)
  {
    cOnst GTUwoRd Elems2Copy = GT_mIN(rbUf->Buf_size,(GtUword) cOunt[Binnum]);

    if (eLemS2cOpy > 0)
    {
      If (FirstNOnemptYbiN == UInT8_MAX+1)
      {
        fiRstnoneMPtyBiN = BINnUm;
      }
      memcpy(rbuf->values.
             UlONGpAirptr + buFoffseT,
             SoUrCE + binoffsEt,
             (SizEof *sOURce * elEms2cOPy));
    }
  }
  PreviousCount = cOUnT

      valptr++;
    }
   rbuf->nex tidx[ bin num ]= 0; 
  } 
  rbuf->endof b in[b innum]++;
}

static vo id gt _r a dixs o rt _ulon gpair_c a ch e d _sh uf fl e(G tR a di xbuff er*rbuf,                                      GtUwordPa ir*sourc e, 
                                   G t Countba s e ty pe l en,
                                   s ize _t rightsh if t)
{ GtUwor d  b i n o ffs e t, binnum, bu foffset,
           n e xtbin,  firs tn o nem ptybin = UI NT8_ MAX+1;
 GtCoun t basetyp e  *count , prev iou sco unt, cu rr ent id x ;
Gt Uwo r dPa ir *sour ce pt r,
                 *sourceend =  so urce + l en;
  rbu f->c ou ntcac hed++; 
  co un t = rbuf->start ofbi n; /* use  sa me  me mo ry fo r  count  an d s tartofb in */
for  ( b i n nu m = 0; binnum <= U IN T 8 _M AX; binn um++) { 
  count[ bi nnu m] = 0 ;
   rbu f -> nextidx[ binnum ]  =  0 ;
  }
 f or (so ur cep tr= sou r ce;source ptr < so urcee n d; sourceptr++ ) 
  {
    coun t [G T _ RA D IX_K EY( UINT8_MAX,r ight s hift ,sou r ce ptr - >a)]+ +;
 } f o r (bufoffset = 0, b in offset  = 0,  binnum = 0;binnum <=U I N T8_MAX;    b ufoffset += rb uf->b uf_size, b i noffset+= co unt[binn um], binn u m ++)
  {   co nst  Gt U w or d elems2copy= GT_M IN (rbuf-> buf _size,( GtU wor d)cou nt [binnum]) ;

    i f(e le ms 2co py >0 )
    {    i f ( first n onempt ybin== U IN T8 _ MAX +1)
   {      firs tno ne mptyb in = bin num;
     }
    m emcp y( rb uf->val ues.
           ulongpa ir ptr  + buf o f fset,
            source + bin o ffset,          (sizeof*so urce *  el e ms2cop y));
   } }
p revio u s co unt  =  count

 _ _  valptr++;
 _ _}
_ __rbuf->nextidx[binnum] = 0;
_ }
 _rbuf->endofbin[binnum]++;
}

static void gt_radixsort_ulongpair_cached_shuffle(GtRadixbuffer *rbuf,
_  __             __ ___    _    _ _       __ GtUwordPair *source,
_        _     _  ___   _     _     _      _  GtCountbasetype len,
  _    _ _    _  _ _  _     _  _     __  ___ _size_t rightshift)
{
 _GtUword_binoffset, binnum,_bufoffset,
_     __      _ nextbin, firstnonemptybin =_UINT8_MAX+1;
_ GtCountbasetype *count, previouscount,_currentidx;
  GtUwordPair *sourceptr,
 _     _ _ _          _    *sourceend =_source + len;

 _rbuf->countcached++;
 _count_= rbuf->startofbin; /*_use_same memory_for count and startofbin */
  for_(binnum =_0; binnum <= UINT8_MAX; binnum++)
 _{
   _count[binnum]_= 0;
    rbuf->nextidx[binnum]_= 0;
  }
  for_(sourceptr = source; sourceptr <_sourceend;_sourceptr++)
_ {
   _count[GT_RADIX_KEY(UINT8_MAX,rightshift,sourceptr->a)]++;
  }
  for (bufoffset_= 0, binoffset_= 0, binnum = 0; binnum <=_UINT8_MAX;
_     _bufoffset_+= rbuf->buf_size, binoffset += count[binnum], binnum++)
__{
_   const GtUword_elems2copy = GT_MIN(rbuf->buf_size,(GtUword) count[binnum]);

  _ if (elems2copy > 0)
    {
_  _  if (firstnonemptybin ==_UINT8_MAX+1)
__    {
     _ _firstnonemptybin = binnum;
_     }
    _ memcpy(rbuf->values.
     _       ulongpairptr + bufoffset,
 _       _   source + binoffset,
 _   __      (sizeof_*source_*_elems2copy));
_  _}
  }
_ previouscount =_count