comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Counting Elements figured out.
Date: Fri, 25 Nov 2005 10:29:39 -0600
Date: 2005-11-25T10:29:39-06:00	[thread overview]
Message-ID: <KXGhf.36308$6y4.18407@bignews3.bellsouth.net> (raw)
In-Reply-To: pan.2005.11.30.01.47.41.83657@nowhere.net


"Freejack" <freejack@nowhere.net> wrote in message 
news:pan.2005.11.30.01.47.41.83657@nowhere.net...
> 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.





       reply	other threads:[~2005-11-25 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <pan.2005.11.30.01.47.41.83657@nowhere.net>
2005-11-25 16:29 ` David C. Hoos, Sr. [this message]
     [not found]   ` <pan.2005.11.30.23.15.25.917461@nowhere.net>
2005-12-02 23:09     ` Counting Elements figured out Robert A Duff
2005-12-03 22:04       ` Gisle Sælensminde
2005-12-03 22:21         ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox