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/babel/blob/main/examples/sample/src/mix.c # babel aien-dev/babel Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `babel / examples / sample / src / mix.c` 58 lines ยท 1032 bytes Raw Blame History 1 #include 2 #include 3 #include 4 5 /* Profile S1: pure functions of uint64_t inputs using + - * (wrapping). */ 6 7 uint64_t add3(uint64_t a, uint64_t b, uint64_t c) { 8 return a + b + c; 9 } 10 11 uint64_t poly(uint64_t x, uint64_t y) { 12 return x * x - y * x + y; 13 } 14 15 uint64_t zero(void) { 16 return 0u; 17 } 18 19 uint64_t mix6(uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f) { 20 return a * b - c * d + e - f; 21 } 22 23 /* Outside S1: each of these must be refused with a reason, never approximated. */ 24 25 uint64_t scale(uint64_t a, uint64_t b) { 26 return a * 3u + b - 7u; 27 } 28 29 uint64_t pick(uint64_t a, uint64_t b) { 30 if (a > b) { 31 return a; 32 } 33 return b; 34 } 35 36 uint64_t counter = 0; 37 38 uint64_t bump(uint64_t a) { 39 counter = counter + a; 40 return counter; 41 } 42 43 struct pair { 44 uint64_t lo; 45 uint64_t hi; 46 }; 47 48 uint64_t first(const uint64_t *p) { 49 return p[0]; 50 } 51 52 void hello(void) { 53 printf("hello\n"); 54 } 55 56 uint64_t *grab(uint64_t n) { 57 return malloc(n * sizeof(uint64_t)); 58 }