Commit Graph

14 Commits

Author SHA1 Message Date
Julien Cretin
1d576fdd31 Add unit-test for Store::entries 2020-12-14 21:06:12 +01:00
Julien Cretin
edcc206e9d Make store operations constant wrt flash operations 2020-12-10 18:41:32 +01:00
Julien Cretin
f548a35f01 Do not crash with dirty init 2020-11-30 10:29:18 +01:00
Julien Cretin
d5a43c346f Rename into_ into extract_ 2020-11-11 10:28:32 +01:00
Julien Cretin
45332158df Add driver for new store 2020-11-03 21:27:32 +01:00
Julien Cretin
a024e642d3 Return zero instead of negative immediate capacity 2020-11-03 13:30:39 +01:00
Julien Cretin
410314b780 Move transaction validity check to Format 2020-11-03 12:54:30 +01:00
Julien Cretin
d734da3a0e Move transaction capacity formula to Format 2020-11-03 12:39:38 +01:00
Julien Cretin
b97758dd99 Do not use import ::* 2020-11-03 11:58:20 +01:00
Julien Cretin
233c15b20c Add new store (without tests yet) 2020-11-02 11:17:09 +01:00
Julien Cretin
9778ea7fd2 Introduce distinct integer types
This PR does the following things:
- Give incompatible representations for integers with different semantics:
  - `usize` is used for natural numbers for the public API.
  - `Nat` is used internally for natural numbers (essentially a stable `usize`).
  - `Word` is used for sequences of bits representing words in flash.
  - `Position` is used for word positions in the virtual storage.
- Only use fixed size integers to preserve overflow behavior between targets.
- Use little-endian representation instead of native representation for `Word`.

Alternatives:
- Run tests and fuzzing on 32-bits architecture (or some compatibility mode).
  This approach would have better readability than the current solution (less
  conversions at public API). However it would require additional setup and
  might not be viable long-term by restricting machines on which fuzzing is
  possible.
- Accept the behavior difference for tests and fuzzing. This approach would also
  have better readability. However checking for arithmetic overflow (and other
  `usize` related concerns like memory size) is more important.
2020-10-29 18:48:15 +01:00
Julien Cretin
5ce91947b6 Fix StoreRatio fields visibility and improve documentation 2020-10-29 12:23:34 +01:00
Julien Cretin
e7303ed7c6 Add model for new store 2020-10-27 14:23:39 +01:00
Julien Cretin
67714510f5 Add bitfield helpers for new store 2020-09-28 17:30:44 +02:00