[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] Alignment in AMF data
From: |
Bastiaan Jacques |
Subject: |
Re: [Gnash-dev] Alignment in AMF data |
Date: |
Sat, 25 Oct 2008 13:56:45 -0700 (PDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
An interface that would solve the problem could look like this:
template <typename T, size_t N>
T
networkConvert(boost::uint8_t* word);
Where T is the requested type and N the number of bytes to read from
'word'. networkConvert copies the data byte by byte, solving the
alignment issue. For example:
double number = networkConvert<double, 8>(stream);
The point of the template here is to have the ability to add specialized
implementations, for example one for even and one for uneven sized byte
counts, without adding runtime overhead. networkConvert could call
swapBytes in its implementation, but from the perspective of the
interface we don't really care.
Thoughts?
Bastiaan
- Re: [Gnash-dev] Alignment in AMF data, (continued)
- 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
Re: [Gnash-dev] Alignment in AMF data, zou lunkai, 2008/10/24