improve calculation of cswch and nvcswch