Overview
Programmer mode offers common mathematical operations for developers, including conversion between common bases and bitwise operations. It evaluates expressions using standard operator precedence. Source Reference:src/Calculator/Views/Calculator.xaml.cs:282-287
Number Base Support
Hexadecimal (HEX)
Base-16 number system (0-9, A-F)
Decimal (DEC)
Base-10 number system (0-9)
Octal (OCT)
Base-8 number system (0-7)
Binary (BIN)
Base-2 number system (0-1)
src/Calculator/Views/CalculatorProgrammerOperators.xaml.cs
Bit Length Modes
Programmer Calculator supports four bit length modes:- QWORD - 64-bit (Quadword)
- DWORD - 32-bit (Doubleword)
- WORD - 16-bit
- BYTE - 8-bit
src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cs:65-97
When switching to a smaller bit length, values are automatically truncated to fit within the new range.
Bitwise Operations
Logical Operators
- AND - Bitwise AND operation
- OR - Bitwise OR operation
- XOR - Bitwise exclusive OR
- NOT - Bitwise NOT (complement)
- NAND - NOT AND
- NOR - NOT OR
Shift Operations
- LSH - Logical Shift Left
- RSH - Logical Shift Right
- RoL - Rotate Left
- RoR - Rotate Right
Bit Manipulation
- Individual bit toggling via the bit display panel
- Visual representation of all bits
- Click individual bits to flip them
src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cs
Display Panel
The Programmer Calculator includes a comprehensive display panel showing:Multi-Base Display
Simultaneous display of the current value in all four number bases:- HEX - Hexadecimal representation
- DEC - Decimal representation
- OCT - Octal representation
- BIN - Binary representation
Binary Visualization
The bit flip panel shows:- Individual bit positions (numbered from 0)
- Visual grouping (bytes separated for readability)
- Interactive bit toggling
- Automatic updates when value changes
src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cs
Integer-Only Operations
Programmer mode operates exclusively with integers. Decimal operations are disabled in this mode.
src/Calculator/Views/Calculator.xaml.cs:285
Memory Support
Unlike Standard and Scientific modes, Programmer Calculator has a dedicated memory panel:- Memory operations available (MS, MR, M+, M-, MC)
- Memory values stored in the current number base
- Memory panel shows stored values with their current base representation
src/Calculator/Views/Calculator.xaml.cs:398-417
Special Features
Full Keyboard Support
- Number keys - Enter digits (0-9)
- A-F keys - Enter hex digits (in HEX mode)
- Operators - Standard operators
- % - Modulo operation
- Shift operators - Custom keyboard shortcuts
Error Handling
The calculator provides visual feedback for:- Invalid operations
- Overflow conditions
- Division by zero
- Invalid digits for current base (e.g., ‘8’ in octal mode)
src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cs:44-56
Window Requirements
Programmer mode requires:- Minimum height: 640px
- Ensures bit display panel remains fully visible
src/Calculator/Views/Calculator.xaml.cs:286
History Panel
Programmer mode has a memory-only panel. The history pivot is removed when entering Programmer mode and restored when switching to other modes.
src/Calculator/Views/Calculator.xaml.cs:401-412
Common Use Cases
- Color code conversions - Converting RGB values between hex and decimal
- Network addressing - IP address calculations and subnet masks
- Bit flag manipulation - Setting and clearing individual bits
- Permission masks - Unix-style permission calculations
- Memory address calculations - Pointer arithmetic and offsets
- Data structure size - Calculating sizes in bits and bytes
Related Features
- Standard Calculator - Basic arithmetic operations
- Scientific Calculator - Advanced mathematical functions
- History & Memory - Memory operations