1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-18 14:45:58 +00:00

Analyzer: W0101 warn on expensive multiply/divide

Emits W0101 on \`a * b\`, \`a / b\`, \`a % b\` expressions where both
operands are non-constant (neither is an integer literal). These lower
to calls into the software multiply/divide routines and can blow the
6502 cycle budget. Multiplying by a constant is still silent because
the optimizer can strength-reduce power-of-2 cases to shifts and small
factors to add chains.

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 11:01:03 +00:00
parent 4e05c008ce
commit 1e4e384501
No known key found for this signature in database
3 changed files with 67 additions and 2 deletions

View file

@ -42,7 +42,6 @@ pub enum ErrorCode {
E0505, // multiple start declarations
// W01xx: Warnings
#[allow(dead_code)]
W0101, // expensive multiply/divide operation
W0102, // loop without break or wait_frame
W0103, // unused variable