MCPcopy Index your code
hub / github.com/RustPython/RustPython / compensate_alignment

Function compensate_alignment

crates/vm/src/buffer.rs:368–376  ·  view source on GitHub ↗
(offset: usize, align: usize)

Source from the content-addressed store, hash-verified

366}
367
368const fn compensate_alignment(offset: usize, align: usize) -> Option<usize> {
369 if align != 0 && offset != 0 {
370 // a % b == a & (b-1) if b is a power of 2
371 (align - 1).checked_sub((offset - 1) & (align - 1))
372 } else {
373 // alignment is already all good
374 Some(0)
375 }
376}
377
378pub(crate) struct FormatInfo {
379 pub size: usize,

Callers 1

parseMethod · 0.85

Calls 1

SomeClass · 0.50

Tested by

no test coverage detected