Re: Efficient scather-gather-copy



"Hynek Schlawack" <spamtrap@xxxxxxxxxx> wrote in message
news:x7slohocfb@xxxxxxxx
Hi,

I'm in the unlucky situation to convert mails from the "\n"-lineendings
to "\r\n"-ones.

I'm doing the rest of the program in C, but I hope to be able to use
some special CPU-capatibilities via inline-assembly to make this
_really_ fast.

If I'm not mistaken, I have to count the lines, alloc
sizeof(mail)+num_of_lines(mail), copy each line seperately with a space
between them to the buffer and replace the "\n" through "\r\n".

Is there something MMX, SSE et. al. could do for me? I'm pretty sure to
have seen a MMX-powered memcpy somewhere so I think it should be able to
help me at least a bit. It would be perfect to be able to supply a array
of sources and destinations, but I guess that would be wishful thinking.

You do *not* have to add CRs or LFs in memory. Just read the lines one by
one, stopping at any CR/LF, and append your personal preferred EoL when
outputting the line.

[Jongware]


.