2022-10-31 22:38:40 -05:00
|
|
|
#include <assert.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2023-06-11 12:41:46 -05:00
|
|
|
struct BoolAndU32
|
|
|
|
{
|
|
|
|
bool a;
|
|
|
|
uint32_t b;
|
|
|
|
};
|
|
|
|
|
2023-05-18 16:53:03 -05:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
__declspec(align(16))
|
2022-10-31 22:38:40 -05:00
|
|
|
struct TwoU64s
|
|
|
|
{
|
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
2023-05-18 16:53:03 -05:00
|
|
|
};
|
|
|
|
#else
|
|
|
|
struct __attribute__((aligned(16))) TwoU64s
|
|
|
|
{
|
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
|
|
|
};
|
|
|
|
#endif
|
2022-10-31 22:38:40 -05:00
|
|
|
|
2023-06-11 12:41:46 -05:00
|
|
|
struct WrappedU64s
|
2022-10-31 22:38:40 -05:00
|
|
|
{
|
2023-06-11 12:41:46 -05:00
|
|
|
struct TwoU64s a;
|
2022-10-31 22:38:40 -05:00
|
|
|
};
|
|
|
|
|
2023-06-11 12:41:46 -05:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
__declspec(align(1))
|
|
|
|
struct LowerAlign
|
|
|
|
{
|
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
struct __attribute__((aligned(1))) LowerAlign
|
|
|
|
{
|
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2023-06-14 21:39:11 -05:00
|
|
|
#pragma pack(push, 1)
|
|
|
|
struct Packed
|
|
|
|
{
|
|
|
|
__uint128_t a;
|
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
2023-06-11 12:41:46 -05:00
|
|
|
|
2022-10-31 22:38:40 -05:00
|
|
|
int32_t many_args(
|
|
|
|
void *a,
|
|
|
|
void *b,
|
|
|
|
const char *c,
|
|
|
|
uint64_t d,
|
|
|
|
bool e,
|
|
|
|
struct BoolAndU32 f,
|
|
|
|
void *g,
|
|
|
|
struct TwoU64s h,
|
|
|
|
void *i,
|
2023-06-11 12:41:46 -05:00
|
|
|
struct WrappedU64s j,
|
2022-10-31 22:38:40 -05:00
|
|
|
void *k,
|
2023-06-11 12:41:46 -05:00
|
|
|
struct LowerAlign l,
|
2023-06-14 21:39:11 -05:00
|
|
|
void *m,
|
|
|
|
struct Packed n,
|
|
|
|
const char *o)
|
2022-10-31 22:38:40 -05:00
|
|
|
{
|
2023-06-11 12:41:46 -05:00
|
|
|
assert(!a);
|
|
|
|
assert(!b);
|
|
|
|
assert(!c);
|
|
|
|
assert(d == 42);
|
|
|
|
assert(e);
|
|
|
|
assert(f.a);
|
|
|
|
assert(f.b == 1337);
|
|
|
|
assert(!g);
|
|
|
|
assert(h.a == 1);
|
|
|
|
assert(h.b == 2);
|
|
|
|
assert(!i);
|
|
|
|
assert(j.a.a == 3);
|
|
|
|
assert(j.a.b == 4);
|
|
|
|
assert(!k);
|
|
|
|
assert(l.a == 5);
|
|
|
|
assert(l.b == 6);
|
2023-06-14 21:39:11 -05:00
|
|
|
assert(!m);
|
|
|
|
assert(n.a == 7);
|
|
|
|
assert(strcmp(o, "Hello world") == 0);
|
2022-10-31 22:38:40 -05:00
|
|
|
return 0;
|
|
|
|
}
|