Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vsipl++] [patch] Add byte-swapping support to save/load_view.hpp


  • To: Don McCoy <don@xxxxxxxxxxxxxxxx>
  • Subject: Re: [vsipl++] [patch] Add byte-swapping support to save/load_view.hpp
  • From: Jules Bergmann <jules@xxxxxxxxxxxxxxxx>
  • Date: Thu, 17 Jul 2008 21:39:33 -0400

Don McCoy wrote:
There were two problems with the previous version of this patch.  First,
the save_view function was reversing the bytes in the view in-place. This has been fixed by forcing it to copy the view so as to avoid this
problem.  Second, complex values were being handled incorrectly, i.e.
for complex floats, the entire 8-byte quantity was being swapped leading
to the reversal of the imaginary and real components.  The correct
operation is to perform two, four-bytes swaps.

Regression tests for the above were added.

Don,

This look good, please check it in.

There are a couple of things we could do to further optimize
save_view, on a rainy day:

 - in save_view when it is necessary to swap bytes, instead of copying
   and then swapping bytes as two steps, it would be more efficient
   to perform that as a single step (copy & swap in one step).

 - also in save_view, instead of copying the entire view (which requires
   a potentially large temporary allocation), you could copy/swap the
   view in chunks.  The chunk size might be chosen (a) large enough for
   fwrite to be efficient and (b) small enough to live on the stack.

			-- Jules

--
Jules Bergmann
CodeSourcery
jules@xxxxxxxxxxxxxxxx
(650) 331-3385 x705