Tip calculation using Bison grammar

As long as I’ve been able to do arithmetic, I’ve been able to figure out calculating taxes and tips, it’s easy. Given a dollar value $17.91 we can figure out the total with a tip of

Read More…

Counting bits in integers

While working on the code to count the number of fifteens I had in a hand in cribbage, I found it would be useful to count the number of bits in an integer. The comment below explains why it is useful

Read More…

Bootstrapping most of a C dev environment

I’ve taken a break from SICP and TAOCP in order to get a good foundation in the C programming language, I’m familiar with it, but that is not good enough. The reason is because C exposes a

Read More…

Swap values in C without intermediate variable

Using the following properties of the XOR function: Associativity {% latex %} $(a \oplus b) \oplus c = a \oplus (b \oplus c) $ {% endlatex %} Commutativity {% latex %} $a \oplus b = b \oplus a $ {

Read More…

All Posts by Category or Tags.