Skip to content

Commit

Permalink
image: use assert in fromBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
arrufat committed Oct 30, 2024
1 parent 929ff86 commit 84fa108
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/image.zig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn Image(comptime T: type) type {

/// Contructs an image of rows and cols size reinterpreting the slice of bytes as a slice of T.
pub fn initFromBytes(rows: usize, cols: usize, bytes: []u8) Image(T) {
assert(rows * cols * @sizeOf(T) == bytes.len);
return .{
.rows = rows,
.cols = cols,
Expand Down

0 comments on commit 84fa108

Please sign in to comment.