Author: Aaron M. Ucko <ucko@debian.org>
Date:   Wed, 01 Dec 2021 21:37:42 -0500
Description: Support x32

Avoid picking up wrong inline assembly.
--- a/c++/include/corelib/impl/ncbi_atomic_defs.h
+++ b/c++/include/corelib/impl/ncbi_atomic_defs.h
@@ -120,7 +120,7 @@ extern "C" {
   (defined(__i386)  ||  defined(__sparc)  ||  defined(__x86_64)  || \
    defined(__aarch64__))  && \
   (!defined(__GLIBCXX__)  ||  !defined(NCBI_TCHECK))
-#  if defined(__x86_64)  ||  defined(__aarch64__)
+#  if (defined(__x86_64)  &&  !defined(_ILP32))  ||  defined(__aarch64__)
 #    define NCBI_COUNTER_64_BIT
 #  endif
 #  ifdef NCBI_COUNTER_64_BIT
--- a/c++/src/build-system/configure
+++ b/c++/src/build-system/configure
@@ -28265,7 +28265,7 @@ $as_echo "$as_me: WARNING: $message" >&2
             darwin*:*86*:64 ) vdb_libpath=mac/$vdb_mode/x86_64/lib   ;;
             darwin*:*86*:* )  vdb_libpath=mac/$vdb_mode/fat86/lib    ;;
             darwin*:arm*   )  vdb_libpath=mac/$vdb_mode/arm64/lib    ;;
-            linux*:*86*:64 )  vdb_libpath=linux/$vdb_mode/x86_64/lib ;;
+            linux*:*86*64* )  vdb_libpath=linux/$vdb_mode/x86_64/lib ;;
             linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/arm64/lib  ;;
             * )
                if test -n "$with_vdb"; then
--- a/c++/src/build-system/configure.ac
+++ b/c++/src/build-system/configure.ac
@@ -7837,7 +7837,7 @@ if test "$with_vdb" != "no" ; then
             darwin*:*86*:64 ) vdb_libpath=mac/$vdb_mode/x86_64/lib   ;;
             darwin*:*86*:* )  vdb_libpath=mac/$vdb_mode/fat86/lib    ;;
             darwin*:arm*   )  vdb_libpath=mac/$vdb_mode/arm64/lib    ;;
-            linux*:*86*:64 )  vdb_libpath=linux/$vdb_mode/x86_64/lib ;;
+            linux*:*86*64* )  vdb_libpath=linux/$vdb_mode/x86_64/lib ;;
             linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/arm64/lib  ;;
             * )
                if test -n "$with_vdb"; then
--- a/c++/src/sra/readers/sra/wgsread.cpp
+++ b/c++/src/sra/readers/sra/wgsread.cpp
@@ -6185,9 +6185,10 @@ void CWGSSeqIterator::x_CreateFeaturesCh
     // select range of feature table rows
     auto range = GetLocFeatRowIdRange();
     auto feat_start = range.first + kFeatPerChunk*index;
-    auto feat_stop = min(range.first+range.second, feat_start+kFeatPerChunk);
+    auto feat_stop = min<TVDBRowId>(range.first+range.second,
+                                    feat_start+kFeatPerChunk);
     range.first = feat_start;
-    range.second = max(feat_start, feat_stop)-feat_start;
+    range.second = max<TVDBRowId>(feat_start, feat_stop)-feat_start;
     // create features
     info.chunk->SetData();
     CSeq_annot::TData::TFtable* main_features = 0;
