Skip to content
Snippets Groups Projects
Commit ce8c221f authored by Michael Hauspie's avatar Michael Hauspie
Browse files

Fix align function

parent 54bfdd10
Branches
No related tags found
1 merge request!1Add a new `link` subcommand
...@@ -67,13 +67,10 @@ fn dump_sections<'s, T: Write>( ...@@ -67,13 +67,10 @@ fn dump_sections<'s, T: Write>(
Ok(output_size) Ok(output_size)
} }
/// returns the number of bytes needed to align value
/// on a given align size (must be a power of 2)
fn align(value: usize, align: usize) -> usize { fn align(value: usize, align: usize) -> usize {
let a = value & (align - 1); (value + (align - 1) & !(align - 1)) - value
if a == 0 {
0
} else {
align - a
}
} }
pub fn link(opts: Opts) -> Result<()> { pub fn link(opts: Opts) -> Result<()> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment