Returns the overall number of blocks in the BlockMap. The valid index values to pass to GetBlockByIndex are the integers from 0 to N-1 where N is the value returned here. Note that it is always true that NumBlocks == NumBlocksOfRows * NumBlocksOfCols because either rows_rectangularness_log2 or cols_rectangularness_log2 is 0.
| 138 | // NumBlocks == NumBlocksOfRows * NumBlocksOfCols |
| 139 | // because either rows_rectangularness_log2 or cols_rectangularness_log2 is 0. |
| 140 | inline int NumBlocks(const BlockMap& block_map) { |
| 141 | return 1 << (2 * block_map.num_blocks_base_log2 + |
| 142 | block_map.rectangularness_log2[Side::kLhs] + |
| 143 | block_map.rectangularness_log2[Side::kRhs]); |
| 144 | } |
| 145 | |
| 146 | } // namespace ruy |
| 147 |