hmm cela doit être une chierie avec un cast automatique float/double <-> int
pour par ces macros de byte swapping.
entre temps j'ai failli me perdre dans un dédale de références de macros de .h
en .h sous osx, pffft, épuisant.
merci pour ton aide !
Le 1 mars 2012 à 16:57, Olivier Evalet a écrit :
> 1) tu as essayé en little endian, et juste pour voir dans tous les sens?
> uint64_t t1=0xC044000000000000;
> uint64_t t2=0x00000000C0440000;
> uint64_t t3=0x000000000000C044;
> uint64_t t4=0x00000000000044C0;
> uint64_t t5=0x000000000000440C;
> dprintf("test: %f;%f\n", be64toh(t1..5),le64toh(t1..5));
>
> c'est pédestre mais parfois ça aide.
>
> -- olivier
>
>
>
> 2012/3/1 Philippe Strauss <[email protected]>
> Hello,
>
> Je tombe sur un problème bizarre, cela paraît cul-cul la praline, mais bon,
> marche pas :-(
>
> j'ai codé deux petits bouts de soft, un côté en caml, l'autre en C.
> la partie caml encode un flottant 64 bits selon ieee 754, l'envoie en mode
> big endian par udp.
>
> sur le fil avec wireshark j'ai un champ à :
>
> 0xC0 44 00 00 00 00 00 00, ce pour la valeur -40.0 encodée. d'après
> binaryconvert.com, c'est juste.
>
> en C je fais:
>
> case volume:
> dprintf("a volume message: %f; mute: %d\n",
> be64toh(msgp->payload.vol.volume),
> be32toh(msgp->payload.vol.mute));
> break;
>
> j'ai pas l'air d'avoir de décalage dans mes bytes, et pourtant s'affiche:
>
> parsing msg, mtype=30, a volume message: 1330613449.029229; mute: 0
>
> -40.0 s'est muté en 1330613449.029229.
>
> nucht gut...
>
> si qqun est déjà passé par là, ça m'intéresse.
>
> --
> Philippe Strauss
> http://www.strauss-acoustics.ch/
>
>
>
>
>
> _______________________________________________
> gull mailing list
> [email protected]
> http://forum.linux-gull.ch/mailman/listinfo/gull
>
>
>
> --
> -------------------------------
> olivier.gelux.ch
> _______________________________________________
> gull mailing list
> [email protected]
> http://forum.linux-gull.ch/mailman/listinfo/gull
--
Philippe Strauss
http://www.strauss-acoustics.ch/
_______________________________________________
gull mailing list
[email protected]
http://forum.linux-gull.ch/mailman/listinfo/gull