func encodedUnsignedLEB()

in Sources/TwitterApacheThrift/MutableThriftCompactBinary.swift [75:91]


    func encodedUnsignedLEB<T: BinaryInteger>(value: T) -> Data {
        var value = value
        var count = 0
        var data = Data()
        data.reserveCapacity(10)
        repeat {
            var byte = UInt8(value & 0x7F)
            value = value >> 7
            if value != 0 {
                byte |= 0x80
            }
            data.append(byte)
            count += 1
        } while value != 0

        return data
    }