Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/ng/bench/kernels/sort.c # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / ng / bench / kernels / sort.c` 15 lines ยท 773 bytes Raw Blame History 1 /* sort.c -- REFERENCE TWIN ONLY (gcc oracle) of seed/rung4/tests/sort.om: same generator, same sort. */ 2 #include 3 #include 4 static uint64_t a[40000]; 5 int main(void) { 6 uint64_t x = 12345, s = 0, bad = 0; 7 for (int i = 0; i < 40000; i++) { x = (x * 1103515245u + 12345u) % 2147483648u; a[i] = x % `4000000`; } 8 for (int j = 0; j < 40000; j++) { uint64_t v = a[j]; int k = j; 9 while (k > 0 && a[k-1] > v) { a[k] = a[k-1]; k--; } a[k] = v; } 10 for (int i = 0; i < 40000; i++) s += a[i] * (uint64_t)(i + 1); 11 for (int i = 0; i < 39999; i++) if (a[i] > a[i+1]) bad++; 12 printf("%llu\n%llu\n%llu\n%llu\n", (unsigned long long)s, (unsigned long long)bad, 13 (unsigned long long)a[0], (unsigned long long)a[39999]); 14 return 0; 15 }