Fix chromosomes for sizeof (unsigned long) == 32 In the chromosome struct, the maximum value of a trait is stored in an unsigned long (which is 32 bits on a typical 32 bit architecture) and up to 32 bits per trait are allowed. When the full 32 bits per trait were used, the value stored in max_value is 1 << 32 which is truncated to zero on 32 bit architectures. This causes the limit check in chromosome_init() to always fail. . While it would be sufficient to change the comparison from v >= max_value to v > (max_value - 1), change the setting of max_value to "(1<<bits)-1". This has the advantage of being the actual maximum value and therefore more appropriate for the name.