Re: [PATCH 1/8] kernel: add common infrastructure for unaligned access

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

 



Harvey Harrison <harvey.harrison@xxxxxxxxx> wrote:

> Well, for the u16 case, won't the compiler warn about truncating the
> return if I return an int when the function returns u16?

It doesn't for me for:

	u16 test(const u8 *p)
	{
		return (u16) (p[0] | p[1] << 8);
	}

> In the u64 case, I need the cast to ensure it expands to u64 rather than
> int from the shift.  Agreed in the u32 case, but then it looks different
> than the u16/u64 case (cargo-cult I know, but nice for consistency).

Agreed, the u64 cast is necessary, but I was talking about casts generally of:

	<TYPE> function(...)
	{
		return (<TYPE>) (...);
	}

David
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux