Next:Computing bounds onpoly_ints, Previous:Arithmetic onpoly_ints, Up:Sizes and offsets as runtime invariants [Contents][Index]
poly_ints ¶poly_int provides various routines for aligning values and for queryingmisalignments. In each case the alignment must be a power of 2.
Return true if we can alignvalue up or down to the nearest multipleofalign at compile time. The answer is the same for both directions.
Return true ifcan_align_p; if so, setaligned to the greatestaligned value that is less than or equal tovalue.
Return true ifcan_align_p; if so, setaligned to the lowestaligned value that is greater than or equal tovalue.
Return true if we can aligna andb down to the nearestalign boundary at compile time and if the two results are equal.
Return true if we can aligna andb up to the nearestalign boundary at compile time and if the two results are equal.
Return a result that is no greater thanvalue and that is alignedtoalign. The result will the closest aligned value for someindeterminate values but not necessarily for all.
For example, suppose we are allocating an object ofsize bytesin a downward-growing stack whose current limit is given bylimit.If the object requiresalign bytes of alignment, the new stacklimit is given by:
aligned_lower_bound (limit -size,align)
Likewise return a result that is no less thanvalue and that isaligned toalign. This is the routine that would be used forupward-growing stacks in the scenario just described.
Return true if we can calculate the misalignment ofvaluewith respect toalign at compile time, storing the result inmisalign if so.
Return the minimum alignment thatvalue is known to have(in other words, the largest alignment that can be guaranteedwhatever the values of the indeterminates turn out to be).Return 0 ifvalue is known to be 0.
Assert thatvalue can be aligned down toalign at compiletime and return the result. When using this routine, please add acomment explaining why the assertion is known to hold.
Likewise, but aligning up.
Divide the result offorce_align_down byalign. Again,please add a comment explaining why the assertion inforce_align_downis known to hold.
Likewise forforce_align_up.
Assert that we can calculate the misalignment ofvalue withrespect toalign at compile time and return the misalignment.When using this function, please add a comment explaining whythe assertion is known to hold.
Next:Computing bounds onpoly_ints, Previous:Arithmetic onpoly_ints, Up:Sizes and offsets as runtime invariants [Contents][Index]