Engineers h3x3r Posted November 23, 2024 Engineers Posted November 23, 2024 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>;
Engineers Solution Rabatini Posted November 23, 2024 Engineers Solution Posted November 23, 2024 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); 1
Engineers h3x3r Posted November 23, 2024 Author Engineers Posted November 23, 2024 Nice, it works. Thank you very much!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now