Re: [Dev-C++] Shift operators portability
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2003-09-23 15:26:50
|
The program picks up the first byte of the integer - as stored in memory.
If it is 1, it's the side where the "little" part of the integer is
stored. If it is 0, it's the side where the "large" part is stored.
Intel, AMD store low byte of integer first, so it is expected that at the
first byte of the address of the integer, the value 1 should be stored.
The other three bytes of the integer will all be zero.
/Per W
On Tue, 23 Sep 2003, Michael D. Smith wrote:
>
> Prints little endian. I have no idea why :)
>
> ms
>
>
> At 06:03 AM 9/23/03, you wrote:
> > > I have an AMD processor and no idea if it's big or little endian.
> >
> >main() {
> > int x = 1;
> > if (*(char *)&x == 1) {
> > printf("little-endian\n");
> > } else {
> > printf("big-endian\n");
> > }
> >}
> >
> >
> >Regards,
> > Neszt Tibor
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|