test for "long long" and %lld in configure.
authorAndrew Tridgell <tridge@samba.org>
Mon, 23 Mar 1998 14:46:03 +0000 (14:46 +0000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 23 Mar 1998 14:46:03 +0000 (14:46 +0000)
configure.in
main.c
match.c

index cc161e7..bd6384c 100644 (file)
@@ -52,6 +52,12 @@ main() { exit(fnmatch("*.o", "x.o", 0) == 0? 0: 1); }],
 echo yes;AC_DEFINE(HAVE_FNMATCH), 
 echo no)
 
+echo $ac_n "checking for long long... $ac_c"
+AC_TRY_RUN([#include <stdio.h>
+main() { long long x = 1000000000000; char b[20]; sprintf(b,"%lld", x); exit(strcmp("1000000000000", b) == 0? 0: 1); }],
+echo yes;AC_DEFINE(HAVE_LONGLONG), 
+echo no)
+
 echo $ac_n "checking for utimbuf ... $ac_c"
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <utime.h>],
diff --git a/main.c b/main.c
index 08d0929..1af6771 100644 (file)
--- a/main.c
+++ b/main.c
@@ -88,10 +88,17 @@ static void report(int f)
     tsize = read_longint(f);
   }
 
+#if HAVE_LONGLONG
+  printf("wrote %lld bytes  read %lld bytes  %g bytes/sec\n",
+        (long long)out,(long long)in,(in+out)/(0.5 + (t-starttime)));
+  printf("total size is %lld  speedup is %g\n",
+        (long long)tsize,(1.0*tsize)/(in+out));
+#else
   printf("wrote %ld bytes  read %ld bytes  %g bytes/sec\n",
         (long)out,(long)in,(in+out)/(0.5 + (t-starttime)));
   printf("total size is %ld  speedup is %g\n",
         (long)tsize,(1.0*tsize)/(in+out));
+#endif
 }
 
 
diff --git a/match.c b/match.c
index d5ceba3..1677900 100644 (file)
--- a/match.c
+++ b/match.c
@@ -96,7 +96,7 @@ static void matched(int f,struct sum_struct *s,struct map_struct *buf,
        off_t n = offset - last_match;
        int j;
 
-       if (verbose > 2 && i != -1)
+       if (verbose > 2 && i >= 0)
                fprintf(FERROR,"match at %d last_match=%d j=%d len=%d n=%d\n",
                        (int)offset,(int)last_match,i,(int)s->sums[i].len,(int)n);
 
@@ -106,7 +106,7 @@ static void matched(int f,struct sum_struct *s,struct map_struct *buf,
        if (n > 0)
                write_flush(f);
 
-       if (i != -1)
+       if (i >= 0)
                n += s->sums[i].len;
   
        for (j=0;j<n;j+=CHUNK_SIZE) {
@@ -115,8 +115,10 @@ static void matched(int f,struct sum_struct *s,struct map_struct *buf,
        }
 
 
-       if (i != -1)
+       if (i >= 0)
                last_match = offset + s->sums[i].len;
+       else
+               last_match = offset;
 }