new version
authorTobias Girstmair <tobi@isticktoit.net>
Wed, 3 Mar 2021 23:36:37 +0000 (00:36 +0100)
committerTobias Girstmair <tobi@isticktoit.net>
Wed, 3 Mar 2021 23:36:37 +0000 (00:36 +0100)
bsv.c

diff --git a/bsv.c b/bsv.c
index cd05728b2051bd1647a49b7a10a6112bcc0da794..52140ec37111aee8ac11817752f4224a392b4e48 100644 (file)
--- a/bsv.c
+++ b/bsv.c
@@ -1,17 +1,32 @@
 typedef unsigned char u8;
 
+int i;
+
 u8 notes[] = "Qj}6jQ6%BY}6YB6%";
 
-u8 g(int i, u8 x, u8 t, u8 o){
-       return((3&x&(i*(notes[t%8 + 8*!!(3&i>>16)]+51)>>o))<<4);
+u8 g(u8 x, u8 t, u8 o){
+       u8 notes_ix = t%8 + 8*!!(3&i>>16);
+       return((3&x&(i*(notes[notes_ix]+51)>>o))<<4);
 }
-void main(int i, u8 n, u8 s){
-       for(i=0;;i++) {
+void main(void){
+       i = 0;
+       for(;;) {
                u8 sample;
-               sample = g(i,1,n=i>>14,12);
-               sample += g(i,s=i>>17,n^i>>13,10);
-               sample += g(i,s/3,n+((i>>11)%3),10);
-               sample += g(i,s/5,8+n-((i>>10)%3),9);
+               u8 n = i >> 14;
+               u8 s = i >> 17;
+               sample = g(1,n,12);
+               { u8 tmp = n^i>>13;
+               sample += g(s,tmp,10);
+               } //tmp
+               { u8 tmp1 = s/3;
+                 u8 tmp2 = n+((i>>11)%3);
+               sample += g(tmp1,tmp2,10);
+               } //tmp1, tmp2
+               { u8 tmp1 = s/5;
+                 u8 tmp2 = 8+n-((i>>10)%3);
+               sample += g(tmp1,tmp2,9);
+               } //tmp1, tmp2
                putchar(sample);
+               i++;
        }
 }
Imprint / Impressum