summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/dwarf2out.c2
-rw-r--r--gcc/wide-int.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 143f1cf0051..20ee7ba8fa9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -14825,7 +14825,7 @@ simple_decl_align_in_bits (const_tree decl)
static inline offset_int
round_up_to_align (const offset_int &t, unsigned int align)
{
- return wi::udiv_trunc (t + align - 1, align) * align;
+ return wi::udiv_ceil (t, align) * align;
}
/* Given a pointer to a FIELD_DECL, compute and return the byte offset of the
diff --git a/gcc/wide-int.h b/gcc/wide-int.h
index 2163f3c75fd..767f24a2307 100644
--- a/gcc/wide-int.h
+++ b/gcc/wide-int.h
@@ -521,6 +521,7 @@ namespace wi
BINARY_FUNCTION udiv_floor (const T1 &, const T2 &);
BINARY_FUNCTION sdiv_floor (const T1 &, const T2 &);
BINARY_FUNCTION div_ceil (const T1 &, const T2 &, signop, bool * = 0);
+ BINARY_FUNCTION udiv_ceil (const T1 &, const T2 &);
BINARY_FUNCTION div_round (const T1 &, const T2 &, signop, bool * = 0);
BINARY_FUNCTION divmod_trunc (const T1 &, const T2 &, signop,
WI_BINARY_RESULT (T1, T2) *);
@@ -2563,6 +2564,13 @@ wi::div_ceil (const T1 &x, const T2 &y, signop sgn, bool *overflow)
return quotient;
}
+template <typename T1, typename T2>
+inline WI_BINARY_RESULT (T1, T2)
+wi::udiv_ceil (const T1 &x, const T2 &y)
+{
+ return div_ceil (x, y, UNSIGNED);
+}
+
/* Return X / Y, rouding towards nearest with ties away from zero.
Treat X and Y as having the signedness given by SGN. Indicate
in *OVERFLOW if the result overflows. */