[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
endianness : Re: timer.c and ckinit.c Re: Timer resolution et al : Read_timer()
- Date: Sun, 14 Mar 2004 11:27:48 +0000 (GMT)
- From: g.rtems.a at gscott.co.uk (Gordon Scott)
- Subject: endianness : Re: timer.c and ckinit.c Re: Timer resolution et al : Read_timer()
On Sat, 13 Mar 2004, sashti srinivasan wrote:
> This lines store two bytes on variable clicks.
> clicks = (msb << 8) | lsb;
>
> My doubt is, since i386 is little endian, why this
> line is written like this instead of:
> clicks = (lsb << 8) | msb;
>
> I guess whatever is written already is correct,
> something is wrong with my understanding. Very
> sorry if my doubt is a trivial one.
The endianness of 'clicks' is irrelevant, because the compiler handles
that for you. The endianness of msb and lsb are already handler in the
fact that ther _sre_ msb and lsb .. the order those two data appear in
memory will change with endianness, but you don't see that in the above
code. You should see it if you look at the definitions of msb and lsb.
ATB,
Gordon.
--
Gordon Scott http://www.gscott.co.uk
Linux ... Because I like to *get* there today.
Hey, I'm looking for a new job! See -> http://www.gscott.co.uk