Re: i386 long Vs alpha long: htons/ntohs question.

From: Gigi Sullivan (sullivan@sikurezza.org)
Date: Thu Jan 27 2000 - 02:29:12 EST


Hello :)

        And Hi Matti :D

> > Hello there to all :)
> >
> > Maybe this could be a newbie question, but I never though at
> > this scenario before yestarday and I cannot try it to be sure,
> > so ... I'm asking here :)
> >
> > Let's consider this normal little data transfer between an
> > alpha architecture machine and an i386 one.
> ...
>
> Short-circuiting it all:
> In NETWORK the 'long' is from 32-bit era and is ALWAYS
> 32 bits. Thus htonl() handles 32 bit values, and htons()
> handles 16 bit values. Machine native 'long' size does
> not step into play in this.

        Ok, but what this means ?
        If on the alpha machine I initialize a u_long like:

        unsigned long data = 0xffffffffffffffff;

        then I do:
        
        data = htonl(data);

        What does it mean ? That htonl handle 32 bits `long data type'
        even on machine whose long data type is 64 bit ?
        So my data (on alpha) will lost 4 bytes when I'll do
        htonl on it ?

        Thx a lot :))

>
> /Matti Aarnio <matti.aarnio@sonera.fi>

bye bye

                                                -- gg sullivan

-- 
Lorenzo Cavallaro	`Gigi Sullivan' <sullivan@sikurezza.org>      -- ITALY

Until I loved, life had no beauty; I did not know I lived until I had loved. (Theodor Korner) - To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:33 EST