Commit 86a74779 authored by Committed by Romain Vimont
Return blocks by reference, not by value
The methods above_of(), left_of() and above_left_of() returned the matching block by value, or a default block if the offset resulted in a block outside boundaries. The Block structure is quite big (std::mem::size_of::<Block>() == 120). For reading a field, it is probably not optimal to return a whole Block copy or a new default block (although the compiler might optimize such accesses). Moreover, the boundaries checks were often redundant, because already done by the callers. Instead, let the callers check boundaries and return a reference to the matching block.
Showing with 32 additions and 38 deletions