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

User Definable NUM_LAYERS. Builds upon layer_state_t #527

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alex-ong
Copy link
Contributor

Users can now define NUM_LAYERS.
I haven't yet tested:

#if NUM_LAYERS > 16   // layer_state is uint32_t
    return action.layer_bitop.part*4;
#elif NUM_LAYERS > 8   // unit16_t
    return (action.layer_bitop.part & 3)*4;
#else  // uint8_t
    return (action.layer_bitop.part & 1)*4;
#endif
  • Major space saving from using uint8_t instead of uint32_t, on the order of 300+ bytes.
  • Minor time saving for all the bitshifts.

TODO: define constant "Layer_size_ONE" as ((layer_state_t)1) for all bitshifting everywhere.

@tmk
Copy link
Owner

tmk commented Jan 25, 2018

I pulled the changes and did quick test, it looks promissing! I'll look into codes closely and do some tests later.

For someone intrested this PR is related to this discussion #523 and supercedes PR #526.

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.

2 participants