util: Make u_atomic.h typeless.
authorMatt Turner <mattst88@gmail.com>
Sat, 22 Nov 2014 00:33:40 +0000 (16:33 -0800)
committerMatt Turner <mattst88@gmail.com>
Mon, 1 Dec 2014 19:28:45 +0000 (11:28 -0800)
commit6df72e970c0e2794a5651f7141528baa51c0c491
tree6100868706cfa3e341c4b69eef835d550cca1801
parent41b5858a2f1d15153d8091235f2ed7610508a334
util: Make u_atomic.h typeless.

like how C11's stdatomic.h provides generic functions. GCC's __sync_*
builtins already take a variety of types, so that's simple.

MSVC and Sun Studio don't, but we can implement it with something that
looks a little crazy but is actually quite readable.

Thanks to Jose for some MSVC fixes!

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/util/u_atomic.h