From 82a487f5efd48d3ec5f35a72e826100371731506 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jul 2012 23:15:58 -0700 Subject: [PATCH] datarace: fixup, properly document BIT48 The "48-bit virtual address" macro should be checked with #if, not #ifdef, since it's defined to 1 or 0. You would use #ifdef if it's either "define" or "not defined." Make this clear in the comment as well. --- config.h | 5 +++-- datarace.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.h b/config.h index 31ae7a4..ed30531 100644 --- a/config.h +++ b/config.h @@ -4,8 +4,9 @@ #ifndef CONFIG_H #define CONFIG_H -/** Do we have a 48 bit virtual address (64 bit machine) or 32 bit addresses */ -#define BIT48 1 +/** Do we have a 48 bit virtual address (64 bit machine) or 32 bit addresses. + * Set to 1 for 48-bit, 0 for 32-bit. */ +#define BIT48 1 #endif diff --git a/datarace.cc b/datarace.cc index 294b6b9..f0d3dc6 100644 --- a/datarace.cc +++ b/datarace.cc @@ -14,7 +14,7 @@ void initRaceDetector() { * given address.*/ static uint64_t * lookupAddressEntry(void * address) { struct ShadowTable *currtable=root; -#ifdef BIT48 +#if BIT48 currtable=(struct ShadowTable *) currtable->array[(((uintptr_t)address)>>32)&MASK16BIT]; if (currtable==NULL) { currtable=(struct ShadowTable *) (root->array[(((uintptr_t)address)>>32)&MASK16BIT]=calloc(sizeof(struct ShadowTable),1)); -- 2.34.1