I would swap this one with next. E.g. make it if (sizeof == 2)

Then add else if (sizeof == 4)  else { error("Unsupported BPP format: %d", sizeof(PixelType)); }