Skip to content
Permalink
Browse files
MDEV-21174: Fix the 32-bit build
mtr_t::write(): Add explicit narrowing type casts to avoid warnings
about lossy implicit conversions.
  • Loading branch information
dr-m committed Dec 3, 2019
1 parent af5947f commit 2ac0e64
Showing 1 changed file with 6 additions and 3 deletions.
@@ -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;

0 comments on commit 2ac0e64

Please sign in to comment.