Announcement

Collapse
No announcement yet.

i += 4 == INCR i BY 4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Colin Schmidt
    replied
    Vladimir Shulakov: Thanks! "! add i, 4" is exactly what I was looking for.

    Scott Turchin: I'm assumming the reason they don't have inc i, 4 is because of the above. Although if it is as simple to add to the compiler as I think it might be, then I'd say YES!

    Thanks,

    -------------
    Colin Schmidt & James Duffy, Praxis Enterprises, Canada


    [This message has been edited by Colin Schmidt (edited January 21, 2000).]

    Leave a comment:


  • Scott Turchin
    replied
    In PB Dos 3.x you could specify:

    Incr i,4

    Love to see that added to the PB/DLL and PB/CC...

    Scott

    -------------
    Scott Turchin


    Leave a comment:


  • Vladimir Shulakov
    replied
    Hi
    For LONG and DWORD!
    'dim i as long

    ! add i,4

    or

    ! mov eax,i
    ! add eax,4
    ...
    or
    ! inc i
    ! inc i
    ! inc i
    ! inc i
    -------------------------------
    V.Shualkov

    Leave a comment:


  • Colin Schmidt
    started a topic i += 4 == INCR i BY 4

    i += 4 == INCR i BY 4

    Hello,

    Can anyone suggest a way to add a value to a variable that is as efficient as the C++ statement of i += 4?

    I know there is the INCR statement that will add a value of one to the variable, but it does not allow for any other values.

    The reason for this is:

    i = i + 4 in C++ takes the value of the memory at i and copies it to the accumulator, then adds the 4 to it, then copies the new value back to the memory at i.

    In i += 4, the code simply adds 4 to the memory location at the location i. Thus there is no double copying of the values.

    I guess what I’m looking for or would like is the command INCR I BY 4

    Thanks,

    -------------
    Colin Schmidt & James Duffy, Praxis Enterprises, Canada
Working...
X