Since type char is 1 byte the upper byte is automatically lost. But I think the official ANSI/ISO C++ standard says a char is 1 byte or more so it would depend on the particular C++ implementation.
We are talking about uint16, nothing else. The only reason to "bitwise or" the high would be that i have to handle more than 16 bits of data. But if there is only 16 bit, my thinking is that i dont need to "cast" the high part to 8 bits by using an "bitwise or" with 0xff. As i stated, the results are the same. I was thinking about that there might exist edge cases, even with uint16, due to my lack of c++ skills as of know.
In fact, the compiler will very rarely actually emit an AND instruction. Or the shift, for that matter. Compiler Explorer
The OP code extracts the 0-7 and 8-15 bits into individual bytes in a way that is portable across most CPUs and compilers, regardless of the exact sizes of the 'int' and "char' data types.