generalize padding funcs

This commit is contained in:
2022-02-19 21:23:33 +02:00
committed by Motiejus Jakštys
parent 2fc925923f
commit ae2d3d5443
3 changed files with 20 additions and 19 deletions

View File

@@ -71,7 +71,7 @@ pub const ShellWriter = struct {
});
fullOffset += len;
const padding = pad.roundUp4Padding(u12, fullOffset);
const padding = pad.roundUpPadding(u12, 2, fullOffset);
fullOffset += padding;
//const stderr = std.io.getStdErr().writer();
//stderr.print("\n", .{}) catch unreachable;
@@ -209,7 +209,7 @@ test "basic shellpopcon" {
try testing.expectEqual(sections.getIndex(nobody), null);
try testing.expectEqual(
sections.sectionBlob().len,
pad.roundUp4(u12, bash.len) + pad.roundUp4(u12, zsh.len) + pad.roundUp4(u12, long.len),
pad.roundUp(u12, 2, bash.len) + pad.roundUp(u12, 2, zsh.len) + pad.roundUp(u12, 2, long.len),
);
const shellReader = ShellReader.init(