News:

  • August 22, 2026, 04:43:54 PM

Login with username, password and session length

Author Topic: Casting a DINT as unsigned  (Read 6157 times)

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Casting a DINT as unsigned
« on: June 01, 2018, 05:14:26 PM »
I'm counting scans and I don't want the counter to roll over negative, but DMD won't let me cast DST0:U, D0:U, etc.
« Last Edit: June 01, 2018, 08:34:16 PM by Controls Guy »
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: 6172
  • Yes Pinky, Do-more will control the world!
Re: Casting a DINT as unsigned
« Reply #1 on: June 01, 2018, 08:49:29 PM »
I'm counting scans and I don't want the counter to roll over negative, but DMD won't let me cast DST0:U, D0:U, etc.

Math stack does not support 32 bit unsigned. It was a trade-off.
"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

LWgreys

  • Hero Member
  • *****
  • Posts: 117
Re: Casting a DINT as unsigned
« Reply #2 on: June 02, 2018, 01:47:58 AM »
This is what I use as a 32-bit counter. Of corse my totalizer is actually 64-bit.
« Last Edit: June 02, 2018, 01:51:24 AM by LWgreys »