|
EnigmaMachineCore 0.1.0
A modular Enigma Machine simulation in C++20
|
Accepted
The Enigma Machine's signal path and rotor stepping logic frequently use the modulo operator (% TRANSFORMER_SIZE) to ensure values stay within the [0, 25] range. On modern CPUs, integer division (which modulo requires) is a significantly more expensive instruction than simple addition or subtraction.
We will replace the modulo operator with Conditional Subtractions in the engine's "hot path" (transformation and rotation).
(position + rotationCount) is guaranteed to be less than 2 * TRANSFORMER_SIZE.2 * TRANSFORMER_SIZE, this optimization would become invalid.if statements to maintain readability and satisfy static analysis (linter) rules.