mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
This pr aims at fixing for negative values in advanced search for numerical values. For a simple example try searching for -1 for int32_t which is 0xFFFFFFFF. With the changes you can now find -1 for 1,2,4 or 8 byte integers. Internal types are bigger than or equal to the types selected in the options. Search keys are converted to the bigger type, but the values read from the input file are not. This works ok for positive numbers, but for negatives it needs some casting. The casting is performed inside a newly added function that takes the value returned by read, the size in bytes of the selected type in the options and a template argument for the 64 bit type the value is stored into. I have tested positive and negative values for several different sizes of signed integers. Also tested unsigned integers both in the low range (near lowest limit) and in the high range (near largest possible value for that type)