On 10/25/22 11:39, Helge Deller wrote:
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.
By impossible values, I mean all descriptors above target_fd_max.
The compiler will most certainly not optimize the number of loop iterations.
r~