/// Encodes a given unsigned variable-length integer using the most significant bit (MSB) algorithm.
/// Implementation taken from <https://techoverflow.net/2013/01/25/efficiently-encoding-variable-length-integers-in-cc/>
pub fn read_u64_variablelength<R: Read, E: Endianness>(stream: &mut BitReader<R, E>) -> Result<u64, MercError> {
// Take 7 bits (mask 0x01111111) from byte and shift it before the bits already written to value.