Tag: binary

  • Simple things feel so good. (warning: geekery)

    Toggle an integer variable between 0 and 1. Useful for a flag to control program flow in C without boolean types. toggleVar = 1>>toggleVar; What this is doing is right shifting the integer 1 either zero or one place, depending on the current value of toggleVar. An 8-bit (unsigned – positive values only) integer has […]