There’s finally some snow on the ground here. Not much just a couple of inches but, the weather seems to have cooled enough that it might not be going away for a long time.

Today I have my networks exam. I think it’ll be easy. Yesterday instead of studying I bought a few movies to watch. Started with Hunted, not too bad, and then American Splendor which is a great flic, and I highly recommend it.

I was also toying around with some code to swap two variables, and was testing out this way of doing it:

a = a XOR b

b = b XOR a

a = a XOR b

compared to the standard way of doing it with a temp variable using xors takes about 2 times longer.

However compiling using -O2 optimizations makes both methods equally quick even though the assembly code generated is completely different.

I did come across the intel instruction xchg which was generated in one of the compilations and not the other.

I’m wondering if there is a quicker way of doing it?