Author Topic: what is this notation qs*=  (Read 125 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris Chancellor

  • Sr. Member
  • ****
  • Posts: 306
what is this notation qs*=
« on: January 14, 2019, 04:37:09 PM »
Hello Charles

i saw the below codes in the O2 forum  at  reply#6
https://www.oxygenbasic.org/forum/index.php?topic=1847.msg20013;topicseen#msg20013

Code: [Select]
quad qs=0x10000 : qs*=0x10000
quad a= qs*0x12345678+0x9abcdef0

i don't understand the notation qs*=0x10000

i knew 0x10000  is a hex number  but not  qs*

because *  means multiplication for normal operators

what does  qs*   or  qs*=    do ?

are these notations derived from C ?

sorry that i asked these simple questions


Offline Mike Lobanovsky

  • Jr. Member
  • **
  • Posts: 93
Re: what is this notation qs*=
« Reply #1 on: January 14, 2019, 05:21:31 PM »
qs *= 0x10000 is a shorthand for qs = qs * 0x10000 pretty much like qs += 1 is a shorthand for qs = qs + 1.

The math operator preceding assignment can be any arith or logical operator like *=, /=, AND= etc., in which case the expression unrolls as shown above.

Note there should be no space between the operator and assignment for the O2 parser to understand the expression.
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

Offline Chris Chancellor

  • Sr. Member
  • ****
  • Posts: 306
Re: what is this notation qs*=
« Reply #2 on: January 14, 2019, 06:00:28 PM »
Thanxx a lot, Mike