[Top][All Lists]

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

Re: [Gnash-dev] Alignment in AMF data

From: zou lunkai
Subject: Re: [Gnash-dev] Alignment in AMF data
Date: Sat, 25 Oct 2008 10:57:19 +0800

>strk wrote:

>> readNetworkShort and readNetworkLong use bitshifting, so single copy and
>> byte order agnostic:

>> Maybe we really want a readNetworkDouble ...

> rob wrote:
>  We don't need to keep adding duplicate functions for code we already
>have that is heavily tested! How you swap the bytes is less important as
>long as it's byte order agnostic, like the current functions or macros.
>For example, all the code in libamf uses the standard macros or
>swapBytes() and works on both big endian and little endian, plus 64 bit
>systems of both. There is rarely ever a good reason to duplicate
>existing code with minor differences.

readNetworkShort() and  readNetworkLong() are mainly used in
as_value.cpp and netconnection.cpp.  If avoid using ntohs/l there
could drop the dependency of another library(it's WS2_32.LIB
on WIN32 platform, not sure about the linux OS), it would make

In my experience, "duplicate existing code" from an existing library/project
is a common case in the embeded world.  And we have a another word for
it, that's "specializing".  If we only need a few small non-core functions from
an external lib, I'd probably drop the lib and specialize these few
functions for
my own project. (But if the lib is already heavily involved, of course I would
think about port it and use it anyway).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]