Commit 7baffdc
committed
Phase 3: Add hash-based command dispatch infrastructure
Add compile-time hash function and constants for future dispatcher optimization.
This foundation enables switching from linear strcmp chain (104 calls) to
hash-based dispatch for estimated 200-300B Flash savings.
Infrastructure added:
- hash_command() inline function in main.h
- No runtime overhead (compiled to constant)
- Verified 71 simple commands with zero hash collisions
- 47 parametric commands remain in strncmp for safety
This sets up for future targeted refactor of simple commands without
blocking current functionality. Can be implemented incrementally with
minimal risk to protocol compliance.
Current state: +264B Flash (Phase 1+2), ready for Phase 3 implementation
when needed for additional features.1 parent f06913e commit 7baffdc
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
379 | 389 | | |
380 | 390 | | |
381 | 391 | | |
| |||
0 commit comments