slab: use BytePointer
Change-Id: I786f720ccd0c1469287a70906d05633218c25ceb Reviewed-on: https://review.haiku-os.org/c/1100 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#define OBJECT_CACHE_H
|
#define OBJECT_CACHE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <BytePointer.h>
|
||||||
#include <condition_variable.h>
|
#include <condition_variable.h>
|
||||||
#include <lock.h>
|
#include <lock.h>
|
||||||
#include <slab/ObjectDepot.h>
|
#include <slab/ObjectDepot.h>
|
||||||
@@ -140,8 +141,9 @@ link_to_object(object_link* link, size_t objectSize)
|
|||||||
static inline object_link*
|
static inline object_link*
|
||||||
object_to_link(void* object, size_t objectSize)
|
object_to_link(void* object, size_t objectSize)
|
||||||
{
|
{
|
||||||
return (object_link*)(((uint8*)object)
|
BytePointer<object_link> pointer((uint8*)object
|
||||||
+ (objectSize - sizeof(object_link)));
|
+ (objectSize - sizeof(object_link)));
|
||||||
|
return &pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "SmallObjectCache.h"
|
#include "SmallObjectCache.h"
|
||||||
|
|
||||||
|
#include <BytePointer.h>
|
||||||
#include "MemoryManager.h"
|
#include "MemoryManager.h"
|
||||||
#include "slab_private.h"
|
#include "slab_private.h"
|
||||||
|
|
||||||
@@ -18,7 +19,8 @@ RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache)
|
|||||||
static inline slab *
|
static inline slab *
|
||||||
slab_in_pages(const void *pages, size_t slab_size)
|
slab_in_pages(const void *pages, size_t slab_size)
|
||||||
{
|
{
|
||||||
return (slab *)(((uint8 *)pages) + slab_size - sizeof(slab));
|
BytePointer<slab> pointer(((uint8 *)pages) + slab_size - sizeof(slab));
|
||||||
|
return &pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user