Files
news.gitea.happylizard.me/bin/gems/sass-embedded-1.83.4-x86_64-linux-gnu/lib/sass/compiler/varint.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

40 lines
729 B
Ruby

# frozen_string_literal: true
module Sass
class Compiler
# The {Varint} module.
#
# It reads and writes varints.
module Varint
module_function
def length(value)
return 1 if value < 128
(value.bit_length + 6) / 7
end
def read(readable)
value = bits = 0
loop do
byte = readable.readbyte
value |= (byte & 0x7f) << bits
bits += 7
break if byte < 0x80
end
value
end
def write(writeable, value)
until value < 0x80
writeable << ((value & 0x7f) | 0x80)
value >>= 7
end
writeable << value
end
end
private_constant :Varint
end
end