Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with size calculation #25

Closed
ioztelcan opened this issue Jul 16, 2019 · 6 comments
Closed

Issues with size calculation #25

ioztelcan opened this issue Jul 16, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@ioztelcan
Copy link

I haven't tested out vigorously but it looks like the size calculation has some problems, at least for small values.

E.g:

$ bitwise 369
Decimal: 369
Hexdecimal: 0x171
Octal: 0561
Size: 369bytes
ASCII: .......q
Binary:
0 0 0 0 0 0 0 1 | 0 1 1 1 0 0 0 1 
    15 -  8            7 -  0      

or

Decimal: 9
Hexdecimal: 0x9
Octal: 011
Size: 9bytes
ASCII: ........
Binary:
0 0 0 0 1 0 0 1

Best,
Ilker

@mellowcandle
Copy link
Owner

looks fine to me, except the missing whitespace between the number and bytes.

@mellowcandle
Copy link
Owner

what troubles you?

@rfs613
Copy link

rfs613 commented Jul 18, 2019

Not the OP here, but my $0.02:

  1. the label "Size" is somewhat confusing. Until I put in a larger value, I thought this was the number of bytes needed to store the value. So for example I would expect it to print "Size: 1byte" for an value less than 256. Only after putting in a larger number, did I realize what this field is actually reporting.

  2. consider changing "bytes" to " B" (with a space in front). This would make it more consistent with the other larger units like KiB, MiB, etc.

@mellowcandle
Copy link
Owner

oh. now I see. I'm not sure this will solve the ambiguity either. perhaps I should only print it if it's bigger than 1k

@rfs613
Copy link

rfs613 commented Jul 18, 2019

Perhaps change "Size:" to "Human:", and drop "bytes" suffix entirely. That's how "ls -lh" seems to behave.

@mellowcandle
Copy link
Owner

@rfs613 I thing it's a good idea. I'll fix it.

@mellowcandle mellowcandle reopened this Jul 19, 2019
@mellowcandle mellowcandle self-assigned this Jul 19, 2019
@mellowcandle mellowcandle added the enhancement New feature or request label Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants