include/intarith: enforce the same type for p2*() arguments
x and align must be of the same width. Otherwise the lack of
sign-extension can bite, e.g.:
uint64_t x = 128000;
uint32_t align = 32768;
uint64_t res = p2roundup(x, align);
// res =
18446744069414715392
While the templates added in commit
c06b97b3d7e3 ("include: Add
templates along side macros in intarith") are technically correct,
P2*() macros weren't meant to be used with different types. The
Solaris kernel (which is where they originated) has P2*_TYPED()
variants for that.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit
d0293dd2d8c0327c9d4d6b826a966dd7b18ea318)
Conflicts:
src/librbd/io/ImageRequest.cc
src/msg/async/frames_v2.h
src/os/bluestore/StupidAllocator.cc