]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
cleaner, shorter, one cycle less, from wk, ocmmitted by mt
authorhadaq <hadaq>
Mon, 8 Apr 2002 14:46:07 +0000 (14:46 +0000)
committerhadaq <hadaq>
Mon, 8 Apr 2002 14:46:07 +0000 (14:46 +0000)
hadaq/hwrace.c

index 79f9373050e938649be571b7598425b89792385f..422c5107ea907f15593ee01e5102c07340d36be3 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.15 2001-11-18 11:56:21 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.16 2002-04-08 14:46:07 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -121,13 +121,15 @@ int HwRace_isEmpty(HwRace *my)
 int HwRace_readSubEvt(HwRace *my, void *subEvt)
 {
        uint32_t *data = (uint32_t *) subEvt;
-       int firstAddr;
+       int lastAddr;
        int size;
 
        size = Rc_readMem(my->rc, my->currAddr);
+       *data++ = size;
+       lastAddr = my->currAddr + size;
 
        /* copy one sub evt from RC to memory */
-       for (firstAddr = my->currAddr; my->currAddr - firstAddr < size; my->currAddr += 4) {
+       while ((my->currAddr+= 4) < lastAddr) {
                *data++ = Rc_readMem(my->rc, my->currAddr);
        }