From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: type casts update_sched_clock cyc_to_sched_clock cyc_to_fixed_sched_clock
Date: Tue, 5 Apr 2011 10:01:00 +0100 [thread overview]
Message-ID: <20110405090100.GC4699@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110405083144.GN13963@pengutronix.de>
On Tue, Apr 05, 2011 at 10:31:44AM +0200, Uwe Kleine-K?nig wrote:
> On Tue, Apr 05, 2011 at 08:56:22AM +0100, Russell King - ARM Linux wrote:
> > On Tue, Apr 05, 2011 at 09:43:21AM +0200, Jan Weitzel wrote:
> > > parameter "u32 mask" type cast befor inversion
> s/befor/before/
>
> > Nak. I want a 32-bit all ones quantity.
> >
> > unsigned long long vali = (unsigned short)~0;
> > unsigned long long vall = ~(unsigned short)0;
> >
> BTW, the definiton of vall is equivalent to
>
> unsigned long long valu = ~(unsigned int)0;
>
> because ~ converts the unsigned short to unsigned int.
No. The value gets promoted to int not unsigned int.
> > compiles to:
> >
> > vali:
> > .word 65535
> > .word 0
> >
> > vall:
> > .word -1
> > .word -1
> I really wonder about that. If I take a value of 0xffffffff (i.e. a 32
> bit wide int == ~0U) and assign that to an 64-bit unsigned long long I'd
> expect it to get the value 0x00000000ffffffffULL, not
> 0xffffffffffffffffULL. What's wrong?
See above. int not unsigned int. And it makes a difference:
unsigned long long vals = ~(int)0;
unsigned long long valu = ~(unsigned int)0;
vals:
.word -1
.word -1
valu:
.word -1
.word 0
next prev parent reply other threads:[~2011-04-05 9:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 7:43 [PATCH] ARM: type casts update_sched_clock cyc_to_sched_clock cyc_to_fixed_sched_clock Jan Weitzel
2011-04-05 7:56 ` Russell King - ARM Linux
2011-04-05 8:31 ` Uwe Kleine-König
2011-04-05 9:01 ` Russell King - ARM Linux [this message]
2011-04-05 11:12 ` Uwe Kleine-König
2011-04-05 13:57 ` Russell King - ARM Linux
2011-04-05 10:59 ` Jan Weitzel
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=20110405090100.GC4699@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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).