Add ad and thaumaturgy, both properly formatted. - tgtimes - The Gopher Times | |
git clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 87ae78486c1766cc3900454f1139535d4b87fae7 | |
parent c6100f10c46523c4fd753bb413e7e848662b61f5 | |
Author: Christoph Lohmann <[email protected]> | |
Date: Sun, 27 Aug 2023 20:47:30 +0200 | |
Add ad and thaumaturgy, both properly formatted. | |
Diffstat: | |
A opus7/6-advertisement-3517.raw | 25 +++++++++++++++++++++++++ | |
A opus7/7-thaumaturgy-7964.md | 16 ++++++++++++++++ | |
2 files changed, 41 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/opus7/6-advertisement-3517.raw b/opus7/6-advertisement-3517.raw | |
@@ -0,0 +1,25 @@ | |
++------------------------------------------------------------------------+ | |
+| | | |
+| ADVERTISEMENT | | |
+| | | |
+| | | |
+| * You really want this cat to be weber-cooked? | | |
+| | | |
+| ______________________ | | |
+| | Meow |..| | | |
+| | / |oo| | | |
+| * NO? | o o |/\| | | |
+| | (m) . |\/| | | |
+| |____(___)________|__| | | |
+| | | |
+| | | |
+| * You can only stop us by talking to us at: | | |
+| | | |
+| | | |
+| | | |
+| #bitreich-cooking on irc.bitreich.org | | |
+| | | |
+| | | |
+| | | |
+| | | |
++------------------------------------------------------------------------+ | |
diff --git a/opus7/7-thaumaturgy-7964.md b/opus7/7-thaumaturgy-7964.md | |
@@ -0,0 +1,16 @@ | |
+# This's opus C Thaumaturgy | |
+ | |
+// Returns the smaller integer of x and y but without a branch | |
+// (if/else/ternary, goto etc..) | |
+// Normally min is implemented something like this: | |
+// return x < y ? x : y; | |
+// But we have a branch there so let's do it witout. (The branch | |
+// free min could be used to merge arrays for example.) | |
+// If x < y, then -(x < y) => -1 => all 1's in two complement | |
+// representation. | |
+// So we have y ^ (x ^ y) => x | |
+// If x >= y, then -(x < y) => 0 so y ^ 0 is y. | |
+ | |
+static inline uint8_t min(const uint8_t x, const uint8_t y) { | |
+ return y ^ ((x ^ y) & -(x < y)); | |
+} |