diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-05-15 20:35:44 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-05-15 20:35:44 +0800 |
commit | 311b406bf90a8244a39a8eff933c7fce45b9c7f2 (patch) | |
tree | e61fe5b49224d4c36aff29fb37307910787cbf0e /tools/standalone_miri/value.cpp | |
parent | b9f65d3234026d231b889abded407c4ae1e34286 (diff) | |
download | mrust-311b406bf90a8244a39a8eff933c7fce45b9c7f2.tar.gz |
standalone_miri - Fiddling for 1.29 support (not working yet)
Diffstat (limited to 'tools/standalone_miri/value.cpp')
-rw-r--r-- | tools/standalone_miri/value.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/standalone_miri/value.cpp b/tools/standalone_miri/value.cpp index 9007eb5c..0b3aa988 100644 --- a/tools/standalone_miri/value.cpp +++ b/tools/standalone_miri/value.cpp @@ -13,6 +13,38 @@ #include <algorithm> #include "debug.hpp" +FfiLayout FfiLayout::new_const_bytes(size_t s) +{ + return FfiLayout { + { Range {s, true, false} } + }; +} +bool FfiLayout::is_valid_read(size_t o, size_t s) const +{ + for(const auto& r : ranges) + { + if( o < r.len ) { + if( !r.is_valid ) + return false; + if( o + s <= r.len ) + { + s = 0; + break; + } + s -= (r.len - o); + o = 0; + } + else { + o -= r.len; + } + } + if( s > 0 ) + { + return false; + } + return true; +} + AllocationHandle Allocation::new_alloc(size_t size) { Allocation* rv = new Allocation(); |