 +static int qnameid_cmpfunc(const void *p1, const void *p2){
 +  bamptr_t * const bp1 = *(bamptr_t**)p1;
 +  bamptr_t * const bp2 = *(bamptr_t**)p2;
-+  return bamptr_get_qnameid(bp1) - bamptr_get_qnameid(bp2);
++  uint64_t const id1 = bamptr_get_qnameid(bp1);
++  uint64_t const id2 = bamptr_get_qnameid(bp2);
++  int r;
++  if (id1 < id2) r = -1;
++  else if (id1 == id2) r = 0;
++  else /* id1 > id2 */ r = 1;
++  return r;
 +}
 +
 +static void mt_mate_finder__(int tidx, mt_find_mate_t * fm) {

+      if (*endp != '\0') n_hash_adder = 1;
+    }
+    fprintf(stderr, "(I) #split %d #parse %d #copy %d #hash %d\n", n_line_splitter, n_sam_parser, n_bam_copier, n_hash_adder);
+    const int n_threads_fm = cpu_map->use_nproc*0.9; //0.95=12.5s 0.9=11.9s, 7/8(0.87)=13.6s;
+    const int n_threads_ss = cpu_map->use_nproc; //-16;
+    fprintf(stderr, "(I) #mate %d #sort %d\n", n_threads_fm, n_threads_ss);
+

# DEALINGS IN THE SOFTWARE.
diff -uprN -x '*_Jul11' -x 'ibm_*' -x 'Numer*' -x a.out -x '#*#' -x version.h -x q -x '*~' -x '*.c.*' -x '*.a' -x .git -x .svn -x '*.MIT' 00_svn_r2/samtools-2015-08-19/samtools/bam_sam2bam.c ../files/samtools/bam_sam2bam.c
--- 00_svn_r2/samtools-2015-08-19/samtools/bam_sam2bam.c	1970-01-01 09:00:00.000000000 +0900
+++ ../files/samtools/bam_sam2bam.c	2016-10-24 17:27:16.277479651 +0900
@@ -0,0 +1,7797 @@
+#define _BAM_SAM2BAM_C
+/*  bam_sam2bam.c
+
