3rd_party/hmmer-3.1b2-linux-intel-x86_64/src/fm_general.c
/* Function:  getChar()
 * Synopsis:  Find the character c residing at a given position in the BWT.
 * Purpose:   This method must account for possible string compression, either
 *            4 characters in one byte for a 4-letter DNA/RNA alphabet, 2 chars
 *            per byte for a 15-letter alphabet of DNA/RNA with ambiguity codes,
 *            or one char per byte for amino acids.
 */
getChar()
Synopsis:  Find the character c residing at a given position in the BWT.
Purpose:   This method must account for possible string compression, either
4 characters in one byte for a 4-letter DNA/RNA alphabet, 2 chars
per byte for a 15-letter alphabet of DNA/RNA with ambiguity codes,
or one char per byte for amino acids.
getChar () Synopsis : Find the character c residing at a given position in the BWT . Purpose : This method must account for possible string compression either 4 characters in one byte for a 4 - letter DNA / RNA alphabet 2 chars per byte for a 15 - letter alphabet of DNA / RNA with ambiguity codes or one char per byte for amino acids .
uint8_t
fm_getChar(uint8_t alph_type, int j, const uint8_t *B )
{
  uint8_t c = -1;
  if (alph_type == fm_DNA ) {
    c = (B[j/4] >> ( 0x6 - ((j&0x3)*2) ) & 0x3);
  } else { 
    c = B[j];
  }
  return c;
}
uint8_t fm_getChar ( uint8_t alph_type , int j , const uint8_t * B ) { uint8_t c = -1 ; if ( alph_type == fm_DNA ) { c = ( B [ j / 4 ] >> ( 0x6 - ( ( j & 0x3 ) * 2 ) ) & 0x3 ) ; } else { c = B [ j ] ; } return c ; }
Function:  getChar()
 Synopsis:  Find the character c residing at a given position in the BWT.
Function : getChar () Synopsis : Find the character c residing at a given position in the BWT .
/* || alph_type == fm_RNA */ /*
     *  B[j/4] is the byte of B in which j is found
     *
     *  Let j' be the final two bits of j (j&0x2)
     *  The char bits are the two starting at position 2*j'.
     *  Without branching, grab them by shifting B[j/4] right 6-2*j' bits,
     *  then masking to keep the final two bits
     */ /*
  } else if (alph_type == fm_DNA_full ) {
    c = (B[j/2] >> (((j&0x1)^0x1)*4) ) & 0xf;  //unpack the char: shift 4 bits right if it's odd, then mask off left bits in any case
*/ // amino