Move the *ROUND* macros to a better place.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3897 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/stage1.c b/coregrind/stage1.c
index 7a3fb77..45a1999 100644
--- a/coregrind/stage1.c
+++ b/coregrind/stage1.c
@@ -45,6 +45,7 @@
 #include "ume.h"
 #include "memcheck/memcheck.h"
 #include "pub_core_debuglog.h"
+#include "pub_core_libcbase.h"
 #include "pub_core_libcproc.h"
 
 
diff --git a/coregrind/ume.c b/coregrind/ume.c
index 9393921..cd997ff 100644
--- a/coregrind/ume.c
+++ b/coregrind/ume.c
@@ -45,6 +45,7 @@
 #include <assert.h>
 
 #include "ume.h"
+#include "pub_core_libcbase.h"
 
 #if	ELFSZ == 64
 #define ESZ(x)	Elf64_##x
diff --git a/include/basic_types.h b/include/basic_types.h
index 786c3a2..7b747c5 100644
--- a/include/basic_types.h
+++ b/include/basic_types.h
@@ -69,11 +69,19 @@
    non-builtin types
    ------------------------------------------------------------------ */
 
+// XXX: these probably shouldn't be here...
+
 /* ThreadIds are simply indices into the VG_(threads)[] array. */
 typedef
    UInt
    ThreadId;
 
+/* Special magic value for an invalid ThreadId.  It corresponds to
+   LinuxThreads using zero as the initial value for
+   pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */
+#define VG_INVALID_THREADID ((ThreadId)(0))
+
+
 /* An abstraction of syscall return values.
    When .isError == False, val holds the return value.
    When .isError == True,  val holds the error code.
diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h
index e96a8c5..fb59b39 100644
--- a/include/pub_tool_libcbase.h
+++ b/include/pub_tool_libcbase.h
@@ -96,6 +96,13 @@
 #define VG_IS_WORD_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(sizeof(Addr)-1))))
 #define VG_IS_PAGE_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(VKI_PAGE_SIZE-1))))
 
+// 'a' -- the alignment -- must be a power of 2.
+// The latter two require the vki-*.h header to be imported also.
+#define VG_ROUNDDN(p, a)   ((Addr)(p) & ~((Addr)(a)-1))
+#define VG_ROUNDUP(p, a)   VG_ROUNDDN((p)+(a)-1, (a))
+#define VG_PGROUNDDN(p)    VG_ROUNDDN(p, VKI_PAGE_SIZE)
+#define VG_PGROUNDUP(p)    VG_ROUNDUP(p, VKI_PAGE_SIZE)
+
 /* ---------------------------------------------------------------------
    Misc useful functions
    ------------------------------------------------------------------ */
diff --git a/include/tool.h b/include/tool.h
index d837f3c..6fcb90d 100644
--- a/include/tool.h
+++ b/include/tool.h
@@ -57,12 +57,6 @@
 /*=== Useful macros                                                ===*/
 /*====================================================================*/
 
-// 'a' -- the alignment -- must be a power of 2
-#define VG_ROUNDDN(p, a)   ((Addr)(p) & ~((Addr)(a)-1))
-#define VG_ROUNDUP(p, a)   VG_ROUNDDN((p)+(a)-1, (a))
-#define VG_PGROUNDDN(p)    VG_ROUNDDN(p, VKI_PAGE_SIZE)
-#define VG_PGROUNDUP(p)    VG_ROUNDUP(p, VKI_PAGE_SIZE)
-
 /* Path to all our library/aux files */
 extern const Char *VG_(libdir);
 
@@ -73,11 +67,6 @@
 /* ------------------------------------------------------------------ */
 /* Thread-related stuff */
 
-/* Special magic value for an invalid ThreadId.  It corresponds to
-   LinuxThreads using zero as the initial value for
-   pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */
-#define VG_INVALID_THREADID ((ThreadId)(0))
-
 /* Get the TID of the thread which currently has the CPU. */
 extern ThreadId VG_(get_running_tid) ( void );