Kommentare angepasst

This commit is contained in:
maxgrf 2025-11-20 14:27:47 +01:00
parent b998717e19
commit 54ca7acca2

View File

@ -34,15 +34,16 @@ void clearMatrix(Matrix *matrix)
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
{ {
if (rowIdx < matrix.rows && colIdx < matrix.cols && matrix.buffer != NULL) if (rowIdx < matrix.rows && colIdx < matrix.cols && matrix.buffer != NULL) //Prüft ob Zugriff möglich
matrix.buffer[rowIdx * matrix.cols + colIdx] = value; //gibt xxxxxxxxxx matrix.buffer[rowIdx * matrix.cols + colIdx] = value;
//schreibt 2D element in 1D Liste: Element_Reihe*Matrix_Spalten + Element_Spalte
} }
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx) MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
{ {
if (rowIdx >= matrix.rows || colIdx >= matrix.cols || matrix.buffer == NULL) if (rowIdx >= matrix.rows || colIdx >= matrix.cols || matrix.buffer == NULL)
return 0; // Sicherheitscheck return 0; // Sicherheitscheck
return matrix.buffer[rowIdx * matrix.cols + colIdx]; //xxxxxxxxxxxx return matrix.buffer[rowIdx * matrix.cols + colIdx];
} }
// TODO: Funktionen implementieren // TODO: Funktionen implementieren