39 if (base!=0 && base!=2 && base!=8 && base!=16)
41 "Bad args: base must be 0,2,8, or 16");
44 "Bad args: nbit must be in 1,..,8");
55 if (base!=0 && base!=2 && base!=8 && base!=16)
57 "Bad args: base must be 0,2,8, or 16");
58 if (nbit<1 || nbit>16)
60 "Bad args: nbit must be in 1,..,16");
71 if (base!=0 && base!=2 && base!=8 && base!=16)
73 "Bad args: base must be 0,2,8, or 16");
74 if (nbit<1 || nbit>32)
76 "Bad args: nbit must be in 1,..,32");
124 if (
fBase == 8) nwidth = 3;
125 if (
fBase == 16) nwidth = 4;
126 uint32_t nmask = (1<<nwidth)-1;
128 size_t ndig = (
fNbit+nwidth-1)/nwidth;
130 for (
size_t i=ndig; i>0; i--) {
131 uint32_t nibble = ((
fVal)>>((i-1)*nwidth)) & nmask;
132 nibble += (nibble <= 9) ?
'0' : (
'a'-10);
133 *pbuf++ = char(nibble);
void Convert(char *pbuf) const
FIXME_docs.
void Print(std::ostream &os) const
FIXME_docs.
uint32_t fVal
value to be printed
size_t fBase
base: 2,8, or 16
RosPrintBvi(uint8_t val, size_t base=2, size_t nbit=8)
Constructor. FIXME_docs.
size_t fNbit
number of bits to print
Declaration of class ReventLoop.