Тестирование производительности: версоры + матрица + поворот

This commit is contained in:
Andrey Pokidov 2024-11-27 02:51:07 +07:00
parent 5d4472150b
commit a30629df67
3 changed files with 78 additions and 4 deletions

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -9,6 +9,45 @@
#include <time.h> #include <time.h>
#endif // _WINDOWS_ #endif // _WINDOWS_
BgFP32Vector3* allocate_vectors3(const unsigned int amount)
{
return calloc(amount, sizeof(BgFP32Vector3));
}
BgFP32Vector3* make_zero_vectors3(const unsigned int amount)
{
BgFP32Vector3* list = allocate_vectors3(amount);
if (list == 0) {
return 0;
}
for (unsigned int i = 0; i < amount; i++) {
bg_fp32_vector3_reset(&list[i]);
}
return list;
}
BgFP32Vector3* make_random_vectors3(const unsigned int amount)
{
BgFP32Vector3* list = allocate_vectors3(amount);
if (list == 0) {
return 0;
}
const float multiplier = 2.0f / RAND_MAX;
for (unsigned int i = 0; i < amount; i++) {
list[i].x1 = rand() * multiplier - 1.0f;
list[i].x2 = rand() * multiplier - 1.0f;
list[i].x3 = rand() * multiplier - 1.0f;
}
return list;
}
BgFP32Versor* allocate_versors(const unsigned int amount) BgFP32Versor* allocate_versors(const unsigned int amount)
{ {
return calloc(amount, sizeof(BgFP32Versor)); return calloc(amount, sizeof(BgFP32Versor));
@ -160,6 +199,27 @@ int main()
return 0; return 0;
} }