[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] Alignment in AMF data
From: |
strk |
Subject: |
Re: [Gnash-dev] Alignment in AMF data |
Date: |
Fri, 24 Oct 2008 21:25:22 +0200 |
On Fri, Oct 24, 2008 at 01:10:37PM -0600, Rob Savoye wrote:
> Bastiaan Jacques wrote:
> > So is this also an issue for differently sized integers? If so, we might
> > just change swapBytes to make a copy of the data and returning that
> > (after swapping the bytes).
>
> There are two schools of though on byte swapping. One thread is that
> when swapping bytes, you should never modify the raw data as read, and
> always make a copy of it. Most of the gnash code that uses swapBytes()
> defines a local variable, usually set by type casting from the raw data
> as read in network order. This is then passed to swapBytes(), so in a
> sense, we're already making a copy. This is the way I've been handling
> byte swapping so far.
>
> The other thread is that one always should just swap the raw data in
> place to avoid a copy, as you'd most likely always use the data in the
> host byte order anyway. This is better performance, but not what we're
> doing now.
Due to memory alignment constraints we'll have to copy anyway, so
I don't see any problem in there.
Just, copy and then swap makes a kind of second copy IFF swappign is
really needed, while assigning result of bitshifts would be a single
copy of each byte.
--strk;
- [Gnash-dev] Alignment in AMF data, Justin Dick, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, Russ Nelson, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, strk, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, strk, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, Rob Savoye, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, strk, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, Rob Savoye, 2008/10/24
- Re: [Gnash-dev] Alignment in AMF data, Justin Dick, 2008/10/24
Re: [Gnash-dev] Alignment in AMF data, Rob Savoye, 2008/10/24
Re: [Gnash-dev] Alignment in AMF data, strk, 2008/10/24