Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150329427
D40722.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40722.diff
View Options
diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c
--- a/sys/kern/subr_pctrie.c
+++ b/sys/kern/subr_pctrie.c
@@ -156,18 +156,11 @@
return ((index >> (level * PCTRIE_WIDTH)) & PCTRIE_MASK);
}
-/* Trims the key after the specified level. */
+/* Computes the key (index) with the low-order 'level' radix-digits zeroed. */
static __inline uint64_t
pctrie_trimkey(uint64_t index, uint16_t level)
{
- uint64_t ret;
-
- ret = index;
- if (level > 0) {
- ret >>= level * PCTRIE_WIDTH;
- ret <<= level * PCTRIE_WIDTH;
- }
- return (ret);
+ return (index & -PCTRIE_UNITLEVEL(level));
}
/*
diff --git a/sys/vm/vm_radix.c b/sys/vm/vm_radix.c
--- a/sys/vm/vm_radix.c
+++ b/sys/vm/vm_radix.c
@@ -181,18 +181,11 @@
return ((index >> (level * VM_RADIX_WIDTH)) & VM_RADIX_MASK);
}
-/* Trims the key after the specified level. */
+/* Computes the key (index) with the low-order 'level' radix-digits zeroed. */
static __inline vm_pindex_t
vm_radix_trimkey(vm_pindex_t index, uint16_t level)
{
- vm_pindex_t ret;
-
- ret = index;
- if (level > 0) {
- ret >>= level * VM_RADIX_WIDTH;
- ret <<= level * VM_RADIX_WIDTH;
- }
- return (ret);
+ return (index & -VM_RADIX_UNITLEVEL(level));
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 1, 6:10 AM (19 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30667901
Default Alt Text
D40722.diff (1 KB)
Attached To
Mode
D40722: radix_trie: simplify trimkey functions
Attached
Detach File
Event Timeline
Log In to Comment