You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR aims to
1. make the result of `storeBytes` as simple as possible.
2. tackle as much as possibilies for the symbolic execution of
`storeBytes`
---------
Co-authored-by: devops <devops@runtimeverification.com>
Co-authored-by: Tamás Tóth <tothtamas28@users.noreply.github.com>
rule dropFront(.SparseBytes, I) => .SparseBytes requires I >Int 0
55
+
rule dropFront(#empty(N) BF, I) => #empty(N -Int I) BF requires I >Int 0 andBool I <Int N
56
+
rule dropFront(#empty(N) BF, I) => dropFront(BF, I -Int N) requires I >Int 0 andBool I >=Int N
57
+
rule dropFront(#bytes(B) EF, I) => dropFront(#bytes(substrBytes(B, I, lengthBytes(B))) EF, 0)
58
+
requires I >Int 0 andBool I <Int lengthBytes(B)
59
+
rule dropFront(#bytes(B) EF, I) => dropFront(EF, I -Int lengthBytes(B)) requires I >=Int lengthBytes(B)
60
+
```
50
61
`readByte` reads a single byte from a given index in `O(E)` time, where `E` is the number of `#empty(_)` or `#bytes(_)` entries in the list up to the location of the index. The result is either
51
62
- an `Int` in the range `[0, 255)` giving the byte value at the index, or
52
63
-`.Byte` if the index does not point to initialized data
@@ -76,28 +87,33 @@ We provide helpers to prepend either data or an empty region to an existing `Spa
76
87
rule readByteBF(#bytes(B) EF, I) => readByteEF(EF, I -Int lengthBytes(B))
77
88
requires I >=Int lengthBytes(B)
78
89
```
79
-
`writeByte` writes a single byte to a given index. With regards to time complexity,
90
+
`writeBytes(SBS, I, V, NUM)` writes value `V` with length `NUM` bytes to a given index`I`. With regards to time complexity,
80
91
- If the index is in the middle of an existing `#empty(_)` or `#bytes(_)` region, time complexity is `O(E)` where `E` is the number of entries up to the index.
81
92
- If the index happens to be the first or last index in an `#empty(_)` region directly boarding a `#bytes(_)` region, then the `#bytes(_)` region must be re-allocated to append the new value, giving worst-case `O(E + B)` time, where `E` is the number of entries up to the location of the index and `B` is the size of this existing `#bytes(_)`.
0 commit comments