software/videomixer: fix overflow in memory bandwidth computation
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 14 Jul 2013 18:05:18 +0000 (20:05 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 14 Jul 2013 18:05:18 +0000 (20:05 +0200)
software/libcompiler-rt/Makefile
software/videomixer/main.c

index 9033e0cab26eefac17bfa0faeb9ca3f9a8e6a64b..4bc33fe4f9d33e75cfe548a609fb82bdea8dde8b 100644 (file)
@@ -5,7 +5,7 @@ CFLAGS+=-D_YUGA_LITTLE_ENDIAN=0 -D_YUGA_BIG_ENDIAN=1 -Wno-missing-prototypes
 
 OBJECTS=divsi3.o modsi3.o comparedf2.o negsf2.o negdf2.o addsf3.o subsf3.o mulsf3.o divsf3.o lshrdi3.o muldi3.o divdi3.o ashldi3.o ashrdi3.o udivmoddi4.o \
   floatsisf.o floatunsisf.o fixsfsi.o fixunssfsi.o adddf3.o subdf3.o muldf3.o divdf3.o floatsidf.o floatunsidf.o floatdidf.o fixdfsi.o fixunsdfsi.o \
-  clzsi2.o ctzsi2.o
+  clzsi2.o ctzsi2.o udivdi3.o
 
 all: libcompiler-rt.a
 
index 5d6128a4e38f1e092ee3ff66ccbe6fdd34f90d39..57fc40269da43b673849a75aa8a930bbbee112f3 100644 (file)
@@ -102,9 +102,9 @@ static void membw_service(void)
                nr = lasmicon_bandwidth_nreads_read();
                nw = lasmicon_bandwidth_nwrites_read();
                f = identifier_frequency_read();
-               rdb = nr*f >> (24 - 7);
-               wrb = nw*f >> (24 - 7);
-               printf("read:%4dMbps  write:%4dMbps  all:%4dMbps\n", rdb/1000000, wrb/1000000, (rdb + wrb)/1000000);
+               rdb = (nr*f >> (24 - 7))/1000000ULL;
+               wrb = (nw*f >> (24 - 7))/1000000ULL;
+               printf("read:%5dMbps  write:%5dMbps  all:%5dMbps\n", rdb, wrb, rdb + wrb);
        }
 }