#ifndef __JABYENGINE_AUTO_LBA_HPP__ #define __JABYENGINE_AUTO_LBA_HPP__ #include "../Auxiliary/bits.hpp" namespace JabyEngine { #define __jabyengine_start_lba_request #define __jabyengine_request_lba_for(name, file) name #define __jabyengine_end_lba_request EndOfRequest struct __attribute__((packed)) AutoLBAEntry { // This layout should make it a bit easier to read the "BitRange" values static constexpr auto SizeInSectors = BitRange::from_to(22, 31); static constexpr auto IsLZ4Compressed = Bit(19); static constexpr auto LBAValue = BitRange::from_to(0, 18); uint32_t value; constexpr uint32_t get_lba() const { return bit::value::get_normalized(this->value, AutoLBAEntry::LBAValue); } constexpr uint32_t get_lba() const volatile { return const_cast(this)->get_lba(); } constexpr uint32_t get_size_in_sectors() const { return this->value >> SizeInSectors.pos; } constexpr uint32_t get_size_in_sectors() const volatile { return const_cast(this)->get_size_in_sectors(); } constexpr bool isLZ4() const { return bit::is_set(this->value, AutoLBAEntry::IsLZ4Compressed); } constexpr bool isLZ4() const volatile { return const_cast(this)->isLZ4(); } }; } #endif //!__JABYENGINE_AUTO_LBA_HPP__