[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    bug#1189: [BusyBox] bug#1189: make_human_readable_str chokes with big  numbers (GB/TB values)
From:       Adam Slattery <aslattery () sunriselinux ! com>
Date:       2001-06-29 16:45:02
[Download RAW message or body]


> > The problem is that in human_readable.c, a 32 bit variable ends up getting
> > shifted left 40 bits when you have a GB size.  The fix is to use a
> > variable as big as the result size (long double). A small problem arrises:
> > you can't bitshift long double on 32 bit archetectures. So instead we can
> > just multiply and divide by 1024 (*1024 is the same as <<10).
> 
> but slower.  Actually, a while back we had a version of human_readable.c that
> didn't need any floats at all.  Unfortunately, we had a very flawed interface
> at the time that led to it being misused.  I was planning on resurrecting that
> version and updating it to the current interface, but I just talked with Manuel
> and it turns out he is already doing it.  So we should have that fixed up soon.

Slower hardly matters at all with this, only binary size. Hopefully
the new code won't be so broken =].

Thanks,
Adam Slattery
aslattery@sunriselinux.com





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic