We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11680d8 commit fa513afCopy full SHA for fa513af
1 file changed
vortex-buffer/src/buffer_mut.rs
@@ -68,11 +68,7 @@ impl<T> BufferMut<T> {
68
let mut bytes = BytesMut::zeroed((len * size_of::<T>()) + *alignment);
69
bytes.advance(bytes.as_ptr().align_offset(*alignment));
70
unsafe { bytes.set_len(len * size_of::<T>()) };
71
- let actual_len = if size_of::<T>() == 0 {
72
- 0
73
- } else {
74
- bytes.len() / size_of::<T>()
75
- };
+ let actual_len = bytes.len().checked_div(size_of::<T>()).unwrap_or(0);
76
Self {
77
bytes,
78
length: actual_len,
0 commit comments