• Probius@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    40
    ·
    16 hours ago

    For those ASCIIng themselves why this works, 0x20 is 00100000 in binary, so it only flips one bit, increasing or decreasing the character’s value by 32. Capital ‘A’ is 65 and lowercase ‘a’ is 97, an offset of exactly 32! The rest of the uppercase and lowercase letters follow in order.

    • addie@feddit.uk
      link
      fedilink
      English
      arrow-up
      11
      ·
      15 hours ago

      Done that way completely on purpose, of course.

      The numbers all have their binary value in their low nibble, too, which makes Binary-Coded Decimal completely trivial to convert into the equivalent string, or vice-versa. Nearly as easy to convert ‘normal’ binary numbers in either direction, too.

    • WR5@lemmy.world
      link
      fedilink
      English
      arrow-up
      11
      arrow-down
      1
      ·
      15 hours ago

      Wow that’s crazy it’s exactly 263,130,836,933,693,530,167,218,012,160,000,000. Wonder why increasing or decreasing by 32 makes a difference? /s