[llvm-commits] CVS: llvm/test/Libraries/libinstr/tracelib.c
Vikram Adve
vadve at cs.uiuc.edu
Fri Jul 11 17:03:00 PDT 2003
Changes in directory llvm/test/Libraries/libinstr:
tracelib.c updated: 1.5 -> 1.6
---
Log message:
Use uint32_t for table index and size: table will never be > 4GB.
Also, make Pointer type depend on architecture.
---
Diffs of the changes:
Index: llvm/test/Libraries/libinstr/tracelib.c
diff -u llvm/test/Libraries/libinstr/tracelib.c:1.5 llvm/test/Libraries/libinstr/tracelib.c:1.6
--- llvm/test/Libraries/libinstr/tracelib.c:1.5 Tue Jul 8 13:42:44 2003
+++ llvm/test/Libraries/libinstr/tracelib.c Fri Jul 11 17:02:28 2003
@@ -20,25 +20,29 @@
/* use #defines until we have inlining */
-typedef int64_t Generic;
-typedef uint64_t Index;
-typedef uint64_t Pointer;
+#ifndef sun
+typedef uint32_t Pointer; /* int representation of a pointer */
+#else
+typedef uint64_t Pointer; /* int representation of a pointer */
+#endif
+typedef uint32_t Index; /* type of index/size for hash table */
+typedef uint32_t Generic; /* type of values stored in table */
/* Index IntegerHashFunc(const Generic value, const Index size) */
#define IntegerHashFunc(value, size) \
- (((value << 3) ^ (value >> 3)) % size)
+ ( ((((Index) value) << 3) ^ (((Index) value) >> 3)) % size )
/* Index IntegerRehashFunc(const Generic oldHashValue, const Index size) */
#define IntegerRehashFunc(oldHashValue, size) \
- ((oldHashValue+16) % size) /* 16 is relatively prime to a Mersenne prime! */
+ ((Index) ((oldHashValue+16) % size)) /* 16 is relatively prime to a Mersenne prime! */
/* Index PointerHashFunc(const void* value, const Index size) */
#define PointerHashFunc(value, size) \
- IntegerHashFunc((Pointer) value, size)
+ IntegerHashFunc((Index) value, size)
/* Index PointerRehashFunc(const void* value, const Index size) */
#define PointerRehashFunc(value, size) \
- IntegerRehashFunc((Pointer) value, size)
+ IntegerRehashFunc((Index) value, size)
/*===---------------------------------------------------------------------=====
@@ -375,7 +379,7 @@
/* print sequence numbers out again to compare with (-r) and w/o release */
for (i=argc-1; i >= 0; --i)
for (j=0; argv[i][j]; ++j)
- printf("Sequence number for argc[%d][%d] (%c) = Hash(%p) = %d\n",
+ printf("Sequence number for argc[%d][%d] (%c) = %d\n",
i, j, argv[i][j], argv[i]+j, HashPointerToSeqNum(argv[i]+j));
return 0;
More information about the llvm-commits
mailing list