Convert bits to bytes
Algorithms
2
Posts
2
Posters
0
Views
1
Watching
-
Hi, In a C++ software projetc I'm working with they gets
number of bytes = ((number of bits)* 7) / 8
Why isn't
number of bytes = (number of bits) / 8
Thanks!
marca292 wrote:
number of bytes = ((number of bits)* 7) / 8
It should really be (note the plus sign)
number of bytes = ((number of bits) + 7) / 8
to round up any odd bits to a byte boundary. Cheers, Peter
Software rusts. Simon Stephenson, ca 1994.