[llvm-commits] CVS: llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h

Joel Stanley jstanley at cs.uiuc.edu
Mon Jun 23 18:32:00 PDT 2003


Changes in directory llvm/include/llvm/Reoptimizer/BinInterface:

bitmath.h updated: 1.9 -> 1.10

---
Log message:



---
Diffs of the changes:

Index: llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h
diff -u llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h:1.9 llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h:1.10
--- llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h:1.9	Sat May 31 17:16:41 2003
+++ llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h	Mon Jun 23 18:31:47 2003
@@ -16,6 +16,8 @@
 #ifndef __BITMATH_H__
 #define __BITMATH_H__
 
+#include "Support/DataTypes.h"
+
 //*********************************
 //	Misc functions
 //*********************************
@@ -29,7 +31,7 @@
 //*********************************
 #define FLD_UPPER(FLD_DEF) (1 ? FLD_DEF)
 #define FLD_LOWER(FLD_DEF) (0 ? FLD_DEF)
-#define MASKBELOW(V)       ((1 << V) - 1)
+#define MASKBELOW(V)       ((((uint64_t) 1) << V) - 1) // 64-bit '1' constant here to avoid overflow warnings
 #define MASKEQBELOW(V)	   ((1 << V) | MASKBELOW(V)) //masks off everything ABOVE
 #define RD_FLD(x, FLD)     ((x & MASKEQBELOW(FLD_UPPER(FLD)))  >> FLD_LOWER(FLD))
 #define MK_FLD(FLD, val)   ((val << FLD_LOWER(FLD)) & MASKEQBELOW(FLD_UPPER(FLD)))
@@ -129,7 +131,9 @@
    return ((0xFFFFAA50 >> w) & 3)+n;   // this is a LUT
 }
 
-
+static unsigned LOW10(unsigned value)    { return value & 0x000003ff;       }
+static unsigned HIGH22(unsigned value)   { return value >> 10;              }
+static unsigned HIGHWORD(uint64_t value) { return (unsigned) (value >> 32); }
+static unsigned LOWWORD(uint64_t value)  { return (unsigned) value;         }
 
 #endif
-





More information about the llvm-commits mailing list