[hackers] [scc] Add test for Duff device || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 7 Oct 2015 17:44:47 +0200 (CEST)

commit 06ccd3a0b986f0eb634bf642fe69ba9434a39ed2
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Oct 6 15:26:33 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Oct 7 15:26:01 2015 +0200

    Add test for Duff device

diff --git a/cc1/tests/test036.c b/cc1/tests/test036.c
new file mode 100644
index 0000000..3ea0daa
--- /dev/null
+++ b/cc1/tests/test036.c
_AT_@ -0,0 +1,32 @@
+
+/*
+name: TEST036
+description: Duff's device
+output:
+
+*/
+
+/* Disgusting, no? But it compiles and runs just fine. I feel a combination of
+ pride and revulsion at this discovery. If no one's thought of it before,
+ I think I'll name it after myself.
+ It amazes me that after 10 years of writing C there are still
+ little corners that I haven't explored fully.
+ - Tom Duff */
+
+send(to, from, count)
+ register short *to, *from;
+ register count;
+{
+ register n=(count+7)/8;
+ switch(count%8){
+ case 0: do{*to = *from++;
+ case 7: *to = *from++;
+ case 6: *to = *from++;
+ case 5: *to = *from++;
+ case 4: *to = *from++;
+ case 3: *to = *from++;
+ case 2: *to = *from++;
+ case 1: *to = *from++;
+ }while(--n>0);
+ }
+}
Received on Wed Oct 07 2015 - 17:44:47 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 07 2015 - 17:48:15 CEST