[EMAIL PROTECTED]:~$ cat t.c
#include <stdio.h>
int main()
{
int a = 0x21E;
int left = a >> 8;
int right = a & 0xFF;
printf("0x%02X 0x%02X 0x%02X\n", a, left, right);
}
[EMAIL PROTECTED]:~$ gcc -o tttt t.c
[EMAIL PROTECTED]:~$ ./tttt
0x21E 0x02 0x1E
[EMAIL PROTECTED]:~$
On Fri, Aug 19, 2005 at 02:25:16PM +0200, Bruno Berteau wrote:
> Fabian Vilers a ?crit :
>
> >Si tu as deux octets, divise ton nombre par 100 le r?sultat sera l'octet
> >"de gauche", reprend ton nombre initial, soustrait lui le r?sultat
> >pr?c?dent multipli? par 100 pour obtenir l'octet "de droite".
> >
> Merci Fabian,
>
> Yes c'est presque ?a. En fait c'est plut?t en divisant par 255 (ou FF en
> hexa) pour avoir l'octet de poids fort.
> int(21E / FF) = 2
>
> En tatonnant un peu J'ai retrouv? les calculs avec les op?rateurs logiques
>
> octet_gauche = 021E & FF
> octet_droite = (021E & FF00 ) / 100
>
> Merci de votre aide.
>
> Cordialement.
>
> --
> Bruno Berteau
> http://b.berteau.free.fr
>
> _______________________________________________________
> Linux Mailing List - http://www.unixtech.be
> Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
> Archives: http://www.mail-archive.com/[email protected]
> IRC: chat.unixtech.be:6667 - #unixtech
> NNTP: news.gname.org - gmane.org.user-groups.linux.unixtech
--
--
-> Jean-Francois Dive
--> [EMAIL PROTECTED]
I think that God in creating Man somewhat overestimated his ability.
-- Oscar Wilde
_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
Archives: http://www.mail-archive.com/[email protected]
IRC: chat.unixtech.be:6667 - #unixtech
NNTP: news.gname.org - gmane.org.user-groups.linux.unixtech