kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

01_arith.c (331B)


      1 /* Integer arithmetic: add/sub/mul/div/mod/shift across a few widths.
      2  * bounce_main returns a value in [0,127]. */
      3 int bounce_main(void) {
      4   unsigned u = 0xDEADBEEFu;
      5   int a = 1234567, b = 89;
      6   long c = (long)a * b - (a / b) + (a % b);
      7   c ^= (long)(u >> 7);
      8   c += (c << 3) - (c >> 2);
      9   int r = (int)(c & 0x7f);
     10   return r;
     11 }