Добавление квалификатора const для запрета изменения указаелей внутри функций

This commit is contained in:
Andrey Pokidov 2026-03-24 00:33:17 +07:00
parent 610756ffed
commit e6ac9023ec
24 changed files with 951 additions and 951 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,7 +9,7 @@
// =================== Reset ==================== //
inline void bgc_fp32_matrix2x2_reset(BGC_FP32_Matrix2x2* matrix)
inline void bgc_fp32_matrix2x2_reset(BGC_FP32_Matrix2x2* const matrix)
{
matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f;
@ -17,7 +17,7 @@ inline void bgc_fp32_matrix2x2_reset(BGC_FP32_Matrix2x2* matrix)
matrix->r2c2 = 0.0f;
}
inline void bgc_fp64_matrix2x2_reset(BGC_FP64_Matrix2x2* matrix)
inline void bgc_fp64_matrix2x2_reset(BGC_FP64_Matrix2x2* const matrix)
{
matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0;
@ -27,7 +27,7 @@ inline void bgc_fp64_matrix2x2_reset(BGC_FP64_Matrix2x2* matrix)
// ================== Identity ================== //
inline void bgc_fp32_matrix2x2_make_identity(BGC_FP32_Matrix2x2* matrix)
inline void bgc_fp32_matrix2x2_make_identity(BGC_FP32_Matrix2x2* const matrix)
{
matrix->r1c1 = 1.0f;
matrix->r1c2 = 0.0f;
@ -35,7 +35,7 @@ inline void bgc_fp32_matrix2x2_make_identity(BGC_FP32_Matrix2x2* matrix)
matrix->r2c2 = 1.0f;
}
inline void bgc_fp64_matrix2x2_make_identity(BGC_FP64_Matrix2x2* matrix)
inline void bgc_fp64_matrix2x2_make_identity(BGC_FP64_Matrix2x2* const matrix)
{
matrix->r1c1 = 1.0;
matrix->r1c2 = 0.0;
@ -45,7 +45,7 @@ inline void bgc_fp64_matrix2x2_make_identity(BGC_FP64_Matrix2x2* matrix)
// ================ Set Diagonal ================ //
inline void bgc_fp32_matrix2x2_make_diagonal(BGC_FP32_Matrix2x2* matrix, const float d1, const float d2)
inline void bgc_fp32_matrix2x2_make_diagonal(BGC_FP32_Matrix2x2* const matrix, const float d1, const float d2)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0f;
@ -53,7 +53,7 @@ inline void bgc_fp32_matrix2x2_make_diagonal(BGC_FP32_Matrix2x2* matrix, const f
matrix->r2c2 = d2;
}
inline void bgc_fp64_matrix2x2_make_diagonal(BGC_FP64_Matrix2x2* matrix, const double d1, const double d2)
inline void bgc_fp64_matrix2x2_make_diagonal(BGC_FP64_Matrix2x2* const matrix, const double d1, const double d2)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0;
@ -63,7 +63,7 @@ inline void bgc_fp64_matrix2x2_make_diagonal(BGC_FP64_Matrix2x2* matrix, const d
// ============== Rotation Matrix =============== //
inline void bgc_fp32_matrix2x2_set_turn(BGC_FP32_Matrix2x2* matrix, const float angle, const int angle_unit)
inline void bgc_fp32_matrix2x2_set_turn(BGC_FP32_Matrix2x2* const matrix, const float angle, const int angle_unit)
{
const float radians = bgc_fp32_angle_to_radians(angle, angle_unit);
const float cosine = cosf(radians);
@ -75,7 +75,7 @@ inline void bgc_fp32_matrix2x2_set_turn(BGC_FP32_Matrix2x2* matrix, const float
matrix->r2c2 = cosine;
}
inline void bgc_fp64_matrix2x2_set_turn(BGC_FP64_Matrix2x2* matrix, const double angle, const int angle_unit)
inline void bgc_fp64_matrix2x2_set_turn(BGC_FP64_Matrix2x2* const matrix, const double angle, const int angle_unit)
{
const double radians = bgc_fp64_angle_to_radians(angle, angle_unit);
const double cosine = cos(radians);
@ -89,19 +89,19 @@ inline void bgc_fp64_matrix2x2_set_turn(BGC_FP64_Matrix2x2* matrix, const double
// ================ Determinant ================= //
inline float bgc_fp32_matrix2x2_get_determinant(const BGC_FP32_Matrix2x2* matrix)
inline float bgc_fp32_matrix2x2_get_determinant(const BGC_FP32_Matrix2x2* const matrix)
{
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
}
inline double bgc_fp64_matrix2x2_get_determinant(const BGC_FP64_Matrix2x2* matrix)
inline double bgc_fp64_matrix2x2_get_determinant(const BGC_FP64_Matrix2x2* const matrix)
{
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
}
// ================ Is Identity ================= //
inline int bgc_fp32_matrix2x2_is_identity(const BGC_FP32_Matrix2x2* matrix)
inline int bgc_fp32_matrix2x2_is_identity(const BGC_FP32_Matrix2x2* const matrix)
{
return bgc_fp32_is_unit(matrix->r1c1) && bgc_fp32_is_zero(matrix->r1c2)
&& bgc_fp32_is_zero(matrix->r2c1) && bgc_fp32_is_unit(matrix->r2c2);
@ -115,19 +115,19 @@ inline int bgc_fp64_matrix2x2_is_identity(const BGC_FP64_Matrix2x2* matrix)
// ================ Is Singular ================= //
inline int bgc_fp32_matrix2x2_is_singular(const BGC_FP32_Matrix2x2* matrix)
inline int bgc_fp32_matrix2x2_is_singular(const BGC_FP32_Matrix2x2* const matrix)
{
return bgc_fp32_is_zero(bgc_fp32_matrix2x2_get_determinant(matrix));
}
inline int bgc_fp64_matrix2x2_is_singular(const BGC_FP64_Matrix2x2* matrix)
inline int bgc_fp64_matrix2x2_is_singular(const BGC_FP64_Matrix2x2* const matrix)
{
return bgc_fp64_is_zero(bgc_fp64_matrix2x2_get_determinant(matrix));
}
// ================ Is Rotation ================= //
inline int bgc_fp32_matrix2x2_is_rotation(const BGC_FP32_Matrix2x2* matrix)
inline int bgc_fp32_matrix2x2_is_rotation(const BGC_FP32_Matrix2x2* const matrix)
{
BGC_FP32_Matrix2x2 product;
@ -140,7 +140,7 @@ inline int bgc_fp32_matrix2x2_is_rotation(const BGC_FP32_Matrix2x2* matrix)
return bgc_fp32_matrix2x2_is_identity(&product);
}
inline int bgc_fp64_matrix2x2_is_rotation(const BGC_FP64_Matrix2x2* matrix)
inline int bgc_fp64_matrix2x2_is_rotation(const BGC_FP64_Matrix2x2* const matrix)
{
BGC_FP64_Matrix2x2 product;
@ -155,7 +155,7 @@ inline int bgc_fp64_matrix2x2_is_rotation(const BGC_FP64_Matrix2x2* matrix)
// ==================== Copy ==================== //
inline void bgc_fp32_matrix2x2_copy(BGC_FP32_Matrix2x2* destination, const BGC_FP32_Matrix2x2* source)
inline void bgc_fp32_matrix2x2_copy(BGC_FP32_Matrix2x2* const destination, const BGC_FP32_Matrix2x2* const source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -164,7 +164,7 @@ inline void bgc_fp32_matrix2x2_copy(BGC_FP32_Matrix2x2* destination, const BGC_F
destination->r2c2 = source->r2c2;
}
inline void bgc_fp64_matrix2x2_copy(BGC_FP64_Matrix2x2* destination, const BGC_FP64_Matrix2x2* source)
inline void bgc_fp64_matrix2x2_copy(BGC_FP64_Matrix2x2* const destination, const BGC_FP64_Matrix2x2* const source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -175,7 +175,7 @@ inline void bgc_fp64_matrix2x2_copy(BGC_FP64_Matrix2x2* destination, const BGC_F
// ==================== Swap ==================== //
inline void bgc_fp32_matrix2x2_swap(BGC_FP32_Matrix2x2* matrix1, BGC_FP32_Matrix2x2* matrix2)
inline void bgc_fp32_matrix2x2_swap(BGC_FP32_Matrix2x2* const matrix1, BGC_FP32_Matrix2x2* const matrix2)
{
const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2;
@ -196,7 +196,7 @@ inline void bgc_fp32_matrix2x2_swap(BGC_FP32_Matrix2x2* matrix1, BGC_FP32_Matrix
matrix1->r2c2 = r2c2;
}
inline void bgc_fp64_matrix2x2_swap(BGC_FP64_Matrix2x2* matrix1, BGC_FP64_Matrix2x2* matrix2)
inline void bgc_fp64_matrix2x2_swap(BGC_FP64_Matrix2x2* const matrix1, BGC_FP64_Matrix2x2* const matrix2)
{
const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2;
@ -219,7 +219,7 @@ inline void bgc_fp64_matrix2x2_swap(BGC_FP64_Matrix2x2* matrix1, BGC_FP64_Matrix
// ================== Convert =================== //
inline void bgc_fp64_matrix2x2_convert_to_fp32(BGC_FP32_Matrix2x2* destination, const BGC_FP64_Matrix2x2* source)
inline void bgc_fp64_matrix2x2_convert_to_fp32(BGC_FP32_Matrix2x2* const destination, const BGC_FP64_Matrix2x2* const source)
{
destination->r1c1 = (float)source->r1c1;
destination->r1c2 = (float)source->r1c2;
@ -228,7 +228,7 @@ inline void bgc_fp64_matrix2x2_convert_to_fp32(BGC_FP32_Matrix2x2* destination,
destination->r2c2 = (float)source->r2c2;
}
inline void bgc_fp32_matrix2x2_convert_to_fp64(BGC_FP64_Matrix2x2* destination, const BGC_FP32_Matrix2x2* source)
inline void bgc_fp32_matrix2x2_convert_to_fp64(BGC_FP64_Matrix2x2* const destination, const BGC_FP32_Matrix2x2* const source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -239,7 +239,7 @@ inline void bgc_fp32_matrix2x2_convert_to_fp64(BGC_FP64_Matrix2x2* destination,
// ================ Get Inverse ================= //
inline int bgc_fp32_matrix2x2_get_inverse(BGC_FP32_Matrix2x2* inverse, const BGC_FP32_Matrix2x2* matrix)
inline int bgc_fp32_matrix2x2_get_inverse(BGC_FP32_Matrix2x2* const inverse, const BGC_FP32_Matrix2x2* const matrix)
{
const float determinant = bgc_fp32_matrix2x2_get_determinant(matrix);
@ -264,7 +264,7 @@ inline int bgc_fp32_matrix2x2_get_inverse(BGC_FP32_Matrix2x2* inverse, const BGC
return BGC_SUCCESS;
}
inline int bgc_fp64_matrix2x2_get_inverse(BGC_FP64_Matrix2x2* inverse, const BGC_FP64_Matrix2x2* matrix)
inline int bgc_fp64_matrix2x2_get_inverse(BGC_FP64_Matrix2x2* const inverse, const BGC_FP64_Matrix2x2* const matrix)
{
const double determinant = bgc_fp64_matrix2x2_get_determinant(matrix);
@ -291,26 +291,26 @@ inline int bgc_fp64_matrix2x2_get_inverse(BGC_FP64_Matrix2x2* inverse, const BGC
// =================== Invert =================== //
inline int bgc_fp32_matrix2x2_invert(BGC_FP32_Matrix2x2* matrix)
inline int bgc_fp32_matrix2x2_invert(BGC_FP32_Matrix2x2* const matrix)
{
return bgc_fp32_matrix2x2_get_inverse(matrix, matrix);
}
inline int bgc_fp64_matrix2x2_invert(BGC_FP64_Matrix2x2* matrix)
inline int bgc_fp64_matrix2x2_invert(BGC_FP64_Matrix2x2* const matrix)
{
return bgc_fp64_matrix2x2_get_inverse(matrix, matrix);
}
// ================= Transpose ================== //
inline void bgc_fp32_matrix2x2_transpose(BGC_FP32_Matrix2x2* matrix)
inline void bgc_fp32_matrix2x2_transpose(BGC_FP32_Matrix2x2* const matrix)
{
const float r1c2 = matrix->r1c2;
matrix->r1c2 = matrix->r2c1;
matrix->r2c1 = r1c2;
}
inline void bgc_fp64_matrix2x2_transpose(BGC_FP64_Matrix2x2* matrix)
inline void bgc_fp64_matrix2x2_transpose(BGC_FP64_Matrix2x2* const matrix)
{
const double r1c2 = matrix->r1c2;
matrix->r1c2 = matrix->r2c1;
@ -319,7 +319,7 @@ inline void bgc_fp64_matrix2x2_transpose(BGC_FP64_Matrix2x2* matrix)
// =============== Get Transpose ================ //
inline void bgc_fp32_matrix2x2_get_transposed(BGC_FP32_Matrix2x2* transposed, const BGC_FP32_Matrix2x2* matrix)
inline void bgc_fp32_matrix2x2_get_transposed(BGC_FP32_Matrix2x2* const transposed, const BGC_FP32_Matrix2x2* const matrix)
{
const float r1c2 = matrix->r1c2;
@ -330,7 +330,7 @@ inline void bgc_fp32_matrix2x2_get_transposed(BGC_FP32_Matrix2x2* transposed, co
transposed->r2c2 = matrix->r2c2;
}
inline void bgc_fp64_matrix2x2_get_transposed(BGC_FP64_Matrix2x2* transposed, const BGC_FP64_Matrix2x2* matrix)
inline void bgc_fp64_matrix2x2_get_transposed(BGC_FP64_Matrix2x2* const transposed, const BGC_FP64_Matrix2x2* const matrix)
{
const double r1c2 = matrix->r1c2;
@ -343,7 +343,7 @@ inline void bgc_fp64_matrix2x2_get_transposed(BGC_FP64_Matrix2x2* transposed, co
// ================== Get Row =================== //
inline void bgc_fp32_matrix2x2_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Matrix2x2* matrix, const int row_number)
inline void bgc_fp32_matrix2x2_get_row(BGC_FP32_Vector2* const row, const BGC_FP32_Matrix2x2* const matrix, const int row_number)
{
if (row_number == 1) {
row->x1 = matrix->r1c1;
@ -361,7 +361,7 @@ inline void bgc_fp32_matrix2x2_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Mat
row->x2 = 0.0f;
}
inline void bgc_fp64_matrix2x2_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Matrix2x2* matrix, const int row_number)
inline void bgc_fp64_matrix2x2_get_row(BGC_FP64_Vector2* const row, const BGC_FP64_Matrix2x2* const matrix, const int row_number)
{
if (row_number == 1) {
row->x1 = matrix->r1c1;
@ -381,7 +381,7 @@ inline void bgc_fp64_matrix2x2_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Mat
// ================== Set Row =================== //
inline void bgc_fp32_matrix2x2_set_row(BGC_FP32_Matrix2x2* matrix, const int row_number, const BGC_FP32_Vector2* row)
inline void bgc_fp32_matrix2x2_set_row(BGC_FP32_Matrix2x2* const matrix, const int row_number, const BGC_FP32_Vector2* const row)
{
if (row_number == 1) {
matrix->r1c1 = row->x1;
@ -395,7 +395,7 @@ inline void bgc_fp32_matrix2x2_set_row(BGC_FP32_Matrix2x2* matrix, const int row
}
}
inline void bgc_fp64_matrix2x2_set_row(BGC_FP64_Matrix2x2* matrix, const int row_number, const BGC_FP64_Vector2* row)
inline void bgc_fp64_matrix2x2_set_row(BGC_FP64_Matrix2x2* const matrix, const int row_number, const BGC_FP64_Vector2* const row)
{
if (row_number == 1) {
matrix->r1c1 = row->x1;
@ -411,7 +411,7 @@ inline void bgc_fp64_matrix2x2_set_row(BGC_FP64_Matrix2x2* matrix, const int row
// ================= Get Column ================= //
inline void bgc_fp32_matrix2x2_get_column(BGC_FP32_Vector2* column, const BGC_FP32_Matrix2x2* matrix, const int column_number)
inline void bgc_fp32_matrix2x2_get_column(BGC_FP32_Vector2* const column, const BGC_FP32_Matrix2x2* const matrix, const int column_number)
{
if (column_number == 1) {
column->x1 = matrix->r1c1;
@ -429,7 +429,7 @@ inline void bgc_fp32_matrix2x2_get_column(BGC_FP32_Vector2* column, const BGC_FP
column->x2 = 0.0f;
}
inline void bgc_fp64_matrix2x2_get_column(BGC_FP64_Vector2* column, const BGC_FP64_Matrix2x2* matrix, const int column_number)
inline void bgc_fp64_matrix2x2_get_column(BGC_FP64_Vector2* const column, const BGC_FP64_Matrix2x2* const matrix, const int column_number)
{
if (column_number == 1) {
column->x1 = matrix->r1c1;
@ -449,7 +449,7 @@ inline void bgc_fp64_matrix2x2_get_column(BGC_FP64_Vector2* column, const BGC_FP
// ================= Set Column ================= //
inline void bgc_fp32_matrix2x2_set_column(BGC_FP32_Matrix2x2* matrix, const int column_number, const BGC_FP32_Vector2* column)
inline void bgc_fp32_matrix2x2_set_column(BGC_FP32_Matrix2x2* const matrix, const int column_number, const BGC_FP32_Vector2* const column)
{
if (column_number == 1) {
matrix->r1c1 = column->x1;
@ -463,7 +463,7 @@ inline void bgc_fp32_matrix2x2_set_column(BGC_FP32_Matrix2x2* matrix, const int
}
}
inline void bgc_fp64_matrix2x2_set_column(BGC_FP64_Matrix2x2* matrix, const int column_number, const BGC_FP64_Vector2* column)
inline void bgc_fp64_matrix2x2_set_column(BGC_FP64_Matrix2x2* const matrix, const int column_number, const BGC_FP64_Vector2* const column)
{
if (column_number == 1) {
matrix->r1c1 = column->x1;
@ -479,7 +479,7 @@ inline void bgc_fp64_matrix2x2_set_column(BGC_FP64_Matrix2x2* matrix, const int
// ==================== Add ===================== //
inline void bgc_fp32_matrix2x2_add(BGC_FP32_Matrix2x2* sum, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2)
inline void bgc_fp32_matrix2x2_add(BGC_FP32_Matrix2x2* const sum, const BGC_FP32_Matrix2x2* const matrix1, const BGC_FP32_Matrix2x2* const matrix2)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -488,7 +488,7 @@ inline void bgc_fp32_matrix2x2_add(BGC_FP32_Matrix2x2* sum, const BGC_FP32_Matri
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
}
inline void bgc_fp64_matrix2x2_add(BGC_FP64_Matrix2x2* sum, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2)
inline void bgc_fp64_matrix2x2_add(BGC_FP64_Matrix2x2* const sum, const BGC_FP64_Matrix2x2* const matrix1, const BGC_FP64_Matrix2x2* const matrix2)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -499,7 +499,7 @@ inline void bgc_fp64_matrix2x2_add(BGC_FP64_Matrix2x2* sum, const BGC_FP64_Matri
// ================= Add Scaled ================= //
inline void bgc_fp32_matrix2x2_add_scaled(BGC_FP32_Matrix2x2* sum, const BGC_FP32_Matrix2x2* basic_matrix, const BGC_FP32_Matrix2x2* scalable_matrix, const float scale)
inline void bgc_fp32_matrix2x2_add_scaled(BGC_FP32_Matrix2x2* const sum, const BGC_FP32_Matrix2x2* const basic_matrix, const BGC_FP32_Matrix2x2* const scalable_matrix, const float scale)
{
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -508,7 +508,7 @@ inline void bgc_fp32_matrix2x2_add_scaled(BGC_FP32_Matrix2x2* sum, const BGC_FP3
sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
}
inline void bgc_fp64_matrix2x2_add_scaled(BGC_FP64_Matrix2x2* sum, const BGC_FP64_Matrix2x2* basic_matrix, const BGC_FP64_Matrix2x2* scalable_matrix, const double scale)
inline void bgc_fp64_matrix2x2_add_scaled(BGC_FP64_Matrix2x2* const sum, const BGC_FP64_Matrix2x2* const basic_matrix, const BGC_FP64_Matrix2x2* const scalable_matrix, const double scale)
{
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -519,7 +519,7 @@ inline void bgc_fp64_matrix2x2_add_scaled(BGC_FP64_Matrix2x2* sum, const BGC_FP6
// ================== Subtract ================== //
inline void bgc_fp32_matrix2x2_subtract(BGC_FP32_Matrix2x2* difference, const BGC_FP32_Matrix2x2* minuend, const BGC_FP32_Matrix2x2* subtrahend)
inline void bgc_fp32_matrix2x2_subtract(BGC_FP32_Matrix2x2* const difference, const BGC_FP32_Matrix2x2* const minuend, const BGC_FP32_Matrix2x2* const subtrahend)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -528,7 +528,7 @@ inline void bgc_fp32_matrix2x2_subtract(BGC_FP32_Matrix2x2* difference, const BG
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
}
inline void bgc_fp64_matrix2x2_subtract(BGC_FP64_Matrix2x2* difference, const BGC_FP64_Matrix2x2* minuend, const BGC_FP64_Matrix2x2* subtrahend)
inline void bgc_fp64_matrix2x2_subtract(BGC_FP64_Matrix2x2* const difference, const BGC_FP64_Matrix2x2* const minuend, const BGC_FP64_Matrix2x2* const subtrahend)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -539,7 +539,7 @@ inline void bgc_fp64_matrix2x2_subtract(BGC_FP64_Matrix2x2* difference, const BG
// ============== Subtract Scaled =============== //
inline void bgc_fp32_matrix2x2_subtract_scaled(BGC_FP32_Matrix2x2* difference, const BGC_FP32_Matrix2x2* basic_matrix, const BGC_FP32_Matrix2x2* scalable_matrix, const float scale)
inline void bgc_fp32_matrix2x2_subtract_scaled(BGC_FP32_Matrix2x2* const difference, const BGC_FP32_Matrix2x2* const basic_matrix, const BGC_FP32_Matrix2x2* const scalable_matrix, const float scale)
{
difference->r1c1 = basic_matrix->r1c1 - scalable_matrix->r1c1 * scale;
difference->r1c2 = basic_matrix->r1c2 - scalable_matrix->r1c2 * scale;
@ -548,7 +548,7 @@ inline void bgc_fp32_matrix2x2_subtract_scaled(BGC_FP32_Matrix2x2* difference, c
difference->r2c2 = basic_matrix->r2c2 - scalable_matrix->r2c2 * scale;
}
inline void bgc_fp64_matrix2x2_subtract_scaled(BGC_FP64_Matrix2x2* difference, const BGC_FP64_Matrix2x2* basic_matrix, const BGC_FP64_Matrix2x2* scalable_matrix, const double scale)
inline void bgc_fp64_matrix2x2_subtract_scaled(BGC_FP64_Matrix2x2* const difference, const BGC_FP64_Matrix2x2* const basic_matrix, const BGC_FP64_Matrix2x2* const scalable_matrix, const double scale)
{
difference->r1c1 = basic_matrix->r1c1 - scalable_matrix->r1c1 * scale;
difference->r1c2 = basic_matrix->r1c2 - scalable_matrix->r1c2 * scale;
@ -559,7 +559,7 @@ inline void bgc_fp64_matrix2x2_subtract_scaled(BGC_FP64_Matrix2x2* difference, c
// ================== Multiply ================== //
inline void bgc_fp32_matrix2x2_multiply_by_real(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* multiplicand, const float multiplier)
inline void bgc_fp32_matrix2x2_multiply_by_real(BGC_FP32_Matrix2x2* const product, const BGC_FP32_Matrix2x2* const multiplicand, const float multiplier)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
@ -568,7 +568,7 @@ inline void bgc_fp32_matrix2x2_multiply_by_real(BGC_FP32_Matrix2x2* product, con
product->r2c2 = multiplicand->r2c2 * multiplier;
}
inline void bgc_fp64_matrix2x2_multiply_by_real(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* multiplicand, const double multiplier)
inline void bgc_fp64_matrix2x2_multiply_by_real(BGC_FP64_Matrix2x2* const product, const BGC_FP64_Matrix2x2* const multiplicand, const double multiplier)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
@ -579,7 +579,7 @@ inline void bgc_fp64_matrix2x2_multiply_by_real(BGC_FP64_Matrix2x2* product, con
// ============ Right Vector Product ============ //
inline void bgc_fp32_matrix2x2_multiply_by_vector2(BGC_FP32_Vector2* product, const BGC_FP32_Matrix2x2* matrix, const BGC_FP32_Vector2* vector)
inline void bgc_fp32_matrix2x2_multiply_by_vector2(BGC_FP32_Vector2* const product, const BGC_FP32_Matrix2x2* const matrix, const BGC_FP32_Vector2* const vector)
{
const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
const float x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
@ -588,7 +588,7 @@ inline void bgc_fp32_matrix2x2_multiply_by_vector2(BGC_FP32_Vector2* product, co
product->x2 = x2;
}
inline void bgc_fp64_matrix2x2_multiply_by_vector2(BGC_FP64_Vector2* product, const BGC_FP64_Matrix2x2* matrix, const BGC_FP64_Vector2* vector)
inline void bgc_fp64_matrix2x2_multiply_by_vector2(BGC_FP64_Vector2* const product, const BGC_FP64_Matrix2x2* const matrix, const BGC_FP64_Vector2* const vector)
{
const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
const double x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
@ -599,7 +599,7 @@ inline void bgc_fp64_matrix2x2_multiply_by_vector2(BGC_FP64_Vector2* product, co
// ========== Matrix Product 2x2 at 2x2 ========= //
inline void bgc_fp32_matrix2x2_multiply_by_matrix2x2(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2)
inline void bgc_fp32_matrix2x2_multiply_by_matrix2x2(BGC_FP32_Matrix2x2* const product, const BGC_FP32_Matrix2x2* const matrix1, const BGC_FP32_Matrix2x2* const matrix2)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -614,7 +614,7 @@ inline void bgc_fp32_matrix2x2_multiply_by_matrix2x2(BGC_FP32_Matrix2x2* product
product->r2c2 = r2c2;
}
inline void bgc_fp64_matrix2x2_multiply_by_matrix2x2(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2)
inline void bgc_fp64_matrix2x2_multiply_by_matrix2x2(BGC_FP64_Matrix2x2* const product, const BGC_FP64_Matrix2x2* const matrix1, const BGC_FP64_Matrix2x2* const matrix2)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -631,7 +631,7 @@ inline void bgc_fp64_matrix2x2_multiply_by_matrix2x2(BGC_FP64_Matrix2x2* product
// ========== Matrix Product 2x2 at 3x2 ========= //
inline void bgc_fp32_matrix2x2_multiply_by_matrix3x2(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix3x2* matrix2)
inline void bgc_fp32_matrix2x2_multiply_by_matrix3x2(BGC_FP32_Matrix3x2* const product, const BGC_FP32_Matrix2x2* const matrix1, const BGC_FP32_Matrix3x2* const matrix2)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -650,7 +650,7 @@ inline void bgc_fp32_matrix2x2_multiply_by_matrix3x2(BGC_FP32_Matrix3x2* product
product->r2c3 = r2c3;
}
inline void bgc_fp64_matrix2x2_multiply_by_matrix3x2(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix3x2* matrix2)
inline void bgc_fp64_matrix2x2_multiply_by_matrix3x2(BGC_FP64_Matrix3x2* const product, const BGC_FP64_Matrix2x2* const matrix1, const BGC_FP64_Matrix3x2* const matrix2)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -671,7 +671,7 @@ inline void bgc_fp64_matrix2x2_multiply_by_matrix3x2(BGC_FP64_Matrix3x2* product
// =================== Divide =================== //
inline int bgc_fp32_matrix2x2_divide_by_real(BGC_FP32_Matrix2x2* quotient, const BGC_FP32_Matrix2x2* dividend, const float divisor)
inline int bgc_fp32_matrix2x2_divide_by_real(BGC_FP32_Matrix2x2* const quotient, const BGC_FP32_Matrix2x2* const dividend, const float divisor)
{
if (bgc_fp32_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE;
@ -681,7 +681,7 @@ inline int bgc_fp32_matrix2x2_divide_by_real(BGC_FP32_Matrix2x2* quotient, const
return BGC_SUCCESS;
}
inline int bgc_fp64_matrix2x2_divide_by_real(BGC_FP64_Matrix2x2* quotient, const BGC_FP64_Matrix2x2* dividend, const double divisor)
inline int bgc_fp64_matrix2x2_divide_by_real(BGC_FP64_Matrix2x2* const quotient, const BGC_FP64_Matrix2x2* const dividend, const double divisor)
{
if (bgc_fp64_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE;
@ -693,7 +693,7 @@ inline int bgc_fp64_matrix2x2_divide_by_real(BGC_FP64_Matrix2x2* quotient, const
// ================== Average2 ================== //
inline void bgc_fp32_matrix2x2_get_mean2(BGC_FP32_Matrix2x2* mean, const BGC_FP32_Matrix2x2* term1, const BGC_FP32_Matrix2x2* term2)
inline void bgc_fp32_matrix2x2_get_mean2(BGC_FP32_Matrix2x2* const mean, const BGC_FP32_Matrix2x2* const term1, const BGC_FP32_Matrix2x2* const term2)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5f;
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5f;
@ -702,7 +702,7 @@ inline void bgc_fp32_matrix2x2_get_mean2(BGC_FP32_Matrix2x2* mean, const BGC_FP3
mean->r2c2 = (term1->r2c2 + term2->r2c2) * 0.5f;
}
inline void bgc_fp64_matrix2x2_get_mean2(BGC_FP64_Matrix2x2* mean, const BGC_FP64_Matrix2x2* term1, const BGC_FP64_Matrix2x2* term2)