Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmk_core/common/action.c: refactor for code size; merge multiple cases into one #11943

Merged
merged 2 commits into from
Feb 20, 2021

Conversation

liyang
Copy link

@liyang liyang commented Feb 17, 2021

Refactor for code size & maintainability; save ~134 bytes on ATmega32.

Description

commit 03ddd855d28dca2804e6b3e2a078b484e8fb1daa (origin/develop/action-mouse, develop/action-mouse)
Author: Liyang HU <git@liyang.hu>
Date:   Tue Feb 16 14:38:16 2021 +0000

    tmk_core/common/action.c: collapse multiple `case KC_MS_BTN[1-8]:` into single `MOUSE_BTN_MASK(action.key.code - KC_MS_BTN1)`

    This saves ~134 bytes on my ATmega32.

commit 1be62c75368575e09c8aa29a4252d02945167f83
Author: Liyang HU <git@liyang.hu>
Date:   Tue Feb 16 14:06:30 2021 +0000

    tmk_core/common/report.h: define `enum mouse_buttons` in terms of `#define MOUSE_BTN_MASK()`

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

  • n/a

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

…to single `MOUSE_BTN_MASK(action.key.code - KC_MS_BTN1)`

We all love tapping on our keyboards but this is taking the piss.

This saves ~134 bytes on my ATmega32.
@github-actions github-actions bot added the core label Feb 17, 2021
@spidey3 spidey3 merged commit c4bd6af into qmk:develop Feb 20, 2021
@liyang liyang deleted the develop/action-mouse branch February 28, 2021 23:44
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
…e`s into one (qmk#11943)

* tmk_core/common/report.h: define `enum mouse_buttons` in terms of `#define MOUSE_BTN_MASK()`

* tmk_core/common/action.c: collapse multiple `case KC_MS_BTN[1-8]:` into single `MOUSE_BTN_MASK(action.key.code - KC_MS_BTN1)`

We all love tapping on our keyboards but this is taking the piss.

This saves ~134 bytes on my ATmega32.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants