Re: Counting Elements figured out.
- From: "David C. Hoos, Sr." <david.c.hoos.sr@xxxxxxxxx>
- Date: Fri, 25 Nov 2005 10:29:39 -0600
"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.
.
- Prev by Date: Re: autotools and ada
- Next by Date: Re: [OT] VMS ODS-5 filesystems, was: Re: Filenames in Ada
- Previous by thread: Tasking and wxWidgets
- Next by thread: Sequental IO and pointers
- Index(es):