Byte Swapping in C
Introduction Some times you need to swap bytes. Sometimes you don’t. But right now we do. Well, we don’t but if we were implementing some sorting functions we’d need a good swap function. Sorting typically doesn’t move pointers around, instead it moves the bytes pointed to by the pointer. Generic Swap We only want to have one swap function and not one for every single possible type. We’ll use void pointers and a width (number of bytes the type occupies) to make a generic swap function....