All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.system.rpmalloc.RPMemoryMapCallbackI Maven / Gradle / Ivy

Go to download

A public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.

There is a newer version: 3.3.4
Show newest version
/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.system.rpmalloc;

import org.lwjgl.system.*;

import static org.lwjgl.system.dyncall.DynCallback.*;

/**
 * Instances of this interface may be set to the {@link RPMallocConfig} struct.
 * 
 * 

Type

* *

 * void * (*) (
 *     size_t size,
 *     size_t *offset
 * )
*/ @FunctionalInterface @NativeType("void * (*) (size_t, size_t *)") public interface RPMemoryMapCallbackI extends CallbackI.P { String SIGNATURE = "(pp)p"; @Override default String getSignature() { return SIGNATURE; } @Override default long callback(long args) { return invoke( dcbArgPointer(args), dcbArgPointer(args) ); } /** * Map memory pages for the given number of bytes. * *

The returned address MUST be aligned to the rpmalloc span size, which will always be a power of two. Optionally the function can store an alignment * offset in the offset variable in case it performs alignment and the returned pointer is offset from the actual start of the memory region due to this * alignment. The alignment offset will be passed to the memory unmap function. The alignment offset MUST NOT be larger than 65535 (storable in an * {@code uint16_t}), if it is you must use natural alignment to shift it into 16 bits.

* *

If you set a {@code memory_map} function, you must also set a {@code memory_unmap} function or else the default implementation will be used for * both.

* * @param size the number of bytes to map * @param offset the alignment offset */ @NativeType("void *") long invoke(@NativeType("size_t") long size, @NativeType("size_t *") long offset); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy