comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: converting floats, ints byte arrays
Date: Thu, 12 Jul 2001 06:45:16 GMT
Date: 2001-07-12T06:45:16+00:00	[thread overview]
Message-ID: <0Ib37.176424$%i7.115281587@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: 9ije24$9kg$1@fang.dsto.defence.gov.au

>a byte array, ie:
>type byte is mod 256;
>type byte_array is array(integer range <>) of byte;
>sampleRate : C.C_Float;
>scalingFactor : C.C_Float;
>What I want is an array where the first C.C_Float'size bytes is the sample
>rate,
  This is a perfect job for Streams.  It will produce an
Ada.Streams.Stream_Element_Array rather than a "byte_array", but
it's essentially the same thing.  In some cases a size might not be
the same as 'size, because the compiler can use the base_type'size.
e.g.
type little_integers is new integer range 0 .. 3;
for little_integers'size use 2;
would have a 'size of 2, but Streams would likely use Integer'size
instead.



  reply	other threads:[~2001-07-12  6:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12  5:46 converting floats, ints byte arrays Vladimir Bednikov
2001-07-12  6:45 ` tmoran [this message]
2001-07-12 16:35 ` Jeffrey Carter
2001-07-13 11:34 ` David C. Hoos
replies disabled

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