1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3
4//go:build !(amd64 || arm || arm64 || loong64 || ppc64le || riscv64 || s390x)
5
6package purego
7
8import (
9 "reflect"
10 "unsafe"
11)
12
13// This file provides the struct-handling helpers for architectures that do
14// not support struct arguments or returns: 386, and any architecture reachable
15// only through the integer-only cgo fallback. Every struct operation panics.
16
17func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any {
18 panic("purego: struct arguments are not supported on this architecture")
19}
20
21func getStruct(outType reflect.Type, syscall syscallArgs) reflect.Value {
22 panic("purego: struct returns are not supported on this architecture")
23}
24
25// structReturnInMemory reports whether a struct return value is returned through
26// a caller-allocated hidden pointer. Structs are unsupported on this
27// architecture, so it always reports false.
28func structReturnInMemory(reflect.Type) bool {
29 return false
30}
31
32// shouldBundleStackArgs always returns false because C-style stack argument
33// bundling is only needed on Darwin ARM64.
34func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool {
35 return false
36}
37
38func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int,
39 keepAlive []any, addInt, addFloat, addStack func(uintptr),
40 pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) {
41 panic("purego: collectStackArgs should not be called on this architecture")
42}
43
44func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) {
45 panic("purego: bundleStackArgs should not be called on this architecture")
46}
47
48func getCallbackStruct(inType reflect.Type, frame unsafe.Pointer, floatsN *int, intsN *int, stackSlot *int, stackByteOffset *uintptr) reflect.Value {
49 panic("purego: struct callback arguments are not supported on this architecture")
50}
51
52func setStruct(a *callbackArgs, ret reflect.Value) {
53 panic("purego: struct returns are not supported on this architecture")
54}