S
shin
Guest
package sample is
type byte is range 00000000 to 1111111;
type integer is range -2147483647 to 2147483647;
function byte_to_integer(x : byte) return integer;
end sample;
PACKAGE BODY sample IS
function byte_to_integer (x : byte) return integer is
++++variable sum : integer :=0;
begin
for i in 0 to 7 loop
if x(i)='1' then
sum :=sum+2**i;
end if;
end loop;
return sum;
end ;
end sample;
-------------- ŔÎĹÍłÝ ÄŤ¸Ž˝ş¸ś KORNET -------------
type byte is range 00000000 to 1111111;
type integer is range -2147483647 to 2147483647;
function byte_to_integer(x : byte) return integer;
end sample;
PACKAGE BODY sample IS
function byte_to_integer (x : byte) return integer is
++++variable sum : integer :=0;
begin
for i in 0 to 7 loop
if x(i)='1' then
sum :=sum+2**i;
end if;
end loop;
return sum;
end ;
end sample;
-------------- ŔÎĹÍłÝ ÄŤ¸Ž˝ş¸ś KORNET -------------