The MASM Forum

Miscellaneous => Miscellaneous Projects => Topic started by: HSE on June 28, 2015, 07:31:15 AM

Title: Are pointers really needed in SmplMath?
Post by: HSE on June 28, 2015, 07:31:15 AM
Hi! (or perhaps I would say: Hi qWord)

SmplMath is working pretty well, and is very easy to translate from Java.

The way I found requiere pointers in the expressions:



        fSlv8R equ  fSlv8 REAL8 ptr
r8r equ REAL8 ptr

fSlv8R VTsFe = (r8r ts1*exp( r8r [esi].ewl/r8r [esi].ebwm)/1000.0)*(r8r WlTs+r8r WlCytF)

                                    ;[esi].xxx are variables inside objects, others are locals
                                    ; the ecuation is part of a OOP method



But the examples in the package don't need pointers. What I'm missing?

Thanks. HSE

Title: Re: Are pointers really needed in SmplMath?
Post by: qWord on June 29, 2015, 02:12:50 AM
Expressions of the form Type ptr ... are typecasts. As long as (e.g.) [esi].ewl does have an arithmetic type, no typecast is needed (so inside the structure or union declaration the field ewl  should be declared as real or signed integer type).

Also you should stay away from above usage of EQU and use TEXTEQU instead**, because without angle brackets MASM expects a numeric expression for EQU. (Even if seems like that MASM accepts nearly everything right from EQU, except broken numerical literals)

** if you use TEXTEQUs with the macros, you must prefix them with the expansion operator %.

Title: Re: Are pointers really needed in SmplMath?
Post by: HSE on June 29, 2015, 04:44:27 AM
So obvious!!! :icon_redface:

All the variables are declared as "qword" (ja, ja, excuseme the use of your name), because there is no diference for FPU instruccions.

After writing I was thinking that the "ptr thing" have a diferent name, I will remember from now on.

I expected even some error using EQU, but work. Very good explanation, macros is all a subject.

Thanks so much. HSE