Function alignBackward [src]

Round an address down to the previous (or current) aligned address. The alignment must be a power of 2 and greater than 0.

Prototype

pub fn alignBackward(comptime T: type, addr: T, alignment: T) T

Parameters

T: typeaddr: Talignment: T

Source

pub fn alignBackward(comptime T: type, addr: T, alignment: T) T { assert(isValidAlignGeneric(T, alignment)); // 000010000 // example alignment // 000001111 // subtract 1 // 111110000 // binary not return addr & ~(alignment - 1); }