- Add arena allocator for zero-allocation hot paths - Add thread pool for parallel operations - Add mmap utilities for memory-mapped I/O - Implement queue_index with heap-based priority queue - Implement dataset_hash with SIMD support (SHA-NI, ARMv8) - Add runtime SIMD detection for cross-platform correctness - Add comprehensive tests and benchmarks
21 lines
630 B
C
21 lines
630 B
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
// SHA256 round constants (shared across implementations)
|
|
extern const uint32_t K[64];
|
|
|
|
// Initial hash values
|
|
static const uint32_t H0[8] = {
|
|
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
|
};
|
|
|
|
// Transform one 64-byte block, updating state[8]
|
|
typedef void (*TransformFunc)(uint32_t* state, const uint8_t* block);
|
|
|
|
// Detect best available implementation at runtime
|
|
TransformFunc detect_best_transform(void);
|
|
|
|
// Generic C implementation (always available)
|
|
void transform_generic(uint32_t* state, const uint8_t* block);
|