Compare commits
No commits in common. "287a054d228b3b12d8b7721605e7b5cbb5af3891" and "e108486c17c33af715e593fdd12c57fe77cb674b" have entirely different histories.
287a054d22
...
e108486c17
|
@ -0,0 +1,6 @@
|
||||||
|
///
|
||||||
|
/// Rounds the `Number` `value` up to the nearest `multiple`.
|
||||||
|
///
|
||||||
|
pub fn roundUp(comptime Number: type, value: Number, multiple: Number) Number {
|
||||||
|
return value + @mod(@mod(multiple - value, multiple), multiple);
|
||||||
|
}
|
10
src/oar.zig
10
src/oar.zig
|
@ -7,19 +7,19 @@ const sys = @import("./sys.zig");
|
||||||
/// Typically, following this block in memory is the file data it holds the meta-information for.
|
/// Typically, following this block in memory is the file data it holds the meta-information for.
|
||||||
///
|
///
|
||||||
pub const Entry = extern struct {
|
pub const Entry = extern struct {
|
||||||
signature: [3]u8 = signature_magic,
|
signature: [3]u8,
|
||||||
revision: u8,
|
revision: u8,
|
||||||
name_length: u8 = 0,
|
name_length: u8,
|
||||||
name_buffer: [255]u8 = std.mem.zeroes([255]u8),
|
name_buffer: [255]u8 = std.mem.zeroes([255]u8),
|
||||||
file_size: u64,
|
file_size: u64,
|
||||||
padding: [244]u8 = std.mem.zeroes([244]u8),
|
padding: [244]u8,
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Returns `true` if `entry` correctly identifies itself as a valid Oar entry, otherwise
|
/// Returns `true` if `entry` correctly identifies itself as a valid Oar entry, otherwise
|
||||||
/// `false`.
|
/// `false`.
|
||||||
///
|
///
|
||||||
pub fn isValid(entry: Entry) bool {
|
pub fn isValid(entry: Entry) bool {
|
||||||
return std.mem.eql(u8, &entry.signature, signature_magic[0 ..]);
|
return std.mem.eql(u8, &entry.signature, "oar");
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -44,5 +44,5 @@ pub const Entry = extern struct {
|
||||||
///
|
///
|
||||||
/// Magic identifier used to validate [Entry] data.
|
/// Magic identifier used to validate [Entry] data.
|
||||||
///
|
///
|
||||||
const signature_magic = [3]u8{'o', 'a', 'r'};
|
const signature_magic = "oar";
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,6 +3,7 @@ const ext = @cImport({
|
||||||
});
|
});
|
||||||
|
|
||||||
const io = @import("./io.zig");
|
const io = @import("./io.zig");
|
||||||
|
const math = @import("./math.zig");
|
||||||
const mem = @import("./mem.zig");
|
const mem = @import("./mem.zig");
|
||||||
const meta = @import("./meta.zig");
|
const meta = @import("./meta.zig");
|
||||||
const oar = @import("./oar.zig");
|
const oar = @import("./oar.zig");
|
||||||
|
|
Loading…
Reference in New Issue