Revision: 115464 https://trac.macports.org/changeset/115464 Author: jeremyhu@macports.org Date: 2014-01-02 14:07:59 -0800 (Thu, 02 Jan 2014) Log Message: ----------- Use fls rather than reinventing it Modified Paths: -------------- trunk/base/src/machista1.0/libmachista.c Modified: trunk/base/src/machista1.0/libmachista.c =================================================================== --- trunk/base/src/machista1.0/libmachista.c 2014-01-02 19:21:11 UTC (rev 115463) +++ trunk/base/src/machista1.0/libmachista.c 2014-01-02 22:07:59 UTC (rev 115464) @@ -41,6 +41,7 @@ #include <err.h> #include <string.h> +#include <strings.h> #ifdef __MACH__ #include <mach-o/fat.h> @@ -530,11 +531,8 @@ /* Returns string representation of the MACHO_* error code constants */ const char *macho_strerror(int err) { - int num = 0; - while (err > 0) { - err >>= 1; - num++; - } + int num = fls(err); + static char *errors[] = { /* 0x00 */ "Success", /* 0x01 */ "Error opening or reading file",
participants (1)
-
jeremyhu@macports.org