November 23, 20241 yr Supporter As title says. I have an array of uint16 values and I need get the highest one. Can someone please help me. Preferably for 010 Hex Editor. Thank you! There is function > double Floor( double x) which returns the highest integer less than or equal to x. But it always return last Index value instead of highest one. Anyway this is code for parsing values. local uint32 Count=50; struct { uint16 Index; }Buffer[Count]<optimize=false>;
November 23, 20241 yr Supporter Solution Try something like that. local uint32 Count = 50; struct { uint16 Index; } Buffer[Count] <optimize=false>; local uint16 maxValue = 0; // Initialize max value local uint32 i; // Loop counter // Iterate through the Buffer array for (i = 0; i < Count; i++) { if (Buffer[i].Index > maxValue) { maxValue = Buffer[i].Index; } } // Output the maximum value PrintF("The highest value is: %u\n", maxValue);
Create an account or sign in to comment