summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/standalone_miri/miri.cpp2
-rw-r--r--tools/standalone_miri/value.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/standalone_miri/miri.cpp b/tools/standalone_miri/miri.cpp
index 14958c45..53783420 100644
--- a/tools/standalone_miri/miri.cpp
+++ b/tools/standalone_miri/miri.cpp
@@ -1036,7 +1036,7 @@ bool InterpreterThread::step_one(Value& out_thread_result)
LOG_ASSERT(ty_r.get_wrapper() == nullptr, "Bitwise operator with non-primitive - " << ty_r);
size_t max_bits = ty_r.get_size() * 8;
uint8_t shift;
- auto check_cast = [&](auto v){ LOG_ASSERT(0 <= v && v <= max_bits, "Shift out of range - " << v); return static_cast<uint8_t>(v); };
+ auto check_cast = [&](auto v){ LOG_ASSERT(0 <= v && v <= static_cast<decltype(v)>(max_bits), "Shift out of range - " << v); return static_cast<uint8_t>(v); };
switch(ty_r.inner_type)
{
case RawType::U64: shift = check_cast(v_r.read_u64(0)); break;
diff --git a/tools/standalone_miri/value.cpp b/tools/standalone_miri/value.cpp
index 849d3a64..39b3b906 100644
--- a/tools/standalone_miri/value.cpp
+++ b/tools/standalone_miri/value.cpp
@@ -586,7 +586,7 @@ Value Value::new_fnptr(const ::HIR::Path& fn_path)
assert(rv.allocation);
rv.allocation->relocations.push_back(Relocation { 0, RelocationPtr::new_fcn(fn_path) });
rv.allocation->data.at(0) = 0;
- rv.allocation->mask.at(0) = 0xFF; // TODO: Get pointer size and make that much valid instead of 8 bytes
+ rv.allocation->mask.at(0) = (1 << POINTER_SIZE)-1;
return rv;
}
Value Value::new_ffiptr(FFIPointer ffi)
@@ -595,7 +595,7 @@ Value Value::new_ffiptr(FFIPointer ffi)
rv.create_allocation();
rv.allocation->relocations.push_back(Relocation { 0, RelocationPtr::new_ffi(ffi) });
rv.allocation->data.at(0) = 0;
- rv.allocation->mask.at(0) = 0xFF; // TODO: Get pointer size and make that much valid instead of 8 bytes
+ rv.allocation->mask.at(0) = (1 << POINTER_SIZE)-1;
return rv;
}
Value Value::new_pointer(::HIR::TypeRef ty, uint64_t v, RelocationPtr r) {