Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

How to get max value

Featured Replies

  • 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>;

 

Solved by Rabatini

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.