linux-mips
[Top] [All Lists]

Bit operations work differently on MIPS and IA32

To: <linux-mips@linux-mips.org>
Subject: Bit operations work differently on MIPS and IA32
From: <hemanth.venkatesh@wipro.com>
Date: Thu, 20 Jul 2006 21:32:27 +0530
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Thread-index: AcasFQ/xrmCPYNwVQ4+tr2B2UuBJFg==
Thread-topic: Bit operations work differently on MIPS and IA32

Hi All,

 

I ran the below program on an IA32 and AU1100 machine, both being little endian machines and got different results. Does anyone know what could be the cause of this behaviour. This problem is blocking us from booting the cramfs rootfs.

 

#include <stdio.h>

typedef unsigned int u32;

main()

{

struct tmp{

u32 namelen:6,offset:26;

}tmp1;

 

(*(int *)(&tmp1))=0x4c0;

 

printf("%d %d\n",tmp1.namelen,tmp1.offset);

 

}

 

Results on IA32 : 0 19

 

Results on AU1100 (MIPS):  0 1216

 

Thanks

hemanth

<Prev in Thread] Current Thread [Next in Thread>