* Ada.Strings.Fixed.Overwrite(), functionality & performance
@ 2014-11-10 10:44 Markus Schöpflin
0 siblings, 0 replies; only message in thread
From: Markus Schöpflin @ 2014-11-10 10:44 UTC (permalink / raw)
Hello,
I'm wondering if there is an efficient way to implement
procedure OVERWRITE (SOURCE : in out STRING;
POSITION : in out POSITIVE;
NEW_ITEM : in STRING;
DROP : in TRUNCATION := RIGHT);
which should behave as
procedure OVERWRITE (SOURCE : in out STRING;
POSITION : in out POSITIVE;
NEW_ITEM : in STRING;
DROP : in TRUNCATION := RIGHT)
is begin
ADA.STRINGS.FIXED.OVERWRITE (SOURCE, POSITION, NEW_ITEM, DROP);
POSITION := POSITION + NATURAL'Min (NEW_ITEM'Length,
SOURCE'Last - POSITION + 1);
end;
using primitives from Ada.Strings.Fixed.
Currently I'm using a self-rolled version which turns out to be more than four
times faster than the naive implementation above; but I'm wondering whether
there isn't a better way to implement it just using primitives from
Ada.Strings.Fixed.
Markus
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-10 10:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-10 10:44 Ada.Strings.Fixed.Overwrite(), functionality & performance Markus Schöpflin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox