// // Created by Selim Mustafaev on 28.11.2022. // #include "Leb128Int.h" namespace Dart { Leb128Int::Leb128Int(): _value(0), _size(0) { } Dart::Leb128Int::Leb128Int(const std::byte* ptr): _value(0), _size(0) { size_t bitShift = 0; auto data = reinterpret_cast(ptr); while (*data < 0x80) { _value |= (*data << bitShift); bitShift += 7; data++; _size++; } _value |= ((*data & 0x7f) << bitShift); _size++; } uint64_t Leb128Int::value() const { return _value; } size_t Leb128Int::size() const { return _size; } }