From 001c53d70b872fd021f289d5fed2db6dda46424e Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Thu, 2 Oct 2014 14:07:42 +0200 Subject: [PATCH] optimization regarding all-fired and none-fired states in unpacking. Gained more than factor 2 --- s-curves/cpp_based-on-dabc-lib/unpacker.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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; } -- 2.43.0