Most computer scientists could rattle off their powers of 2 just as easily as their powers of 10.
Unfortunately in this instance, Daniel has discovered that possessing such "power"ful knowledge could prove dangerous when it comes to validation:
/* ============= checkSize Make sure the image is a power of 2. ============= */ int checkSize(int x) { if (x == 2 || x == 4 || x == 8 || x == 16 || x == 32 || x == 64 || x == 128 || x == 256 || x == 512) return 1; else return 0; }
Apparently the original developer disregarded the infinite set of other numbers that are powers of two, along with the existence of the Boolean type.
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!