реорганизация функций проекта, уменьшение дублирующегося кода

This commit is contained in:
Andrey Pokidov 2025-02-04 13:20:46 +07:00
parent 6c0ae92ed4
commit 07623b2aa6
10 changed files with 84 additions and 67 deletions

View file

@ -162,16 +162,12 @@ inline int bgc_vector2_is_zero_fp64(const BgcVector2FP64* vector)
inline int bgc_vector2_is_unit_fp32(const BgcVector2FP32* vector)
{
const float square_modulus = bgc_vector2_get_square_modulus_fp32(vector);
return 1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32;
return bgc_is_sqare_value_unit_fp32(bgc_vector2_get_square_modulus_fp32(vector));
}
inline int bgc_vector2_is_unit_fp64(const BgcVector2FP64* vector)
{
const double square_modulus = bgc_vector2_get_square_modulus_fp64(vector);
return 1.0f - BGC_TWO_EPSYLON_FP64 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP64;
return bgc_is_sqare_value_unit_fp64(bgc_vector2_get_square_modulus_fp64(vector));
}
// ==================== Add ===================== //
@ -320,7 +316,7 @@ inline int bgc_vector2_normalize_fp32(BgcVector2FP32* vector)
{
const float square_modulus = bgc_vector2_get_square_modulus_fp32(vector);
if (1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32) {
if (bgc_is_sqare_value_unit_fp32(square_modulus)) {
return 1;
}
@ -337,7 +333,7 @@ inline int bgc_vector2_normalize_fp64(BgcVector2FP64* vector)
{
const double square_modulus = bgc_vector2_get_square_modulus_fp64(vector);
if (1.0 - BGC_TWO_EPSYLON_FP64 <= square_modulus && square_modulus <= 1.0 + BGC_TWO_EPSYLON_FP64) {
if (bgc_is_sqare_value_unit_fp64(square_modulus)) {
return 1;
}