Page MenuHomeFreeBSD

radix_trie: simplify trimkey functions
ClosedPublic

Authored by dougm on Jun 23 2023, 8:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 18, 1:10 PM
Unknown Object (File)
Mar 22 2025, 8:33 AM
Unknown Object (File)
Mar 22 2025, 2:29 AM
Unknown Object (File)
Mar 20 2025, 10:23 PM
Unknown Object (File)
Mar 16 2025, 2:30 PM
Unknown Object (File)
Jan 28 2025, 3:30 AM
Unknown Object (File)
Jan 26 2025, 7:55 PM
Unknown Object (File)
Jan 10 2025, 10:04 PM
Subscribers

Details

Summary

Replacing a branch and two shifts with a single masking operation saves 64 bytes the pair of functions lookup_le and lookup_ge.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.Jun 23 2023, 8:34 AM
dougm created this revision.
sys/vm/vm_radix.c
187–188

I don't see the point of retaining this variable.

188

Can you revise the comment at the top of the function to more clearly explain what is being done here? "Trims the key" is not very clear.

dougm marked 2 inline comments as done.
This revision is now accepted and ready to land.Jun 25 2023, 5:48 PM
This revision was automatically updated to reflect the committed changes.

I'm surprised this is needed, you'd hope the compiler could do this transformation. Maybe worth filling a LLVM bug report?