Analysis and simplified prediction of primary instability of three-dimensional boundary-layer flows