Added lfs_crc32c_cube, replacing lfsr_gcksum_cube

This is a bit on the edge of what is a reasonable to shove in
lfs_util.h. But it's useful enough that we were giving it its own
function anyways, and moving it to lfs_util.h allows it to be
potentially overriden with cube-specific optimizations (expanded
terms?).

No code changes.
This commit is contained in:
Christopher Haster
2025-01-19 01:14:05 -06:00
parent bc959e4d0e
commit a80694b9a7
2 changed files with 10 additions and 16 deletions
+5
View File
@@ -635,6 +635,11 @@ uint32_t lfs_crc32c(uint32_t crc, const void *buffer, size_t size);
// Multiply two crc32cs in the crc32c ring
uint32_t lfs_crc32c_mul(uint32_t a, uint32_t b);
// Find the cube of a crc32c in the crc32c ring
static inline uint32_t lfs_crc32c_cube(uint32_t a) {
return lfs_crc32c_mul(lfs_crc32c_mul(a, a), a);
}
// Allocate memory, only used if buffers are not provided to littlefs
// Note, memory must be 64-bit aligned