Yes, I wrote this…

A coworker today proposed to me a question he’d received in class about adding numbers using only bitwise ops.  Being a C/C++ program of some reasonable chops I remembered that you can add/divide numbers by 2 using the bitwise shifts   I didn’t immediately know if there was a way to add using only bitwise ops, just a sneaking suspicion that it wasn’t possible or any faster then using the CPU instructions (and hardware) dedicated to the task since the dawn of time.  A bit of Google-ing bore out my suspicions and I imparted this knowledge to my coworker in no uncertain terms.

I’d found a bit of code that adds two numbers together using just bitwise ops and a do-while loop.  I wanted to solve the “problem” so I started to think about changing the code I found for the more constrained case.  Tracing through the function with real data was just giving me a headache so I just resolved myself to reinvent the world and ended up writing this: http://pastebin.com/wLMFyyrw.  Yes, that’s right, it’s a recursive adder function.  It works too.  I only typed in random numbers up to about 7 figures, so YMMV.  Quite possibly the dumbest thing I’ve ever written but am still proud of.

Frist Psot!

This is the third first post I’ve written for this blog, and I’m probably still going to hate it.  It’s not that I will think it’s poorly written (though it is) or that I’m not happy to write whatever I want, but really, I have nothing interesting to say.  And if you don’t have anything interesting to say, why write something that in inherently egotistical and self-promotional?

Anyway, this is my personal website.  Welcome!  Um, there’s like no content right now because I’m ultimately lazy when it comes to grooming my online profile.  Eventually I’ll end up listing my resume/CV and some projects I’m toying around with.  Hopefully, I can post some interesting blog articles about whatever the hell interests me.