Added bref function for calc distance til end

master
David Rupprecht 4 years ago committed by David Rupprecht
parent e8f2b3a74c
commit ff3e7c321d

@ -142,6 +142,7 @@ public:
int distance() const; int distance() const;
int distance_bytes(uint8_t* ref_ptr) const; int distance_bytes(uint8_t* ref_ptr) const;
int distance_bytes() const; int distance_bytes() const;
int distance_bytes_end() const;
template <class T> template <class T>
SRSASN_CODE unpack(T& val, uint32_t n_bits) SRSASN_CODE unpack(T& val, uint32_t n_bits)

@ -129,6 +129,11 @@ int bit_ref_impl<Ptr>::distance_bytes() const
{ {
return ((int)(ptr - start_ptr)) + ((offset) ? 1 : 0); return ((int)(ptr - start_ptr)) + ((offset) ? 1 : 0);
} }
template <typename Ptr>
int bit_ref_impl<Ptr>::distance_bytes_end() const
{
return ((int)(max_ptr - ptr)) - ((offset) ? 1 : 0);
}
SRSASN_CODE bit_ref::pack(uint64_t val, uint32_t n_bits) SRSASN_CODE bit_ref::pack(uint64_t val, uint32_t n_bits)
{ {

Loading…
Cancel
Save