Support Board
Date/Time: Fri, 27 Dec 2024 16:16:56 +0000
Post From: *IMPORTANT* Notice: Custom Study Improperly Altering Time Scale of Chart
[2020-12-05 18:25:01] |
User816220 - Posts: 80 |
It could be a calling convention mismatch. The Windows x64 calling convention passes and returns integers and doubles in different registers; integers in the 64-bit integer registers and doubles in the 128-bit XMM registers. https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-160 Parameter passing
By default, the x64 calling convention passes the first four arguments to a function in registers. The registers used for these arguments depend on the position and type of the argument. Remaining arguments get pushed on the stack in right-to-left order. Integer valued arguments in the leftmost four positions are passed in left-to-right order in RCX, RDX, R8, and R9, respectively. The fifth and higher arguments are passed on the stack as previously described. All integer arguments in registers are right-justified, so the callee can ignore the upper bits of the register and access only the portion of the register necessary. Any floating-point and double-precision arguments in the first four parameters are passed in XMM0 - XMM3, depending on position. Floating-point values are only placed in the integer registers RCX, RDX, R8, and R9 when there are varargs arguments. For details, see Varargs. Similarly, the XMM0 - XMM3 registers are ignored when the corresponding argument is an integer or pointer type. Return values
A scalar return value that can fit into 64 bits, including the __m64 type, is returned through RAX. Non-scalar types including floats, doubles, and vector types such as __m128, __m128i, __m128d are returned in XMM0. The state of unused bits in the value returned in RAX or XMM0 is undefined. |