move hash_page to pages.h
This commit is contained in:
parent
13de480bde
commit
55769496dc
@ -784,15 +784,6 @@ static void regions_quarantine_deallocate_pages(void *p, size_t size, size_t gua
|
||||
}
|
||||
}
|
||||
|
||||
static size_t hash_page(const void *p) {
|
||||
uintptr_t u = (uintptr_t)p >> PAGE_SHIFT;
|
||||
size_t sum = u;
|
||||
sum = (sum << 7) - sum + (u >> 16);
|
||||
sum = (sum << 7) - sum + (u >> 32);
|
||||
sum = (sum << 7) - sum + (u >> 48);
|
||||
return sum;
|
||||
}
|
||||
|
||||
static int regions_grow(void) {
|
||||
struct region_allocator *ra = ro.region_allocator;
|
||||
|
||||
|
10
pages.h
10
pages.h
@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define PAGE_SHIFT 12
|
||||
#ifndef PAGE_SIZE
|
||||
@ -14,4 +15,13 @@ void *allocate_pages(size_t usable_size, size_t guard_size, bool unprotect, cons
|
||||
void *allocate_pages_aligned(size_t usable_size, size_t alignment, size_t guard_size, const char *name);
|
||||
void deallocate_pages(void *usable, size_t usable_size, size_t guard_size);
|
||||
|
||||
static inline size_t hash_page(const void *p) {
|
||||
uintptr_t u = (uintptr_t)p >> PAGE_SHIFT;
|
||||
size_t sum = u;
|
||||
sum = (sum << 7) - sum + (u >> 16);
|
||||
sum = (sum << 7) - sum + (u >> 32);
|
||||
sum = (sum << 7) - sum + (u >> 48);
|
||||
return sum;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user