This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RUN: cc -Wall -Wextra -pthread %s && ./a.out | sort | uniq | |
| // RUN: cc -Wall -Wextra -fopenmp %s && ./a.out | sort | uniq | |
| #include <assert.h> | |
| #include <omp.h> | |
| #include <pthread.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <syscall.h> | |
| #include <unistd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CFLAGS="-Wall -Wextra -Wno-implicit-fallthrough" | |
| #include <assert.h> | |
| #include <stdio.h> | |
| // 1) (n - (n % 4)) / 4 iterations | |
| // 2) n % 4 iterations | |
| void loop1(int n) | |
| { | |
| int i, j; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # ShellChecked | |
| set -eu | |
| set -o pipefail | |
| usage=$(cat <<EOF | |
| Usage: $(basename "$0") test.input [repetitions] | |
| If not specified, repetitions is set to 10. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # ShellChecked with no issues detected | |
| set -eu | |
| set -o pipefail | |
| spinning_wheel() { | |
| local spinning=("|" "/" "-" "\\") | |
| local i=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # ShellChecked with no issues detected | |
| set -eu | |
| set -o pipefail | |
| compile() { | |
| local args | |
| args=$(head -1 "$src" | sed 's/^\/*//') | |
| # Ignore any Makefiles that might be present |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Speed up Time Machine operation: | |
| sudo sysctl debug.lowpri_throttle_enabled=0 | |
| # Revert to default setting: | |
| sudo sysctl debug.lowpri_throttle_enabled=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo: bar | |
| foo: | |
| @echo foo: $(FLAGS) | |
| bar: FLAGS += B | |
| bar: baz | |
| bar: | |
| @echo bar: $(FLAGS) | |
| baz: FLAGS += C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <functional> | |
| #include <iostream> | |
| template<typename T> | |
| struct coro { | |
| using fn = std::function<T(T)>; | |
| coro(fn f) : m_lc(0), m_done(false), m_fn(f) {} | |
| bool done() const { return m_done; } | |
| T resume(T arg) { return m_fn(arg); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdbool.h> | |
| #include <stdio.h> | |
| struct coro { | |
| unsigned int lc; | |
| bool done; | |
| }; | |
| #define CORO_INIT(co) \ | |
| (co)->lc = 0; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CC := gcc | |
| CFLAGS += -Wall -Wextra -std=c99 | |
| LDLIBS += -lpthread | |
| all: test_wrap | |
| test_wrap: LDFLAGS += -Wl,--wrap=pthread_create -Wl,--wrap=pthread_join | |
| test_wrap: test_wrap.c wrap.c | |
| clean: |