19 #ifndef MINLIB_FAST_TYPE_H_
20 #define MINLIB_FAST_TYPE_H_
41 unsigned char bit : 1;
61 return bit == other.bit;
64 return bit != other.bit;
67 operator bool() {
return bit == 1; }
71 void flip() { bit = (bit ==1) ? 0 : 1; }
80 template <
size_t Bits,
typename TBaseType>
112 for(
int j = 0; j < Bits; j++)
121 return Bits -
count();
128 unsigned int set(
size_t pos,
bool p) {
129 bits[pos].bit = p ? 1 : 0;
149 Value = v;
return *
this;
153 Value = other.Value;
return *
this;
160 return Value == other.Value;
167 return Value != other.Value;
170 return Value <= other.Value;
173 return Value >= other.Value;
176 return Value < other.Value;
179 return Value > other.Value;
183 Value += other.Value;
return *
this;
186 Value -= other.Value;
return *
this;
189 Value *= other.Value;
return *
this;
192 Value &= other.Value;
return *
this;
195 Value |= other.Value;
return *
this;
198 Value ^= other.Value;
return *
this;
201 Value <<= other.Value;
return *
this;
204 Value >>= other.Value;
return *
this;
207 Value /= other.Value;
return *
this;
210 Value += v;
return *
this;
213 Value -= v;
return *
this;
216 Value *= v;
return *
this;
219 Value /= v;
return *
this;
222 Value <<= v;
return *
this;
225 Value >>= v;
return *
this;
247 result.Value |= rhs.Value;
252 result.Value ^= rhs.Value;
257 result.Value &= rhs.Value;
262 result.Value = ~result.Value;
267 Value++;
return *
this;
270 Value--;
return *
this;
273 Value = ~Value;
return *
this;
Definition: mn_fast_type.hpp:35
void flip()
Definition: mn_fast_type.hpp:71
basic_fbit(const basic_fbit &b)
Definition: mn_fast_type.hpp:55
basic_fbit()
Definition: mn_fast_type.hpp:46
bool operator!=(const basic_fbit &other)
Definition: mn_fast_type.hpp:63
basic_fbit(bool b)
Definition: mn_fast_type.hpp:51
basic_fbit & operator=(const basic_fbit &other)
Definition: mn_fast_type.hpp:57
bool operator==(const basic_fbit &other)
Definition: mn_fast_type.hpp:60
Definition: mn_fast_type.hpp:81
self_type & operator+(const self_type &rhs)
Definition: mn_fast_type.hpp:230
self_type & operator=(value_type &v)
Definition: mn_fast_type.hpp:148
self_type & operator|=(self_type &other)
Definition: mn_fast_type.hpp:194
bool operator<=(self_type &other)
Definition: mn_fast_type.hpp:169
size_t size()
Definition: mn_fast_type.hpp:135
fbit bit_type
Definition: mn_fast_type.hpp:85
self_type & operator+=(self_type &other)
Definition: mn_fast_type.hpp:182
self_type & operator/(const self_type &rhs)
Definition: mn_fast_type.hpp:236
self_type & operator--()
Definition: mn_fast_type.hpp:269
fast_type(value_type v)
Definition: mn_fast_type.hpp:103
self_type & operator>>=(self_type &other)
Definition: mn_fast_type.hpp:203
self_type & operator*=(self_type &other)
Definition: mn_fast_type.hpp:188
self_type & operator<<=(self_type &other)
Definition: mn_fast_type.hpp:200
self_type & operator^=(self_type &other)
Definition: mn_fast_type.hpp:197
self_type & operator/=(self_type &other)
Definition: mn_fast_type.hpp:206
self_type & operator*(const self_type &rhs)
Definition: mn_fast_type.hpp:233
self_type & operator++()
Definition: mn_fast_type.hpp:266
self_type & operator&(const self_type &rhs)
Definition: mn_fast_type.hpp:255
self_type & operator-(const self_type &rhs)
Definition: mn_fast_type.hpp:227
value_type & operator[](const size_t p)
Definition: mn_fast_type.hpp:141
bool operator!=(self_type &other)
Definition: mn_fast_type.hpp:166
bool operator>(self_type &other)
Definition: mn_fast_type.hpp:178
TBaseType value_type
Definition: mn_fast_type.hpp:84
bool operator<(self_type &other)
Definition: mn_fast_type.hpp:175
self_type & operator-=(self_type &other)
Definition: mn_fast_type.hpp:185
self_type & operator|(const self_type &rhs)
Definition: mn_fast_type.hpp:245
self_type & operator>>(const self_type &rhs)
Definition: mn_fast_type.hpp:242
fast_type(const fast_type &c)
Definition: mn_fast_type.hpp:104
fast_type< Bits, TBaseType > self_type
Definition: mn_fast_type.hpp:83
unsigned int count()
Definition: mn_fast_type.hpp:110
self_type & operator^(const self_type &rhs)
Definition: mn_fast_type.hpp:250
self_type & operator&=(self_type &other)
Definition: mn_fast_type.hpp:191
bool operator>=(self_type &other)
Definition: mn_fast_type.hpp:172
self_type & operator~()
Definition: mn_fast_type.hpp:260
self_type & operator<<(const self_type &rhs)
Definition: mn_fast_type.hpp:239
unsigned int set(size_t pos, bool p)
Definition: mn_fast_type.hpp:128
bool operator==(self_type &other)
Definition: mn_fast_type.hpp:159
unsigned int zeros()
Definition: mn_fast_type.hpp:120
Basic algorithmens This file is part of the Mini Thread Library (https://github.com/RoseLeBlood/MiniT...
Definition: mn_allocator_typetraits.hpp:25
Definition: mn_uint128.hpp:30