[llvm-commits] [llvm] r172015 - /llvm/trunk/lib/Object/Archive.cpp

Michael J. Spencer bigcheesegs at gmail.com
Wed Jan 9 14:58:43 PST 2013


Author: mspencer
Date: Wed Jan  9 16:58:43 2013
New Revision: 172015

URL: http://llvm.org/viewvc/llvm-project?rev=172015&view=rev
Log:
[Object][Archive] Use uint64_t instead of APInt. It is significantly faster.

Modified:
    llvm/trunk/lib/Object/Archive.cpp

Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=172015&r1=172014&r2=172015&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Wed Jan  9 16:58:43 2013
@@ -48,9 +48,9 @@
   }
 
   uint64_t getSize() const {
-    APInt ret;
+    uint64_t ret;
     StringRef(Size, sizeof(Size)).getAsInteger(10, ret);
-    return ret.getZExtValue();
+    return ret;
   }
 };
 }
@@ -110,11 +110,11 @@
     }
     // It's a long name.
     // Get the offset.
-    APInt offset;
+    uint64_t offset;
     name.substr(1).getAsInteger(10, offset);
     const char *addr = Parent->StringTable->Data.begin()
                        + sizeof(ArchiveMemberHeader)
-                       + offset.getZExtValue();
+                       + offset;
     // Verify it.
     if (Parent->StringTable == Parent->end_children()
         || addr < (Parent->StringTable->Data.begin()
@@ -133,9 +133,9 @@
     }
     return object_error::success;
   } else if (name.startswith("#1/")) {
-    APInt name_size;
+    uint64_t name_size;
     name.substr(3).getAsInteger(10, name_size);
-    Result = Data.substr(0, name_size.getZExtValue());
+    Result = Data.substr(0, name_size);
     return object_error::success;
   }
   // It's a simple name.
@@ -151,9 +151,9 @@
   // Don't include attached name.
   StringRef name =  ToHeader(Data.data())->getName();
   if (name.startswith("#1/")) {
-    APInt name_size;
+    uint64_t name_size;
     name.substr(3).getAsInteger(10, name_size);
-    size -= name_size.getZExtValue();
+    size -= name_size;
   }
   return size;
 }
@@ -163,9 +163,9 @@
   if (getName(name)) return NULL;
   int size = sizeof(ArchiveMemberHeader);
   if (name.startswith("#1/")) {
-    APInt name_size;
+    uint64_t name_size;
     name.substr(3).getAsInteger(10, name_size);
-    size += name_size.getZExtValue();
+    size += name_size;
   }
   return MemoryBuffer::getMemBuffer(Data.substr(size, getSize()),
                                     name,





More information about the llvm-commits mailing list