comp.lang.ada
 help / color / mirror / Atom feed
* Re[2]: Re[2]: Storage Pool
@ 2001-06-14 13:21 ANH_VO
  0 siblings, 0 replies; only message in thread
From: ANH_VO @ 2001-06-14 13:21 UTC (permalink / raw)
  To: comp.lang.ada

Actually, I already had the alignment rules set like this

   function Aligned (
     Size      : System.Storage_Elements.Storage_Count;
     Alignment : System.Storage_Elements.Storage_Count)
           return System.Storage_Elements.Storage_Count is
   begin
      if Size rem Alignment /= 0 then
         return Size + Alignment - (Size mod Alignment);
      else
         return Size;
      end if;
   end Aligned;

   Then, the actual size is calculated 

   Actual_Size := 
     Aligned (Size_In_Storage_Elements, Aligment);

   However, if Size_In_Storage_Elements mod Alignment = 0 then Actual_Size =
Size_In_Storage_Elements. Thus, I can speed up the process by not calculating
the Actual_Size since it is not necessary.

Anh Vo


____________________Reply Separator____________________
Subject:    Re: Re[2]: Storage Pool
Author: Robert A Duff <bobduff@world.std.com>
Date:       6/14/01 2:57 PM

ANH_VO@udlp.com writes:

> Could you elaborate more on your NO answer? I do not have enough evidence to
say
> either way. However, based on test results from GNAT 3.13p, the answer is yes.
I
> need to conduct further test using APEX and ObjectAda. If it works as GNAT, I
> will post the codes.

I don't think the RM guarantees that Size_In_Storage_Element mod
Alignment = 0, but you may be right that it's always true in practise.

In any case, I think there's nothing wrong with writing a storage pool
that *requires* this property (or any other property), and tell users
of the pool that they must obey.

- Bob



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-14 13:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-14 13:21 Re[2]: Re[2]: Storage Pool ANH_VO

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