I currently have a function which returns the closed off squares for a piece in a particular position based on pieces blocking it. This function iterates over the rays of a piece and is sufficiently fast, but can use a lot of improvement since it accounts for most of the time taken in the move generation.
I have been recently researching on how I can optimise this function and came across this "trick": https://www.chessprogramming.org/Subtracting_a_Rook_from_a_Blocking_Piece which conveniently uses a formula to instantly get all the moves for a rook. Is there a similar "trick" to generating moves for a bishop while accounting for the blocking pieces?
If you need any clarifications regarding the question, feel free to ask.