Author Topic: Are pointers really needed in SmplMath?  (Read 975 times)

HSE

  • Member
  • ****
  • Posts: 522
  • <AMD>< 7-32>
Are pointers really needed in SmplMath?
« 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:


Code: [Select]
        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


qWord

  • Member
  • *****
  • Posts: 1452
  • The base type of a type is the type itself
    • SmplMath macros
Re: Are pointers really needed in SmplMath?
« Reply #1 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 %.

MREAL macros - when you need floating point arithmetic while assembling!

HSE

  • Member
  • ****
  • Posts: 522
  • <AMD>< 7-32>
Re: Are pointers really needed in SmplMath?
« Reply #2 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