Git Product home page Git Product logo

bitwise's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitwise's Issues

Unable to fill last 4 bits in 64bit mode with decimal, hex or octal fields

Hi!

As issue title says โ€” I am unable to fill all bits, when I am filling in decimal, hex or octal fields.

The case:

  1. I enter hex ffff ffff ffff fff, only 15 symbols (whitespaces are for readability);
  2. Bits are 0 0 0 0 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1, decimal is 1152921504606846975, octal - 77777777777777777777;
  3. I enter 16th f to fill bits 60-63, but nothing happens. If I want to delete this last 16th f I will delete both 16th and 15th.
  4. When I go to the bits field and set all 60-63 bits manually I get decimal to 18446744073709551615, hex to ffff ffff ffff ffff, octal 1777777777777777777777, all bits are set. And now all values have their expected values.

Is it a bug or expected behaviour?

Suggestion: More than 8 letters of ASCII

If I pass more than 8 bytes ASCII: field only show dots (.........).
Will it be a problem to display more than 8 characters, or at least keep the first 8 letters in place?

Parse all arguments

Currently when calling bitwise 3 + 3, the result for 3 is displayed.
To avoid quoting (and making usage in pipes easier), all arguments should be parsed as an expression.

Thanks, this is already a great tool!

add command to change output base

in interactive command mode, add command to change output base. currently it set to hex, allow seeing it to decimal or octal or binary as well.

Depends: libreadline6 (>= 6.3) but it is not installable

Trying to install and I'm getting the following error. I can't seem to find libreadline6 using apt-get install libreadline6 either.

Running Ubuntu 18.04.2 on WSL.

$ sudo apt-get install bitwise

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 bitwise : Depends: libreadline6 (>= 6.3) but it is not installable
E: Unable to correct problems, you have held broken packages.

Issues with size calculation

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

Dividing by 0 is not handled

Describe the bug
Dividing by 0 causes the program to crash with Floating point exception (core dumped) error.

To Reproduce
Divide any number by 0.

Expected behavior
It should be handled by printing a warning.

Version:
v0.40

Desktop:

  • OS: Ubuntu 20.04

Wrong colors when inside a terminal multiplexer (tmux)

Whenever I open bitwise inside tmux my default colors are swapped to black foreground on white background. I do believe that's because some color resetting[1] happening after we call start_colors(). I've found two solutions:

  1. calling use_default_colors() after start_color() in src/misc.c
  2. calling init_pair(0, COLOR_WHITE, COLOR_BLACK) in src/interactive.c

I think 1) is the right way to deal with this problem because it will respect whatever colorscheme is being used. It's trivial to change, should I make a pull request?

[1] curs_color(3X) says that It restores the colors on the terminal to the values they had when the terminal was just turned on.

Screen repaint hides decimal, hex and octal fields values

Describe the bug
There is a visual bug caused by, I suppose, by unpaint_screen(); ... paint_screen();. When the cursor is on the bit-field and I preess ~ NOT hotkey, for example, values of decimal, hex and octal are hidden. And they will update again only when we change the value of bits or move cursor to the up to that fields.

To Reproduce
Steps to reproduce the behavior:

  1. Open bitwise in interactive mode
  2. Enter any number in decimal field
  3. Move cursor to bitfield
  4. Press ~ hotkey
  5. Values in decimal, hex and octal are disappeared; label with bit number is also disappeared.
  6. Move to up to decimal field - values will appear again, move back to bitsfield - bit label number will appear again.

Expected behavior
Screen repaint should update fields to actual current values โ€” values in decimal, hex, octal and bit number should not disappear.

Screenshots
https://asciinema.org/a/LMDk8RuDmdqlahkitRvKHPbUX

Version:

  • master
  • 0.32

Desktop (please complete the following information):

  • OS: macOS 10.14.4

Bitwidth not enforced, oveflow is a bit awkward

Describe the bug
Overflow not handled elegantly

To Reproduce
Steps to reproduce the behavior:

  1. Set width to a low amount eg: :width 8
  2. Add two numbers that total higher than the max value for that width eg: 0xff + 1

Expected behavior
Overflow should probably be truncated, to resemble the behavior in most programming languages and provide a warning

Screenshots
image

Version:

  • 0.43

Desktop (please complete the following information):

  • OS: Arch Linux

Add command line mode

Add commannd line mode using libreadline that allows more bit operations such as shifts, rors, etc.

Create help screen

Create help screen:

  1. Launch using :help / :h in command mode or h in normal mode.
  2. Display a new ncurses window on all of the screen masking other windows
  3. Exit help screen by typing any key and restore previous state.

Create vim plugin

vim plugin should be able to launch command line vim on currently selected word and output the result in a new window.

Failure to compile without -ltinfo

Describe the bug
bitwise fails to compile.

Expected behavior
successful compilation

Screenshots

/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/cmd.o: undefined reference to symbol 'nodelay'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:638: bitwise] Error 1

Version:

  • master

Desktop (please complete the following information):

  • 5.15.16-gentoo-x86_64

Additional context
This problem is fixed by adding -ltinfo to LIBS on line 437.

wrong output on overflow

In the interactive mode, if the input value doesn't fit in chosen word length, instead of returning an error or truncating, bitwise displays a bogus value.

For example, on the first try, I did not notice the 32-bit limitation and typed in 4294967296. I'd expect one of:

  • 0
  • "error" or "overflow"
  • extending the field

yet I got:

hex 19999999
oct 3146314631
bin 0 0 0 1 1 0 0 1 | 1 0 0 1 1 0 0 1 | 1 0 0 1 1 0 0 1 | 1 0 0 1 1 0 0 1

warning: data argument not used by format string

clang8 complains:

src/misc.c:166:24: warning: data argument not used by format string [-Wformat-extra-args]
                sprintf(buf, PRIu64, val);
                             ~~~~~~  ^
src/misc.c:169:24: warning: data argument not used by format string [-Wformat-extra-args]
                sprintf(buf, PRIx64, val);
                             ~~~~~~  ^
src/misc.c:172:24: warning: data argument not used by format string [-Wformat-extra-args]
                sprintf(buf, PRIo64, val);
                             ~~~~~~  ^

Wrong bits displayed in interactive mode

The displayed bit string is always lagging one input behind.

Steps to reproduce:

  • ./bootstrap.sh && ./configure && make && ./bitwise
  • Type 1 (in the Decimal input)
  • Observe how the bit string stays all zero
  • Type Backspace
  • Observe how the bit string displays 1.

On v0.30 and on current master (306e66b).

Bitview incorrect for byte

change to byte width. Enter 255 in dec. Bit field should be all ones, instead it is not until the width is toggled again. Edit: it seem to be generally incorrect actually, just try entering some numbers when modifying width.

License is not clear

Describe the bug
The license terms are not clear, the license is GPLv3, which could allow any later version too if the files specify that.
The source files specify that the license is BSD-2 though, so what is the license of all files in this repo?
And if it is the way the License file specifies, rather than the way the source specifies. Can we use a later version too?

To Reproduce
Steps to reproduce the behavior:
Compare https://github.com/mellowcandle/bitwise/blob/master/src/stack.c and https://github.com/mellowcandle/bitwise/blob/master/LICENSE

Expected behavior
A defined license in both LICENSE and source files

Version:

  • master

Desktop (please complete the following information):

  • OS: any

Additional context
Homebrew/homebrew-core#137210 reports usage of an outdated license identifier and I can't figure out what it should be either

Inconsistent binary prefix

0B should be valid just like B is.

[xfgusta@fedora bitwise]$ bitwise b101 + B010
Unsigned decimal: 7
Signed decimal: 7
Hexadecimal: 0x7
Octal: 07
Human: 7
Radix64: 5
IPv4 (Network byte order - Big):  7.0.0.0
IPv4 (Reversed byte order - Little):  0.0.0.7
ASCII: ........
Binary:
0 0 0 0 0 1 1 1
     7 -  0

[xfgusta@fedora bitwise]$ bitwise 0b101 + 0B010
Unsigned decimal: 5
Signed decimal: 5
Hexadecimal: 0x5
Octal: 05
Human: 5
Radix64: 3
IPv4 (Network byte order - Big):  5.0.0.0
IPv4 (Reversed byte order - Little):  0.0.0.5
ASCII: ........
Binary:
0 0 0 0 0 1 0 1
     7 -  0

Add X clipboard integration

Allow copying result to clipboard using a keybind,
This isn't not portable across OS's but this could be added with a compilation flag specifically for Linux.

Provide full documentation in manpage

The purpose of having documentation is to document the various operations of a program or alike. It would be awesome if the manpage could reflect the documentation written in the Readme (with completeness).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.