Page MenuHomeFreeBSD

D40722.diff
No OneTemporary

D40722.diff

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

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)

Event Timeline