NCBI C++ ToolKit
seq_vector_cvt_gcc_i386.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef SEQ_VECTOR_CVT_GCC_I386__HPP
2 #define SEQ_VECTOR_CVT_GCC_I386__HPP
3 /* $Id: seq_vector_cvt_gcc_i386.hpp 33815 2007-05-04 17:18:18Z kazimird $
4 * ===========================================================================
5 *
6 * PUBLIC DOMAIN NOTICE
7 * National Center for Biotechnology Information
8 *
9 * This software/database is a "United States Government Work" under the
10 * terms of the United States Copyright Act. It was written as part of
11 * the author's official duties as a United States Government employee and
12 * thus cannot be copyrighted. This software/database is freely available
13 * to the public for use. The National Library of Medicine and the U.S.
14 * Government have not placed any restriction on its use or reproduction.
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * Please cite the author in any work or product based on this material.
25 *
26 * ===========================================================================
27 *
28 * Author: Eugene Vasilchenko
29 *
30 * File Description:
31 * Seq-vector conversion functions for Intel CPU with GCC.
32 *
33 */
34 
36 
37 #if 0
38 template<class SrcCont>
39 void copy_2bit_table(char* dst, size_t count,
40  const SrcCont& srcCont, size_t srcPos,
41  const char* table)
42 {
43  const char* src = &srcCont[srcPos / 4];
44  {
45  // odd chars first
46  char c = *src;
47  switch ( srcPos % 4 ) {
48  case 1:
49  *(dst++) = table[(c >> 4) & 0x03];
50  if ( --count == 0 ) return;
51  // intentional fall through
52  case 2:
53  *(dst++) = table[(c >> 2) & 0x03];
54  if ( --count == 0 ) return;
55  // intentional fall through
56  case 3:
57  *(dst++) = table[(c ) & 0x03];
58  ++src;
59  --count;
60  break;
61  }
62  }
63  for ( DstIter end = dst + (count & ~3); dst != end; dst += 4, ++src ) {
64  char c3 = *src;
65  char c0 = c3 >> 6;
66  char c1 = c3 >> 4;
67  char c2 = c3 >> 2;
68  c0 = table[c0 & 0x03];
69  c1 = table[c1 & 0x03];
70  *(dst ) = c0;
71  c2 = table[c2 & 0x03];
72  *(dst+1) = c1;
73  c3 = table[c3 & 0x03];
74  *(dst+2) = c2;
75  *(dst+3) = c3;
76  }
77  // remaining odd chars
78  switch ( count % 4 ) {
79  case 3:
80  *(dst+2) = table[(*src >> 2) & 0x03];
81  // intentional fall through
82  case 2:
83  *(dst+1) = table[(*src >> 4) & 0x03];
84  // intentional fall through
85  case 1:
86  *(dst ) = table[(*src >> 6) & 0x03];
87  break;
88  }
89 
90 
91  copy_2bit_table_up(dst, count, src, table
93  asm volatile("lock; xaddl %1, %0" : "=m" (*nv_value_p), "=r" (result)
94  : "1" (delta), "m" (*nv_value_p));
95 
96 
97 #endif
98 
99 #endif//SEQ_VECTOR_CVT_GCC_I386__HPP
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
Int4 delta(size_t dimension_, const Int4 *score_)
#define count
void copy_2bit_table(DstIter dst, size_t count, const SrcCont &srcCont, size_t srcPos, const char *table)
else result
Definition: token2.c:20
Modified on Fri Sep 20 14:57:20 2024 by modify_doxy.py rev. 669887