A checksum of a store's reading, so a reply that brings nothing new costs no flash write. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | STORE_READING_SIZE(state, stamp) |
| How many leading bytes of a store's blob are the reading, which is everything before its sync time. | |
Functions | |
| uint32_t | store_sum (const void *bytes, size_t size) |
| Sums a run of bytes, so two readings can be compared without keeping both. | |
A checksum of a store's reading, so a reply that brings nothing new costs no flash write.
Every reply stamps a fresh sync time, so the saved blob always differs from the last one even when every reading in it is the same. A store sums only the part before its sync time, keeps that sum, and skips the write when the next one matches. Four bytes a store is far cheaper in RAM than a second copy of the blob.