Closed briansmith closed 8 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
c4742e0
) 96.02% compared to head (00c2368
) 96.02%. Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@joshlf Are you around? This isn't dealing with unsafe
exactly but it seems like you'd be the best person to review it.
Replace pointer-to-usize
as
conversions with use ofalign_offset
. This avoids any dependency on the way pointers are encoded.Previously when the buffer was already aligned the way we needed it, we'd treat the buffer as being misaligned by
ALIGNMENT
bytes. This wasn't problematic but it wasn't optimal. By usingalign_offset
, we'll recognize it as being misaligned by 0 bytes, i.e. already aligned.Previously we were allocating
ALIGNMENT
extra Limbs to have slack for alignment where we could have allocatedALIGNMMENT / LIMB_BYTES
extra limbs. Now, since we make the minimum alignment adjustment necessary, we can allocate 1 less limb than that.Be explicit that the type of the buffer elements is
Limb
. Usecore::mem::{align_of}::size_of::<Limb>()
instead ofLIMB_BYTES
.