comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Adding offset to 'Address
Date: Fri, 12 Sep 2008 17:40:53 -0400
Date: 2008-09-12T17:40:53-04:00	[thread overview]
Message-ID: <wccy71xjb4q.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: ab194d94-6a10-4e83-bd2e-79966a07f90a@a2g2000prm.googlegroups.com

Adam Beneschan <adam@irvine.com> writes:

>   (Ethernet_Header'Size + System.Storage_Unit - 1) /
> System.Storage_Unit
>
> which rounds the size in bits up to the next multiple of
> System.Storage_Unit.  [System.Storage_Unit will equal 8 on most
> systems.]

It seems to me that this sort of thing won't work unless
System.Storage_Unit is 8 bits.  So you don't want rounding up.
It seems better to say:

    pragma Assert (System.Storage_Unit = 8);
    ... Raw_Bytes.all'Address + Ethernet_Header'Size/8 ...

If you really need to do this sort of thing, that is.

- Bob



  reply	other threads:[~2008-09-12 21:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12  8:35 Adding offset to 'Address Kim Rostgaard Christensen
2008-09-12  9:47 ` Georg Bauhaus
2008-09-12 10:17   ` Kim Rostgaard Christensen
2008-09-12 11:18     ` petter_fryklund
2008-09-12 15:23 ` Adam Beneschan
2008-09-12 21:40   ` Robert A Duff [this message]
2008-09-13  0:37     ` Adam Beneschan
2008-09-13  6:21   ` tmoran
2008-09-17  9:15     ` Kim Rostgaard Christensen
2008-09-19  6:09       ` Randy Brukardt
2008-09-19  9:25         ` anon
2008-09-13 10:18 ` Björn
2008-09-17  9:18   ` Kim Rostgaard Christensen
replies disabled

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