2003-09-19 Andrew Cagney <cagney@redhat.com>
* utils.c (align_up, align_down): New functions. * defs.h (align_up, align_down): Declare. * ppc-sysv-tdep.c (align_up, align_down): Delete functions. * s390-tdep.c: Replace "round_up" and "round_down" with "align_up" and "align_down". (round_up, round_down): Delete functions. * mips-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and "align_down". (ROUND_DOWN, ROUND_UP): Delete macros. (mips_dump_tdep): Do not print "ROUND_UP" or "ROUND_DOWN". * h8300-tdep.c: Replace "round_up" and "round_down" with "align_up" and "align_down". (round_up, round_down): Delete macros. * frv-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and "align_down". (ROUND_UP, ROUND_DOWN): Delete macros.
This commit is contained in:
parent
9f6c1c4b8b
commit
5b03f2662b
8 changed files with 112 additions and 101 deletions
|
@ -1,3 +1,22 @@
|
|||
2003-09-19 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* utils.c (align_up, align_down): New functions.
|
||||
* defs.h (align_up, align_down): Declare.
|
||||
* ppc-sysv-tdep.c (align_up, align_down): Delete functions.
|
||||
* s390-tdep.c: Replace "round_up" and "round_down" with "align_up"
|
||||
and "align_down".
|
||||
(round_up, round_down): Delete functions.
|
||||
* mips-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and
|
||||
"align_down".
|
||||
(ROUND_DOWN, ROUND_UP): Delete macros.
|
||||
(mips_dump_tdep): Do not print "ROUND_UP" or "ROUND_DOWN".
|
||||
* h8300-tdep.c: Replace "round_up" and "round_down" with
|
||||
"align_up" and "align_down".
|
||||
(round_up, round_down): Delete macros.
|
||||
* frv-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and
|
||||
"align_down".
|
||||
(ROUND_UP, ROUND_DOWN): Delete macros.
|
||||
|
||||
2003-09-18 J. Brobecker <brobecker@gnat.com>
|
||||
|
||||
* hppa-hpux-tdep.c (_initialize_hppa_hpux_tdep): Remove a
|
||||
|
|
32
gdb/defs.h
32
gdb/defs.h
|
@ -1264,4 +1264,36 @@ extern int use_windows;
|
|||
#define ISATTY(FP) (isatty (fileno (FP)))
|
||||
#endif
|
||||
|
||||
/* Ensure that V is aligned to an N byte boundary (B's assumed to be a
|
||||
power of 2). Round up/down when necessary. Examples of correct
|
||||
use include:
|
||||
|
||||
addr = align_up (addr, 8); -- VALUE needs 8 byte alignment
|
||||
write_memory (addr, value, len);
|
||||
addr += len;
|
||||
|
||||
and:
|
||||
|
||||
sp = align_down (sp - len, 16); -- Keep SP 16 byte aligned
|
||||
write_memory (sp, value, len);
|
||||
|
||||
Note that uses such as:
|
||||
|
||||
write_memory (addr, value, len);
|
||||
addr += align_up (len, 8);
|
||||
|
||||
and:
|
||||
|
||||
sp -= align_up (len, 8);
|
||||
write_memory (sp, value, len);
|
||||
|
||||
are typically not correct as they don't ensure that the address (SP
|
||||
or ADDR) is correctly aligned (relying on previous alignment to
|
||||
keep things right). This is also why the methods are called
|
||||
"align_..." instead of "round_..." as the latter reads better with
|
||||
this incorrect coding style. */
|
||||
|
||||
extern ULONGEST align_up (ULONGEST v, int n);
|
||||
extern ULONGEST align_down (ULONGEST v, int n);
|
||||
|
||||
#endif /* #ifndef DEFS_H */
|
||||
|
|
|
@ -760,14 +760,11 @@ frv_frameless_function_invocation (struct frame_info *frame)
|
|||
return frameless_look_for_prologue (frame);
|
||||
}
|
||||
|
||||
#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1))
|
||||
#define ROUND_DOWN(n,a) ((n) & ~((a)-1))
|
||||
|
||||
static CORE_ADDR
|
||||
frv_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
|
||||
{
|
||||
/* Require dword alignment. */
|
||||
return ROUND_DOWN (sp, 8);
|
||||
return align_down (sp, 8);
|
||||
}
|
||||
|
||||
static CORE_ADDR
|
||||
|
@ -795,14 +792,14 @@ frv_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
|
||||
stack_space = 0;
|
||||
for (argnum = 0; argnum < nargs; ++argnum)
|
||||
stack_space += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), 4);
|
||||
stack_space += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])), 4);
|
||||
|
||||
stack_space -= (6 * 4);
|
||||
if (stack_space > 0)
|
||||
sp -= stack_space;
|
||||
|
||||
/* Make sure stack is dword aligned. */
|
||||
sp = ROUND_DOWN (sp, 8);
|
||||
sp = align_down (sp, 8);
|
||||
|
||||
stack_offset = 0;
|
||||
|
||||
|
@ -852,7 +849,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
argnum, *((int *)val), stack_offset, (int) (sp + stack_offset));
|
||||
#endif
|
||||
write_memory (sp + stack_offset, val, partial_len);
|
||||
stack_offset += ROUND_UP(partial_len, 4);
|
||||
stack_offset += align_up (partial_len, 4);
|
||||
}
|
||||
len -= partial_len;
|
||||
val += partial_len;
|
||||
|
|
|
@ -559,12 +559,6 @@ h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
|
|||
}
|
||||
}
|
||||
|
||||
/* Round N up or down to the nearest multiple of UNIT.
|
||||
Evaluate N only once, UNIT several times.
|
||||
UNIT must be a power of two. */
|
||||
#define round_up(n, unit) (((n) + (unit) - 1) & -(unit))
|
||||
#define round_down(n, unit) ((n) & -(unit))
|
||||
|
||||
/* Function: push_dummy_call
|
||||
Setup the function arguments for calling a function in the inferior.
|
||||
In this discussion, a `word' is 16 bits on the H8/300s, and 32 bits
|
||||
|
@ -641,12 +635,12 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
int argument;
|
||||
|
||||
/* First, make sure the stack is properly aligned. */
|
||||
sp = round_down (sp, wordsize);
|
||||
sp = align_down (sp, wordsize);
|
||||
|
||||
/* Now make sure there's space on the stack for the arguments. We
|
||||
may over-allocate a little here, but that won't hurt anything. */
|
||||
for (argument = 0; argument < nargs; argument++)
|
||||
stack_alloc += round_up (TYPE_LENGTH (VALUE_TYPE (args[argument])),
|
||||
stack_alloc += align_up (TYPE_LENGTH (VALUE_TYPE (args[argument])),
|
||||
wordsize);
|
||||
sp -= stack_alloc;
|
||||
|
||||
|
@ -665,7 +659,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
char *contents = (char *) VALUE_CONTENTS (args[argument]);
|
||||
|
||||
/* Pad the argument appropriately. */
|
||||
int padded_len = round_up (len, wordsize);
|
||||
int padded_len = align_up (len, wordsize);
|
||||
char *padded = alloca (padded_len);
|
||||
|
||||
memset (padded, 0, padded_len);
|
||||
|
|
|
@ -2822,18 +2822,12 @@ mips_type_needs_double_align (struct type *type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Macros to round N up or down to the next A boundary;
|
||||
A must be a power of two. */
|
||||
|
||||
#define ROUND_DOWN(n,a) ((n) & ~((a)-1))
|
||||
#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1))
|
||||
|
||||
/* Adjust the address downward (direction of stack growth) so that it
|
||||
is correctly aligned for a new stack frame. */
|
||||
static CORE_ADDR
|
||||
mips_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
|
||||
{
|
||||
return ROUND_DOWN (addr, 16);
|
||||
return align_down (addr, 16);
|
||||
}
|
||||
|
||||
static CORE_ADDR
|
||||
|
@ -2862,21 +2856,21 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
aligned. For n32 and n64, stack frames need to be 128-bit
|
||||
aligned, so we round to this widest known alignment. */
|
||||
|
||||
sp = ROUND_DOWN (sp, 16);
|
||||
struct_addr = ROUND_DOWN (struct_addr, 16);
|
||||
sp = align_down (sp, 16);
|
||||
struct_addr = align_down (struct_addr, 16);
|
||||
|
||||
/* Now make space on the stack for the args. We allocate more
|
||||
than necessary for EABI, because the first few arguments are
|
||||
passed in registers, but that's OK. */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
MIPS_STACK_ARGSIZE);
|
||||
sp -= ROUND_UP (len, 16);
|
||||
sp -= align_up (len, 16);
|
||||
|
||||
if (mips_debug)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"mips_eabi_push_dummy_call: sp=0x%s allocated %d\n",
|
||||
paddr_nz (sp), ROUND_UP (len, 16));
|
||||
"mips_eabi_push_dummy_call: sp=0x%s allocated %ld\n",
|
||||
paddr_nz (sp), (long) align_up (len, 16));
|
||||
|
||||
/* Initialize the integer and float register pointers. */
|
||||
argreg = A0_REGNUM;
|
||||
|
@ -3083,7 +3077,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
only needs to be adjusted when it has been used. */
|
||||
|
||||
if (stack_used_p)
|
||||
stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE);
|
||||
stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE);
|
||||
}
|
||||
}
|
||||
if (mips_debug)
|
||||
|
@ -3124,19 +3118,19 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
aligned. For n32 and n64, stack frames need to be 128-bit
|
||||
aligned, so we round to this widest known alignment. */
|
||||
|
||||
sp = ROUND_DOWN (sp, 16);
|
||||
struct_addr = ROUND_DOWN (struct_addr, 16);
|
||||
sp = align_down (sp, 16);
|
||||
struct_addr = align_down (struct_addr, 16);
|
||||
|
||||
/* Now make space on the stack for the args. */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
MIPS_STACK_ARGSIZE);
|
||||
sp -= ROUND_UP (len, 16);
|
||||
sp -= align_up (len, 16);
|
||||
|
||||
if (mips_debug)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"mips_n32n64_push_dummy_call: sp=0x%s allocated %d\n",
|
||||
paddr_nz (sp), ROUND_UP (len, 16));
|
||||
"mips_n32n64_push_dummy_call: sp=0x%s allocated %ld\n",
|
||||
paddr_nz (sp), (long) align_up (len, 16));
|
||||
|
||||
/* Initialize the integer and float register pointers. */
|
||||
argreg = A0_REGNUM;
|
||||
|
@ -3314,7 +3308,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
adjusted when it has been used. */
|
||||
|
||||
if (stack_used_p)
|
||||
stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE);
|
||||
stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE);
|
||||
}
|
||||
}
|
||||
if (mips_debug)
|
||||
|
@ -3355,19 +3349,19 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
aligned. For n32 and n64, stack frames need to be 128-bit
|
||||
aligned, so we round to this widest known alignment. */
|
||||
|
||||
sp = ROUND_DOWN (sp, 16);
|
||||
struct_addr = ROUND_DOWN (struct_addr, 16);
|
||||
sp = align_down (sp, 16);
|
||||
struct_addr = align_down (struct_addr, 16);
|
||||
|
||||
/* Now make space on the stack for the args. */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
MIPS_STACK_ARGSIZE);
|
||||
sp -= ROUND_UP (len, 16);
|
||||
sp -= align_up (len, 16);
|
||||
|
||||
if (mips_debug)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"mips_o32_push_dummy_call: sp=0x%s allocated %d\n",
|
||||
paddr_nz (sp), ROUND_UP (len, 16));
|
||||
"mips_o32_push_dummy_call: sp=0x%s allocated %ld\n",
|
||||
paddr_nz (sp), (long) align_up (len, 16));
|
||||
|
||||
/* Initialize the integer and float register pointers. */
|
||||
argreg = A0_REGNUM;
|
||||
|
@ -3478,7 +3472,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
argreg += FP_REGISTER_DOUBLE ? 1 : 2;
|
||||
}
|
||||
/* Reserve space for the FP register. */
|
||||
stack_offset += ROUND_UP (len, MIPS_STACK_ARGSIZE);
|
||||
stack_offset += align_up (len, MIPS_STACK_ARGSIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3622,7 +3616,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
refered to as their "home". Consequently, space is
|
||||
always allocated. */
|
||||
|
||||
stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE);
|
||||
stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE);
|
||||
}
|
||||
}
|
||||
if (mips_debug)
|
||||
|
@ -3663,19 +3657,19 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
aligned. For n32 and n64, stack frames need to be 128-bit
|
||||
aligned, so we round to this widest known alignment. */
|
||||
|
||||
sp = ROUND_DOWN (sp, 16);
|
||||
struct_addr = ROUND_DOWN (struct_addr, 16);
|
||||
sp = align_down (sp, 16);
|
||||
struct_addr = align_down (struct_addr, 16);
|
||||
|
||||
/* Now make space on the stack for the args. */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
|
||||
MIPS_STACK_ARGSIZE);
|
||||
sp -= ROUND_UP (len, 16);
|
||||
sp -= align_up (len, 16);
|
||||
|
||||
if (mips_debug)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"mips_o64_push_dummy_call: sp=0x%s allocated %d\n",
|
||||
paddr_nz (sp), ROUND_UP (len, 16));
|
||||
"mips_o64_push_dummy_call: sp=0x%s allocated %ld\n",
|
||||
paddr_nz (sp), (long) align_up (len, 16));
|
||||
|
||||
/* Initialize the integer and float register pointers. */
|
||||
argreg = A0_REGNUM;
|
||||
|
@ -3786,7 +3780,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
argreg += FP_REGISTER_DOUBLE ? 1 : 2;
|
||||
}
|
||||
/* Reserve space for the FP register. */
|
||||
stack_offset += ROUND_UP (len, MIPS_STACK_ARGSIZE);
|
||||
stack_offset += align_up (len, MIPS_STACK_ARGSIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3930,7 +3924,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||
refered to as their "home". Consequently, space is
|
||||
always allocated. */
|
||||
|
||||
stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE);
|
||||
stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE);
|
||||
}
|
||||
}
|
||||
if (mips_debug)
|
||||
|
@ -6399,10 +6393,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
|
|||
fprintf_unfiltered (file,
|
||||
"mips_dump_tdep: RA_REGNUM = %d\n",
|
||||
RA_REGNUM);
|
||||
fprintf_unfiltered (file,
|
||||
"mips_dump_tdep: ROUND_DOWN = function?\n");
|
||||
fprintf_unfiltered (file,
|
||||
"mips_dump_tdep: ROUND_UP = function?\n");
|
||||
#ifdef SAVED_BYTES
|
||||
fprintf_unfiltered (file,
|
||||
"mips_dump_tdep: SAVED_BYTES = %d\n",
|
||||
|
|
|
@ -29,21 +29,6 @@
|
|||
|
||||
#include "ppc-tdep.h"
|
||||
|
||||
/* Ensure that X is aligned to an S byte boundary (assuming that S is
|
||||
a power of 2) rounding up/down where necessary. */
|
||||
|
||||
static ULONGEST
|
||||
align_up (ULONGEST x, int s)
|
||||
{
|
||||
return (x + s - 1) & -s;
|
||||
}
|
||||
|
||||
static ULONGEST
|
||||
align_down (ULONGEST x, int s)
|
||||
{
|
||||
return (x & -s);
|
||||
}
|
||||
|
||||
/* Pass the arguments in either registers, or in the stack. Using the
|
||||
ppc sysv ABI, the first eight words of the argument list (that might
|
||||
be less than eight parameters if some parameters occupy more than one
|
||||
|
|
|
@ -2206,28 +2206,6 @@ extend_simple_arg (struct value *arg)
|
|||
}
|
||||
|
||||
|
||||
/* Round ADDR up to the next N-byte boundary. N must be a power of
|
||||
two. */
|
||||
static CORE_ADDR
|
||||
round_up (CORE_ADDR addr, int n)
|
||||
{
|
||||
/* Check that N is really a power of two. */
|
||||
gdb_assert (n && (n & (n-1)) == 0);
|
||||
return ((addr + n - 1) & -n);
|
||||
}
|
||||
|
||||
|
||||
/* Round ADDR down to the next N-byte boundary. N must be a power of
|
||||
two. */
|
||||
static CORE_ADDR
|
||||
round_down (CORE_ADDR addr, int n)
|
||||
{
|
||||
/* Check that N is really a power of two. */
|
||||
gdb_assert (n && (n & (n-1)) == 0);
|
||||
return (addr & -n);
|
||||
}
|
||||
|
||||
|
||||
/* Return the alignment required by TYPE. */
|
||||
static int
|
||||
alignment_of (struct type *type)
|
||||
|
@ -2304,7 +2282,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|||
&& pass_by_copy_ref (type))
|
||||
{
|
||||
sp -= length;
|
||||
sp = round_down (sp, alignment_of (type));
|
||||
sp = align_down (sp, alignment_of (type));
|
||||
write_memory (sp, VALUE_CONTENTS (arg), length);
|
||||
copy_addr[i] = sp;
|
||||
num_copies++;
|
||||
|
@ -2323,7 +2301,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|||
struct type *type = VALUE_TYPE (arg);
|
||||
int length = TYPE_LENGTH (type);
|
||||
|
||||
sp = round_down (sp, alignment_of (type));
|
||||
sp = align_down (sp, alignment_of (type));
|
||||
|
||||
/* SIMPLE_ARG values get extended to DEPRECATED_REGISTER_SIZE bytes.
|
||||
Assume every argument is. */
|
||||
|
@ -2333,12 +2311,12 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|||
}
|
||||
|
||||
/* Include space for any reference-to-copy pointers. */
|
||||
sp = round_down (sp, pointer_size);
|
||||
sp = align_down (sp, pointer_size);
|
||||
sp -= num_copies * pointer_size;
|
||||
|
||||
/* After all that, make sure it's still aligned on an eight-byte
|
||||
boundary. */
|
||||
sp = round_down (sp, 8);
|
||||
sp = align_down (sp, 8);
|
||||
|
||||
/* Finally, place the actual parameters, working from SP towards
|
||||
higher addresses. The code above is supposed to reserve enough
|
||||
|
@ -2403,7 +2381,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|||
{
|
||||
/* Simple args are always extended to
|
||||
DEPRECATED_REGISTER_SIZE bytes. */
|
||||
starg = round_up (starg, DEPRECATED_REGISTER_SIZE);
|
||||
starg = align_up (starg, DEPRECATED_REGISTER_SIZE);
|
||||
|
||||
/* Do we need to pass a pointer to our copy of this
|
||||
argument? */
|
||||
|
@ -2420,10 +2398,10 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|||
else
|
||||
{
|
||||
/* You'd think we should say:
|
||||
starg = round_up (starg, alignment_of (type));
|
||||
starg = align_up (starg, alignment_of (type));
|
||||
Unfortunately, GCC seems to simply align the stack on
|
||||
a four/eight-byte boundary, even when passing doubles. */
|
||||
starg = round_up (starg, S390_STACK_PARAMETER_ALIGNMENT);
|
||||
starg = align_up (starg, S390_STACK_PARAMETER_ALIGNMENT);
|
||||
write_memory (starg, VALUE_CONTENTS (arg), length);
|
||||
starg += length;
|
||||
}
|
||||
|
|
16
gdb/utils.c
16
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue