Skip to content

tc6-regs: fix narrowing conversions in init#73

Open
tkummermehr wants to merge 1 commit intoMicrochipTech:mainfrom
tkummermehr:static-analysis/narrowing-async
Open

tc6-regs: fix narrowing conversions in init#73
tkummermehr wants to merge 1 commit intoMicrochipTech:mainfrom
tkummermehr:static-analysis/narrowing-async

Conversation

@tkummermehr
Copy link
Copy Markdown
Collaborator

Summary

Cast initOffset operands to int16_t before arithmetic in config parameter initialization. Fixes 8 clang-tidy bugprone-narrowing-conversions warnings.

Test plan

  • Static analysis re-run confirms warnings eliminated
  • Code logic unchanged (only explicit casts added)

Fixes clang-tidy bugprone-narrowing-conversions warnings where int16_t
operands were being promoted to int during arithmetic, then narrowed back
to int16_t on assignment. Casting the initOffset operands to int16_t
before addition keeps arithmetic in the target type.

Finding: clang-tidy/bugprone-narrowing-conversions at libtc6/src/tc6-regs.c:591,594,603,612,615,624,627,637,640
@tkummermehr tkummermehr requested a review from SvenSemmler May 4, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant