Ramshankar
on software & life

sysprocalc

sysprocalc (system programmer’s calculator) is an interactive, command-line expression evaluator for Windows, macOS, Linux. sysprocalc is written entirely in Rust and is the successor to my C project nopf.

Basic expression parsing and evaluation works. There’s good test coverage using GitHub continuous integration for Windows, macOS and Linux. There is also fuzz testing using cargo-fuzz.

Variables/constants aren’t supported yet but are planned to be implemented in the future.

Features

  • Performs separate integer and floating-point math for every operation.

  • Interactive mode with colored output.

  • Support for input and output in hex, oct, decimal and binary.

  • Bit shifts, alignment and other bitwise operations.

  • Pretty printing of some x86/amd64 registers with description of bits.

  • Unit of measure conversions for common units like pages to bytes, gigabits to bits etc.

License

sysprocalc is licensed under either of the Apache license, version 2 or the MIT license at your option.

Source code

Source code available at sysprocalc’s GitHub repository.

Sample output

> avg(10, 12, 14, 0x18 + 0x120)
Bool:                     true (nat)
Dec :                       87 (u64)                          87 (f)
Hex :       0x0000000000000057 (u64)                        0x57 (n)
Oct :   0o00000000000000000127 (u64)                       0o127 (n)
Bin : 101 0111 (7 bits)

> cel2far(32)
Bool:                     true (nat)
Dec :                       89 (u64)                        89.6 (f)
Hex :       0x0000000000000059 (u64)                        0x59 (n)
Oct :   0o00000000000000000131 (u64)                       0o131 (n)
Bin : 101 1001 (7 bits)

> efer 0xd01
cpu.x86 efer (Extended Feature Register)
 0000 0000 0000 0000 0000 1101 0000 0001
                      │││ ││ │         │
                      │││ ││ │         └── SCE   ( 0) *
                      │││ ││ └──────────── LME   ( 8) *
                      │││ │└────────────── LMA   (10) *
                      │││ └─────────────── NXE   (11) *
                      ││└───────────────── SVME  (12)
                      │└────────────────── LMSLE (13)
                      └─────────────────── FFXSR (14)