comp.lang.ada
 help / color / mirror / Atom feed
* quick question
@ 2001-09-07 16:00 mop
  2001-09-07 18:53 ` James Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: mop @ 2001-09-07 16:00 UTC (permalink / raw)


I have something along these lines

Data : SomeType is  ( word1 => (x.a => 1,
                                                        x.b => Normal),
                                    --etc
                                      word8.checksum => Compute_Checksum);

Compute_Checksum here is a procedure that does a "straight" sum on the
bytes.  Dont care about overflow.   So now i need to take whatever value
compute_checksum returns and "pack" in word8.checksum.

I'm thinking that all i need to do is create some sort of array such that:

    type SomeType_Array is array (SomeType) of BYTE;

Trouble is is I'm hearing I need to do some sort of Unchecked Conversion
because of words like "Normal" which is not an integer or real, etc?  Is
this true, If yes how to do this.  Here is procedure Compute_Checksum

procedure Compute_Checksum is
       Checksum  : BYTE : = 0;
begin
      for i in SomeType_Array'First .. SomeType_Array'Last -1 loop
             Checksum :=  Checksum + SomeType_Array (i);
      end loop
     word8.checksum := Checksum;
end procedure Compute_Checksum;








^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-09-07 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-07 16:00 quick question mop
2001-09-07 18:53 ` James Rogers

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