slab: use BytePointer

Change-Id: I786f720ccd0c1469287a70906d05633218c25ceb
Reviewed-on: https://review.haiku-os.org/c/1100
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
PulkoMandy 2019-02-23 22:16:37 +01:00 committed by waddlesplash
parent 995aabb04e
commit d581bcba52
2 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#define OBJECT_CACHE_H
#include <BytePointer.h>
#include <condition_variable.h>
#include <lock.h>
#include <slab/ObjectDepot.h>
@ -140,8 +141,9 @@ link_to_object(object_link* link, size_t objectSize)
static inline object_link*
object_to_link(void* object, size_t objectSize)
{
return (object_link*)(((uint8*)object)
BytePointer<object_link> pointer((uint8*)object
+ (objectSize - sizeof(object_link)));
return &pointer;
}

View File

@ -8,6 +8,7 @@
#include "SmallObjectCache.h"
#include <BytePointer.h>
#include "MemoryManager.h"
#include "slab_private.h"
@ -18,7 +19,8 @@ RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache)
static inline slab *
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;
}