86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
end loop;
end Process;
begin
Preallocate (Buffer, Data'Length);
Buffer.Ref.Update (Process'Access);
end Append_Reverse;
procedure Invert (Buffer : in out Atom_Buffer) is
procedure Process (Data : in out Atom);
procedure Process (Data : in out Atom) is
Low : Count := Data'First;
High : Count := Buffer.Used;
Tmp : Octet;
begin
while Low < High loop
Tmp := Data (Low);
Data (Low) := Data (High);
Data (High) := Tmp;
Low := Low + 1;
High := High - 1;
end loop;
end Process;
begin
if not Buffer.Ref.Is_Empty then
Buffer.Ref.Update (Process'Access);
end if;
end Invert;
function Length (Buffer : Atom_Buffer) return Count is
begin
return Buffer.Used;
end Length;
|