kernel: utilities: add simple hash function (re: app checker and AppID) #3808
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Overview
The AppID TRD references being able to assign
ShortID
s to applications (and therefore running processes) based on the app name. To do this, we need a function with signaturefn create_short_id(s: &'static str) -> u32
.I just made this one up since it is simple to implement, doesn't require a dependency, and will probably work for the type of basic use cases that we want to be able to experiment with. For example, I've used this to assign specific applications by name to specific regions on a screen. We could also assign apps to LEDs or any other resource. What is nice is this "just works" without having to add new TBF headers, and we as humans have an easy time understanding the app name.
Testing Strategy
Work on screens.
TODO or Help Wanted
If there is something in the core library that would be better.
If there is a more well known simple hash-like function that does this that might be better. I'm opening this PR because I think we need something like this, but I'm not exactly sure what.
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.