If you can assume GCC or Clang then __builtin_bswap{16,32,64} functions are provided which will be considerably more efficient, less error-prone, and easier to use than anything you can homebrew.
Or, on Linux and BSD systems at least, you can use the <endian.h> or <sys/endian.h> functions (https://linux.die.net/man/3/endian) and rely on the libc implementation to do the system/compiler detection for you and use an appropriate compiler builtin inside of an inline function instead of bothering to hack something together in your own code.
The article mentions those functions at the bottom, but strangely still recommends hacking up your own macros.
https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins...
https://github.com/rustyrussell/ccan/blob/master/ccan/endian...
Though the article only mentions bswap64 and mentioning __builtin_bswap64 would be a nice addition.