From: erik quanstrom <quanstro@labs.coraid.com>
To: maht-9fans@maht0x0r.net, 9fans@9fans.net
Subject: Re: [9fans] portability question
Date: Wed, 16 Jun 2010 11:26:55 -0400 [thread overview]
Message-ID: <9013d88b6219f01a48b8fee28a2b5d6c@coraid.com> (raw)
In-Reply-To: <4C18D1D8.2060301@maht0x0r.net>
> 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 fits) so the original expression
is evaulated as
(int)0xab << (int)24
-> (int)0xab000000
if there is any sign extension here, it is shifted
away. then gcc sign-extends this into 8 bytes,
giving the value you see.
- erik
next prev parent reply other threads:[~2010-06-16 15:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-16 9:11 hugo rivera
2010-06-16 10:01 ` Lucio De Re
2010-06-16 10:15 ` hugo rivera
2010-06-16 10:27 ` Charles Forsyth
2010-06-16 13:30 ` maht
2010-06-16 15:26 ` erik quanstrom [this message]
2010-06-16 17:52 ` Bakul Shah
2010-06-17 7:50 ` hugo rivera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9013d88b6219f01a48b8fee28a2b5d6c@coraid.com \
--to=quanstro@labs.coraid.com \
--cc=9fans@9fans.net \
--cc=maht-9fans@maht0x0r.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).