It's hard to give an engine length because they're not cubes, they have fans, pulleys, bell housings, and other accessories. Also V and inline engines differ in shape, how they fit in and around things.
Then engine compartment is not a cube and has varoius obstructions and shape to it.
Your engine, engine compartment, and tape measure will give the bet answer of fit and how.