DragonFly on Intel Mac?

Matthew Dillon dillon at apollo.backplane.com
Sun Mar 11 16:44:03 PDT 2007


:+	for (i = 0; i != 65535; i++) {
:+		if ((bus_space_read_1(tag, ioh1, 0) & 0x2) == 0)
:+			break;
:+	}
:+	if (i == 65535) {
:+		bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
:+		bus_release_resource(dev, SYS_RES_IOPORT, 1, port1);
:+		return ENXIO;
:+	}

    Do this instead:

    for (i = 65536; i != 0; --i) {
	...
    }
    if (i == 0) {
	...
    }

    Ok, its a nit, but you aren't duplicating the counter constant and
    not depending on the compiler to optimize the constant.  And the code
    is a bit smaller.

						-Matt





More information about the Submit mailing list