Fix undefined behavior in uint_to_bytes_be and bytes_be_to_uint due to intermittent usage of int.
Fix the same issue in pnglite.
Add separate int_to_bytes_be and bytes_be_to_int to fix conversions between signed and unsigned and fix undefined/implementation-specific behavior due to right shift of negative number, by instead copying the bytes without using any bit arithmetic.
imo it is good to minimize code changes to the necessary, because they invariably come with bugs, especially additions. A good PR adds little code imo :)