Отказ от restrict функций для упрощения библиотеки. Компиляторы достаточно хорошо оптимизируют не-restrict inline-функции
This commit is contained in:
parent
f402f68516
commit
ed404690ed
17 changed files with 48 additions and 257 deletions
|
|
@ -504,9 +504,9 @@ void test_pair_difference_fp64()
|
|||
int main()
|
||||
{
|
||||
//test_pair_difference_fp32();
|
||||
test_pair_difference_fp64();
|
||||
//test_pair_difference_fp64();
|
||||
|
||||
//printf("Affine3 performance test: %f\n", test_bgc_affine3_performance(10000000, 10));
|
||||
printf("Affine3 performance test: %f\n", test_bgc_affine3_performance(10000000, 10));
|
||||
|
||||
//printf("sizeof(BGC_FP32_Affine3) = %zu\n", sizeof(BGC_FP32_Affine3));
|
||||
//printf("offsetof(shift) = %zu\n", offsetof(BGC_FP32_Affine3, shift));
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ inline int bgc_fp64_affine2_get_inverse(BGC_FP64_Affine2* const inverse, const B
|
|||
inline void bgc_fp32_affine2_combine(BGC_FP32_Affine2* const combination, const BGC_FP32_Affine2* const first, const BGC_FP32_Affine2* const second)
|
||||
{
|
||||
BGC_FP32_Vector2 first_shift;
|
||||
_bgc_fp32_restrict_matrix2x2_multiply_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp32_matrix2x2_multiply_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp32_vector2_add(&combination->shift, &second->shift, &first_shift);
|
||||
bgc_fp32_matrix2x2_multiply_by_matrix2x2(&combination->distortion, &second->distortion, &first->distortion);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ inline void bgc_fp32_affine2_combine(BGC_FP32_Affine2* const combination, const
|
|||
inline void bgc_fp64_affine2_combine(BGC_FP64_Affine2* const combination, const BGC_FP64_Affine2* const first, const BGC_FP64_Affine2* const second)
|
||||
{
|
||||
BGC_FP64_Vector2 first_shift;
|
||||
_bgc_fp64_restrict_matrix2x2_multiply_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp64_matrix2x2_multiply_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp64_vector2_add(&combination->shift, &second->shift, &first_shift);
|
||||
bgc_fp64_matrix2x2_multiply_by_matrix2x2(&combination->distortion, &second->distortion, &first->distortion);
|
||||
}
|
||||
|
|
@ -151,14 +151,14 @@ inline void bgc_fp64_affine2_combine(BGC_FP64_Affine2* const combination, const
|
|||
inline void bgc_fp32_affine2_transform_point(BGC_FP32_Vector2* const transformed_point, const BGC_FP32_Affine2* const affine, const BGC_FP32_Vector2* const initial_point)
|
||||
{
|
||||
BGC_FP32_Vector2 distorted;
|
||||
_bgc_fp32_restrict_matrix2x2_multiply_by_vector2(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp32_matrix2x2_multiply_by_vector2(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp32_vector2_add(transformed_point, &affine->shift, &distorted);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_transform_point(BGC_FP64_Vector2* const transformed_point, const BGC_FP64_Affine2* const affine, const BGC_FP64_Vector2* const initial_point)
|
||||
{
|
||||
BGC_FP64_Vector2 distorted;
|
||||
_bgc_fp64_restrict_matrix2x2_multiply_by_vector2(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp64_matrix2x2_multiply_by_vector2(&distorted, &affine->distortion, initial_point);
|
||||