Commit 2ac0e64c authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-21174: Fix the 32-bit build

mtr_t::write(): Add explicit narrowing type casts to avoid warnings
about lossy implicit conversions.
parent af5947f4
......@@ -109,17 +109,20 @@ inline void mtr_t::write(const buf_block_t &block, byte *ptr, V val)
case 1:
if (w == OPT && mach_read_from_1(ptr) == val) return;
ut_ad(w != NORMAL || mach_read_from_1(ptr) != val);
mach_write_to_1(ptr, val);
ut_ad(val == static_cast<byte>(val));
*ptr= static_cast<byte>(val);
break;
case 2:
ut_ad(val == static_cast<uint16_t>(val));
if (w == OPT && mach_read_from_2(ptr) == val) return;
ut_ad(w != NORMAL || mach_read_from_2(ptr) != val);
mach_write_to_2(ptr, val);
mach_write_to_2(ptr, static_cast<uint16_t>(val));
break;
case 4:
ut_ad(val == static_cast<uint32_t>(val));
if (w == OPT && mach_read_from_4(ptr) == val) return;
ut_ad(w != NORMAL || mach_read_from_4(ptr) != val);
mach_write_to_4(ptr, val);
mach_write_to_4(ptr, static_cast<uint32_t>(val));
break;
case 8:
if (w == OPT && mach_read_from_8(ptr) == val) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment