Добавление проверки при делении, стандартизация возвращаемого значения (BGC_SUCCESS, BGC_FAILURE)

This commit is contained in:
Andrey Pokidov 2026-02-11 20:55:54 +07:00
parent a4b9f8b2b9
commit e9558ff977
27 changed files with 589 additions and 370 deletions

View file

@ -192,7 +192,7 @@ inline void bgc_fp64_hg_vector3_swap(BGC_FP64_HgVector3* first, BGC_FP64_HgVecto
inline int bgc_fp32_hg_vector3_rescale(BGC_FP32_HgVector3* homogeneous_vector, const float new_ratio)
{
if (bgc_fp32_is_zero(homogeneous_vector->d0)) {
return 0;
return BGC_FAILURE;
}
const float multiplier = new_ratio / homogeneous_vector->d0;
@ -202,13 +202,13 @@ inline int bgc_fp32_hg_vector3_rescale(BGC_FP32_HgVector3* homogeneous_vector, c
homogeneous_vector->x3 *= multiplier;
homogeneous_vector->d0 = new_ratio;
return 1;
return BGC_SUCCESS;
}
inline int bgc_fp64_hg_vector3_rescale(BGC_FP64_HgVector3* homogeneous_vector, const double new_ratio)
{
if (bgc_fp64_is_zero(homogeneous_vector->d0)) {
return 0;
return BGC_FAILURE;
}
const double multiplier = new_ratio / homogeneous_vector->d0;
@ -218,7 +218,7 @@ inline int bgc_fp64_hg_vector3_rescale(BGC_FP64_HgVector3* homogeneous_vector, c
homogeneous_vector->x3 *= multiplier;
homogeneous_vector->d0 = new_ratio;
return 1;
return BGC_SUCCESS;
}
#endif