#ifndef VECTOR_STORAGE_F16_HEADER
#define VECTOR_STORAGE_F16_HEADER

#define VECTOR_STORAGE_ELEMENT_TYPE f16vec4
#define VECTOR_STORAGE_SCORE_TYPE float
#define VECTOR_STORAGE_POSTPROCESS_SCORE(RESULT) subgroupAdd(RESULT)

#ifdef COSINE_DISTANCE
#define VECTOR_STORAGE_SCORE_ELEMENT(a, b) dot(a, b)
#endif

#ifdef DOT_DISTANCE
#define VECTOR_STORAGE_SCORE_ELEMENT(a, b) dot(a, b)
#endif

#ifdef EUCLID_DISTANCE
float euclid_metric_f16(f16vec4 v1, f16vec4 v2) {
    f16vec4 v = v1 - v2;
    return float(-v.x * v.x - v.y * v.y - v.z * v.z - v.w * v.w);
}
#define VECTOR_STORAGE_SCORE_ELEMENT(a, b) euclid_metric_f16(a, b)
#endif

#ifdef MANHATTAN_DISTANCE
float manhattan_metric_f16(f16vec4 v1, f16vec4 v2) {
    f16vec4 v = abs(v1 - v2);
    return float(-v.x - v.y - v.z - v.w);
}
#define VECTOR_STORAGE_SCORE_ELEMENT(a, b) manhattan_metric_f16(a, b)
#endif

#endif
