/* Shared general utility routines for GDB, the GNU debugger.
- Copyright (C) 1986-2017 Free Software Foundation, Inc.
+ Copyright (C) 1986-2018 Free Software Foundation, Inc.
This file is part of GDB.
return xcalloc (1, size);
}
-void
-xfree (void *ptr)
-{
- if (ptr != NULL)
- free (ptr); /* ARI: free */
-}
-
void
xmalloc_failed (size_t size)
{
return ret;
}
+
+/* See common/common-utils.h. */
+
+ULONGEST
+align_up (ULONGEST v, int n)
+{
+ /* Check that N is really a power of two. */
+ gdb_assert (n && (n & (n-1)) == 0);
+ return (v + n - 1) & -n;
+}
+
+/* See common/common-utils.h. */
+
+ULONGEST
+align_down (ULONGEST v, int n)
+{
+ /* Check that N is really a power of two. */
+ gdb_assert (n && (n & (n-1)) == 0);
+ return (v & -n);
+}