aboutsummaryrefslogtreecommitdiff
path: root/src/console/vtxprintf.c
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2013-03-06 20:43:55 -0800
committerRonald G. Minnich <rminnich@gmail.com>2013-03-08 23:14:26 +0100
commitae0e8d3613ad9cb6872c58cd95fc9774b3b17f5b (patch)
tree452b6c60e2f9bf9f5d0c373a27eed092675e13e6 /src/console/vtxprintf.c
parent31c5e07a04e90c03822d216d2dc92454b42e21ce (diff)
Eliminate do_div().
This eliminates the use of do_div() in favor of using libgcc functions. This was tested by building and booting on Google Snow (ARMv7) and Qemu (x86). printk()s which use division in vtxprintf() look good. Change-Id: Icad001d84a3c05bfbf77098f3d644816280b4a4d Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/2606 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/console/vtxprintf.c')
-rw-r--r--src/console/vtxprintf.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/console/vtxprintf.c b/src/console/vtxprintf.c
index 9de25845bd..4fc6f35bd1 100644
--- a/src/console/vtxprintf.c
+++ b/src/console/vtxprintf.c
@@ -5,7 +5,6 @@
*/
#include <string.h>
-#include <div64.h>
#include <console/console.h>
#include <console/vtxprintf.h>
@@ -70,20 +69,8 @@ static int number(void (*tx_byte)(unsigned char byte),
if (num == 0)
tmp[i++]='0';
else while (num != 0){
- /* there are some nice optimizations in the
- * Macros-From-Hell that form the div64 code
- * *IF* you call it with a constant.
- * We're firmware, we only do bases
- * 8, 10, and 16. Let's be smart.
- * This greatly helps ARM, reduces the
- * code footprint at compile time, and does not hurt x86.
- */
- if (base == 10)
- tmp[i++] = digits[do_div(num,10)];
- else if (base == 8)
- tmp[i++] = digits[do_div(num,8)];
- else /* sorry, you're out of choices */
- tmp[i++] = digits[do_div(num,16)];
+ tmp[i++] = digits[num % base];
+ num /= base;
}
if (i > precision)
precision = i;