#include <stdint.h>
#include <assert.h>
+#include <stdarg.h>
// These functions are used in the unit tests for C ABI calls.
struct TwoU8s arg6;
};
+// MSVC doesn't allow empty structs or unions
+#ifndef _MSC_VER
struct Empty {
};
assert(v1.arg6.one == v2.arg6.one + 1);
assert(v1.arg6.two == v2.arg6.two + 1);
}
+#endif
intptr_t
rust_get_test_int() {
}
int
-rust_dbg_static_mut;
-
-int rust_dbg_static_mut = 3;
+rust_dbg_static_mut = 3;
void
rust_dbg_static_mut_check_four() {
assert(rust_dbg_static_mut == 4);
}
+
+struct S {
+ uint64_t x;
+ uint64_t y;
+ uint64_t z;
+};
+
+uint64_t get_x(struct S s) {
+ return s.x;
+}
+
+uint64_t get_y(struct S s) {
+ return s.y;
+}
+
+uint64_t get_z(struct S s) {
+ return s.z;
+}
+
+uint64_t get_c_many_params(void *a, void *b, void *c, void *d, struct quad f) {
+ return f.c;
+}
+
+// Calculates the average of `(x + y) / n` where x: i64, y: f64. There must be exactly n pairs
+// passed as variadic arguments.
+double rust_interesting_average(uint64_t n, ...) {
+ va_list pairs;
+ double sum = 0.0;
+ int i;
+ va_start(pairs, n);
+ for(i = 0; i < n; i += 1) {
+ sum += (double)va_arg(pairs, int64_t);
+ sum += va_arg(pairs, double);
+ }
+ va_end(pairs);
+ return sum / n;
+}