36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
#ifndef TASK01_STATIC_ALLOCATION_MODEL_H
|
|
#define TASK01_STATIC_ALLOCATION_MODEL_H
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
typedef struct StaticAllocationEvidence
|
|
{
|
|
uint32_t sequence;
|
|
uint32_t event;
|
|
uint32_t tick;
|
|
uint32_t actor;
|
|
uint32_t value;
|
|
uint32_t committed;
|
|
} StaticAllocationEvidence;
|
|
static inline uint32_t fc11_digest( const StaticAllocationEvidence * events,
|
|
size_t count )
|
|
{
|
|
uint32_t hash = 2166136261U;
|
|
size_t index;
|
|
for( index = 0U; index < count; ++index )
|
|
{
|
|
hash = ( hash ^ events[ index ].event ) * 16777619U;
|
|
hash = ( hash ^ events[ index ].actor ) * 16777619U;
|
|
hash = ( hash ^ events[ index ].value ) * 16777619U;
|
|
hash = ( hash ^ events[ index ].committed ) * 16777619U;
|
|
}
|
|
return hash;
|
|
}
|
|
static inline int fc11_heap_relation_is_valid( size_t h0,
|
|
size_t h1,
|
|
size_t h2,
|
|
size_t h3 )
|
|
{
|
|
return h1 < h0 && h2 == h1 && h3 == h2;
|
|
}
|
|
#endif
|