libmatrix
guard.h
Go to the documentation of this file.
1 
11 #pragma once
12 
13 #include "oxidation.h"
14 
15 #ifdef SAFE_MATRIX
16 
17 #define MATRIX_SAFE_GUARD(_matrix_type, _data_type, _index_type) \
18  static inline bool _matrix_type##_out_range(_matrix_type* m, _index_type row, \
19  _index_type col) { \
20  return row < 0 || row >= m->data[0].row || col < 0 || col >= m->data[0].col; \
21  }
22 
23 #else
24 
25 #define MATRIX_SAFE_GUARD(_matrix_type, _data_type, _index_type) \
26  static inline bool _matrix_type##_out_range(_matrix_type* m, _index_type row, \
27  _index_type col) { \
28  return false; \
29  }
30 
31 #endif
32 
33 #define MATRIX_SAFE_GUARD_DECLARE(_matrix_type, _data_type, _index_type) \
34  static inline bool _matrix_type##_out_range(_matrix_type* m, _index_type row, _index_type col);
oxidation.h
Type aliases and wrapped result type.