Re: [PATCH 1/2] kernel.h: Add DIV_ROUND_UP_ULL usage

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

 



On Tue, 2011-07-26 at 07:10 +0000, Nicholas A. Bellinger wrote:
> Add new DIV_ROUND_UP_ULL macro usage for 32-bit architectures requiring
> unsigned long long division of sectors * dev_max_sectors.
[]
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
[]
> +#define DIV_ROUND_UP_ULL(ll,d) \
> +	({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })

Maybe use uint64_t and a temporary for d?

#define DIV_ROUND_UP_ULL(ll, d)				\
({							\
	typeof(d) _d = d;				\
	uint64_t _tmp = (uint64_t)(ll) + _d - 1;	\
	do_div(_tmp, _d);				\
	_tmp;						\
})


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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux