File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -435,7 +435,8 @@ impl ArrayData {
435435 /// would return `20 * 8 = 160`.
436436 ///
437437 /// The `alignment` parameter is used to add padding to each buffer being counted, to ensure
438- /// the size for each one is aligned to `alignment` bytes (if it is `Some`)
438+ /// the size for each one is aligned to `alignment` bytes (if it is `Some`). This function
439+ /// assumes that `alignment` is a power of 2.
439440 pub fn get_slice_memory_size_with_alignment (
440441 & self ,
441442 alignment : Option < u8 > ,
@@ -449,7 +450,7 @@ impl ArrayData {
449450 // Just pulled from arrow-ipc
450451 #[ inline]
451452 fn pad_to_alignment ( alignment : u8 , len : usize ) -> usize {
452- let a = usize:: from ( alignment - 1 ) ;
453+ let a = usize:: from ( alignment. saturating_sub ( 1 ) ) ;
453454 ( ( len + a) & !a) - len
454455 }
455456
You can’t perform that action at this time.
0 commit comments