[PATCH] Add a simple helper function to create a 64-bit integer.

Zachary Turner zturner at google.com
Wed May 28 12:15:55 PDT 2014


Hi rnk,

Add a function to combine two 32-bit integers into a 64-bit integer.  There are no calls to this function yet, although a subsequent change will add some in LLDB.

http://reviews.llvm.org/D3941

Files:
  include/llvm/Support/MathExtras.h

Index: include/llvm/Support/MathExtras.h
===================================================================
--- include/llvm/Support/MathExtras.h
+++ include/llvm/Support/MathExtras.h
@@ -258,6 +258,12 @@
   return static_cast<uint32_t>(Value);
 }
 
+/// Make_64 - This functions makes a 64-bit integer from a high / low pair of
+///           32-bit integers.
+inline uint64_t Make_64(uint32_t High, uint32_t Low) {
+  return ((uint64_t)High << 32) | (uint64_t)Low;
+}
+
 /// isInt - Checks if an integer fits into the given bit width.
 template<unsigned N>
 inline bool isInt(int64_t x) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3941.9885.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140528/7678e446/attachment.bin>


More information about the llvm-commits mailing list