From: broersma.juda_ANTISPAM_@tiscali.nl   
      
   Op Thu, 13 Oct 2005 17:12:43 +0100 schreef Dr John Stockton   
   :   
      
   >JRS: In article <4luqk1h2b8reltasns332spdavt4qheg7l@4ax.com>, dated   
   >Wed, 12 Oct 2005 23:06:43, seen in news:comp.lang.pascal.borland, Bart   
   > posted :   
   >   
   >>function CodonHash3(const ACodon: tCodon): Word;   
   >>// bit 6 and bit 7 are enough to identify the letter !!   
   >>// 'A' = 01000001 -> 00   
   >>// 'C' = 01000011 -> 01   
   >>// 'G' = 01000111 -> 11   
   >>// 'U' = 01010101 -> 10   
   >>begin   
   >> Result := (((Ord(ACodon[1]) and 7) shr 1) shl 4) +   
   >> (((Ord(ACodon[2]) and 7) shr 1) shl 2) +   
   >> ((Ord(ACodon[3]) and 7) shr 1);   
   >>end;   
   >   
   > (* Since bit 8 (1..8) is always the same,   
   > it does not really need to be removed. *)   
   >   
   > N := 0 ;   
   > for J := 1 to 3 do N := 4*N + (Ord(ACodon[J]) and 6)   
   >   
   >UNTESTED! Naturally, you write the loop unrolled.   
   >   
   Well, this modification being 1.06 times faster the original   
   CodonHash3 (and making a nice little HashTable), it still is 1.5 time   
   slower than the "Nested Case" method.   
      
   Bart   
   --   
   Bart Broersma   
   broersma.juda_ANTISPAM_@tiscali.nl   
   (ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|