From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <1ebc06ba0079a91546444a93ab21bc65@quintile.net> <12706eb9d1aafea3af76c427a31aae1a@coraid.com> Date: Wed, 27 Nov 2013 11:24:37 -0800 Message-ID: From: Skip Tavakkolian To: erik quanstrom Content-Type: multipart/alternative; boundary=089e013d0dc048511604ec2d8cba Cc: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] compiler bug? Topicbox-Message-UUID: 8c541402-ead8-11e9-9d60-3106f5b1d025 --089e013d0dc048511604ec2d8cba Content-Type: text/plain; charset=ISO-8859-1 the Go to C switch got me :) (no breaks!); couldn't see why more than one byte was getting the 'x' value! changing buf to "1234" made it more obvious. On Wed, Nov 27, 2013 at 10:38 AM, erik quanstrom wrote: > On Wed Nov 27 13:07:31 EST 2013, skip.tavakkolian@gmail.com wrote: > > > why is mips different (erik's version)? > > > > supermic% ./8.out > > 78780000 > > mikro% ./v.out > > 7878 > > rpi% ./5.out > > 78780000 > > > > because it's big endian. what you're doing there is > putting bytes in specific positions. in this case you have > bytes (in hex): > > 0 0 78 78 > > on a little endian machine this is 0x78780000 and on a > big-endian machine this is 0x00007878. > > - erik > --089e013d0dc048511604ec2d8cba Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
the Go to C switch got me :) (no breaks!); couldn't se= e why more than one byte was getting the 'x' value! changing buf to= "1234" made it more obvious.

On Wed, Nov 27, 2013 at 10:38 AM, erik quans= trom <quanstro@labs.coraid.com> wrote:
On Wed Nov 27 13:07:31 EST 2013, skip.tavakkolian@gmail.com wrote:

> why is mips different (erik's version)?
>
> supermic% ./8.out
> 78780000
> mikro% ./v.out
> 7878
> rpi% ./5.out
> 78780000
>

because it's big endian. =A0what you're doing there is
putting bytes in specific positions. =A0in this case you have
bytes (in hex):

=A0 =A0 =A0 =A0 0 0 78 78

on a little endian machine this is 0x78780000 and on a
big-endian machine this is 0x00007878.

- erik

--089e013d0dc048511604ec2d8cba--