mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[sequence] The store checksum takes the storage into account
This fixed the following scenario: Create f(x)=120 Create u(n) = f(1) Go to sequence graph, then Home, then change f. Go back to the sequence app: the cursor is not updated.
This commit is contained in:
@@ -1,22 +1,25 @@
|
||||
#include "sequence_store.h"
|
||||
#include <ion/storage.h>
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
}
|
||||
#include <ion.h>
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
constexpr const char * SequenceStore::k_sequenceNames[MaxNumberOfSequences];
|
||||
|
||||
uint32_t SequenceStore::storeChecksum() {
|
||||
size_t dataLengthInBytes = MaxNumberOfSequences*sizeof(uint32_t);
|
||||
assert((dataLengthInBytes & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4
|
||||
assert((MaxNumberOfSequences*sizeof(uint32_t) & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4
|
||||
uint32_t checksums[MaxNumberOfSequences];
|
||||
for (int i = 0; i < MaxNumberOfSequences; i++) {
|
||||
checksums[i] = m_sequences[i].checksum();
|
||||
}
|
||||
return Ion::crc32((uint32_t *)checksums, dataLengthInBytes/sizeof(uint32_t));
|
||||
constexpr int checksumsStoreStorageSize = 2;
|
||||
uint32_t checksumsStoreStorage[checksumsStoreStorageSize];
|
||||
checksumsStoreStorage[0] = Ion::crc32((uint32_t *)checksums, MaxNumberOfSequences);
|
||||
checksumsStoreStorage[1] = Ion::Storage::sharedStorage()->checksum();
|
||||
return Ion::crc32((uint32_t *)checksumsStoreStorage, checksumsStoreStorageSize);
|
||||
}
|
||||
|
||||
char SequenceStore::symbol() const {
|
||||
|
||||
Reference in New Issue
Block a user