@@ -265,9 +265,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
265265 }
266266
267267
268- unsigned short i1 = _data_in[0 ][0 ][l+ELAPSED_LIVETIME_OFFSET +(idx_detector*8 )];
269- unsigned short i2 = _data_in[0 ][0 ][l+ELAPSED_LIVETIME_OFFSET +(idx_detector*8 )+1 ];
270- unsigned int ii = i1 | i2<<16 ;
268+ unsigned int i1 = static_cast <unsigned int >(_data_in[0 ][0 ][l+ELAPSED_LIVETIME_OFFSET +(idx_detector*8 )]);
269+ unsigned int i2 = static_cast <unsigned int >(_data_in[0 ][0 ][l+ELAPSED_LIVETIME_OFFSET +(idx_detector*8 )+1 ]);
270+ i1 = (0x0000ffff & i1);
271+ i2 = (i2 << 16 ) & 0xffff0000 ;
272+ unsigned int ii = i1 | i2;
271273 elapsed_livetime = ((T_real)ii) * 320e-9f ; // need to multiply by this value becuase of the way it is saved
272274 if (ltype == E_load_type::LINE )
273275 {
@@ -298,9 +300,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
298300 callback_spectra->elapsed_livetime (elapsed_livetime);
299301 }
300302
301- i1 = _data_in[0 ][0 ][l+ELAPSED_REALTIME_OFFSET +(idx_detector*8 )];
302- i2 = _data_in[0 ][0 ][l+ELAPSED_REALTIME_OFFSET +(idx_detector*8 )+1 ];
303- ii = i1 | i2<<16 ;
303+ i1 = static_cast <unsigned int >(_data_in[0 ][0 ][l+ELAPSED_REALTIME_OFFSET +(idx_detector*8 )]);
304+ i2 = static_cast <unsigned int >(_data_in[0 ][0 ][l+ELAPSED_REALTIME_OFFSET +(idx_detector*8 )+1 ]);
305+ i1 = (0x0000ffff & i1);
306+ i2 = (i2 << 16 ) & 0xffff0000 ;
307+ ii = i1 | i2;
304308 elapsed_realtime = ((T_real)ii) * 320e-9f ; // need to multiply by this value becuase of the way it is saved
305309 if (ltype == E_load_type::LINE )
306310 {
@@ -331,9 +335,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
331335 callback_spectra->elapsed_realtime (elapsed_realtime);
332336 }
333337
334- i1 = _data_in[0 ][0 ][l+INPUT_COUNTS_OFFSET +(idx_detector*8 )];
335- i2 = _data_in[0 ][0 ][l+INPUT_COUNTS_OFFSET +(idx_detector*8 )+1 ];
336- ii = i1 | i2<<16 ;
338+ i1 = static_cast <unsigned int >(_data_in[0 ][0 ][l+INPUT_COUNTS_OFFSET +(idx_detector*8 )]);
339+ i2 = static_cast <unsigned int >(_data_in[0 ][0 ][l+INPUT_COUNTS_OFFSET +(idx_detector*8 )+1 ]);
340+ i1 = (0x0000ffff & i1);
341+ i2 = (i2 << 16 ) & 0xffff0000 ;
342+ ii = i1 | i2;
337343 input_counts = ((T_real)ii) / elapsed_livetime;
338344 if (ltype == E_load_type::LINE )
339345 {
@@ -365,9 +371,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
365371 }
366372
367373
368- i1 = _data_in[0 ][0 ][l+OUTPUT_COUNTS_OFFSET +(idx_detector*8 )];
369- i2 = _data_in[0 ][0 ][l+OUTPUT_COUNTS_OFFSET +(idx_detector*8 )+1 ];
370- ii = i1 | i2<<16 ;
374+ i1 = static_cast <unsigned int >(_data_in[0 ][0 ][l+OUTPUT_COUNTS_OFFSET +(idx_detector*8 )]);
375+ i2 = static_cast <unsigned int >(_data_in[0 ][0 ][l+OUTPUT_COUNTS_OFFSET +(idx_detector*8 )+1 ]);
376+ i1 = (0x0000ffff & i1);
377+ i2 = (i2 << 16 ) & 0xffff0000 ;
378+ ii = i1 | i2;
371379 output_counts = ((T_real)ii) / elapsed_realtime;
372380 if (ltype == E_load_type::LINE )
373381 {
0 commit comments