/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <stdint.h>
#include <stdalign.h>
#include <stddef.h>
typedef uint16_t ObjectLayer;
typedef uint8_t BroadPhaseLayer;
typedef struct BroadPhaseLayerInterfaceVTable
{
const void *__unused0; // Unused, *must* be NULL.
const void *__unused1; // Unused, *must* be NULL.
// Required, *cannot* be NULL.
uint32_t
(*GetNumBroadPhaseLayers)(const void *in_self);
// Required, *cannot* be NULL.
BroadPhaseLayer
(*GetBroadPhaseLayer)(const void *in_self, ObjectLayer in_layer);
} BroadPhaseLayerInterfaceVTable;
typedef struct BPLayerInterfaceImpl
{
const BroadPhaseLayerInterfaceVTable *vtable; // VTable has to be the first field in the struct.
BroadPhaseLayer object_to_broad_phase[2];
} BPLayerInterfaceImpl;
int main()
{
printf("%ld\n", sizeof(BroadPhaseLayerInterfaceVTable));
printf("%ld\n", alignof(BroadPhaseLayerInterfaceVTable));
printf("%ld\n", offsetof(BroadPhaseLayerInterfaceVTable, __unused0));
printf("%ld\n", offsetof(BroadPhaseLayerInterfaceVTable, __unused1));
printf("%ld\n", offsetof(BroadPhaseLayerInterfaceVTable, GetNumBroadPhaseLayers));
printf("%ld\n", offsetof(BroadPhaseLayerInterfaceVTable, GetBroadPhaseLayer));
printf("%ld\n", sizeof(BPLayerInterfaceImpl));
printf("%ld\n", alignof(BPLayerInterfaceImpl));
printf("%ld\n", offsetof(BPLayerInterfaceImpl, vtable));
printf("%ld\n", offsetof(BPLayerInterfaceImpl, object_to_broad_phase));
return 0;
}