On 10/25/22 00:39, Richard Henderson wrote:
On 10/25/22 06:43, Helge Deller wrote:
+            abi_long maxfd = arg2;
+
+            if ((sizeof(abi_long) == 4 && arg2 == (abi_long)0x7FFFFFFFUL) ||
+                (sizeof(abi_long) == 8 && arg2 == 
(abi_long)0x7FFFFFFFFFFFFFFFULL)) {
+                maxfd = target_fd_max;
+            }
+
+            for (fd = arg1; fd < maxfd; fd++) {

Why do we need explicit checks for INT32/64_MAX?
If the guest passes 0x7FFFFFFFFFFFFFFEULL,

A 32-bit guest (on a 64bit host) will pass 0x7FFFFFFFUL...

do we really need to iterate over all of those impossible values?

The compiler will optimize one of those checks away, so it's effectively
just one expression.

I should think some expression involving MIN() is in order.

Helge

Reply via email to