chiark / gitweb /
Use shifts rather than multiplies to scale up size requests.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 24 May 2014 14:00:30 +0000 (15:00 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 24 May 2014 14:00:30 +0000 (15:00 +0100)
vbig.cc

diff --git a/vbig.cc b/vbig.cc
index 338052e..86e24bf 100644 (file)
--- a/vbig.cc
+++ b/vbig.cc
@@ -215,11 +215,11 @@ int main(int argc, char **argv) {
     if(end == argv[1])
       fatal(0, "invalid size");
     if(!strcmp(end, "K"))
-      size *= 1024;
+      size <<= 10;
     else if(!strcmp(end, "M"))
-      size *= 1024 * 1024;
+      size <<= 20;
     else if(!strcmp(end, "G"))
-      size *= 1024 * 1024 * 1024;
+      size <<= 30;
     else if(*end)
       fatal(0, "invalid size");
   } else if(entireopt) {