From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2808111f01d47bd3,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!bigfeed.bellsouth.net!bignumber.bellsouth.net!news.bellsouth.net!bignews3.bellsouth.net.POSTED!84c79386!not-for-mail Reply-To: "David C. Hoos, Sr." From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada References: Subject: Re: Counting Elements figured out. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original Message-ID: X-Complaints-To: abuse@bellsouth.net X-Abuse-Info: Please forward a copy of all headers for proper handling X-Trace: bhmkggakljkaanefdbdpiflmbcekedmfhojhikkbagflhcbooclokfiffbflbcnglnnbdjhjmijoefhjnkjfddlgomgbfikmgojcbeghicandagjafiphlgbghfjeckkdbodbafmnfihkkmccnpdjnlfiihalnbd NNTP-Posting-Date: Fri, 25 Nov 2005 11:27:22 EST Organization: BellSouth Internet Group Date: Fri, 25 Nov 2005 10:29:39 -0600 Xref: g2news1.google.com comp.lang.ada:6615 Date: 2005-11-25T10:29:39-06:00 List-Id: "Freejack" wrote in message news:pan.2005.11.30.01.47.41.83657@nowhere.net... > The title says it all. > 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.