comparison dyncallback/dyncall_args_ppc64.c @ 83:54930a037e8a

- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!) - changelog and todo update
author cslag
date Mon, 28 Mar 2016 23:46:59 +0200
parents 3e629dc19168
children 71c884e610f0
comparison
equal deleted inserted replaced
82:186af66ae67f 83:54930a037e8a
48 DCushort dcbArgUShort (DCArgs* p) { return (DCushort)dcbArgLongLong(p); } 48 DCushort dcbArgUShort (DCArgs* p) { return (DCushort)dcbArgLongLong(p); }
49 DCbool dcbArgBool (DCArgs* p) { return (DCbool) dcbArgLongLong(p); } 49 DCbool dcbArgBool (DCArgs* p) { return (DCbool) dcbArgLongLong(p); }
50 50
51 DCpointer dcbArgPointer (DCArgs* p) { return (DCpointer)dcbArgLongLong(p); } 51 DCpointer dcbArgPointer (DCArgs* p) { return (DCpointer)dcbArgLongLong(p); }
52 52
53 DCdouble dcbArgDouble (DCArgs* p) 53 DCdouble dcbArgDouble (DCArgs* p)
54 { 54 {
55 DCdouble result; 55 DCdouble result;
56 56
57 if (p->freg_count < 13) { 57 if (p->freg_count < 13) {
58 result = p->freg_data[p->freg_count++]; 58 result = p->freg_data[p->freg_count++];
59 if (p->ireg_count < 8) { 59 if (p->ireg_count < 8) {
65 65
66 p->stackptr += sizeof(double); 66 p->stackptr += sizeof(double);
67 return result; 67 return result;
68 } 68 }
69 69
70 DCfloat dcbArgFloat (DCArgs* p) { return (DCfloat)dcbArgDouble(p); } 70 DCfloat dcbArgFloat (DCArgs* p)
71 {
72 DCfloat result;
71 73
74 #if defined(DC__Endian_BIG)
75 struct sf { DCfloat f_pad; DCfloat f; } sf;
76 #else /* Endian_LITTLE */
77 struct sf { DCfloat f; DCfloat f_pad; } sf;
78 #endif
79
80 if (p->freg_count < 13) {
81 result = (float)p->freg_data[p->freg_count++];
82 if (p->ireg_count < 8) {
83 p->ireg_count++;
84 }
85 } else {
86 sf = * ( (struct sf*) p->stackptr );
87 result = sf.f;
88 }
89
90 p->stackptr += sizeof(double);
91 return result;
92 }