From c35fbba188de6d542dfedeb2d7caafeb77819640 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 10 Jun 2023 16:37:54 +0100 Subject: [PATCH] micro optimisations proposal --- src/files/surf.c | 3 +++ src/vk/vk_model.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/files/surf.c b/src/files/surf.c index e3dd05b..cb0df1f 100644 --- a/src/files/surf.c +++ b/src/files/surf.c @@ -174,6 +174,9 @@ R_SetFrustum(vec3_t vup, vec3_t vpn, vec3_t vright, vec3_t r_origin, RotatePointAroundVector(frustum[3].normal, vright, vpn, -(90 - fov_y / 2)); +#if defined(__GNUC__) +# pragma GCC unroll 4 +#endif for (i = 0; i < 4; i++) { frustum[i].type = PLANE_ANYZ; diff --git a/src/vk/vk_model.c b/src/vk/vk_model.c index 85ca403..f77be30 100644 --- a/src/vk/vk_model.c +++ b/src/vk/vk_model.c @@ -85,8 +85,7 @@ Mod_Reallocate (void) R_Printf(PRINT_ALL, "Reallocate space for %d models.\n", models_known_max); - models_known = malloc(models_known_max * sizeof(model_t)); - memset(models_known, 0, models_known_max * sizeof(model_t)); + models_known = calloc(models_known_max, sizeof(model_t)); } /*