Shop Learn
Pre set all bits — Parallax Forums

Pre set all bits

I am working on migrating some of my objects to spin2. I noticed that ~~ (pre) is no in spin2. I don't see anything that may have replaced it. Did i miss something or is it gone ?


  • ~~x in Spin1 is sign extend from bit 15.
    Use X SIGNX 15 instead.
  • JonnyMacJonnyMac Posts: 7,412
    edited 2020-11-27 17:01
    From Chip's early document on Spin2
    ZEROX		var ZEROX= x	17		x ZEROX y	3		binary		Zero-extend above bit y
    SIGNX		var SIGNX= x	17		x SIGNX y	3		binary		Sign-extend from bit y
  • Peter JakackiPeter Jakacki Posts: 10,043
    edited 2020-11-28 23:31
    I thought Greg was talking about x~~ and not ~~x where x~~ is preset to all ones.
    But I guess I was wrong :)
    Just having my morning coffee now!
    2                        ~~x
    Addr : 0018:          66 14  : Variable Operation Local Offset - 1 Assign ~~VAR Sign extend Word
    3                        x~~
    Addr : 001A:          66 1C  : Variable Operation Local Offset - 1 Assign VAR~~ Post-set
    Addr : 001C:             32  : Return
Sign In or Register to comment.