Skip to content

Commit 093869f

Browse files
committed
Clarify that in_bounds_index has unspecified behavior for invalid indices
1 parent 52f5219 commit 093869f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/flat.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ impl SampleLayout {
426426
/// Assumes that the image is backed by some sufficiently large buffer. Then computation can
427427
/// not overflow as we could represent the maximum coordinate. Since overflow is defined either
428428
/// way, this method can not be unsafe.
429+
///
430+
/// Behavior is *unspecified* if the index is out of bounds or this sample layout would require
431+
/// a buffer larger than `isize::MAX`.
429432
pub fn in_bounds_index(&self, c: u8, x: u32, y: u32) -> usize {
430433
let (c_stride, x_stride, y_stride) = self.strides_cwh();
431434
(y as usize * y_stride) + (x as usize * x_stride) + (c as usize * c_stride)

0 commit comments

Comments
 (0)