appendOne :: L.ByteString -> Int64 -> L.ByteString
appendOne xs len
    | len == 0 || L.null xs = L.singleton 0x80
    | byteOffset == 0 =  L.snoc xs 0x80
    | otherwise = L.snoc (L.init xs) (setBit (L.last xs) (7 - byteOffset))
    where byteOffset = fromIntegral $ len `mod` 8
appendOne :: L.ByteString -> Int64 -> L.ByteString
appendOne xs len
    | len == 0 || L.null xs = L.singleton 0x80
    | byteOffset == 0 =  L.snoc xs 0x80
    | otherwise = L.snoc (L.init xs) (setBit (L.last xs) (7 - byteOffset))
    where byteOffset = fromIntegral $ len `mod` 8
appendOne xs len
    | len == 0 || L.null xs = L.singleton 0x80
    | byteOffset == 0 =  L.snoc xs 0x80
    | otherwise = L.snoc (L.init xs) (setBit (L.last xs) (7 - byteOffset))
    where byteOffset = fromIntegral $ len `mod` 8