work on = problem. NEEDS TO BE TESTED

master
edwin 4 years ago
parent 2bb7bc2ed5
commit b65fa2f79f

@ -47,10 +47,21 @@ struct BitField
*/ */
BitField& operator =(T v) BitField& operator =(T v)
{ {
// this step can be optimised for systems that support bitbandalias
T mask = ((1ULL << SIZE)-1) << START;
_raw &= ~mask;
_raw |= ((v & ((1ULL << SIZE)-1)) << START);
return *this;
#ifdef old
//TODO: test = problem with |= instead of = //TODO: test = problem with |= instead of =
// mask creation for v : https://stackoverflow.com/questions/1392059/algorithm-to-generate-bit-mask // mask creation for v : https://stackoverflow.com/questions/1392059/algorithm-to-generate-bit-mask
_raw |= ((v & ((1ULL << SIZE)-1)) << START) ; _raw |= ((v & ((1ULL << SIZE)-1)) << START) ;
return *this; return *this;
#endif
} }
/** /**

Loading…
Cancel
Save