5 #ifndef __NODAMUSHI_SVD_NORMALIZED_BIT_RANGE_HPP__ 6 #define __NODAMUSHI_SVD_NORMALIZED_BIT_RANGE_HPP__ 27 constexpr
unsigned int width()const noexcept{
return _msb - _lsb + 1;}
29 constexpr
unsigned int size()const noexcept{
return _msb - _lsb + 1;}
31 constexpr
unsigned int left()const noexcept{
return _msb;}
33 constexpr
unsigned int right()const noexcept{
return _lsb;}
34 constexpr
unsigned int msb()const noexcept{
return _msb;}
35 constexpr
unsigned int lsb()const noexcept{
return _lsb;}
37 void msb(
unsigned int x)noexcept{
if(_lsb <= x)_msb = x;
else _lsb = x;}
39 void lsb(
unsigned int x)noexcept{
if(x <= _msb)_lsb = x;
else _msb = x;}
45 uint64_t
get(uint64_t v){
49 const uint64_t mask = (((uint64_t)1) << w) -1;
59 uint64_t
bit(uint64_t v){
62 const uint64_t mask = ((((uint64_t)1) << w) -1) << _lsb;
68 :_lsb(x<y? x:y),_msb(x <y? y:x){}
92 if(bitOffset &&bitWidth){
100 if(n.dim && n.dim.index!=0){
105 l += inc * n.dim.index;
107 unsigned int m = l + w -1;
112 using uint = uint16_t;
121 inline ostream&
operator <<(ostream& o ,const ::nodamushi::svd::normalized::bit_range& r)
123 return o <<
'[' << r.left() <<
':' << r.right() <<
']';
127 #endif // __NODAMUSHI_SVD_NORMALIZED_BITRANGE_HPP__ constexpr bool operator<(const bit_range &r) const noexcept
constexpr bool operator<=(const bit_range &r) const noexcept
ostream & operator<<(std::ostream &os, const ::nodamushi::svd::Access &value)
<field>.<bitRange> element
uint64_t get(uint64_t v)
get the bit number of bit-range.
constexpr bool operator==(const bit_range &r) const noexcept
constexpr bool operator >=(const bit_range &r) const noexcept
constexpr unsigned int lsb() const noexcept
void lsb(unsigned int x) noexcept
set lsb
uint32_t lsb
lsb: the bit position of the least significant bit within the register.
constexpr unsigned int right() const noexcept
lsb
constexpr unsigned int msb() const noexcept
constexpr unsigned int size() const noexcept
bit size
bit_range(unsigned int x, unsigned int y)
constexpr bool operator >(const bit_range &r) const noexcept
constexpr bool operator !=(const bit_range &r) const noexcept
uint64_t bit(uint64_t v)
get the bit of bit-range.
void msb(unsigned int x) noexcept
set msb
constexpr unsigned int left() const noexcept
msb
#define __NORMALIZED_DERIVED_FROM_HELPER(name)
constexpr unsigned int width() const noexcept
bit size