On 30.06.15 07:53, Richard Henderson wrote:
> On 06/29/2015 09:24 PM, Aurelien Jarno wrote:
>> On 2015-06-29 10:28, Richard Henderson wrote:
>>> On 06/25/2015 08:16 PM, Aurelien Jarno wrote:
for (shift = 4; (shift < 64) && bin; shift += 4) {
-int current_number = bin % 10;
On 06/29/2015 09:24 PM, Aurelien Jarno wrote:
On 2015-06-29 10:28, Richard Henderson wrote:
On 06/25/2015 08:16 PM, Aurelien Jarno wrote:
for (shift = 4; (shift < 64) && bin; shift += 4) {
-int current_number = bin % 10;
-
-dec |= (current_number) << shift;
+dec |=
On 2015-06-29 10:28, Richard Henderson wrote:
> On 06/25/2015 08:16 PM, Aurelien Jarno wrote:
> > for (shift = 4; (shift < 64) && bin; shift += 4) {
> >-int current_number = bin % 10;
> >-
> >-dec |= (current_number) << shift;
> >+dec |= (bin % 10) << shift;
> >
On 06/25/2015 08:16 PM, Aurelien Jarno wrote:
for (shift = 4; (shift < 64) && bin; shift += 4) {
-int current_number = bin % 10;
-
-dec |= (current_number) << shift;
+dec |= (bin % 10) << shift;
bin /= 10;
}
You've changed from 32-bit division to 64
current_number being shift left by more than 32 bits, we can't use a
simple int. Similarly use an int64_t type for the input binary value,
to not get the -2^31 case wrong. Finally don't initialize shift to 4,
it's already done in the for loop.
Signed-off-by: Aurelien Jarno
Cc: Alexander Graf
Cc: