Re: [PATCH] ARM: type casts update_sched_clock cyc_to_sched_clock cyc_to_fixed_sched_clock

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

 



On Tue, Apr 05, 2011 at 01:12:57PM +0200, Uwe Kleine-König wrote:
> ah, ok, makes sense and actually is consistent with my book.
> (After knowing what I search I found it. The rules are:
> 
>  - A signed type of rank less than int
>    -> int
>  - An unsigned type of rank less than int,
>    all of whose values can be represented in type int
>    -> int
>  - An unsigned type of rank less than int,
>    all of whose values cannot be represented in type int
>    -> unsigned int
> ).
> 
> So the maximal correct variant is (u32)(int)~0U or alternatively
> (u32)(-1), right?

If you really want to be pedantic, (u32)~0UL, as we assume that longs
will always be equal or larger than 32-bit throughout the kernel.  The
u32 cast then becomes truncating in itself.

But... in the interests of avoiding churn, we know the current code
works, we know that its safe should we chose to change the function
argument to be a u64, so lets leave it as-is.  We know the only time
that it'd break is if an 'int' becomes less than 32-bit, which we
aren't going to see on ARM any time soon.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux