Archive for the “C” category

Fast Base64 encoding in C

by john on November 18, 2013

David Lazar on his open source base64 encoding: The C code in base64encode.c is a fast implementation of Base64 encoding. It is based on libb64, which uses coroutines to achieve speed. The nontrivial control-flow of this code makes proving it (…)

Read the rest of this entry »

Using bitwise operators in C and Objective-C

by john on November 11, 2013

One of the wonderful(?) things about Objective-C is that it’s based on C. Part of the power of C is bit-bashing, where you can manipulate individual bits inside of a piece of memory…That being said, there are times where bitwise (…)

Read the rest of this entry »

Bitfields in C

by john on August 9, 2013

Given space is often at a premium when writing applications for mobile devices, I want to show you how to use bitfields to manage a series of values that need only on/off status. The upside is that you can store (…)

Read the rest of this entry »

Using XOR to Toggle an Integer Between 1 and 0

by john on June 12, 2013

If you ever come upon a need to toggle an integer value between 1 and 0, consider using the bitwise exclusive-OR (^) operator in C to get the job done. In a recent application I wrote a method with one (…)

Read the rest of this entry »