• pinball_wizard@lemmy.zip
      link
      fedilink
      arrow-up
      28
      ·
      edit-2
      1 month ago

      Genie grants the wish, and then deducts one from the pool of remaining wishes.

      Edit 1: And it is implied that the Genie stored the number of remaining wishes as an eight bit unsigned integer, where subtracting one from zero gives 255.

      It is worth noting that unsigned integer subtract-from-zero exploits were common in video games from around the time that Disney’s Aladdin was released.

      Edit 2: No discussion of amusing subtract-from-zero bugs is complete without a link to Nuclear Gandhi. (Even though it is now believed not to have been a subtract-from-zero bug.)

    • thirteene@lemmy.world
      link
      fedilink
      arrow-up
      11
      arrow-down
      1
      ·
      1 month ago

      Its a quirk in binary math with 8 digits. If you “roll the odometer” past 0, it resets to 255

       0000 0011 (3)
      -0000 0001 (1)
      =0000 0010 (2)
      
       0000 0000 (0)
      -0000 0001 (1)
      =1111 1111 (255)