158 operator const char* ()
232 fNBitsRep =
b.GetNBits();
273 Int_t idx_min = nbits - fNBits;
274 idx_min = idx_min * (idx_min > 0);
275 for (
Int_t i = nbits - 1; i >= idx_min; i--) {
277 fVal += (
T)(1 << ibit);
306 fDumString.Prepend(
'1');
308 fDumString.Prepend(
'0');
317 (nbits ? (
Int_t) nbits -
318 (
Int_t) setbits : (GetNBits() ? (
Int_t) GetNBits() -
319 (
Int_t) setbits : 0));
322 fDumString.Prepend(
'0', lzos);
326 fDumString.Remove(0, -lzos);
328 return fDumString.Data();
364 return (fVal == b2.
fVal);
370 return (fVal != b2.
fVal);
377 return ((*
this) != Bb2);
548 Int_t _fNBits, _msb, _nbits;
549 _fNBits = (
Int_t) fNBits;
551 _nbits = (
Int_t) nbits;
552 if (_nbits < 1 || _nbits > _fNBits || _msb > (_fNBits - 1)
553 || (_msb - _nbits + 1) < 0) {
554 std::cout <<
"Error in <Binary_t<T>::WriteSubvalue> : ";
556 std::cout <<
"nbits<1";
557 if (_nbits > _fNBits)
558 std::cout <<
"nbits(" << _nbits <<
")>fNBits(" << _fNBits <<
")";
559 if (_msb > (_fNBits - 1))
560 std::cout <<
"msb(" << _msb <<
") > fNBits-1(" << _fNBits - 1 <<
")";
561 if ((_msb - _nbits + 1) < 0)
562 std::cout <<
"(msb-nbits+1) < 0 : msb=" << _msb <<
" nbits=" << _nbits;
563 std::cout << std::endl;
571 fDumString.Replace((_fNBits - _msb - 1), nbits, tmp.
String(nbits));
573 Set(fDumString.Data());
578 std::cout <<
"Binary number : " <<
const_cast<Binary_t<T>*
>(
this)->
String() <<
" : fNBits=" << (int) fNBits
579 <<
" fNBitsRep=" << (
int) fNBitsRep <<
" fVal=" << (
Long64_t)
580 Value() << std::endl;
593 Int_t _firstbit, _nbits;
594 _firstbit = (
Int_t) firstbit;
595 _nbits = (
Int_t) nbits;
597 _nbits = ((_firstbit - _nbits + 1) < 0 ? _firstbit + 1 : _nbits);
602 fDumString2 = fDumString(0, _nbits);
605 tmp.
Set(fDumString2.Data());
606 return (tmp.
Value());
Binary_t< UChar_t > Binary8_t
Binary_t< UShort_t > Binary16_t
Binary_t< UInt_t > Binary32_t
Binary_t< Long64_t > Binary64_t
const ULong_t kBitsPerByte
#define ClassDef(name, id)
double pow(double, double)
Binary numbers, bit manipulations, etc.
Bool_t operator!=(const Binary_t< T > &)
void SetNBits(UChar_t nbits)
T Subvalue(UChar_t msb, UChar_t nbits)
Binary_t< T > operator&(const Binary_t< T > &b1)
Binary_t< T > & operator=(const T)
void Print(Option_t *opt="") const
Bool_t operator!=(const Char_t *)
Binary_t< T > & operator=(const Char_t *)
Binary_t< T > & operator=(const Binary_t< T > &)
equals operators
const Char_t * String(UChar_t nbits=0)
Binary_t(const Binary_t &)
Binary_t< T > operator|(const Binary_t< T > &b1)
-----------------------------------------------—bitwise OR operators
Bool_t operator==(const Binary_t< T > &)
TString fDumString2
dummy, used by String method
void WriteSubvalue(const T, UChar_t msb, UChar_t nbits)
void init()
dummy, used by WriteSubValue method