News:

  • October 03, 2026, 01:08:13 PM

Login with username, password and session length

Author Topic: MEMCLEAR not allowing casts  (Read 7052 times)

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
MEMCLEAR not allowing casts
« on: July 15, 2019, 12:24:33 PM »
Why will MEMCOPY let me cast but MEMCLEAR not?

Code: [Select]
MEMCOPY CustomWP0:UW LastCustomWP0:UW 0x20000 MaxRelayWords

MEMCLEAR LastCustomWP0 MaxRelayCount
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: MEMCLEAR not allowing casts
« Reply #1 on: July 15, 2019, 01:42:56 PM »
Why will MEMCOPY let me cast but MEMCLEAR not?

Code: [Select]
MEMCOPY CustomWP0:UW LastCustomWP0:UW 0x20000 MaxRelayWords

MEMCLEAR LastCustomWP0 MaxRelayCount

Because we're mean.

MEMCOPY is blind. MEMCLEAR is type-aware and does struct initialization. We could probably make it work for simple types, but it wasn't straightforward.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: MEMCLEAR not allowing casts
« Reply #2 on: July 15, 2019, 01:50:09 PM »
Ah, gotcha.  That makes sense.  I was kind of classing the two together mentally.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: MEMCLEAR not allowing casts
« Reply #3 on: July 15, 2019, 01:55:14 PM »
Ah, gotcha.  That makes sense.  I was kind of classing the two together mentally.

In a perfect world, they would be, but 'cleared' isn't always 'zero'. For simple types it is, but the instruction is built around type awareness and casting violates that.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO