Ada to D - an array for storing values of each of the six bits which are sufficient

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 30 03:37:50 PDT 2015


Hi,
There is an array of values to store each of which sufficiently 6 
bits.
As it is written down on the D?

-----
With Ada.Text_IO; Use Ada.Text_IO;
With Ada.Integer_Text_IO; Use Ada.Integer_Text_IO;

procedure Program is
	type T_Type is range -10 .. 27;
for T_Type'Size use 6;

type Vector is array(1 .. 100) of T_Type;
Pragma Pack(Vector);
My_Array : constant Vector := (1 => -5, 2 => 22, others => 10);

begin
Put_Line(Integer'Image(My_Array'Size));
end Program;
-----
http://ideone.com/uAzl41


More information about the Digitalmars-d-learn mailing list