[Verse-dev] Network packing of real64s (doubles)

Emil Brink verse-dev@blender.org
Fri, 19 Mar 2004 17:51:19 +0100 (MET)


On Fri, 19 Mar 2004, Eskil Steenberg wrote:

> Hi
>
> >Somebody sound the alarm, please.
[...]
> Alarm sounded!

Excellent. :)

> I always assumed that intel would do it right since its a 32bit
> architecture....
> Usually in 32bit architectures they read in doubles as two 32bit
> words.,  but i guess even then they do it wrong.

Heh. I don't think you should be so quick to blame Intel, here. I
quote the code, once again:

> size = vnp_raw_pack_uint32(buffer, ((uint32 *)p)[0]);
> size += vnp_raw_pack_uint32(&((uint8 *)buffer)[4], ((uint32 *)p)[1]);

Show me the 64-bit read that Intel did wrong. :)

> This was the same in the old verse right?

No. The original code reads like this:

gpointer vnp_raw_pack_gdouble(gpointer buffer, gdouble data)
{
	guint64	tmp;

	tmp = GUINT64_TO_BE(*((guint64 *) &data));

	return vnp_raw_pack_guint8_v(buffer, (guint8 *) &tmp, 8);
}

(Special-casing for ARM removed for brevity). See the difference?

> back then we used a64 bit integer but i dont think we word swapped
> right?

Sure we did. And we also actually did a 64-bit read, unlike the code
quoted above. It's in the details. :)

/Emil