The "formula" is making this whole issue far more complicated than it needs to be. Look at those numbers you're working with in hex and you'll see they're just the ASCII digits. That is, the number of crystals is stored as a text string, not as a binary integer.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.