diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h index 8c583141d..0361359e9 100644 --- a/lib/include/srsran/asn1/asn1_utils.h +++ b/lib/include/srsran/asn1/asn1_utils.h @@ -142,6 +142,7 @@ public: int distance() const; int distance_bytes(uint8_t* ref_ptr) const; int distance_bytes() const; + int distance_bytes_end() const; template SRSASN_CODE unpack(T& val, uint32_t n_bits) diff --git a/lib/src/asn1/asn1_utils.cc b/lib/src/asn1/asn1_utils.cc index 2e4b81259..6433d8d7a 100644 --- a/lib/src/asn1/asn1_utils.cc +++ b/lib/src/asn1/asn1_utils.cc @@ -129,6 +129,11 @@ int bit_ref_impl::distance_bytes() const { return ((int)(ptr - start_ptr)) + ((offset) ? 1 : 0); } +template +int bit_ref_impl::distance_bytes_end() const +{ + return ((int)(max_ptr - ptr)) - ((offset) ? 1 : 0); +} SRSASN_CODE bit_ref::pack(uint64_t val, uint32_t n_bits) {