Mercurial > pub > dyncall > dyncall
diff dyncallback/dyncall_args_arm64_apple.c @ 654:0079a8fa894e
- arm64 tweaks/cleanups for callbacks:
* using 32b less of stack space
* saved one instruction
* simplified
* cosmetics
author | Tassilo Philipp |
---|---|
date | Thu, 07 Mar 2024 18:01:54 +0100 |
parents | 2562c89d5bb5 |
children |
line wrap: on
line diff
--- a/dyncallback/dyncall_args_arm64_apple.c Thu Mar 07 17:42:13 2024 +0100 +++ b/dyncallback/dyncall_args_arm64_apple.c Thu Mar 07 18:01:54 2024 +0100 @@ -35,16 +35,13 @@ struct DCArgs { /* buffers and stack-pointer: */ - uint64_t I[8]; DCFPU_t F[8]; uint8_t* sp; - + /* counters: */ int i; int f; - int s; - int reserved; }; static inline uint8_t* align(uint8_t* p, size_t v) @@ -53,7 +50,7 @@ } -DClonglong dcbArgLongLong (DCArgs* p) +DClonglong dcbArgLongLong(DCArgs* p) { if (p->i < 8) { return p->I[p->i++]; @@ -65,8 +62,10 @@ return value; } } -DCdouble dcbArgDouble (DCArgs* p) { - if (p->f < 8) { + +DCdouble dcbArgDouble(DCArgs* p) +{ + if (p->f < 8) { return p->F[p->f++].d.value; } else { DCdouble value; @@ -76,7 +75,9 @@ return value; } } -DCfloat dcbArgFloat (DCArgs* p) { + +DCfloat dcbArgFloat(DCArgs* p) +{ if (p->f < 8) { return p->F[p->f++].f.value; } else { @@ -88,7 +89,8 @@ } } -DClong dcbArgLong (DCArgs* p) { +DClong dcbArgLong(DCArgs* p) +{ if (p->i < 8) { return (DClong) p->I[p->i++]; } else { @@ -100,7 +102,8 @@ } } -DCint dcbArgInt (DCArgs* p) { +DCint dcbArgInt(DCArgs* p) +{ if (p->i < 8) { return (DCint) p->I[p->i++]; } else { @@ -112,7 +115,8 @@ } } -DCshort dcbArgShort (DCArgs* p) { +DCshort dcbArgShort(DCArgs* p) +{ if (p->i < 8) { return (DCshort) p->I[p->i++]; } else { @@ -124,7 +128,8 @@ } } -DCchar dcbArgChar (DCArgs* p) { +DCchar dcbArgChar(DCArgs* p) +{ if (p->i < 8) { return (DCchar) p->I[p->i++]; } else { @@ -136,7 +141,8 @@ } } -DCbool dcbArgBool (DCArgs* p) { +DCbool dcbArgBool(DCArgs* p) +{ if (p->i < 8) { return (DCbool) p->I[p->i++]; } else { @@ -148,8 +154,8 @@ } } -DCpointer dcbArgPointer(DCArgs* p) { - return (DCpointer) dcbArgLongLong(p); +DCpointer dcbArgPointer(DCArgs* p) { + return (DCpointer) dcbArgLongLong(p); } DCuint dcbArgUInt (DCArgs* p) { return (DCuint) dcbArgInt(p); }