159 operator const char* ()
233 fNBitsRep =
b.GetNBits();
274 Int_t idx_min = nbits - fNBits;
275 idx_min = idx_min * (idx_min > 0);
276 for (
Int_t i = nbits - 1; i >= idx_min; i--) {
278 fVal += (
T)(1 << ibit);
307 fDumString.Prepend(
'1');
309 fDumString.Prepend(
'0');
318 (nbits ? (
Int_t) nbits -
319 (
Int_t) setbits : (GetNBits() ? (
Int_t) GetNBits() -
320 (
Int_t) setbits : 0));
323 fDumString.Prepend(
'0', lzos);
327 fDumString.Remove(0, -lzos);
329 return fDumString.Data();
332template <
class T > Binary_t < T >& Binary_t < T >::operator=(
const T val)
339template <
class T > Binary_t < T >&
Binary_t <
354template <
class T > Binary_t < T >&
Binary_t <
365 return (fVal == b2.
fVal);
371 return (fVal != b2.
fVal);
378 return ((*
this) != Bb2);
549 Int_t _fNBits, _msb, _nbits;
550 _fNBits = (
Int_t) fNBits;
552 _nbits = (
Int_t) nbits;
553 if (_nbits < 1 || _nbits > _fNBits || _msb > (_fNBits - 1)
554 || (_msb - _nbits + 1) < 0) {
555 std::cout <<
"Error in <Binary_t<T>::WriteSubvalue> : ";
557 std::cout <<
"nbits<1";
558 if (_nbits > _fNBits)
559 std::cout <<
"nbits(" << _nbits <<
")>fNBits(" << _fNBits <<
")";
560 if (_msb > (_fNBits - 1))
561 std::cout <<
"msb(" << _msb <<
") > fNBits-1(" << _fNBits - 1 <<
")";
562 if ((_msb - _nbits + 1) < 0)
563 std::cout <<
"(msb-nbits+1) < 0 : msb=" << _msb <<
" nbits=" << _nbits;
564 std::cout << std::endl;
568 Binary_t < T > tmp(val);
572 fDumString.Replace((_fNBits - _msb - 1), nbits, tmp.
String(nbits));
574 Set(fDumString.Data());
579 std::cout <<
"Binary number : " <<
const_cast<Binary_t<T>*
>(
this)->
String() <<
" : fNBits=" << (int) fNBits
580 <<
" fNBitsRep=" << (
int) fNBitsRep <<
" fVal=" << (
Long64_t)
581 Value() << std::endl;
594 Int_t _firstbit, _nbits;
595 _firstbit = (
Int_t) firstbit;
596 _nbits = (
Int_t) nbits;
598 _nbits = ((_firstbit - _nbits + 1) < 0 ? _firstbit + 1 : _nbits);
603 fDumString2 = fDumString(0, _nbits);
606 tmp.
Set(fDumString2.Data());
607 return (tmp.
Value());
constexpr ULong_t kBitsPerByte
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
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
RVec< PromoteTypes< T0, T1 > > pow(const RVec< T0 > &v, const T1 &y)