Monthly Archives: February 2011

Parity

Data transfer inevitably threatens data integrity. It does not matter whether you save and restore files on your hard disk or you transmit data over long distances. Bits can always get twisted by interfering electric and electromagnetic fields. TCP/IP uses … Continue reading

Posted in Bit-Twiddling, Uncategorized | Tagged ,

Masking

In this posting I’m going to explain a bit-twiddling technique called masking. It is used to extract (and alter) specific bits in a word of bits, for example a byte. You might be familiar with IP subnet masks in network … Continue reading

Posted in Bit-Twiddling, Uncategorized | Tagged , , , ,

Conditional Assignments

Many programs require implementing some code which assigns values to variables based on certain conditions. Here is an example: if( a < 5 )    b = 3; else    b = 8; The same in abbreviated form (Java): b … Continue reading

Posted in Programming Essentials, Uncategorized | Tagged , , , ,

Simple Math: Truncating and Rounding Numbers

If you need to truncate or to round floating point numbers you should always use functions from your compiler’s math library. These functions have been thoroughly tested and there is no reason why you want to implement such algorithms manually … Continue reading

Posted in Programming Essentials, Uncategorized | Tagged ,

Loops

A loop allows to repeatedly execute a sequence of instructions. From the CPU’s view a loop simply means resetting the program counter (PC) which always points to the currently executed instruction. ; Example in some pseudo assembly language ; showing … Continue reading

Posted in Programming Essentials, Uncategorized | Tagged , , ,