DragonFly submit List (threaded) for 2007-03
DragonFly BSD
DragonFly submit List (threaded) for 2007-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: DragonFly on Intel Mac?


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Mar 2007 16:42:36 -0700 (PDT)

:+	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



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]