Created
November 19, 2014 14:23
-
-
Save catharinejm/f8c03840c5b74dbff44d to your computer and use it in GitHub Desktop.
bitwise op shorthand, with metadata (inline!) from originals
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
| (defmacro bit-ops | |
| [] | |
| `(do | |
| ~@(for [[s l] '[[<< bit-shift-left] | |
| [>> bit-shift-right] | |
| [>>> unsigned-bit-shift-right] | |
| [| bit-or] | |
| [& bit-and] | |
| [xor bit-xor] | |
| [!b bit-not]]] | |
| `(do | |
| (def ~s ~(deref (resolve l))) | |
| (.setMeta (var ~s) (meta ~(resolve l))))))) | |
| (bit-ops) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment