The limit on upgrades is because they use a 128 bit integer for upgrades. They then simply have to logically or the bitmask of the upgrade with the current upgrade mask, and they have a very fast cheap way to add upgrades. It's a clever optimization, as an upgrade check requires a single logical and. It also means that there is a hard limit somewhere for the number of upgrades. 128 bits is a good choice, as it is a multiple of 32 bits, which is what most processors like to work in. It's a matter of fast code versus expandability. They picked a limit that would provide everything that they need, and used it.
|