Update git__swap threading primitive

Based on conversation with @ethomson, this PR proposes updating the `git__swap` threading helper function to use `__sync_lock_test_and_set` / `InterlockedExchangePointer` instead of using the compare-and-swap primitives in a counterintuitive manner.

This also fixes up some warnings about the differences between `volatile void **` and `void * volatile *`, and fixes a number of warnings that showed up in the 64-bit Windows build.