https://123dok.net/document/q05xmkd3-high-order-conversion-from-boolean-to-arithmetic-masking.html