text stringlengths 0 234 |
|---|
end Update_Rotation; |
--- |
--- |
--- |
procedure Update_All_Rotations is |
begin |
for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop |
Update_Rotation (Element_Index); |
end loop; |
end Update_All_Rotations; |
-- |
-- |
-- |
procedure Remove_Empties is |
begin |
if Length (Swarm_State) > 1 then |
declare |
Element_Index : Swarm_Element_Index := First_Index (Swarm_State); |
begin |
while Element_Index <= Last_Index (Swarm_State) and then Length (Swarm_State) > 1 loop |
if Element (Swarm_State, Element_Index).Charge.Level = Empty_Charge then |
Remove_Vehicle_in_Stages (Element_Index); |
else |
Element_Index := Element_Index + 1; |
end if; |
end loop; |
Function Definition: procedure Distribute_Jobs (Job : Job_Type) is |
Function Body: use Swarm_Vectors; |
First_Element_Ix : constant Swarm_Element_Index := First_Index (Swarm_State); |
Last_Element_Ix : constant Swarm_Element_Index := Last_Index (Swarm_State); |
No_Of_Elements : constant Swarm_Element_Index := Swarm_Element_Index (Length (Swarm_State)); |
Elements_Per_Task : constant Swarm_Element_Index := Natural'Max (1, No_Of_Elements / No_Of_CPU_Cores); |
begin |
for Task_Index in Workers'First .. Workers'Last - 1 loop |
declare |
From_Ix : constant Integer := Swarm_Element_Index ((Integer (Task_Index) - Workers'First) * Elements_Per_Task + First_Element_Ix); |
To_Ix : constant Integer := Swarm_Element_Index ((Integer (Task_Index) - Workers'First + 1) * Elements_Per_Task + First_Element_Ix - 1); |
begin |
if From_Ix >= First_Element_Ix and then To_Ix <= Last_Element_Ix then |
Workers (Task_Index).Set_Job (Job, From_Ix, To_Ix); |
else |
Workers (Task_Index).Set_Job (No_Job, From_Ix, To_Ix); |
end if; |
Function Definition: function Current_Discharge_Per_Sec return Real is |
Function Body: (Charging_Setup.Constant_Discharge_Rate_Per_Sec + Charging_Setup.Propulsion_Discharge_Rate_Per_Sec * abs (Acceleration)); |
function Energy_Globes_Around return Energy_Globes is |
Globes_Found : Natural := 0; |
Globes_Detected : array (Globes'Range) of Boolean := (others => False); |
This_Element_Position : constant Positions := Position; |
begin |
for Globe_Ix in Globes'Range loop |
if abs (This_Element_Position - Globes (Globe_Ix).Position.all.Read) <= Energy_Globe_Detection then |
Globes_Detected (Globe_Ix) := True; |
Globes_Found := Globes_Found + 1; |
end if; |
end loop; |
declare |
Found_Globes : Energy_Globes (1 .. Globes_Found); |
Found_Globes_Ix : Natural := Globes'First; |
begin |
for Globe_Ix in Globes'Range loop |
if Globes_Detected (Globe_Ix) then |
Found_Globes (Found_Globes_Ix) := (Position => Globes (Globe_Ix).Position.all.Read, |
Velocity => Globes (Globe_Ix).Velocity.all.Read); |
Found_Globes_Ix := Found_Globes_Ix + 1; |
end if; |
end loop; |
return Found_Globes; |
Function Definition: function Cvt is new Ada.Unchecked_Conversion (I16, U16); |
Function Body: function Cvt is new Ada.Unchecked_Conversion (I32, U32); |
function Cvt is new Ada.Unchecked_Conversion (U16, I16); |
function Cvt is new Ada.Unchecked_Conversion (U32, I32); |
generic |
type Number is mod <>; |
procedure Read_Intel_x86_number (sb : in out GL.IO.Input_buffer; n : out Number); |
procedure Read_Intel_x86_number (sb : in out GL.IO.Input_buffer; n : out Number) is |
b : U8; |
m : Number := 1; |
bytes : constant Integer := Number'Size / 8; |
begin |
n := 0; |
for i in 1 .. bytes loop |
GL.IO.Get_Byte (sb, b); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.