[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Porting problem.

On Tue, Jul 13, 2004 at 05:33:41PM +0530, amith wrote:

> PS: This code runs smoothly on an ARM if i make sure i write to word 
> boundaries . i.e if i comment out Buffer++.
> Hope its a known problem and someone helps :-) !

It's part of the architecture.
You'll have to re-write your code to read chars from a char * pointer and
splice them together with bit shifts to get the 32 bit values you want.

Your code as is is not portable, and not ANSI conformant C. It happens to
work on x86 because x86 has no alignment constraints.

Offhand I'm not sure which other RISC platforms would segfault with your code,
as I believe some do messy kernel fixups to fake it working, but generally you
cannot rely on reading values larger than char from arbitrary alignments.

Nicholas Clark

Reply to: