aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 23032b7..46b24b6 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2929,3 +2929,19 @@ gnu_debuglink_crc32 (unsigned long crc, unsigned char *buf, size_t len)
crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
return ~crc & 0xffffffff;;
}
+
+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;
+}
+
+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);
+}