Re: Counting Elements figured out.




"Freejack" <freejack@xxxxxxxxxxx> wrote in message
news:pan.2005.11.30.01.47.41.83657@xxxxxxxxxxxxxx
> The title says it all.
<snip>
> Marker := (Size_In_Storage_Elements + Alignment - 1) / Alignment;
>
> Okay...32 Integers.
> Storage_Unit <= 4
> Storage_Element'Size <= Storage_Unit
>
> Size_In_Storage_Elements <= 168 etc...
>
> Shouldn't it be ... Marker := (Size_In_Storage_Elements / Alignment);
> ?
No. The code is exactly correct; it handles cases where Size_In_Storage
Elements
is not evenly divisible by Alignment. Since integer division truncates,
adding one
less than the divisor insures that the quotient is larege enough to
accommodate
the fractional part, as well.


.