kit

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

callx_recursion_long.c (345B)


      1 /* 64-bit recursive factorial-ish accumulation: ssum(n) = n + ssum(n-1) over
      2  * long, returning a long. Exercises a self-call CALL26 with 64-bit operands.
      3  * ssum(8) = 36, then +6 = 42. */
      4 __attribute__((noinline)) static long ssum(long n) {
      5   if (n <= 0) return 0;
      6   return n + ssum(n - 1);
      7 }
      8 int test_main(void) { return (int)(ssum(8) + 6); }