Files
FEX-Emu--FEX/ThunkLibs/libfex_thunk_test/lib.cpp
T
Paulo Matos 2b4ec88dae Whole-tree reformat
This follows discussions from #3413.
Followup commits add clang-format file, script and blame ignore lists.
2024-04-12 16:26:02 +02:00

63 lines
1.3 KiB
C++

#include "api.h"
extern "C" {
uint32_t GetDoubledValue(uint32_t input) {
return 2 * input;
}
struct OpaqueType {
uint32_t data;
};
OpaqueType* MakeOpaqueType(uint32_t data) {
return new OpaqueType {data};
}
uint32_t ReadOpaqueTypeData(OpaqueType* value) {
return value->data;
}
void DestroyOpaqueType(OpaqueType* value) {
delete value;
}
UnionType MakeUnionType(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
return UnionType {.c = {a, b, c, d}};
}
uint32_t GetUnionTypeA(UnionType* value) {
return value->a;
}
ReorderingType MakeReorderingType(uint32_t a, uint32_t b) {
return ReorderingType {.a = a, .b = b};
}
uint32_t GetReorderingTypeMember(const ReorderingType* data, int index) {
if (index == 0) {
return data->a;
} else {
return data->b;
}
}
uint32_t GetReorderingTypeMemberWithoutRepacking(const ReorderingType* data, int index) {
return GetReorderingTypeMember(data, index);
}
void ModifyReorderingTypeMembers(ReorderingType* data) {
data->a += 1;
data->b += 2;
}
int RanCustomRepack(CustomRepackedType* data) {
return data->custom_repack_invoked;
}
int FunctionWithDivergentSignature(DivType a, DivType b, DivType c, DivType d) {
return ((uint8_t)a << 24) | ((uint8_t)b << 16) | ((uint8_t)c << 8) | (uint8_t)d;
}
} // extern "C"