Re: [PATCH 4/3] Introduce 'convert_path_to_git()'

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

 



Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:

> +#ifdef FAST_UNALIGNED
> +	while (plen >= sizeof(unsigned long)) {
> +		unsigned long x = *(unsigned long *)path;
> +		if (x & (unsigned long) 0x8080808080808080ull)
> +			break;
> +		*(unsigned long *)result = x;
> +		path += sizeof(unsigned long);
> +		result += sizeof(unsigned long);
> +		plen -= sizeof(unsigned long);
> +		retval += sizeof(unsigned long);
> +	}
> +#endif

It somehow bothers me that the stride of this loop is protected from
having different size of unsigned long from what the author of this
function expected, but the literal constant used as the mask is not quite,
which means that taken as a whole it does not work if your unsigned long
is more than 8-bytes.  No, I do not think it matters in practice, and I
find it a neat trick to cast the unsigned long long literal down to
unsigned long, but still it looks somewhat, eh, what would I say...

"Ugly" is not quite the word I am looking for.  "My gut feels that there
has to be a way to write this more cleanly, but I am frustrated that I
cannot come up with one" might be the word...

--
To unsubscribe from this list: send the line "unsubscribe git" 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 Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]