Add ad and thaumaturgy, both properly formatted. - tgtimes - The Gopher Times HTML git clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 87ae78486c1766cc3900454f1139535d4b87fae7 DIR parent c6100f10c46523c4fd753bb413e7e848662b61f5 HTML Author: Christoph Lohmann <20h@r-36.net> 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(-) --- DIR 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 | +| | +| | +| | +| | ++------------------------------------------------------------------------+ DIR 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)); +}