Make magic number unsigned and add missing #ifdef