Engineer h3x3r Posted November 23 Engineer Share Posted November 23 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>; Link to comment Share on other sites More sharing options...
Engineer Solution Rabatini Posted November 23 Engineer Solution Share Posted November 23 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 Link to comment Share on other sites More sharing options...
Engineer h3x3r Posted November 23 Author Engineer Share Posted November 23 Nice, it works. Thank you very much! Link to comment Share on other sites More sharing options...
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