From ba278632e2f60c1c3633a48e5626eb09bded546f Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 25 Jun 2024 16:41:39 +0300 Subject: [PATCH] C: jokes: add bytebeat-cryptic.c --- c-programming/jokes/bytebeat-cryptic.c | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 c-programming/jokes/bytebeat-cryptic.c diff --git a/c-programming/jokes/bytebeat-cryptic.c b/c-programming/jokes/bytebeat-cryptic.c new file mode 100644 index 0000000..796439b --- /dev/null +++ b/c-programming/jokes/bytebeat-cryptic.c @@ -0,0 +1,38 @@ +/* + * bytebeat-cryptic.c + * + * NOTE: PulseAudio: Pipe STDOUT of this program to aplay -c 1 -f U8 -r 44100 + * + * Author: Intel A80486DX2-66 + * License: Unlicense + */ + +#include +#include +#include + +int main(void) { + srand(time(NULL)); + + volatile float k[] = {0.7088250000000000f, 0.9451000000000000f, + 1.2601333301830002f, 1.4176500000000000f}; + + unsigned A = 4294967295, B = rand(); + + for (unsigned i = 0; i < 3; i++) { + for (unsigned j = 1; j < 4; j++) { + if (rand() & 1) { + k[i] = *(float*)(unsigned[]){(*(unsigned*)&k[i]) ^ (*(unsigned*)&k[j])}; + k[j] = *(float*)(unsigned[]){(*(unsigned*)&k[j]) ^ (*(unsigned*)&k[i])}; + k[i] = *(float*)(unsigned[]){(*(unsigned*)&k[i]) ^ (*(unsigned*)&k[j])}; + } + } + } + + while (1) { + float C = k[(A / 65536) & 0b11]; + C *= ((B >> ((7 & A >> 13) << 1)) & 6); + unsigned D = ++A * C / 4; + putchar(D); + } +}