// Code generated by modernc.org/undup from the per-target vec_*.go files; DO NOT EDIT.

//go:build (darwin && amd64) || (darwin && arm64) || (windows && (amd64 || arm64))

package vec

import (
	"modernc.org/libc"
)

func Xvector_byte_size(tls *libc.TLS, element_type _VectorElementType, dimensions Tsize_t) (r Tsize_t) {
	switch element_type {
	case int32(_SQLITE_VEC_ELEMENT_TYPE_FLOAT32):
		return dimensions * uint64(4)
	case int32(_SQLITE_VEC_ELEMENT_TYPE_INT8):
		return dimensions * uint64(1)
	case int32(_SQLITE_VEC_ELEMENT_TYPE_BIT):
		return dimensions / uint64(m___CHAR_BIT__)
	}
	return uint64(0)
}

// C documentation
//
//	/**
//	 * @brief Calculate the hamming distance between two bitvectors.
//	 *
//	 * @param a - first bitvector, MUST have d dimensions
//	 * @param b - second bitvector, MUST have d dimensions
//	 * @param d - pointer to size_t, MUST be divisible by CHAR_BIT
//	 * @return f32
//	 */
func _distance_hamming(tls *libc.TLS, a uintptr, b uintptr, d uintptr) (r Tf32) {
	var dimensions Tsize_t
	_ = dimensions
	dimensions = **(**Tsize_t)(__ccgo_up(d))
	if dimensions%uint64(64) == uint64(0) {
		return _distance_hamming_u64(tls, a, b, dimensions/uint64(8)/uint64(m___CHAR_BIT__))
	}
	return _distance_hamming_u8(tls, a, b, dimensions/uint64(m___CHAR_BIT__))
}
