I cannot tell whether the original comment was unsure about the arithmetic calculations, or if it was unsure about the assumptions being made about the alignment of the current allocation pointer. The arithmetic calculation looks fine to me, though. This technique is documented e.g. in Henry Warren's "Hacker's Delight" (section 3-1). (I am sure one can find it elsewhere too, its not an obscure property.)
This commit is contained in:
parent
747213a280
commit
861e6f5cd2
|
@ -20,7 +20,6 @@ extern {
|
|||
#[inline]
|
||||
pub fn get_box_size(body_size: uint, body_align: uint) -> uint {
|
||||
let header_size = size_of::<raw::Box<()>>();
|
||||
// FIXME (#2699): This alignment calculation is suspicious. Is it right?
|
||||
let total_size = align_to(header_size, body_align) + body_size;
|
||||
total_size
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue