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

chore: make fields/developerFields n buffer size 255 instead of 256 #303

Merged

Conversation

muktihari
Copy link
Owner

A byte value is between 0-255, so field's num, n Fields and field's value size max value is 255. The same logic applies for developer fields as well. So we only need 255 size for those values such as when creating fieldsArray in decoder, fields' pool in mesgdef, etc. Even the maximum number of character in a string should not exceed 255.

And for factory, we keep the fields' size 256 as we want to ensure O(1) field lookup, and technically, field number 255 is still a valid byte even if it's an invalid field number.

@muktihari muktihari added the chore update not related to the functionality of the sdk, e.g. update workflow label Jun 3, 2024
@muktihari muktihari self-assigned this Jun 3, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6836dae) to head (5a14556).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #303   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         3691      3691           
=========================================
  Hits          3691      3691           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@muktihari muktihari merged commit 412411f into master Jun 3, 2024
4 checks passed
@muktihari muktihari deleted the chore/make-fields-developer-fields-n-size-255-instead-of-256 branch June 3, 2024 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore update not related to the functionality of the sdk, e.g. update workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants