From: Jan Michel Date: Thu, 2 Oct 2014 12:07:42 +0000 (+0200) Subject: optimization regarding all-fired and none-fired states in unpacking. Gained more... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=001c53d70b872fd021f289d5fed2db6dda46424e;p=mvd_soft.git optimization regarding all-fired and none-fired states in unpacking. Gained more than factor 2 --- diff --git a/s-curves/cpp_based-on-dabc-lib/unpacker.cxx b/s-curves/cpp_based-on-dabc-lib/unpacker.cxx index 0d93c78..e276aed 100644 --- a/s-curves/cpp_based-on-dabc-lib/unpacker.cxx +++ b/s-curves/cpp_based-on-dabc-lib/unpacker.cxx @@ -281,11 +281,22 @@ signed analyzeData(hadaq::RawSubevent* sub, unsigned ix, unsigned datalen, unsig rowcount[row]++; while(1) { d = sub->Data(ix++); - //printf("%08x", d); - for(int i = 0; i < 0x20; i++) { - pixelprob[1152 * row + pos*0x20 + i] += d & 0x1; - d = d >> 1; + //////loop over all bits, optimized for all-set and all-clear states + unsigned start = 1152 * row + pos*0x20; + if(d == 0) {} + else if(d == 0xFFFFFFFF) { + for(unsigned i = start; i < start + 0x20; i++) { + pixelprob[i] ++; + } + } + else { + for(unsigned i = start; i < start + 0x20; i++) { + pixelprob[i] += d & 0x1; + d >>= 1; + } } + /////////////end add loop + pos++; if(ix >= RocEnd) break; }