Search This Blog

Wednesday, June 01, 2005

Blinding Flash of the Obvious

So yeah, I had one of those. I was working on modifying the CMutex class to support delayed semaphore allocation (that would reduce resource usage for rarely used mutexes), and noticed a couple of glaring deficiencies in the atomic functions set. First, there's no AtomicCompareExchange function for pointers. This is important because a pointer can vary in size - either 32-bits or 64-bits. That brought to light a second epiphany: NONE of those atomic functions I wrote support 64-bit pointers. Blindingly obvious, but quite frankly, I've never had a 64-bit CPU to work on, and thus it's not exactly second nature for me to work with 64-bit assembly (particularly x64 assembly). Guess it's time to grab those AMD x86-64 manuals off my shelf and write some atomic functions...

And while I'm at it, I should probably make some defines for 8, 16, 32, and 64-bit data types, rather than using short, long, and long long...

No comments: