[Xorp-hackers] [PATCH] Support for IEEE754 binary64 format in XRLs

Ben Greear greearb at candelatech.com
Thu Sep 1 08:31:35 PDT 2011


On 09/01/2011 02:50 AM, Steven Simpson wrote:
> On 31/08/11 16:18, Ben Greear wrote:
>> On 08/31/2011 04:55 AM, ss at comp.lancs.ac.uk wrote:
>>> diff --git a/xorp/libxipc/SConscript b/xorp/libxipc/SConscript
>>> index 104bc8e..e7cf973 100644
>>> --- a/xorp/libxipc/SConscript
>>> +++ b/xorp/libxipc/SConscript
>>> @@ -87,6 +87,7 @@ libxipc_sources = [
>>>        'xrl_std_router.cc',
>>>        'xrl_tokens.cc',
>>>        'xuid.cc',                # only for udp (and fea tcpudp mgr)
>>> +    'fp64serial.c',
>>>        ]
>>
>> It should be a .cc file I think.
>
> It was intentional.  It appeared to be the easiest way to access certain
> C99 features portably - they don't all appear automatically in C++ (so I
> discovered).  I don't think finding a strictly C++ solution buys you
> very much for the effort - it's just two ordinary functions that don't
> use any C++ features.  Is it vital to be C++ for other reasons?  I'll
> put the effort in if so.

It's not vital..if there's a big reason for it to be C instead of C++, that's
OK by me.

Have you tried compiling this on older systems..say perhaps Fedora Core 5?

Some folks use old compilers and such for embedded systems and cannot easily
upgrade to later code...

>> In general, I'm amazed at how much code this took, but from skimming
>> through
>> it quickly, I didn't notice any issues.  I guess floating-point
>> serialization
>> is just a pain in the arse to do right!
>
> It's a matter of recognizing that double has many implementation-defined
> characteristics, so it can't just be shifted and masked like an
> integer.  frexp, ldexp, etc allow it to be expressed more portably, and
> shouldn't be too costly on most systems.

Could you just convert it to a string and pass it that way?

But, as long as your stuff compiles and works on stuff at least as
old as Fedora 5, then that's good enough for me.

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-hackers mailing list