view test/test.cc @ 38:fd42f9b1b95e

docs: update copyright for 2025, update the README with more info I slightly edited vec.h however to use calloc directly rather than malloc + memset.
author Paper <paper@tflc.us>
date Sat, 26 Apr 2025 02:54:44 -0400
parents 4b5a557aa64f
children
line wrap: on
line source

#include "vec/vec.h"

#include <iostream>

/* this test makes sure that vec can be included under C++ */
int main(void)
{
	int ret = 0;

	VUINT32x8_ALIGNED_ARRAY(varrin);
	VUINT32x8_ALIGNED_ARRAY(varrout);

	for (int i = 0; i < 8; i++)
		varrin[i] = i;

	vuint32x8 vec = vuint32x8_load_aligned(varrin);
	vec = vuint32x8_add(vec, vec);

	vuint32x8_store_aligned(vec, varrout);

	for (int i = 0; i < 8; i++)
		if (varrout[i] != (uint32_t)(varrin[i] + varrin[i]))
			ret |= 1;

	return ret;
}