-
-
Save oprypin/99b7fa4cecaabe79883286c8b62a66aa to your computer and use it in GitHub Desktop.
This file contains 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
7500f0df856ebd0865eb147239172e4e376af248 exe_def | |
7500f0df856ebd0865eb147239172e4e376af248 exe_def_i | |
7500f0df856ebd0865eb147239172e4e376af248 exe_macro |
This file contains 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
#!/bin/bash | |
set -e -x | |
cat <<EOF >test.cr | |
def set_bit(value, bit) | |
(value | 1 << bit) | |
end | |
p set_bit(4, 4) | |
EOF | |
crystal build --release test.cr -o exe_def | |
cat <<EOF >test.cr | |
@[AlwaysInline] | |
def set_bit(value, bit) | |
(value | 1 << bit) | |
end | |
p set_bit(4, 4) | |
EOF | |
crystal build --release test.cr -o exe_def_i | |
cat <<EOF >test.cr | |
macro set_bit(value, bit) | |
({{value}} | 1 << {{bit}}) | |
end | |
p set_bit(4, 4) | |
EOF | |
crystal build --release test.cr -o exe_macro | |
rm test.cr | |
sha1sum exe* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment