summaryrefslogtreecommitdiffstats
path: root/src/misc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-06-22 23:04:53 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-06-22 23:04:53 -0700
commit0398ced8243806439b814f21ca7d6e584cea13a1 (patch)
tree8812787fdd028d6fa04b1206c628a1b0c4743417 /src/misc
parent70697f868a263930e971c062e5b46e64fbb1ee18 (diff)
downloadabc-0398ced8243806439b814f21ca7d6e584cea13a1.tar.gz
abc-0398ced8243806439b814f21ca7d6e584cea13a1.tar.bz2
abc-0398ced8243806439b814f21ca7d6e584cea13a1.zip
Version abc90714
committer: Baruch Sterin <baruchs@gmail.com>
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/util/abc_global.h24
-rw-r--r--src/misc/util/util_hack.h2
-rw-r--r--src/misc/vec/vec.h1
-rw-r--r--src/misc/vec/vecStr.h22
4 files changed, 42 insertions, 7 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h
index 35a391ba..f58e3ddf 100644
--- a/src/misc/util/abc_global.h
+++ b/src/misc/util/abc_global.h
@@ -153,6 +153,15 @@ typedef unsigned __int64 ABC_UINT64_T;
#define ABC_MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABC_INFINITY (100000000)
+#define ABC_PRT(a,t) (printf("%s = ", (a)), printf("%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC)))
+#define ABC_PRTn(a,t) (printf("%s = ", (a)), printf("%6.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC)))
+#define ABC_PRTP(a,t,T) (printf("%s = ", (a)), printf("%7.2f sec (%6.2f %%)\n", (float)(t)/(float)(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0))
+#define ABC_PRM(a,f) (printf("%s = ", (a)), printf("%7.2f Mb ", 1.0*(f)/(1<<20)))
+
+
+//#define ABC_USE_MEM_REC 1
+
+#ifndef ABC_USE_MEM_REC
#define ABC_ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
#define ABC_CALLOC(type, num) ((type *) calloc((num), sizeof(type)))
#define ABC_FALLOC(type, num) ((type *) memset(malloc(sizeof(type) * (num)), 0xff, sizeof(type) * (num)))
@@ -160,11 +169,16 @@ typedef unsigned __int64 ABC_UINT64_T;
#define ABC_REALLOC(type, obj, num) \
((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
((type *) malloc(sizeof(type) * (num))))
-
-#define ABC_PRT(a,t) (printf("%s = ", (a)), printf("%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC)))
-#define ABC_PRTn(a,t) (printf("%s = ", (a)), printf("%6.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC)))
-#define ABC_PRTP(a,t,T) (printf("%s = ", (a)), printf("%7.2f sec (%6.2f %%)\n", (float)(t)/(float)(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0))
-#define ABC_PRM(a,f) (printf("%s = ", (a)), printf("%7.2f Mb ", 1.0*(f)/(1<<20)))
+#else
+#include "utilMem.h"
+#define ABC_ALLOC(type, num) ((type *) Util_MemRecAlloc(malloc(sizeof(type) * (num))))
+#define ABC_CALLOC(type, num) ((type *) Util_MemRecAlloc(calloc((num), sizeof(type))))
+#define ABC_FALLOC(type, num) ((type *) memset(Util_MemRecAlloc(malloc(sizeof(type) * (num))), 0xff, sizeof(type) * (num)))
+#define ABC_FREE(obj) ((obj) ? (free((char *) Util_MemRecFree(obj)), (obj) = 0) : 0)
+#define ABC_REALLOC(type, obj, num) \
+ ((obj) ? ((type *) Util_MemRecAlloc(realloc((char *)(Util_MemRecFree(obj)), sizeof(type) * (num)))) : \
+ ((type *) Util_MemRecAlloc(malloc(sizeof(type) * (num)))))
+#endif
#ifdef __cplusplus
}
diff --git a/src/misc/util/util_hack.h b/src/misc/util/util_hack.h
index 825c8bee..33fb6c6b 100644
--- a/src/misc/util/util_hack.h
+++ b/src/misc/util/util_hack.h
@@ -58,7 +58,7 @@ extern "C" {
# define ARGS(args) args
# else
# define ARGS(args) ()
-# endif
+# endif
#endif
extern long Extra_CpuTime();
diff --git a/src/misc/vec/vec.h b/src/misc/vec/vec.h
index 915265f3..d6ed53b9 100644
--- a/src/misc/vec/vec.h
+++ b/src/misc/vec/vec.h
@@ -37,7 +37,6 @@
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
-
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h
index c77a3a17..bd10154c 100644
--- a/src/misc/vec/vecStr.h
+++ b/src/misc/vec/vecStr.h
@@ -572,6 +572,28 @@ static inline char Vec_StrPop( Vec_Str_t * p )
/**Function*************************************************************
+ Synopsis [Reverses the order of entries.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_StrReverseOrder( Vec_Str_t * p )
+{
+ int i, Temp;
+ for ( i = 0; i < p->nSize/2; i++ )
+ {
+ Temp = p->pArray[i];
+ p->pArray[i] = p->pArray[p->nSize-1-i];
+ p->pArray[p->nSize-1-i] = Temp;
+ }
+}
+
+/**Function*************************************************************
+
Synopsis [Comparison procedure for two clauses.]
Description []