Skip to content

Commit bda11e6

Browse files
authored
[PWGLF] set default before bit computation (#14547)
1 parent 64dc408 commit bda11e6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

PWGLF/TableProducer/Nuspex/ebyeMaker.cxx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,16 @@ void encode16bit(int const& n, uint8_t& low, uint8_t& up)
9898
if (n >= (1 << 16)) {
9999
low = up = -1;
100100
return;
101+
} else {
102+
low = up = 0;
101103
}
102-
int bbyte = 8;
103-
for (int b{0}; b < bbyte; ++b) {
104-
int bl = (n & (1 << b)) >> b;
105-
int bu = (n & (1 << (b + bbyte))) >> (b + bbyte);
106-
if (bl > 0)
104+
int bByte = 8;
105+
for (int b{0}; b < bByte; ++b) {
106+
int bL = (n & (1 << b)) >> b;
107+
int bU = (n & (1 << (b + bByte))) >> (b + bByte);
108+
if (bL > 0)
107109
low += (1 << b);
108-
if (bu > 0)
110+
if (bU > 0)
109111
up += (1 << b);
110112
}
111113
}

0 commit comments

Comments
 (0)