Re: [9fans] portability question

2010-06-17 Thread hugo rivera
Thanks for the feedback. 2010/6/16 Bakul Shah : > On Wed, 16 Jun 2010 11:11:09 +0200 hugo rivera  wrote: >> Can someone clarify why the program included outputs 'AB00' (as I >> expect) on 32 bit systems and 'AB00' on 64 bit systems? >> where all those 1's came from? what's the por

Re: [9fans] portability question

2010-06-16 Thread Bakul Shah
On Wed, 16 Jun 2010 11:11:09 +0200 hugo rivera wrote: > Can someone clarify why the program included outputs 'AB00' (as I > expect) on 32 bit systems and 'AB00' on 64 bit systems? > where all those 1's came from? what's the portable way of doing this? > sorry for newbie questions

Re: [9fans] portability question

2010-06-16 Thread erik quanstrom
> check the ASM, looks like c is being cast as signed and then sign > extended into a long and then ORed with l. > > perhaps this would solve it : > > l |= ((unsigned long) c) << 24 that works. the extra () are unnecessary. i think that gcc is using 6.3.1.1 and converting c to an int (since it

Re: [9fans] portability question

2010-06-16 Thread maht
On 06/16/10 10:11, hugo rivera wrote: > Can someone clarify why the program included outputs 'AB00' (as I > expect) on 32 bit systems and 'AB00' on 64 bit systems? > where all those 1's came from? what's the portable way of doing this? > sorry for newbie questions like this. > > >

Re: [9fans] portability question

2010-06-16 Thread Charles Forsyth
>Would you try %luX? It may work better? he's calling printf, not print

Re: [9fans] portability question

2010-06-16 Thread hugo rivera
2010/6/16 Lucio De Re : > On Wed, Jun 16, 2010 at 11:11:09AM +0200, hugo rivera wrote: > >>         printf("%lX\n", l); > > Would you try %luX?  It may work better? no, or at least not as I intend. It produces '2868903936X' on 32 bit linux and '18446744072283488256X' on 64 bit. According to printf

Re: [9fans] portability question

2010-06-16 Thread Lucio De Re
On Wed, Jun 16, 2010 at 11:11:09AM +0200, hugo rivera wrote: > printf("%lX\n", l); Would you try %luX? It may work better? ++L

[9fans] portability question

2010-06-16 Thread hugo rivera
Can someone clarify why the program included outputs 'AB00' (as I expect) on 32 bit systems and 'AB00' on 64 bit systems? where all those 1's came from? what's the portable way of doing this? sorry for newbie questions like this. unsigned long l; unsigned char c;